当前位置: 首页>>代码示例>>Java>>正文


Java MatcherUtil类代码示例

本文整理汇总了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);
}
 
开发者ID:ligoj,项目名称:plugin-id-ldap,代码行数:24,代码来源:GroupLdapRepositoryTest.java

示例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);
}
 
开发者ID:ligoj,项目名称:plugin-bt-jira,代码行数:17,代码来源:BugTrackerResourceTest.java

示例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());
}
 
开发者ID:ligoj,项目名称:plugin-bt-jira,代码行数:20,代码来源:JiraPluginResourceTest.java

示例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);
}
 
开发者ID:ligoj,项目名称:plugin-id-ldap,代码行数:17,代码来源:UserLdapResourceTest.java

示例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);
}
 
开发者ID:ligoj,项目名称:plugin-id-ldap,代码行数:17,代码来源:UserLdapResourceTest.java

示例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);
}
 
开发者ID:ligoj,项目名称:plugin-id-ldap,代码行数:18,代码来源:UserLdapResourceTest.java

示例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);
}
 
开发者ID:ligoj,项目名称:plugin-id-ldap,代码行数:17,代码来源:UserLdapResourceTest.java

示例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);
}
 
开发者ID:ligoj,项目名称:plugin-id-ldap,代码行数:17,代码来源:UserLdapResourceTest.java

示例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);
}
 
开发者ID:ligoj,项目名称:plugin-id-ldap,代码行数:17,代码来源:UserLdapResourceTest.java

示例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);
}
 
开发者ID:ligoj,项目名称:plugin-id-ldap,代码行数:22,代码来源:LdapPluginResourceTest.java

示例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);
}
 
开发者ID:ligoj,项目名称:plugin-id-ldap,代码行数:29,代码来源:LdapPluginResourceTest.java

示例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);
}
 
开发者ID:ligoj,项目名称:plugin-id-ldap,代码行数:29,代码来源:LdapPluginResourceTest.java

示例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);
}
 
开发者ID:ligoj,项目名称:plugin-id-ldap,代码行数:28,代码来源:LdapPluginResourceTest.java

示例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);
}
 
开发者ID:ligoj,项目名称:plugin-id-ldap,代码行数:29,代码来源:LdapPluginResourceTest.java

示例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);
}
 
开发者ID:ligoj,项目名称:plugin-bt,代码行数:17,代码来源:BugTrackerResourceTest.java


注:本文中的org.ligoj.app.MatcherUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。