CAS Unit Tests
Clover coverage report - CAS Unit Tests
Coverage timestamp: Mon Jul 4 2005 18:13:17 CDT
file stats: LOC: 641   Methods: 5
NCLOC: 491   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
TestSelfEnrollPermissions.java 0% 0% 0% 0%
coverage
 1    /*
 2    * Portions of this file Copyright 1999-2005 University of Chicago
 3    * Portions of this file Copyright 1999-2005 The University of Southern California.
 4    *
 5    * This file or a portion of this file is licensed under the
 6    * terms of the Globus Toolkit Public License, found at
 7    * http://www.globus.org/toolkit/download/license.html.
 8    * If you redistribute this file, with or without
 9    * modifications, you must include this notice in the file.
 10    */
 11    package org.globus.cas.impl.service;
 12   
 13    import junit.framework.Test;
 14    import junit.framework.TestCase;
 15    import junit.framework.TestSuite;
 16   
 17    import org.globus.cas.faults.CasFault;
 18    import org.globus.cas.faults.NoPermissionFault;
 19   
 20    import org.globus.cas.types.UserData;
 21    import org.globus.cas.types.PolicyData;
 22    import org.globus.cas.types.ObjectData;
 23    import org.globus.cas.types.UserGroupData;
 24    import org.globus.cas.types.NamespaceData;
 25    import org.globus.cas.types.ObjectGroupData;
 26    import org.globus.cas.types.TrustAnchorData;
 27    import org.globus.cas.types.ServiceTypeData;
 28    import org.globus.cas.types.ArrayOfString;
 29   
 30    import org.globus.cas.types.AddUser;
 31    import org.globus.cas.types.CreateGroup;
 32    import org.globus.cas.types.CreateObject;
 33    import org.globus.cas.types.AddTrustAnchor;
 34    import org.globus.cas.types.ManageUserGroups;
 35    import org.globus.cas.types.ManageObjectGroups;
 36    import org.globus.cas.types.ManageServiceAction;
 37    import org.globus.cas.types.CreateServiceType;
 38    import org.globus.cas.types.CreateObjectNamespace;
 39    import org.globus.cas.types.ManageServiceActionGroups;
 40   
 41    import org.globus.cas.impl.databaseAccess.UserDataHandler;
 42    import org.globus.cas.impl.databaseAccess.ObjectDataHandler;
 43    import org.globus.cas.impl.databaseAccess.PolicyDataHandler;
 44    import org.globus.cas.impl.databaseAccess.UserGroupDataHandler;
 45    import org.globus.cas.impl.databaseAccess.NamespaceDataHandler;
 46    import org.globus.cas.impl.databaseAccess.TrustAnchorDataHandler;
 47    import org.globus.cas.impl.databaseAccess.ServiceTypeDataHandler;
 48    import org.globus.cas.impl.databaseAccess.ObjectGroupDataHandler;
 49    import org.globus.cas.impl.databaseAccess.ServiceTypeActionHandler;
 50   
 51    import org.globus.cas.utils.CasStringUtils;
 52   
 53    import org.globus.cas.impl.CasConstants;
 54   
 55    import org.globus.cas.CASPortType;
 56   
 57    import java.io.FileInputStream;
 58   
 59    import java.util.Properties;
 60   
 61    import org.apache.commons.logging.Log;
 62    import org.apache.commons.logging.LogFactory;
 63   
 64    public class TestSelfEnrollPermissions extends TestCase {
 65   
 66    static Log logger =
 67    LogFactory.getLog(TestSelfEnrollPermissions.class.getName());
 68   
 69    static CASPortType casPort = null;
 70   
 71    String objId = null;
 72    String enrollAnchor = null;
 73    String enrollUser = null;
 74    String enrollNs = null;
 75    String enrollObject = null;
 76    String enrollService = null;
 77    String createObjGp = null;
 78    String createUserGp = null;
 79    String createServiceActionGp = null;
 80    String addGroupEntry = null;
 81   
 82  0 public TestSelfEnrollPermissions(String name){
 83  0 super(name);
 84    }
 85   
 86  0 public static Test suite() {
 87  0 return new TestSuite(TestSelfEnrollPermissions.class);
 88    }
 89   
 90  0 public static void setParams(CASPortType casPort_) {
 91  0 casPort = casPort_;
 92    }
 93   
 94    // Direct database minipulation to set up the db for testing
 95  0 private void initialSetup() throws Exception {
 96   
 97  0 String propFileName = System.getProperty("casTestProperties");
 98  0 Properties prop = new Properties();
 99  0 prop.load(new FileInputStream(propFileName));
 100  0 String subjectName = prop.getProperty("user1SubjectDN");
 101   
 102    // Store Trust anchor data
 103  0 String authMethod = "authMethod";
 104  0 String authData = TestConstants.defTrustNickDN;
 105  0 TrustAnchorData trustAnchor = new TrustAnchorData();
 106  0 trustAnchor.setNickname(TestConstants.defTrustNick);
 107  0 trustAnchor.setAuthMethod(authMethod);
 108  0 trustAnchor.setAuthData(authData);
 109  0 TrustAnchorDataHandler.storeObject(trustAnchor);
 110   
 111    // Store user data
 112  0 UserData userData1 = new UserData();
 113  0 userData1.setNickname(TestConstants.user1);
 114  0 userData1.setSubjectName(subjectName);
 115  0 userData1.setTrustAnchorName(TestConstants.defTrustNick);
 116  0 UserDataHandler.storeObject(userData1);
 117  0 logger.debug("Store user data with group went through ");
 118   
 119    // UserGroup data store without usernames
 120  0 UserGroupData userGpData = new UserGroupData();
 121  0 userGpData.setGroupName(TestConstants.defUserGp);
 122  0 UserGroupDataHandler.storeObject(userGpData);
 123  0 logger.debug("Store user group data went through ");
 124   
 125    // add to user group
 126  0 UserGroupDataHandler.addGroupMember(TestConstants.defUserGp,
 127    TestConstants.user1);
 128   
 129  0 objId =
 130    Integer.toString(ObjectDataHandler.getObjectId(
 131    CasConstants.OBJECT_SELF,
 132    CasConstants.NAMESPACE_SELF));
 133  0 enrollAnchor =
 134    Integer.toString(ServiceTypeActionHandler.getServiceActionId(
 135    CasConstants.SERVICETYPE_CAS,
 136    CasConstants.ACTION_ENROLL_ANCHOR));
 137  0 enrollUser =
 138    Integer.toString(
 139    ServiceTypeActionHandler.getServiceActionId(
 140    CasConstants.SERVICETYPE_CAS,
 141    CasConstants.ACTION_ENROLL_USER));
 142  0 enrollNs = Integer.toString(
 143    ServiceTypeActionHandler.getServiceActionId(
 144    CasConstants.SERVICETYPE_CAS,
 145    CasConstants.ACTION_ENROLL_NAMESPACE));
 146  0 enrollObject = Integer.toString(
 147    ServiceTypeActionHandler.getServiceActionId(
 148    CasConstants.SERVICETYPE_CAS,
 149    CasConstants.ACTION_ENROLL_OBJECT));
 150  0 enrollService = Integer.toString(
 151    ServiceTypeActionHandler.getServiceActionId(
 152    CasConstants.SERVICETYPE_CAS,
 153    CasConstants.ACTION_CREATE_SERVICE_TYPE));
 154  0 createObjGp = Integer.toString(
 155    ServiceTypeActionHandler.getServiceActionId(
 156    CasConstants.SERVICETYPE_CAS,
 157    CasConstants.ACTION_CREATE_OBJECT_GROUP));
 158  0 createUserGp = Integer.toString(
 159    ServiceTypeActionHandler.getServiceActionId(
 160    CasConstants.SERVICETYPE_CAS,
 161    CasConstants.ACTION_CREATE_USER_GROUP));
 162  0 createServiceActionGp =
 163    Integer.toString(
 164    ServiceTypeActionHandler.getServiceActionId(
 165    CasConstants.SERVICETYPE_CAS,
 166    CasConstants.ACTION_CREATE_SERVICEACTION_GROUP));
 167  0 addGroupEntry =
 168    Integer.toString(ServiceTypeActionHandler.getServiceActionId(
 169    CasConstants.SERVICETYPE_CAS,
 170    CasConstants.ACTION_ADD_GROUP_ENTRY));
 171   
 172    }
 173   
 174    /* FIXME: test RPs.
 175    public void testServiceData() throws Exception {
 176    String propFileName = System.getProperty("casTestProperties");
 177    Properties prop = new Properties();
 178    prop.load(new FileInputStream(propFileName));
 179    String serverDN = prop.getProperty("serverDN");
 180   
 181    QName dnQName = new QName("http://ogsa.globus.org/base/cas",
 182    "ServerDN");
 183    ExtensibilityType dnResult =
 184    casPort.findServiceData(QueryHelper.getNamesQuery(dnQName));
 185    ServiceDataValuesType serviceData =
 186    AnyHelper.getAsServiceDataValues(dnResult);
 187    assertTrue(serviceData.get_any() != null);
 188    Object[] entries =
 189    AnyHelper.getAsObject(serviceData, ServerDN.class);
 190    String retVal = ((ServerDN)entries[0]).getServerDN();
 191    logger.debug(retVal);
 192    assertTrue(retVal != null);
 193    assertTrue(retVal.equals(serverDN));
 194   
 195    }
 196    */
 197   
 198  0 public void testEnrollData() throws Exception {
 199   
 200  0 initialSetup();
 201   
 202  0 PolicyData policyData = new PolicyData();
 203  0 policyData.setUserGroupName(TestConstants.defUserGp);
 204   
 205    // attempt adding trust anchor
 206  0 boolean exception = false;
 207  0 try {
 208  0 casPort
 209    .addTrustAnchor(new AddTrustAnchor(TestConstants.authData,
 210    TestConstants.authMeth,
 211    TestConstants.trustNick,
 212    TestConstants.defUserGp));
 213    } catch (NoPermissionFault casFault) {
 214  0 exception = true;
 215    }
 216  0 assertTrue(exception);
 217   
 218    // Set permission to add enrollTrustAnchor
 219  0 policyData.setObjectSpec(objId);
 220  0 policyData.setObjectSpecDesc(CasConstants.OBJECT_SPEC);
 221  0 policyData.setActionSpec(enrollAnchor);
 222  0 policyData.setActionSpecDesc(CasConstants.SERVICEACTION_SPEC);
 223  0 PolicyDataHandler.storeObject(policyData);
 224   
 225    // attempt adding with bad user group for grant all permissions
 226  0 exception = false;
 227  0 try {
 228  0 casPort.addTrustAnchor(new AddTrustAnchor(TestConstants.authData,
 229    TestConstants.authMeth,
 230    TestConstants.trustNick,
 231    "dummyUserGroup"));
 232    } catch (CasFault casFault) {
 233  0 if ((casFault.getDescription(0).toString()
 234    .indexOf("does not exist"))!=-1) {
 235  0 exception = true;
 236    } else
 237  0 logger.error("Error" + casFault.getDescription(0).toString());
 238    }
 239  0 assertTrue(exception);
 240   
 241    // Invoke method after permission has been added
 242  0 casPort.addTrustAnchor(new AddTrustAnchor(TestConstants.authData,
 243    TestConstants.authMeth,
 244    TestConstants.trustNick,
 245    TestConstants.defUserGp));
 246    // Ensure it was added
 247  0 TrustAnchorData addedAnchor = new TrustAnchorData();
 248  0 addedAnchor.setNickname(TestConstants.trustNick);
 249  0 addedAnchor.setAuthMethod(TestConstants.authMeth);
 250  0 addedAnchor.setAuthData(TestConstants.authData);
 251  0 assertTrue(addedAnchor.equals(
 252    (TrustAnchorData)TrustAnchorDataHandler.retrieveObject(
 253    TestConstants.trustNick)));
 254   
 255    // Attempt adding trust anchor same authdata i.e DN and authMethod
 256  0 exception = false;
 257  0 try {
 258  0 casPort.addTrustAnchor(new AddTrustAnchor(TestConstants.authData,
 259    TestConstants.authMeth,
 260    TestConstants.trustNick,
 261    "DummyTrust"));
 262    } catch (CasFault casFault) {
 263  0 exception = true;
 264    }
 265  0 assertTrue(exception);
 266   
 267    // attempt adding user
 268  0 exception = false;
 269  0 try {
 270  0 casPort.addUser(new AddUser(TestConstants.userNick,
 271    TestConstants.subjectName,
 272    TestConstants.trustNick,
 273    TestConstants.defUserGp));
 274    } catch (NoPermissionFault casFault) {
 275  0 exception = true;
 276    }
 277  0 assertTrue(exception);
 278    // Set permission to add enrolluser
 279  0 policyData.setObjectSpec(objId);
 280  0 policyData.setObjectSpecDesc(CasConstants.OBJECT_SPEC);
 281  0 policyData.setActionSpec(enrollUser);
 282  0 policyData.setActionSpecDesc(CasConstants.SERVICEACTION_SPEC);
 283  0 PolicyDataHandler.storeObject(policyData);
 284   
 285    // attempt adding with bad user group for grant all permissions
 286  0 exception = false;
 287  0 try {
 288  0 casPort.addUser(new AddUser(TestConstants.userNick,
 289    TestConstants.subjectName,
 290    TestConstants.trustNick,
 291    "dummyUserGp"));
 292    } catch (CasFault casFault) {
 293  0 if (casFault.getDescription(0).toString()
 294    .indexOf("does not exist")!=-1) {
 295  0 exception = true;
 296    } else {
 297  0 logger.error("Error" + casFault.getDescription(0).toString());
 298    }
 299    }
 300  0 assertTrue(exception);
 301   
 302    // Invoke method after permission has been added
 303  0 casPort.addUser(new AddUser(TestConstants.userNick,
 304    TestConstants.subjectName,
 305    TestConstants.trustNick,
 306    TestConstants.defUserGp));
 307    // Ensure it was added
 308  0 UserData addedUserData = new UserData();
 309  0 addedUserData.setNickname(TestConstants.userNick);
 310  0 addedUserData.setSubjectName(TestConstants.subjectName);
 311  0 addedUserData.setTrustAnchorName(TestConstants.trustNick);
 312  0 assertTrue(addedUserData.equals(
 313    (UserData)UserDataHandler.retrieveObject(
 314    TestConstants.userNick)));
 315   
 316    // Attempt adding user same subject name and trust anchor nick
 317  0 exception = false;
 318  0 try {
 319  0 casPort.addUser(new AddUser("DummyUserName",
 320    TestConstants.subjectName,
 321    TestConstants.trustNick,
 322    TestConstants.defUserGp));
 323    } catch (CasFault casFault) {
 324  0 exception = true;
 325    }
 326  0 assertTrue(exception);
 327   
 328    // attempt adding namespace
 329  0 exception = false;
 330  0 try {
 331  0 casPort.createObjectNamespace(
 332    new CreateObjectNamespace(TestConstants.baseName,
 333    TestConstants.compAlg,
 334    TestConstants.nsNick,
 335    TestConstants.defUserGp));
 336    } catch (NoPermissionFault casFault) {
 337  0 exception = true;
 338    }
 339  0 assertTrue(exception);
 340    // Set permission to enroll namespace
 341  0 policyData.setObjectSpec(objId);
 342  0 policyData.setObjectSpecDesc(CasConstants.OBJECT_SPEC);
 343  0 policyData.setActionSpec(enrollNs);
 344  0 policyData.setActionSpecDesc(CasConstants.SERVICEACTION_SPEC);
 345  0 PolicyDataHandler.storeObject(policyData);
 346   
 347    // attempt adding with bad user group for grant all permissions
 348  0 exception = false;
 349  0 try {
 350  0 casPort.createObjectNamespace(
 351    new CreateObjectNamespace(TestConstants.baseName,
 352    TestConstants.compAlg,
 353    TestConstants.nsNick,
 354    "DummyUserGp"));
 355    } catch (CasFault casFault) {
 356  0 if (casFault.getDescription(0).toString()
 357    .indexOf("does not exist")!=-1) {
 358  0 exception = true;
 359    }
 360    }
 361  0 assertTrue(exception);
 362   
 363    // Invoke method after permission has been added
 364  0 casPort.createObjectNamespace(
 365    new CreateObjectNamespace(TestConstants.baseName,
 366    TestConstants.compAlg,
 367    TestConstants.nsNick,
 368    TestConstants.defUserGp));
 369    // Ensure it was added
 370  0 NamespaceData nsData = new NamespaceData();
 371  0 nsData.setNickname(TestConstants.nsNick);
 372  0 nsData.setBasename(TestConstants.baseName);
 373  0 nsData.setComparisonAlg(TestConstants.compAlg);
 374  0 assertTrue(nsData.equals(
 375    (NamespaceData)NamespaceDataHandler.retrieveObject(
 376    TestConstants.nsNick)));
 377   
 378    // attempt adding object
 379  0 exception = false;
 380  0 try {
 381  0 casPort.createObject(new CreateObject(TestConstants.objName,
 382    TestConstants.nsNick,
 383    TestConstants.defUserGp));
 384    } catch (NoPermissionFault casFault) {
 385  0 exception = true;
 386    }
 387  0 assertTrue(exception);
 388    // Set permission to add enrollObject
 389  0 policyData.setObjectSpec(objId);
 390  0 policyData.setObjectSpecDesc(CasConstants.OBJECT_SPEC);
 391  0 policyData.setActionSpec(enrollObject);
 392  0 policyData.setActionSpecDesc(CasConstants.SERVICEACTION_SPEC);
 393  0 PolicyDataHandler.storeObject(policyData);
 394   
 395    // attempt adding with bad user group for grant all permissions
 396  0 exception = false;
 397  0 try {
 398  0 casPort.createObject(new CreateObject(TestConstants.objName,
 399    TestConstants.nsNick,
 400    "DummyUserGroup"));
 401    }
 402    catch (CasFault casFault) {
 403  0 if (casFault.getDescription(0).toString()
 404    .indexOf("does not exist")!=-1) {
 405  0 exception = true;
 406    }
 407    }
 408  0 assertTrue(exception);
 409   
 410    // Invoke method after permission has been added
 411  0 casPort.createObject(new CreateObject(TestConstants.objName,
 412    TestConstants.nsNick,
 413    TestConstants.defUserGp));
 414    // Ensure it was added
 415  0 ObjectData objData = new ObjectData();
 416  0 objData.setObjectName(TestConstants.objName);
 417  0 objData.setObjectNamespace(TestConstants.nsNick);
 418  0 String addedObj =
 419    Integer.toString(ObjectDataHandler.getObjectId(
 420    TestConstants.objName,
 421    TestConstants.nsNick));
 422  0 objData.setObjectId(addedObj);
 423  0 assertTrue(objData.equals(
 424    (ObjectData)ObjectDataHandler.retrieveObject(
 425    TestConstants.objName,
 426    TestConstants.nsNick)));
 427   
 428    // attempt creating userGp
 429  0 exception = false;
 430  0 try {
 431  0 casPort.createGroup(new CreateGroup(TestConstants.userGpName,
 432    "user",
 433    TestConstants.defUserGp));
 434    } catch (NoPermissionFault casFault) {
 435  0 exception = true;
 436    }
 437  0 assertTrue(exception);
 438    // Set permission to add create user Gp
 439  0 policyData.setObjectSpec(objId);
 440  0 policyData.setObjectSpecDesc(CasConstants.OBJECT_SPEC);
 441  0 policyData.setActionSpec(createUserGp);
 442  0 logger.debug("create user gp " + createUserGp);
 443  0 policyData.setActionSpecDesc(CasConstants.SERVICEACTION_SPEC);
 444  0 PolicyDataHandler.storeObject(policyData);
 445  0 logger.debug("/n stored data "
 446    + CasStringUtils.policyToString(policyData));
 447   
 448    // attempt adding with bad user group for grant all permissions
 449  0 exception = false;
 450  0 try {
 451  0 casPort.createGroup(new CreateGroup("DummyUserGroup", "user",
 452    TestConstants.userGpName));
 453    } catch (CasFault casFault) {
 454  0 if (casFault.getDescription(0).toString()
 455    .indexOf("does not exist")!=-1) {
 456  0 exception = true;
 457    }
 458    }
 459  0 assertTrue(exception);
 460   
 461    // Invoke method after permission has been added
 462  0 casPort.createGroup(new CreateGroup(TestConstants.userGpName, "user",
 463    TestConstants.defUserGp));
 464    // Ensure it was added
 465  0 UserGroupData userGpData = new UserGroupData();
 466  0 userGpData.setGroupName(TestConstants.userGpName);
 467  0 assertTrue(userGpData.equals(
 468    (UserGroupData)UserGroupDataHandler.retrieveObject(
 469    TestConstants.userGpName)));
 470   
 471    // attempt adding to user group, because of grantAll this should
 472    // go through
 473  0 casPort.manageUserGroups(new ManageUserGroups(TestConstants.userGpName,
 474    "add",
 475    TestConstants.userNick));
 476    // Ensure it was added
 477  0 String temp[] = new String[1];
 478  0 temp[0] = TestConstants.userNick;
 479  0 userGpData.setUserNames(new ArrayOfString(temp));
 480  0 assertTrue(userGpData.equals(
 481    (UserGroupData)UserGroupDataHandler.retrieveObject(
 482    TestConstants.userGpName)));
 483   
 484    // attempt creating objectGP
 485  0 exception = false;
 486  0 try {
 487  0 casPort.createGroup(new CreateGroup(TestConstants.objectGpName,
 488    "object",
 489    TestConstants.defUserGp));
 490    } catch (NoPermissionFault casFault) {
 491  0 exception = true;
 492    }
 493  0 assertTrue(exception);
 494    // Set permission to add create Obj Gp
 495  0 policyData.setObjectSpec(objId);
 496  0 policyData.setObjectSpecDesc(CasConstants.OBJECT_SPEC);
 497  0 policyData.setActionSpec(createObjGp);
 498  0 policyData.setActionSpecDesc(CasConstants.SERVICEACTION_SPEC);
 499  0 PolicyDataHandler.storeObject(policyData);
 500   
 501    // attempt adding with bad user group for grant all permissions
 502  0 exception = false;
 503  0 try {
 504  0 casPort.createGroup(new CreateGroup(TestConstants.objectGpName,
 505    "object", "DummyUserGroup"));
 506    } catch (CasFault casFault) {
 507  0 if (casFault.getDescription(0).toString()
 508    .indexOf("does not exist")!=-1) {
 509  0 exception = true;
 510    }
 511    }
 512  0 assertTrue(exception);
 513   
 514    // Invoke method after permission has been added
 515  0 casPort
 516    .createGroup(new CreateGroup(TestConstants.objectGpName,
 517    "object", TestConstants.defUserGp));
 518    // Ensure it was added
 519  0 ObjectGroupData objectGpData = new ObjectGroupData();
 520  0 objectGpData.setGroupName(TestConstants.objectGpName);
 521  0 assertTrue(objectGpData.equals(
 522    (ObjectGroupData)ObjectGroupDataHandler.retrieveObject(
 523    TestConstants.objectGpName)));
 524   
 525    // attempt adding to object group, because of grantAll this
 526    // should go through
 527  0 casPort.manageObjectGroups(
 528    new ManageObjectGroups(TestConstants.objectGpName,
 529    TestConstants.nsNick + "|"
 530    + TestConstants.objName, "object",
 531    "add"));
 532    // Ensure it was added
 533  0 String objTemp[] = new String[1];
 534  0 objTemp[0] = addedObj;
 535  0 String objTemp1[] = new String[1];
 536  0 objTemp1[0] = CasConstants.OBJECT_SPEC;
 537  0 objectGpData.setObjectSpecs(new ArrayOfString(objTemp));
 538  0 objectGpData.setObjectSpecsDesc(new ArrayOfString(objTemp1));
 539  0 assertTrue(objectGpData.equals(
 540    (ObjectGroupData)ObjectGroupDataHandler.retrieveObject(
 541    TestConstants.objectGpName)));
 542   
 543    // attempting to createServiceType
 544  0 exception = false;
 545  0 try {
 546  0 casPort.createServiceType(
 547    new CreateServiceType(TestConstants.serviceName,
 548    TestConstants.defUserGp));
 549    } catch (NoPermissionFault casFault) {
 550  0 exception = true;
 551    }
 552  0 assertTrue(exception);
 553    // Set permission to create service Type
 554  0 policyData.setObjectSpec(objId);
 555  0 policyData.setObjectSpecDesc(CasConstants.OBJECT_SPEC);
 556  0 policyData.setActionSpec(enrollService);
 557  0 policyData.setActionSpecDesc(CasConstants.SERVICEACTION_SPEC);
 558  0 PolicyDataHandler.storeObject(policyData);
 559   
 560    // attempt adding with bad user group for grant all permissions
 561  0 exception = false;
 562  0 try {
 563  0 casPort.createServiceType(
 564    new CreateServiceType(TestConstants.serviceName,
 565    "DummyUserGp"));
 566    } catch (CasFault casFault) {
 567  0 if (casFault.getDescription(0).toString()
 568    .indexOf("does not exist")!=-1) {
 569  0 exception = true;
 570    }
 571    }
 572  0 assertTrue(exception);
 573   
 574    // Invoke method after permission has been added
 575  0 casPort.createServiceType(
 576    new CreateServiceType(TestConstants.serviceName,
 577    TestConstants.defUserGp));
 578    // Ensure it was added
 579  0 ServiceTypeData serviceType = new ServiceTypeData();
 580  0 serviceType.setName(TestConstants.serviceName);
 581  0 assertTrue(serviceType.equals(
 582    (ServiceTypeData)ServiceTypeDataHandler.retrieveObject(
 583    TestConstants.serviceName)));
 584   
 585    // attempting to add serviceAction mapping, because of grantAll
 586    // this should go through
 587  0 casPort.manageServiceAction(
 588    new ManageServiceAction(TestConstants.actionName, "add",
 589    TestConstants.serviceName));
 590    // Ensure it was added
 591  0 String actNames[] = new String[1];
 592  0 actNames[0] = TestConstants.actionName;
 593  0 serviceType.setActionNames(new ArrayOfString(actNames));
 594  0 assertTrue(serviceType.equals(
 595    (ServiceTypeData)ServiceTypeDataHandler.retrieveObject(
 596    TestConstants.serviceName)));
 597   
 598    // attempt creating serviceActionGp
 599  0 exception = false;
 600  0 try {
 601  0 casPort.createGroup(
 602    new CreateGroup(TestConstants.serviceActionGpName,
 603    "serviceAction",
 604    TestConstants.defUserGp));
 605    } catch (NoPermissionFault casFault) {
 606  0 exception = true;
 607    }
 608  0 assertTrue(exception);
 609    // Set permission to create serviceAction Gp
 610  0 policyData.setObjectSpec(objId);
 611  0 policyData.setObjectSpecDesc(CasConstants.OBJECT_SPEC);
 612  0 policyData.setActionSpec(createServiceActionGp);
 613  0 policyData.setActionSpecDesc(CasConstants.SERVICEACTION_SPEC);
 614  0 PolicyDataHandler.storeObject(policyData);
 615    // Invoke method after permission has been added
 616  0 casPort.createGroup(
 617    new CreateGroup(TestConstants.serviceActionGpName,
 618    "serviceAction", TestConstants.defUserGp));
 619    // Ensure it was added
 620  0 String[] serviceActionGp =
 621    ServiceTypeActionHandler.listServiceActionGroups();
 622  0 assertTrue(CasStringUtils.stringInArray(serviceActionGp,
 623    TestConstants.serviceActionGpName));
 624   
 625    // attempt adding to serviceActionGp, because of grantAll this
 626    // should go through
 627  0 casPort.manageServiceActionGroups(new ManageServiceActionGroups(
 628    TestConstants.actionName,
 629    TestConstants.serviceActionGpName,
 630    "add",
 631    TestConstants.serviceName));
 632    // Ensure it was added
 633  0 String[] serviceActionGpEntry =
 634    ServiceTypeActionHandler.retrieveServiceActionGpEntries(
 635    TestConstants.serviceActionGpName);
 636  0 assertTrue(CasStringUtils.stringInArray(serviceActionGpEntry,
 637    TestConstants.serviceName
 638    + "/"
 639    + TestConstants.actionName));
 640    }
 641    }