ZMSImpl implements Authorizer, KeyStore, ZMSHandler { Domain createSubDomain(ResourceContext ctx, Domain domain, List<String> adminUsers, List<String> solutionTemplates, String auditRef, String caller) { if (domain.getName().length() > domainNameMaxLen) { throw ZMSUtils.requestError("Invalid SubDomain name: " + domain.getName() + " : name length cannot exceed: " + domainNameMaxLen, caller); } List<String> users = validatedAdminUsers(adminUsers); return dbService.makeDomain(ctx, domain, users, solutionTemplates, auditRef); } ZMSImpl(); Schema schema(); DomainList getDomainList(ResourceContext ctx, Integer limit, String skip, String prefix,
            Integer depth, String account, Integer productId, String roleMember, String roleName,
            String modifiedSince); Domain getDomain(ResourceContext ctx, String domainName); Domain postTopLevelDomain(ResourceContext ctx, String auditRef, TopLevelDomain detail); void deleteTopLevelDomain(ResourceContext ctx, String domainName, String auditRef); Domain postUserDomain(ResourceContext ctx, String name, String auditRef, UserDomain detail); Domain postSubDomain(ResourceContext ctx, String parent, String auditRef, SubDomain detail); void deleteSubDomain(ResourceContext ctx, String parent, String name, String auditRef); void deleteUserDomain(ResourceContext ctx, String name, String auditRef); UserList getUserList(ResourceContext ctx); @Override void deleteDomainRoleMember(ResourceContext ctx, String domainName, String memberName, String auditRef); @Override void deleteUser(ResourceContext ctx, String name, String auditRef); @Override void putDomainMeta(ResourceContext ctx, String domainName, String auditRef,
            DomainMeta meta); @Override void putDomainSystemMeta(ResourceContext ctx, String domainName, String attribute,
            String auditRef, DomainMeta meta); DomainTemplateList getDomainTemplateList(ResourceContext ctx, String domainName); @Override void putDomainTemplate(ResourceContext ctx, String domainName, String auditRef,
            DomainTemplate domainTemplate); @Override void putDomainTemplateExt(ResourceContext ctx, String domainName,
            String templateName, String auditRef, DomainTemplate domainTemplate); void deleteDomainTemplate(ResourceContext ctx, String domainName, String templateName, String auditRef); boolean access(String action, String resource, Principal principal, String trustDomain); Access getAccessExt(ResourceContext ctx, String action, String resource,
            String trustDomain, String checkPrincipal); Access getAccess(ResourceContext ctx, String action, String resource,
            String trustDomain, String checkPrincipal); @Override void putEntity(ResourceContext ctx, String domainName, String entityName, String auditRef, Entity resource); @Override EntityList getEntityList(ResourceContext ctx, String domainName); Entity getEntity(ResourceContext ctx, String domainName, String entityName); void deleteEntity(ResourceContext ctx, String domainName, String entityName, String auditRef); ServerTemplateList getServerTemplateList(ResourceContext ctx); Template getTemplate(ResourceContext ctx, String templateName); @Override DomainTemplateDetailsList getDomainTemplateDetailsList(ResourceContext ctx, String domainName); RoleList getRoleList(ResourceContext ctx, String domainName, Integer limit, String skip); Roles getRoles(ResourceContext ctx, String domainName, Boolean members); @Override DomainRoleMembers getDomainRoleMembers(ResourceContext ctx, String domainName); @Override DomainRoleMember getPrincipalRoles(ResourceContext context, String principal, String domainName); @Override Role getRole(ResourceContext ctx, String domainName, String roleName,
            Boolean auditLog, Boolean expand, Boolean pending); @Override void putRole(ResourceContext ctx, String domainName, String roleName, String auditRef, Role role); void deleteRole(ResourceContext ctx, String domainName, String roleName, String auditRef); @Override Membership getMembership(ResourceContext ctx, String domainName,
            String roleName, String memberName, String expiration); @Override DomainRoleMembers getOverdueReview(ResourceContext ctx, String domainName); @Override void putMembership(ResourceContext ctx, String domainName, String roleName,
            String memberName, String auditRef, Membership membership); void deletePendingMembership(ResourceContext ctx, String domainName, String roleName,
            String memberName, String auditRef); void deleteMembership(ResourceContext ctx, String domainName, String roleName,
            String memberName, String auditRef); Quota getQuota(ResourceContext ctx, String domainName); @Override void putQuota(ResourceContext ctx, String domainName, String auditRef, Quota quota); void deleteQuota(ResourceContext ctx, String domainName, String auditRef); PolicyList getPolicyList(ResourceContext ctx, String domainName, Integer limit, String skip); Policies getPolicies(ResourceContext ctx, String domainName, Boolean assertions); Policy getPolicy(ResourceContext ctx, String domainName, String policyName); Assertion getAssertion(ResourceContext ctx, String domainName, String policyName,
            Long assertionId); @Override Assertion putAssertion(ResourceContext ctx, String domainName, String policyName,
            String auditRef, Assertion assertion); void deleteAssertion(ResourceContext ctx, String domainName, String policyName,
            Long assertionId, String auditRef); @Override void putPolicy(ResourceContext ctx, String domainName, String policyName, String auditRef, Policy policy); void deletePolicy(ResourceContext ctx, String domainName, String policyName, String auditRef); boolean isValidServiceName(final String serviceName); @Override void putServiceIdentity(ResourceContext ctx, String domainName, String serviceName,
                                   String auditRef, ServiceIdentity service); @Override void putServiceIdentitySystemMeta(ResourceContext ctx, String domainName, String serviceName,
             String attribute, String auditRef, ServiceIdentitySystemMeta meta); ServiceIdentity getServiceIdentity(ResourceContext ctx, String domainName, String serviceName); void deleteServiceIdentity(ResourceContext ctx, String domainName,
            String serviceName, String auditRef); ServiceIdentities getServiceIdentities(ResourceContext ctx, String domainName,
            Boolean publicKeys, Boolean hosts); ServiceIdentityList getServiceIdentityList(ResourceContext ctx, String domainName,
            Integer limit, String skip); PublicKeyEntry getPublicKeyEntry(ResourceContext ctx, String domainName, String serviceName, String keyId); void deletePublicKeyEntry(ResourceContext ctx, String domainName, String serviceName,
            String keyId, String auditRef); @Override void putPublicKeyEntry(ResourceContext ctx, String domainName, String serviceName,
            String keyId, String auditRef, PublicKeyEntry keyEntry); @Override Response getSignedDomains(ResourceContext ctx, String domainName, String metaOnly,
            String metaAttr, Boolean master, String matchingTag); @Override JWSDomain getJWSDomain(ResourceContext ctx, String domainName); @Override UserToken getUserToken(ResourceContext ctx, String userName, String authorizedServices,
            Boolean header); UserToken optionsUserToken(ResourceContext ctx, String userName, String authorizedServices); @Override void putTenancy(ResourceContext ctx, String tenantDomain, String provider,
            String auditRef, Tenancy detail); @Override void deleteTenancy(ResourceContext ctx, String tenantDomain, String provider, String auditRef); @Override void putTenant(ResourceContext ctx, String providerDomain, String providerService,
           String tenantDomain, String auditRef, Tenancy detail); @Override void deleteTenant(ResourceContext ctx, String providerDomain, String providerService,
            String tenantDomain, String auditRef); @Override TenantResourceGroupRoles putTenantResourceGroupRoles(ResourceContext ctx, String provSvcDomain,
            String provSvcName, String tenantDomain, String resourceGroup, String auditRef,
            TenantResourceGroupRoles detail); DomainDataCheck getDomainDataCheck(ResourceContext ctx, String domainName); void deleteProviderResourceGroupRoles(ResourceContext ctx, String tenantDomain,
             String provSvcDomain, String provSvcName, String resourceGroup, String auditRef); ProviderResourceGroupRoles getProviderResourceGroupRoles(ResourceContext ctx, String tenantDomain,
            String provSvcDomain, String provSvcName, String resourceGroup); @Override ProviderResourceGroupRoles putProviderResourceGroupRoles(ResourceContext ctx, String tenantDomain,
             String provSvcDomain, String provSvcName, String resourceGroup, String auditRef,
             ProviderResourceGroupRoles detail); TenantResourceGroupRoles getTenantResourceGroupRoles(ResourceContext ctx, String provSvcDomain,
            String provSvcName, String tenantDomain, String resourceGroup); void deleteTenantResourceGroupRoles(ResourceContext ctx, String provSvcDomain,
            String provSvcName, String tenantDomain, String resourceGroup, String auditRef); @Override String getPublicKey(String domain, String service, String keyId); @Override void putDefaultAdmins(ResourceContext ctx, String domainName, String auditRef,
            DefaultAdmins defaultAdmins); ServicePrincipal getServicePrincipal(ResourceContext ctx); @Override ResourceAccessList getResourceAccessList(ResourceContext ctx, String principal,
            String action); @Override Status getStatus(ResourceContext ctx); ResourceContext newResourceContext(HttpServletRequest request,
                                              HttpServletResponse response,
                                              String apiName); @Override Schema getRdlSchema(ResourceContext context); static String getRootDir(); @Override void putRoleSystemMeta(ResourceContext ctx, String domainName, String roleName, String attribute,
            String auditRef, RoleSystemMeta meta); @Override void putRoleMeta(ResourceContext ctx, String domainName, String roleName, String auditRef, RoleMeta meta); @Override void putMembershipDecision(ResourceContext ctx, String domainName, String roleName,
            String memberName, String auditRef, Membership membership); @Override DomainRoleMembership getPendingDomainRoleMembersList(ResourceContext ctx, String principal); @Override void putRoleReview(ResourceContext ctx, String domainName, String roleName, String auditRef, Role role); @Override Groups getGroups(ResourceContext ctx, String domainName, Boolean members); @Override Group getGroup(ResourceContext ctx, String domainName, String groupName, Boolean auditLog, Boolean pending); @Override void putGroup(ResourceContext ctx, String domainName, String groupName, String auditRef, Group group); @Override void deleteGroup(ResourceContext ctx, String domainName, String groupName, String auditRef); @Override GroupMembership getGroupMembership(ResourceContext ctx, String domainName, String groupName, String memberName, String expiration); @Override void putGroupMembership(ResourceContext ctx, String domainName, String groupName, String memberName, String auditRef, GroupMembership membership); @Override void deleteGroupMembership(ResourceContext ctx, String domainName, String groupName, String memberName, String auditRef); @Override void deletePendingGroupMembership(ResourceContext ctx, String domainName, String groupName, String memberName, String auditRef); @Override DomainGroupMember getPrincipalGroups(ResourceContext ctx, String principal, String domainName); @Override void putGroupSystemMeta(ResourceContext ctx, String domainName, String groupName, String attribute,
                                   String auditRef, GroupSystemMeta meta); @Override void putGroupMeta(ResourceContext ctx, String domainName, String groupName, String auditRef, GroupMeta meta); @Override void putGroupMembershipDecision(ResourceContext ctx, String domainName, String groupName, String memberName,
                                           String auditRef, GroupMembership membership); @Override void putGroupReview(ResourceContext ctx, String domainName, String groupName, String auditRef, Group group); @Override DomainGroupMembership getPendingDomainGroupMembersList(ResourceContext ctx, String principal); void recordMetrics(ResourceContext ctx, int httpStatus); static Metric metric; static String serverHostName; }
@Test public void testCreateSubDomain() { TopLevelDomain dom1 = createTopLevelDomainObject("AddSubDom1", "Test Domain1", "testOrg", adminUser); zms.postTopLevelDomain(mockDomRsrcCtx, auditRef, dom1); SubDomain dom2 = createSubDomainObject("AddSubDom2", "AddSubDom1", "Test Domain2", null, adminUser); Domain resDom1 = zms.postSubDomain(mockDomRsrcCtx, "AddSubDom1", auditRef, dom2); assertNotNull(resDom1); Domain resDom2 = zms.getDomain(mockDomRsrcCtx, "AddSubDom1.AddSubDom2"); assertNotNull(resDom2); assertEquals(dom2.getOrg(), "testorg"); assertFalse(resDom2.getAuditEnabled()); zms.deleteSubDomain(mockDomRsrcCtx, "AddSubDom1", "AddSubDom2", auditRef); zms.deleteTopLevelDomain(mockDomRsrcCtx, "AddSubDom1", auditRef); }