Search in sources :

Example 31 with Organisation

use of org.estatio.module.party.dom.Organisation in project estatio by estatio.

the class Order_Test method minimalRequiredDataToComplete_consitent_dimensions_for_project_budgetItem.

@Test
public void minimalRequiredDataToComplete_consitent_dimensions_for_project_budgetItem() throws Exception {
    // given
    Order order = new Order();
    OrderItem item1 = new OrderItem();
    order.getItems().add(item1);
    order.setOrderNumber("123");
    order.setBuyer(new Organisation());
    order.setSeller(new Organisation());
    item1.setNetAmount(new BigDecimal("100"));
    item1.setDescription("blah");
    item1.setGrossAmount(BigDecimal.ZERO);
    item1.setCharge(new Charge());
    item1.setStartDate(new LocalDate());
    item1.setEndDate(new LocalDate());
    item1.setProperty(new Property());
    // when
    item1.setBudgetItem(new BudgetItem());
    item1.setProject(new Project());
    String result = order.reasonIncomplete();
    // then
    assertThat(result).isEqualTo("(on item) either project or budget item - not both required");
}
Also used : Project(org.estatio.module.capex.dom.project.Project) Organisation(org.estatio.module.party.dom.Organisation) BudgetItem(org.estatio.module.budget.dom.budgetitem.BudgetItem) Charge(org.estatio.module.charge.dom.Charge) LocalDate(org.joda.time.LocalDate) Property(org.estatio.module.asset.dom.Property) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Example 32 with Organisation

use of org.estatio.module.party.dom.Organisation in project estatio by estatio.

the class Order_Test method minimalRequiredDataToComplete_consitent_dimensions_for_property_budgetItem.

@Test
public void minimalRequiredDataToComplete_consitent_dimensions_for_property_budgetItem() throws Exception {
    // given
    Order order = new Order();
    OrderItem item1 = new OrderItem();
    order.getItems().add(item1);
    order.setOrderNumber("123");
    order.setBuyer(new Organisation());
    order.setSeller(new Organisation());
    item1.setNetAmount(new BigDecimal("100"));
    item1.setDescription("blah");
    item1.setGrossAmount(BigDecimal.ZERO);
    item1.setCharge(new Charge());
    item1.setStartDate(new LocalDate());
    item1.setEndDate(new LocalDate());
    // when
    item1.setBudgetItem(new BudgetItem());
    String result = order.reasonIncomplete();
    // then
    assertThat(result).isEqualTo("(on item) when budget item filled in then property required");
}
Also used : Organisation(org.estatio.module.party.dom.Organisation) BudgetItem(org.estatio.module.budget.dom.budgetitem.BudgetItem) Charge(org.estatio.module.charge.dom.Charge) LocalDate(org.joda.time.LocalDate) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Example 33 with Organisation

use of org.estatio.module.party.dom.Organisation in project estatio by estatio.

the class PartyRelationshipType_Test method createFor.

@Test
public void createFor() {
    Person p = new Person();
    Organisation o = new Organisation();
    PartyRelationship pr = PartyRelationshipTypeEnum.createWithToTitle(o, p, PartyRelationshipTypeEnum.EMPLOYMENT.toTitle());
    assertThat((Organisation) pr.getFrom()).isEqualTo(o);
}
Also used : PartyRelationship(org.estatio.module.party.dom.relationship.PartyRelationship) Organisation(org.estatio.module.party.dom.Organisation) Person(org.estatio.module.party.dom.Person) Test(org.junit.Test)

Example 34 with Organisation

use of org.estatio.module.party.dom.Organisation in project estatio by estatio.

the class PartyDtoFactory_Test method happy_case.

@Test
public void happy_case() throws Exception {
    // given
    final Party p = new Organisation();
    p.setReference("12345678");
    p.setName("New Company");
    // expecting
    final OidDto partyOidDto = new OidDto();
    context.checking(new Expectations() {

        {
            oneOf(mockDtoMappingHelper).oidDtoFor(p);
            will(returnValue(partyOidDto));
            oneOf(mockCommunicationChannelRepository).findByOwnerAndType(p, CommunicationChannelType.POSTAL_ADDRESS);
            will(returnValue(Collections.emptySortedSet()));
        }
    });
    // when
    PartyDto partyDto = partyDtoFactory.newDto(p);
    // and when roundtrip
    String xml = jaxbService.toXml(partyDto);
    PartyDto partyDtoAfter = jaxbService.fromXml(PartyDto.class, xml);
    // then
    assertThat(partyDtoAfter.getName()).isEqualTo(p.getName());
    assertThat(partyDtoAfter.getReference()).isEqualTo(p.getReference());
}
Also used : Expectations(org.jmock.Expectations) OidDto(org.apache.isis.schema.common.v1.OidDto) Party(org.estatio.module.party.dom.Party) Organisation(org.estatio.module.party.dom.Organisation) PartyDto(org.estatio.canonical.party.v1.PartyDto) Test(org.junit.Test)

Example 35 with Organisation

use of org.estatio.module.party.dom.Organisation in project estatio by estatio.

the class ChamberOfCommerceCodeLookUpServiceTest method getChamberOfCommerceCodeCandidatesByOrganisation_works.

@Test
public void getChamberOfCommerceCodeCandidatesByOrganisation_works() throws Exception {
    // given
    ChamberOfCommerceCodeLookUpService service = new ChamberOfCommerceCodeLookUpService() {

        @Override
        List<OrganisationNameNumberViewModel> findCandidatesForFranceByName(final String name) {
            return Arrays.asList(new OrganisationNameNumberViewModel(), new OrganisationNameNumberViewModel(), new OrganisationNameNumberViewModel());
        }
    };
    Organisation organisation = new Organisation() {

        @Override
        public String getAtPath() {
            return "/FRA";
        }
    };
    organisation.setName("Company");
    // when
    List<OrganisationNameNumberViewModel> result = service.getChamberOfCommerceCodeCandidatesByOrganisation(organisation);
    // then
    Assertions.assertThat(result.size()).isEqualTo(3);
}
Also used : Organisation(org.estatio.module.party.dom.Organisation) Test(org.junit.Test)

Aggregations

Organisation (org.estatio.module.party.dom.Organisation)37 Test (org.junit.Test)26 Expectations (org.jmock.Expectations)18 Party (org.estatio.module.party.dom.Party)13 IncomingInvoice (org.estatio.module.capex.dom.invoice.IncomingInvoice)9 BankAccount (org.estatio.module.financial.dom.BankAccount)7 LocalDate (org.joda.time.LocalDate)7 Action (org.apache.isis.applib.annotation.Action)6 Property (org.estatio.module.asset.dom.Property)5 BigDecimal (java.math.BigDecimal)4 ArrayList (java.util.ArrayList)4 Charge (org.estatio.module.charge.dom.Charge)4 Order (org.estatio.module.capex.dom.order.Order)3 Person (org.estatio.module.party.dom.Person)3 ActionLayout (org.apache.isis.applib.annotation.ActionLayout)2 BudgetItem (org.estatio.module.budget.dom.budgetitem.BudgetItem)2 IncomingInvoiceMenu (org.estatio.module.capex.app.IncomingInvoiceMenu)2 Project (org.estatio.module.capex.dom.project.Project)2 Country (org.incode.module.country.dom.impl.Country)2 MemberOrder (org.apache.isis.applib.annotation.MemberOrder)1