本文整理汇总了Java中org.ligoj.app.model.Project.setName方法的典型用法代码示例。如果您正苦于以下问题:Java Project.setName方法的具体用法?Java Project.setName怎么用?Java Project.setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.ligoj.app.model.Project
的用法示例。
在下文中一共展示了Project.setName方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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());
}
示例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());
}
示例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());
}
示例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());
}
示例5: 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());
}
示例6: 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()));
}
示例7: 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()));
}
示例8: 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;
}
示例9: createOrLink
import org.ligoj.app.model.Project; //导入方法依赖的package包/类
public void createOrLink(final Consumer<Subscription> function) {
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:bt"));
em.persist(subscription);
em.flush();
em.clear();
function.accept(subscription);
em.flush();
em.clear();
// Check SLA
final BugTrackerConfiguration configuration = repository.findBySubscriptionFetch(subscription.getId());
checkSla(configuration);
// Check calendar
final Calendar calendar = configuration.getCalendar();
Assert.assertNotNull(calendar);
Assert.assertEquals(66, calendar.getHolidays().size());
Assert.assertEquals("France", calendar.getName());
Assert.assertEquals("Jour de l'an", calendar.getHolidays().get(0).getName());
Assert.assertNotNull(calendar.getHolidays().get(0).getDate());
// Check default business hours
Assert.assertEquals(1, configuration.getBusinessHours().size());
Assert.assertEquals(8 * DateUtils.MILLIS_PER_HOUR, configuration.getBusinessHours().get(0).getStart());
Assert.assertEquals(18 * DateUtils.MILLIS_PER_HOUR, configuration.getBusinessHours().get(0).getEnd());
em.flush();
em.clear();
Assert.assertEquals(1, subscriptionRepository.findAllByProject(project.getId()).size());
}
示例10: linkInvalidDatabase
import org.ligoj.app.model.Project; //导入方法依赖的package包/类
@Test(expected = CannotGetJdbcConnectionException.class)
public void linkInvalidDatabase() throws Exception {
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(JiraBaseResource.KEY));
em.persist(subscription);
final ParameterValue parameterValueEntity = new ParameterValue();
parameterValueEntity.setParameter(parameterRepository.findOne(JiraBaseResource.PARAMETER_JDBC_URL));
parameterValueEntity.setData("jdbc:hsqldb:mem:dataSource");
parameterValueEntity.setSubscription(subscription);
em.persist(parameterValueEntity);
final ParameterValue parameterValueEntity2 = new ParameterValue();
parameterValueEntity2.setParameter(parameterRepository.findOneExpected(JiraBaseResource.PARAMETER_JDBC_DRIVER));
parameterValueEntity2.setData("org.hsqldb.jdbc.JDBCDriver");
parameterValueEntity2.setSubscription(subscription);
em.persist(parameterValueEntity2);
final ParameterValue parameterValueEntity3 = new ParameterValue();
parameterValueEntity3.setParameter(parameterRepository.findOneExpected(JiraBaseResource.PARAMETER_JDBC_PASSSWORD));
parameterValueEntity3.setData("invalid");
parameterValueEntity3.setSubscription(subscription);
em.persist(parameterValueEntity3);
em.flush();
em.clear();
resource.link(subscription.getId());
}
示例11: linkInvalidAdmin
import org.ligoj.app.model.Project; //导入方法依赖的package包/类
@Test
public void linkInvalidAdmin() throws Exception {
thrown.expect(ValidationJsonException.class);
thrown.expect(MatcherUtil.validationMatcher(JiraBaseResource.PARAMETER_ADMIN_USER, "jira-admin"));
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);
// Set an invalid URL
em.createQuery("UPDATE ParameterValue v SET v.data = ?3 WHERE v.node.id = ?1 AND v.parameter.id = ?2")
.setParameter(1, JiraBaseResource.PARAMETER_URL).setParameter(2, "service:bt:jira:6").setParameter(3, "any")
.executeUpdate();
em.flush();
em.clear();
CacheManager.getInstance().getCache("subscription-parameters").removeAll();
try {
resource.link(subscription.getId());
} finally {
CacheManager.getInstance().getCache("subscription-parameters").removeAll();
}
}
示例12: createOrLink
import org.ligoj.app.model.Project; //导入方法依赖的package包/类
public void createOrLink(final Consumer<Subscription> function) {
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:bt"));
em.persist(subscription);
em.flush();
em.clear();
function.accept(subscription);
em.flush();
em.clear();
// Check SLA
final BugTrackerConfiguration configuration = repository.findBySubscriptionFetch(subscription.getId());
checkSla(configuration);
// Check calendar
final Calendar calendar = configuration.getCalendar();
Assert.assertNotNull(calendar);
Assert.assertEquals(44, calendar.getHolidays().size());
Assert.assertEquals("France", calendar.getName());
Assert.assertEquals("Jour de l'an", calendar.getHolidays().get(0).getName());
Assert.assertNotNull(calendar.getHolidays().get(0).getDate());
// Check default business hours
Assert.assertEquals(1, configuration.getBusinessHours().size());
Assert.assertEquals(8 * DateUtils.MILLIS_PER_HOUR, configuration.getBusinessHours().get(0).getStart());
Assert.assertEquals(18 * DateUtils.MILLIS_PER_HOUR, configuration.getBusinessHours().get(0).getEnd());
em.flush();
em.clear();
Assert.assertEquals(1, subscriptionRepository.findAllByProject(project.getId()).size());
}
示例13: delete
import org.ligoj.app.model.Project; //导入方法依赖的package包/类
@Test
public void delete() {
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:bt"));
em.persist(subscription);
final Calendar calendar = new Calendar();
calendar.setName("Any");
em.persist(calendar);
final BugTrackerConfiguration configuration = new BugTrackerConfiguration();
configuration.setSubscription(subscription);
configuration.setCalendar(calendar);
em.persist(configuration);
final Sla sla = new Sla();
sla.setName("Any");
sla.setConfiguration(configuration);
sla.setStart("Open");
sla.setStop("Resolved");
em.persist(sla);
final BusinessHours businessHours = new BusinessHours();
businessHours.setConfiguration(configuration);
em.persist(businessHours);
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());
}
示例14: createCreateDefault
import org.ligoj.app.model.Project; //导入方法依赖的package包/类
@Test
public void createCreateDefault() {
slaRepository.deleteAll();
repository.deleteAll();
businessHoursRepository.deleteAll();
holidayRepository.deleteAll();
calendarRepository.deleteAll();
em.flush();
em.clear();
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:bt"));
em.persist(subscription);
em.flush();
em.clear();
resource.create(subscription.getId());
em.flush();
em.clear();
// Check default SLA
final BugTrackerConfiguration configuration = repository.findBySubscriptionFetch(subscription.getId());
checkSla(configuration);
// Check default calendar
final Calendar calendar = calendarRepository.getDefault();
Assert.assertEquals(configuration.getCalendar(), calendar);
Assert.assertNotNull(calendar);
Assert.assertEquals(4, calendar.getHolidays().size());
Assert.assertEquals("Default", calendar.getName());
Assert.assertNotNull(calendar.getHolidays().get(0).getName());
Assert.assertNotNull(calendar.getHolidays().get(0).getDate());
// Check default business hours
Assert.assertEquals(1, configuration.getBusinessHours().size());
Assert.assertEquals(8 * DateUtils.MILLIS_PER_HOUR, configuration.getBusinessHours().get(0).getStart());
Assert.assertEquals(18 * DateUtils.MILLIS_PER_HOUR, configuration.getBusinessHours().get(0).getEnd());
em.flush();
em.clear();
Assert.assertEquals(1, subscriptionRepository.findAllByProject(project.getId()).size());
}