本文整理汇总了Java中org.ligoj.app.MatcherUtil类的典型用法代码示例。如果您正苦于以下问题:Java MatcherUtil类的具体用法?Java MatcherUtil怎么用?Java MatcherUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MatcherUtil类属于org.ligoj.app包,在下文中一共展示了MatcherUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeUserSchema
import org.ligoj.app.MatcherUtil; //导入依赖的package包/类
/**
* Mock a managed LDAP schema violation
*/
@Test
public void removeUserSchema() {
thrown.expect(ValidationJsonException.class);
thrown.expect(MatcherUtil.validationMatcher("groups", "last-member-of-group"));
final GroupLdapRepository groupRepository = new GroupLdapRepository() {
@Override
public GroupOrg findById(final String name) {
// The group has only the user user we want to remove
return new GroupOrg("dc=" + name, name, Collections.singleton("flast1"));
}
};
groupRepository.setLdapCacheRepository(Mockito.mock(LdapCacheRepository.class));
final LdapTemplate ldapTemplate = Mockito.mock(LdapTemplate.class);
groupRepository.setTemplate(ldapTemplate);
Mockito.doThrow(new org.springframework.ldap.SchemaViolationException(new SchemaViolationException("any"))).when(ldapTemplate)
.modifyAttributes(ArgumentMatchers.any(LdapName.class), ArgumentMatchers.any());
removeUser(groupRepository);
}
示例2: addSlaBoundStart
import org.ligoj.app.MatcherUtil; //导入依赖的package包/类
@Test
public void addSlaBoundStart() {
thrown.expect(ValidationJsonException.class);
thrown.expect(MatcherUtil.validationMatcher("start", "SlaBound"));
final SlaEditionVo vo = new SlaEditionVo();
vo.setName("AA");
vo.setStart(identifierHelper.asList("Open"));
vo.setStop(identifierHelper.asList("Resolved"));
vo.setPause(new ArrayList<>());
vo.getPause().add("Open");
vo.setSubscription(subscription);
em.flush();
em.clear();
resource.addSla(vo);
}
示例3: linkInvalidProject
import org.ligoj.app.MatcherUtil; //导入依赖的package包/类
@Test
public void linkInvalidProject() throws Exception {
thrown.expect(ValidationJsonException.class);
thrown.expect(MatcherUtil.validationMatcher(JiraBaseResource.PARAMETER_PKEY, "jira-project"));
final Project project = new Project();
project.setName("TEST");
project.setPkey("test");
project.setTeamLeader(getAuthenticationName());
em.persist(project);
final Subscription subscription = new Subscription();
subscription.setProject(project);
subscription.setNode(nodeRepository.findOneExpected("service:bt:jira:6"));
em.persist(subscription);
addProjectParameters(subscription, 11111);
em.flush();
em.clear();
resource.link(subscription.getId());
}
示例4: zcreateUserNoDelegateGroup
import org.ligoj.app.MatcherUtil; //导入依赖的package包/类
@Test
public void zcreateUserNoDelegateGroup() {
thrown.expect(ValidationJsonException.class);
thrown.expect(MatcherUtil.validationMatcher("group", BusinessException.KEY_UNKNOW_ID));
final UserOrgEditionVo user = new UserOrgEditionVo();
user.setId("flastg");
user.setFirstName("FirstG");
user.setLastName("LastG");
user.setCompany("ing");
user.setMail("[email protected]");
final List<String> groups = new ArrayList<>();
groups.add("dig sud ouest");
user.setGroups(groups);
initSpringSecurityContext("someone");
resource.create(user);
}
示例5: updateUserGroupNotExists
import org.ligoj.app.MatcherUtil; //导入依赖的package包/类
@Test
public void updateUserGroupNotExists() {
thrown.expect(ValidationJsonException.class);
thrown.expect(MatcherUtil.validationMatcher("group", BusinessException.KEY_UNKNOW_ID));
final UserOrgEditionVo user = new UserOrgEditionVo();
user.setId("flast1");
user.setFirstName("FirstA");
user.setLastName("LastA");
user.setCompany("ing");
user.setMail("[email protected]");
final List<String> groups = new ArrayList<>();
groups.add("any");
user.setGroups(groups);
initSpringSecurityContext("fdaugan");
resource.update(user);
}
示例6: updateUserNoDelegate
import org.ligoj.app.MatcherUtil; //导入依赖的package包/类
@Test
public void updateUserNoDelegate() {
thrown.expect(ValidationJsonException.class);
thrown.expect(MatcherUtil.validationMatcher("company", BusinessException.KEY_UNKNOW_ID));
final UserOrgEditionVo user = new UserOrgEditionVo();
user.setId("flast1");
user.setFirstName("FirstW");
user.setLastName("LastW");
user.setCompany("ing");
user.setMail("[email protected]");
final List<String> groups = new ArrayList<>();
groups.add("dig rha");
user.setGroups(groups);
initSpringSecurityContext("any");
resource.update(user);
}
示例7: updateNotVisibleTargetCompany
import org.ligoj.app.MatcherUtil; //导入依赖的package包/类
@Test
public void updateNotVisibleTargetCompany() {
thrown.expect(ValidationJsonException.class);
thrown.expect(MatcherUtil.validationMatcher("company", BusinessException.KEY_UNKNOW_ID));
final UserOrgEditionVo user = new UserOrgEditionVo();
user.setId("flast0");
user.setFirstName("First0");
user.setLastName("Last0");
user.setCompany("socygan");
user.setMail("[email protected]");
final List<String> groups = new ArrayList<>();
groups.add("Biz Agency");
user.setGroups(groups);
initSpringSecurityContext("mlavoine");
resource.update(user);
}
示例8: updateUserNoDelegateCompany
import org.ligoj.app.MatcherUtil; //导入依赖的package包/类
@Test
public void updateUserNoDelegateCompany() {
thrown.expect(ValidationJsonException.class);
thrown.expect(MatcherUtil.validationMatcher("company", BusinessException.KEY_UNKNOW_ID));
final UserOrgEditionVo user = new UserOrgEditionVo();
user.setId("flast0");
user.setFirstName("FirstA");
user.setLastName("LastA");
user.setCompany("socygan");
user.setMail("[email protected]");
final List<String> groups = new ArrayList<>();
user.setGroups(groups);
initSpringSecurityContext("any");
resource.update(user);
}
示例9: updateUserNoDelegateGroupForTarget
import org.ligoj.app.MatcherUtil; //导入依赖的package包/类
@Test
public void updateUserNoDelegateGroupForTarget() {
thrown.expect(ValidationJsonException.class);
thrown.expect(MatcherUtil.validationMatcher("group", BusinessException.KEY_UNKNOW_ID));
final UserOrgEditionVo user = new UserOrgEditionVo();
user.setId("flast1");
user.setFirstName("FirstA");
user.setLastName("LastA");
user.setCompany("ing");
user.setMail("[email protected]");
final List<String> groups = new ArrayList<>();
groups.add("dig sud ouest"); // no right on this group
user.setGroups(groups);
initSpringSecurityContext("fdaugan");
resource.update(user);
}
示例10: createAlreadyExist
import org.ligoj.app.MatcherUtil; //导入依赖的package包/类
/**
* Create a group with the same name.
*/
@Test
public void createAlreadyExist() throws Exception {
thrown.expect(ValidationJsonException.class);
thrown.expect(MatcherUtil.validationMatcher(IdentityResource.PARAMETER_GROUP, "already-exist"));
// Attach the new group
final Subscription subscription = em.find(Subscription.class, this.subscription);
final Subscription subscription2 = new Subscription();
subscription2.setProject(newProject("sea-octopus"));
subscription2.setNode(subscription.getNode());
em.persist(subscription2);
// Add parameters
setGroup(subscription2, "sea-octopus");
setOu(subscription2, "sea");
basicCreate(subscription2);
}
示例11: createNotCompliantGroupForProject
import org.ligoj.app.MatcherUtil; //导入依赖的package包/类
/**
* Create a group for an existing project, but without reusing the pkey of this project.
*/
@Test
public void createNotCompliantGroupForProject() throws Exception {
thrown.expect(ValidationJsonException.class);
thrown.expect(MatcherUtil.validationMatcher(IdentityResource.PARAMETER_GROUP, "pattern"));
// Preconditions
Assert.assertNotNull(getGroup().findById("sea-octopus"));
Assert.assertNull(getGroup().findById("sea-octopusZZ"));
Assert.assertNotNull(projectCustomerLdapRepository.findAll("ou=project,dc=sample,dc=com").get("sea"));
// Attach the new group
final Subscription subscription = em.find(Subscription.class, this.subscription);
final Subscription subscription2 = new Subscription();
subscription2.setProject(newProject("sea-octopus"));
subscription2.setNode(subscription.getNode());
em.persist(subscription2);
// Add parameters
setGroup(subscription2, "sea-octopusZZ");
setOu(subscription2, "sea");
// Invoke link for an already linked entity, since for now
basicCreate(subscription2);
}
示例12: createNotCompliantGroupForProject2
import org.ligoj.app.MatcherUtil; //导入依赖的package包/类
/**
* Create a group for an existing project, reusing the pkey of this project and without suffix.
*/
@Test
public void createNotCompliantGroupForProject2() throws Exception {
thrown.expect(ValidationJsonException.class);
thrown.expect(MatcherUtil.validationMatcher(IdentityResource.PARAMETER_GROUP, "pattern"));
// Preconditions
Assert.assertNotNull(getGroup().findById("sea-octopus"));
Assert.assertNull(getGroup().findById("sea-octopus-"));
Assert.assertNotNull(projectCustomerLdapRepository.findAll("ou=project,dc=sample,dc=com").get("sea"));
// Attach the new group
final Subscription subscription = em.find(Subscription.class, this.subscription);
final Subscription subscription2 = new Subscription();
subscription2.setProject(newProject("sea-octopus"));
subscription2.setNode(subscription.getNode());
em.persist(subscription2);
// Add parameters
setGroup(subscription2, "sea-octopus-");
setOu(subscription2, "sea");
// Invoke link for an already linked entity, since for now
basicCreate(subscription2);
}
示例13: createNotCompliantGroupForOu
import org.ligoj.app.MatcherUtil; //导入依赖的package包/类
/**
* Create a group for an existing project, perfect match with the pkey, but without reusing the OU of this project.
*/
@Test
public void createNotCompliantGroupForOu() throws Exception {
thrown.expect(ValidationJsonException.class);
thrown.expect(MatcherUtil.validationMatcher(IdentityResource.PARAMETER_GROUP, "pattern"));
// Preconditions
Assert.assertNull(getGroup().findById("sea-invalid-ou"));
Assert.assertNotNull(projectCustomerLdapRepository.findAll("ou=project,dc=sample,dc=com").get("sea"));
// Attach the new group
final Subscription subscription = em.find(Subscription.class, this.subscription);
final Subscription subscription2 = new Subscription();
subscription2.setProject(newProject("sea-invalid-ou"));
subscription2.setNode(subscription.getNode());
em.persist(subscription2);
// Add parameters
setGroup(subscription2, "sea-invalid-ou");
setOu(subscription2, "gfi");
// Invoke link for an already linked entity, since for now
basicCreate(subscription2);
}
示例14: createNotExistingParentGroup
import org.ligoj.app.MatcherUtil; //导入依赖的package包/类
/**
* Create a group inside an existing group without reusing the name of the parent.
*/
@Test
public void createNotExistingParentGroup() throws Exception {
thrown.expect(ValidationJsonException.class);
thrown.expect(MatcherUtil.validationMatcher(IdentityResource.PARAMETER_PARENT_GROUP, "unknown-id"));
// Preconditions
Assert.assertNotNull(getGroup().findById("sea-octopus"));
Assert.assertNull(getGroup().findById("sea-octopus-client"));
Assert.assertNotNull(projectCustomerLdapRepository.findAll("ou=project,dc=sample,dc=com").get("sea"));
// Attach the new group
final Subscription subscription = em.find(Subscription.class, this.subscription);
final Subscription subscription2 = new Subscription();
subscription2.setProject(newProject("sea-orpahn"));
subscription2.setNode(subscription.getNode());
em.persist(subscription2);
// Add parameters
setGroup(subscription2, "sea-orpahn-any");
setParentGroup(subscription2, "sea-orpahn");
setOu(subscription2, "sea");
// Invoke link for an already linked entity, since for now
basicCreate(subscription2);
}
示例15: addSlaBoundEnd
import org.ligoj.app.MatcherUtil; //导入依赖的package包/类
@Test
public void addSlaBoundEnd() {
thrown.expect(ValidationJsonException.class);
thrown.expect(MatcherUtil.validationMatcher("stop", "SlaBound"));
final SlaEditionVo vo = new SlaEditionVo();
vo.setName("AA");
vo.setStart(identifierHelper.asList("Open"));
vo.setStop(identifierHelper.asList("Resolved"));
vo.setPause(new ArrayList<>());
vo.getPause().add("Resolved");
vo.setSubscription(subscription);
em.flush();
em.clear();
resource.addSla(vo);
}