Search in sources :

Example 16 with Project

use of org.estatio.module.capex.dom.project.Project in project estatio by estatio.

the class Project_IntegTest method addChildProject_works.

@Test
public void addChildProject_works() throws Exception {
    // given
    Project parent = Project_enum.KalProject1.findUsing(serviceRegistry);
    Project child = Project_enum.KalProject2.findUsing(serviceRegistry);
    // when
    wrap(parent).addChildProject(child);
    transactionService.nextTransaction();
    // then
    assertThat(child.getParent()).isEqualTo(parent);
    assertThat(parent.getChildren()).contains(child);
}
Also used : Project(org.estatio.module.capex.dom.project.Project) Test(org.junit.Test)

Example 17 with Project

use of org.estatio.module.capex.dom.project.Project in project estatio by estatio.

the class Project_IntegTest method create_parent_project_works.

@Test
public void create_parent_project_works() throws Exception {
    // given
    Project child = Project_enum.KalProject1.findUsing(serviceRegistry);
    // when
    final String reference = "KAL-PARENT";
    final String name = "Kal Parent Project";
    Project parent = wrap(child).createParentProject(reference, name, null, null);
    // then
    assertThat(child.getParent()).isEqualTo(parent);
    assertThat(parent.getChildren()).contains(child);
    assertThat(parent.getReference()).isEqualTo(reference);
    assertThat(parent.getName()).isEqualTo(name);
}
Also used : Project(org.estatio.module.capex.dom.project.Project) Test(org.junit.Test)

Example 18 with Project

use of org.estatio.module.capex.dom.project.Project in project estatio by estatio.

the class Project_IntegTest method parent_project_cannot_add_a_child_that_already_has_a_parent.

@Test
public void parent_project_cannot_add_a_child_that_already_has_a_parent() throws Exception {
    // given
    Project parent = Project_enum.KalProject1.findUsing(serviceRegistry);
    Project child = Project_enum.KalProject2.findUsing(serviceRegistry);
    wrap(child).createParentProject("Some ref", "some name", null, null);
    // expect
    expectedExceptions.expect(InvalidException.class);
    expectedExceptions.expectMessage("Reason: The child project is linked to a parent already.");
    // when
    wrap(parent).addChildProject(child);
}
Also used : Project(org.estatio.module.capex.dom.project.Project) Test(org.junit.Test)

Aggregations

Project (org.estatio.module.capex.dom.project.Project)18 Test (org.junit.Test)11 Charge (org.estatio.module.charge.dom.Charge)9 BigDecimal (java.math.BigDecimal)6 Property (org.estatio.module.asset.dom.Property)6 BudgetItem (org.estatio.module.budget.dom.budgetitem.BudgetItem)5 Tax (org.estatio.module.tax.dom.Tax)5 LocalDate (org.joda.time.LocalDate)5 ArrayList (java.util.ArrayList)3 Programmatic (org.apache.isis.applib.annotation.Programmatic)2 IncomingInvoiceItem (org.estatio.module.capex.dom.invoice.IncomingInvoiceItem)2 OrderItemInvoiceItemLink (org.estatio.module.capex.dom.orderinvoice.OrderItemInvoiceItemLink)2 Organisation (org.estatio.module.party.dom.Organisation)2 Expectations (org.jmock.Expectations)2 BigInteger (java.math.BigInteger)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Inject (javax.inject.Inject)1 ApplicationException (org.apache.isis.applib.ApplicationException)1 Action (org.apache.isis.applib.annotation.Action)1