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


Java Project类代码示例

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


Project类属于org.ligoj.app.model包,在下文中一共展示了Project类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: delete

import org.ligoj.app.model.Project; //导入依赖的package包/类
@Test
public void delete() throws SchedulerException {
	final Project project = new Project();
	project.setName("TEST");
	project.setPkey("test");
	em.persist(project);

	final Subscription subscription = new Subscription();
	subscription.setProject(project);
	subscription.setNode(nodeRepository.findOneExpected("service:vm"));
	em.persist(subscription);

	Assert.assertEquals(1, subscriptionRepository.findAllByProject(project.getId()).size());
	em.flush();
	em.clear();

	resource.delete(subscription.getId(), false);
	subscriptionRepository.delete(subscription);
	em.flush();
	em.clear();
	Assert.assertEquals(0, subscriptionRepository.findAllByProject(project.getId()).size());
	Assert.assertEquals(0, vmScheduleRepository.findBySubscription(subscription.getId()).size());
	Assert.assertEquals(0, vmExecutionRepository.findAllBy("subscription.id", subscription.getId()).size());
}
 
开发者ID:ligoj,项目名称:plugin-vm,代码行数:25,代码来源:VmResourceTest.java

示例2: create

import org.ligoj.app.model.Project; //导入依赖的package包/类
@Test
public void create() throws Exception {
	final Project project = new Project();
	project.setName("TEST");
	project.setPkey("test");
	em.persist(project);
	em.flush();

	final Subscription subscription = new Subscription();
	subscription.setProject(project);
	subscription.setNode(nodeRepository.findOneExpected("service:km"));
	em.persist(subscription);
	em.flush();
	em.clear();

	resource.create(subscription.getId());
	em.flush();
	em.clear();

	em.flush();
	em.clear();
	Assert.assertEquals(1, subscriptionRepository.findAllByProject(project.getId()).size());
}
 
开发者ID:ligoj,项目名称:plugin-km-confluence,代码行数:24,代码来源:KmResourceTest.java

示例3: delete

import org.ligoj.app.model.Project; //导入依赖的package包/类
@Test
public void delete() throws Exception {
	final Project project = new Project();
	project.setName("TEST");
	project.setPkey("test");
	em.persist(project);

	final Subscription subscription = new Subscription();
	subscription.setProject(project);
	subscription.setNode(nodeRepository.findOneExpected("service:qa"));
	em.persist(subscription);

	Assert.assertEquals(1, subscriptionRepository.findAllByProject(project.getId()).size());
	em.flush();
	em.clear();

	resource.delete(subscription.getId(), false);
	subscriptionRepository.delete(subscription);
	em.flush();
	em.clear();
	Assert.assertEquals(0, subscriptionRepository.findAllByProject(project.getId()).size());
}
 
开发者ID:ligoj,项目名称:plugin-qa-sonarqube,代码行数:23,代码来源:QaResourceTest.java

示例4: create

import org.ligoj.app.model.Project; //导入依赖的package包/类
@Test
public void create() throws Exception {
	final Project project = new Project();
	project.setName("TEST");
	project.setPkey("test");
	em.persist(project);
	em.flush();

	final Subscription subscription = new Subscription();
	subscription.setProject(project);
	subscription.setNode(nodeRepository.findOneExpected("service:qa"));
	em.persist(subscription);
	em.flush();
	em.clear();

	resource.create(subscription.getId());
	em.flush();
	em.clear();

	em.flush();
	em.clear();
	Assert.assertEquals(1, subscriptionRepository.findAllByProject(project.getId()).size());
}
 
开发者ID:ligoj,项目名称:plugin-qa-sonarqube,代码行数:24,代码来源:QaResourceTest.java

示例5: prepareData

import org.ligoj.app.model.Project; //导入依赖的package包/类
@Before
public void prepareData() throws IOException {
	persistSystemEntities();
	persistEntities("csv",
			new Class[] { Node.class, Project.class, CacheCompany.class, CacheUser.class, DelegateNode.class, Parameter.class,
					ProvLocation.class, ProvStorageType.class, Subscription.class, ParameterValue.class, ProvQuote.class },
			StandardCharsets.UTF_8.name());
	this.subscription = getSubscription("gStack");

	// Disable inner transaction
	this.resource = new ProvAwsPriceImportResource();
	applicationContext.getAutowireCapableBeanFactory().autowireBean(resource);
	this.resource.initSpotToNewRegion();
	this.resource.initEbsToApi();
	this.resource.importCatalogResource = new ImportCatalogResource();
	applicationContext.getAutowireCapableBeanFactory().autowireBean(this.resource.importCatalogResource);
	initSpringSecurityContext(DEFAULT_USER);
	resetImportTask();
}
 
开发者ID:ligoj,项目名称:plugin-prov-aws,代码行数:20,代码来源:ProvAwsPriceImportResourceTest.java

示例6: linkInvalidProject

import org.ligoj.app.model.Project; //导入依赖的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

示例7: linkNotAdmin

import org.ligoj.app.model.Project; //导入依赖的package包/类
@Test
public void linkNotAdmin() throws Exception {
	final long initCount = importStatusRepository.count();
	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, 10074);
	em.createQuery("DELETE ParameterValue v WHERE v.node.id = ?1 AND v.parameter.id = ?2")
			.setParameter(2, JiraBaseResource.PARAMETER_ADMIN_USER).setParameter(1, "service:bt:jira:6").executeUpdate();
	em.flush();
	em.clear();
	resource.link(subscription.getId());
	em.flush();
	Assert.assertEquals(initCount, importStatusRepository.count());
	Assert.assertNull(resource.getTask(subscription.getId()));
}
 
开发者ID:ligoj,项目名称:plugin-bt-jira,代码行数:23,代码来源:JiraPluginResourceTest.java

示例8: link

import org.ligoj.app.model.Project; //导入依赖的package包/类
@Test
public void link() throws Exception {
	prepareJiraServer();

	final long initCount = importStatusRepository.count();
	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, 10074);
	em.flush();
	em.clear();
	resource.link(subscription.getId());
	em.flush();
	Assert.assertEquals(initCount, importStatusRepository.count());
	Assert.assertNull(resource.getTask(subscription.getId()));
}
 
开发者ID:ligoj,项目名称:plugin-bt-jira,代码行数:23,代码来源:JiraPluginResourceTest.java

示例9: create

import org.ligoj.app.model.Project; //导入依赖的package包/类
@Override
public void create(final int subscription) throws Exception {
	final Map<String, String> parameters = subscriptionResource.getParameters(subscription);
	final String group = parameters.get(IdentityResource.PARAMETER_GROUP);
	final String parentGroup = parameters.get(IdentityResource.PARAMETER_PARENT_GROUP);
	final String ou = parameters.get(IdentityResource.PARAMETER_OU);
	final Project project = subscriptionRepository.findOne(subscription).getProject();
	final String pkey = project.getPkey();

	// Check the relationship between group, OU and project
	validateGroup(group, ou, pkey);

	// Check the relationship between group, and parent
	final String parentDn = validateAndCreateParent(group, parentGroup, ou, pkey);

	// Create the group inside the parent (OU or parent CN)
	final String groupDn = "cn=" + group + "," + parentDn;
	log.info("New Group CN would be created {} project {} and subscription {}", group, pkey);
	final GroupLdapRepository repository = getGroup();
	final GroupOrg groupLdap = repository.create(groupDn, group);

	// Complete as needed the relationship between parent and this new group
	if (StringUtils.isNotBlank(parentGroup)) {
		// This group will be added as "uniqueMember" of its parent
		repository.addGroup(groupLdap, parentGroup);
	}

	// Associate the project to this group in the cache
	final CacheProjectGroup projectGroup = new CacheProjectGroup();
	projectGroup.setProject(project);
	projectGroup.setGroup(repository.getCacheRepository().findOneExpected(groupLdap.getId()));
	cacheProjectGroupRepository.saveAndFlush(projectGroup);
}
 
开发者ID:ligoj,项目名称:plugin-id-ldap,代码行数:34,代码来源:LdapPluginResource.java

示例10: persistProjectGroups

import org.ligoj.app.model.Project; //导入依赖的package包/类
/**
 * Persist association between project and groups.
 * 
 * @param groups
 *            The groups already persisted in database.
 * @return the amount of persisted relations.
 */
private int persistProjectGroups(final Map<String, CacheGroup> groups) {
	final List<Object[]> allProjectGroup = cacheProjectGroupRepository.findAllProjectGroup();
	for (final Object[] projectGroup : allProjectGroup) {
		final Project project = new Project();
		project.setId((int) projectGroup[0]);
		final CacheProjectGroup entity = new CacheProjectGroup();
		entity.setProject(project);
		entity.setGroup(groups.get(projectGroup[1]));
		em.persist(entity);
	}
	return allProjectGroup.size();
}
 
开发者ID:ligoj,项目名称:plugin-id-ldap,代码行数:20,代码来源:LdapCacheDao.java

示例11: prepareData

import org.ligoj.app.model.Project; //导入依赖的package包/类
@Before
public void prepareData() throws IOException {
	persistEntities(
			"csv", new Class[] { DelegateOrg.class, ContainerScope.class, CacheCompany.class, CacheUser.class, CacheGroup.class,
					CacheMembership.class, Project.class, Node.class, Parameter.class, Subscription.class, ParameterValue.class, 
					CacheProjectGroup.class },
			StandardCharsets.UTF_8.name());
	CacheManager.getInstance().getCache("container-scopes").removeAll();

	// Only with Spring context
	this.subscription = getSubscription("gStack", IdentityResource.SERVICE_KEY);

	// Coverage only
	resource.getKey();
}
 
开发者ID:ligoj,项目名称:plugin-id-ldap,代码行数:16,代码来源:LdapPluginResourceTest.java

示例12: create

import org.ligoj.app.model.Project; //导入依赖的package包/类
/**
 * Create a group in a existing OU "sea". Most Simple case. Group matches exactly to the pkey of the project.
 * 
 * @return the created subscription.
 */
private Subscription create(final String groupAndProject) throws Exception {
	// Preconditions
	Assert.assertNull(getGroup().findById(groupAndProject));
	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();
	final Project newProject = newProject(groupAndProject);
	subscription2.setProject(newProject);
	subscription2.setNode(subscription.getNode());
	em.persist(subscription2);

	// Add parameters
	setGroup(subscription2, groupAndProject);
	setOu(subscription2, "sea");

	basicCreate(subscription2);

	// Checks
	final GroupOrg groupLdap = getGroup().findById(groupAndProject);
	Assert.assertNotNull(groupLdap);
	Assert.assertEquals(groupAndProject, groupLdap.getName());
	Assert.assertEquals(groupAndProject, groupLdap.getId());
	Assert.assertEquals("cn=" + groupAndProject + ",ou=sea,ou=project,dc=sample,dc=com", groupLdap.getDn());
	Assert.assertNotNull(projectCustomerLdapRepository.findAllNoCache("ou=project,dc=sample,dc=com").get("sea"));
	Assert.assertNotNull(projectCustomerLdapRepository.findAll("ou=project,dc=sample,dc=com").get("sea"));

	return subscription2;
}
 
开发者ID:ligoj,项目名称:plugin-id-ldap,代码行数:36,代码来源:LdapPluginResourceTest.java

示例13: createSubGroup

import org.ligoj.app.model.Project; //导入依赖的package包/类
/**
 * Create a group inside an existing group. Parent group matches exactly to the pkey of the project.
 */
@Test
public void createSubGroup() throws Exception {
	// Create the parent group
	final Project newProject = create("sea-parent").getProject();
	createSubGroup(newProject, "sea-parent", "sea-parent-client");
}
 
开发者ID:ligoj,项目名称:plugin-id-ldap,代码行数:10,代码来源:LdapPluginResourceTest.java

示例14: createNotCompliantGroupForParent

import org.ligoj.app.model.Project; //导入依赖的package包/类
/**
 * Create a group inside an existing group without reusing the name of the parent group.
 */
@Test
public void createNotCompliantGroupForParent() throws Exception {
	// Create the parent group
	final Project newProject = create("sea-parent2").getProject();
	createSubGroup(newProject, "sea-parent2", "sea-parent2-client");

	thrown.expect(ValidationJsonException.class);
	thrown.expect(MatcherUtil.validationMatcher(IdentityResource.PARAMETER_GROUP, "pattern"));

	createSubGroup(newProject, "sea-parent2-client", "sea-parent2-dev");
}
 
开发者ID:ligoj,项目名称:plugin-id-ldap,代码行数:15,代码来源:LdapPluginResourceTest.java

示例15: newProject

import org.ligoj.app.model.Project; //导入依赖的package包/类
/**
 * Create a new project
 */
private Project newProject(final String pkey) {
	final Project project = new Project();
	project.setPkey(pkey);
	project.setName("ANY - " + pkey);
	project.setTeamLeader(DEFAULT_USER);
	em.persist(project);
	return project;
}
 
开发者ID:ligoj,项目名称:plugin-id-ldap,代码行数:12,代码来源:LdapPluginResourceTest.java


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