@Test
public void testGetTemplate() {

    
    Template template = zms.getTemplate(mockDomRsrcCtx, "user_provisioning");
    assertNotNull(template);
    List<Role> roles = template.getRoles();
    assertNotNull(roles);
    assertEquals(3, roles.size());
    
    Role userRole = null;
    Role superuserRole = null;
    Role openstackReadersRole = null;
    for (Role role : roles) {
        switch (role.getName()) {
            case "_domain_:role.user":
                userRole = role;
                break;
            case "_domain_:role.superuser":
                superuserRole = role;
                break;
            case "_domain_:role.openstack_readers":
                openstackReadersRole = role;
                break;
        }
    }
    
    assertNotNull(userRole);
    assertNotNull(superuserRole);
    assertNotNull(openstackReadersRole);
    
    // openstack_readers role has 2 members
    
    assertEquals(2, openstackReadersRole.getRoleMembers().size());
    List<String> checkList = new ArrayList<>();
    checkList.add("sys.builder");
    checkList.add("sys.openstack");
    checkRoleMember(checkList, openstackReadersRole.getRoleMembers());
    
    // other roles have no members
    
    assertNull(userRole.getRoleMembers());
    assertNull(superuserRole.getRoleMembers());
    List<Policy> policies = template.getPolicies();
    assertNotNull(policies);
    assertEquals(3, policies.size());
    
    Policy userPolicy = null;
    Policy superuserPolicy = null;
    Policy openstackReadersPolicy = null;
    for (Policy policy : policies) {
        switch (policy.getName()) {
            case "_domain_:policy.user":
                userPolicy = policy;
                break;
            case "_domain_:policy.superuser":
                superuserPolicy = policy;
                break;
            case "_domain_:policy.openstack_readers":
                openstackReadersPolicy = policy;
                break;
        }
    }
    
    assertNotNull(userPolicy);
    assertNotNull(superuserPolicy);
    assertNotNull(openstackReadersPolicy);
    
    assertEquals(1, userPolicy.getAssertions().size());
    assertEquals(1, superuserPolicy.getAssertions().size());
    assertEquals(2, openstackReadersPolicy.getAssertions().size());
    template = zms.getTemplate(mockDomRsrcCtx, "vipng");
    assertNotNull(template);
    
    template = zms.getTemplate(mockDomRsrcCtx, "platforms");
    assertNotNull(template);
    
    template = zms.getTemplate(mockDomRsrcCtx, "VipNg");
    assertNotNull(template);
    assertEquals(10, template.getMetadata().getLatestVersion().intValue());
    assertEquals("2020-04-28T00:00:00.000Z", template.getMetadata().timestamp.toString());
    assertEquals("Vipng template", template.getMetadata().description);
    assertEquals("", template.getMetadata().keywordsToReplace);
    assertFalse(template.getMetadata().getAutoUpdate());
}