• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java MatcherUtil类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.ligoj.app.MatcherUtil的典型用法代码示例。如果您正苦于以下问题:Java MatcherUtil类的具体用法?Java MatcherUtil怎么用?Java MatcherUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MatcherUtil类属于org.ligoj.app包,在下文中一共展示了MatcherUtil类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: addBusinessHoursOverlapsEnd

import org.ligoj.app.MatcherUtil; //导入依赖的package包/类
@Test
public void addBusinessHoursOverlapsEnd() {
	thrown.expect(ValidationJsonException.class);
	thrown.expect(MatcherUtil.validationMatcher("stop", "Overlap"));

	final BusinessHoursEditionVo vo = new BusinessHoursEditionVo();
	vo.setStart(2 * DateUtils.MILLIS_PER_HOUR);
	vo.setEnd(1 * DateUtils.MILLIS_PER_HOUR);
	vo.setSubscription(subscription);
	em.flush();
	em.clear();
	resource.addBusinessHours(vo);
}
 
开发者ID:ligoj,项目名称:plugin-bt,代码行数:14,代码来源:BugTrackerResourceTest.java


示例17: linkNotFound

import org.ligoj.app.MatcherUtil; //导入依赖的package包/类
@Test
public void linkNotFound() throws Exception {
	thrown.expect(ValidationJsonException.class);
	thrown.expect(MatcherUtil.validationMatcher("service:scm:svn:repository", "svn-repository"));

	prepareMockRepository();
	httpServer.start();

	parameterValueRepository.findAllBySubscription(subscription).stream()
			.filter(v -> v.getParameter().getId().equals(SvnPluginResource.KEY + ":repository")).findFirst().get().setData("0");
	em.flush();
	em.clear();

	// Invoke create for an already created entity, since for now, there is nothing but validation pour SonarQube
	resource.link(this.subscription);

	// Nothing to validate for now...
}
 
开发者ID:ligoj,项目名称:plugin-scm-svn,代码行数:19,代码来源:SvnPluginResourceTest.java


示例18: checkStatusSubscriptionStatusVersionNotFound

import org.ligoj.app.MatcherUtil; //导入依赖的package包/类
/**
 * Version is not found
 */
@Test
public void checkStatusSubscriptionStatusVersionNotFound() throws Exception {
	thrown.expect(ValidationJsonException.class);
	thrown.expect(MatcherUtil.validationMatcher(FortifyPluginResource.PARAMETER_VERSION, "fortify-version"));

	prepareMockHome();
	httpServer.stubFor(get(urlPathEqualTo("/api/v1/projects/2")).willReturn(aResponse().withStatus(HttpStatus.SC_OK)
			.withBody(IOUtils.toString(
					new ClassPathResource("mock-server/fortify/fortify-api-projects-detail.json").getInputStream(),
					StandardCharsets.UTF_8))));

	// Find project return an empty list
	httpServer.stubFor(get(urlPathEqualTo("/api/v1/projects/2/versions"))
			.willReturn(aResponse().withStatus(HttpStatus.SC_OK).withBody("{\"data\":[]}")));
	httpServer.start();
	Assert.assertFalse(resource.checkSubscriptionStatus(subscriptionResource.getParametersNoCheck(subscription))
			.getStatus().isUp());
}
 
开发者ID:ligoj,项目名称:plugin-security-fortify,代码行数:22,代码来源:FortifyPluginResourceTest.java


示例19: deleteNotEmptyParent

import org.ligoj.app.MatcherUtil; //导入依赖的package包/类
@Test
public void deleteNotEmptyParent() {
	thrown.expect(ValidationJsonException.class);
	thrown.expect(MatcherUtil.validationMatcher("company", "not-empty-company"));
	final CompanyOrg companyOrg1 = new CompanyOrg("ou=france,ou=people,dc=sample,dc=com", "france");
	final CompanyOrg companyOrg2 = new CompanyOrg("ou=ing-internal,ou=ing,ou=external,ou=people,dc=sample,dc=com", "ing-internal");
	final Map<String, CompanyOrg> companies = new HashMap<>();
	companies.put("france", companyOrg1);
	companies.put("ing-internal", companyOrg2);

	final Map<String, UserOrg> users = new HashMap<>();
	final UserOrg user1 = new UserOrg();
	user1.setCompany("france");
	users.put("user1", user1);


	Mockito.when(userRepository.findAll()).thenReturn(users);
	Mockito.when(companyRepository.findByIdExpected(DEFAULT_USER, "france")).thenReturn(companyOrg1);
	Mockito.when(companyRepository.findAll()).thenReturn(companies);
	resource.delete("france");
}
 
开发者ID:ligoj,项目名称:plugin-id,代码行数:22,代码来源:CompanyResourceTest.java


示例20: deleteLastMember

import org.ligoj.app.MatcherUtil; //导入依赖的package包/类
@Test
public void deleteLastMember() {
	thrown.expect(ValidationJsonException.class);
	thrown.expect(MatcherUtil.validationMatcher("id", "last-member-of-group"));
	final GroupOrg groupOrg1 = new GroupOrg("cn=DIG,ou=fonction,ou=groups,dc=sample,dc=com", "DIG", Collections.singleton("wuser"));
	final Map<String, GroupOrg> groupsMap = new HashMap<>();
	groupsMap.put("dig", groupOrg1);
	final UserOrg user = new UserOrg();
	user.setCompany("ing");
	user.setGroups(Collections.singleton("dig"));
	Mockito.when(userRepository.findByIdExpected(DEFAULT_USER, "wuser")).thenReturn(user);
	Mockito.when(groupRepository.findAll()).thenReturn(groupsMap);
	final CompanyOrg company = new CompanyOrg("ou=ing,ou=france,ou=people,dc=sample,dc=com", "ing");
	Mockito.when(companyRepository.findById("ing")).thenReturn(company);
	resource.delete("wuser");
}
 
开发者ID:ligoj,项目名称:plugin-id,代码行数:17,代码来源:UserOrgResourceTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java NSBundle类代码示例发布时间:2022-05-22
下一篇:
Java JSONTokener类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap