Search in sources :

Example 6 with Organization

use of org.devgateway.ocds.persistence.mongo.Organization in project ocvn by devgateway.

the class OrganizationEndpointsTest method testSupplierSaerchText.

@Test
public void testSupplierSaerchText() {
    final TextSearchRequest osr = new TextSearchRequest();
    osr.setText("Development");
    final List<Organization> organizations = supplierSearchController.searchText(osr);
    Assert.assertEquals(0, organizations.size(), 0);
}
Also used : TextSearchRequest(org.devgateway.ocds.web.rest.controller.request.TextSearchRequest) Organization(org.devgateway.ocds.persistence.mongo.Organization) Test(org.junit.Test) AbstractWebTest(org.devgateway.toolkit.web.AbstractWebTest)

Example 7 with Organization

use of org.devgateway.ocds.persistence.mongo.Organization in project ocvn by devgateway.

the class OrganizationEndpointsTest method importTestData.

@Before
public void importTestData() throws IOException, InterruptedException {
    organizationRepository.deleteAll();
    final Organization organization = new Organization();
    organization.setName("Development Gateway");
    organization.setId(ORG_ID);
    final Address address = new Address();
    address.setCountryName("Romania");
    address.setLocality("Bucuresti");
    address.setPostalCode("022671");
    address.setRegion("Bucuresti");
    address.setStreetAddress("7 Sos. Iancului");
    organization.setAddress(address);
    final ContactPoint contactPoint = new ContactPoint();
    contactPoint.setEmail("mpostelnicu@developmentgateway.org");
    contactPoint.setFaxNumber("01234567");
    contactPoint.setTelephone("01234567");
    contactPoint.setUrl("http://developmentgateway.org");
    organization.setContactPoint(contactPoint);
    final Identifier identifier = new Identifier();
    identifier.setId(ORG_ID);
    organization.getAdditionalIdentifiers().add(identifier);
    organization.getRoles().add(Organization.OrganizationType.procuringEntity);
    organization.getRoles().add(Organization.OrganizationType.buyer);
    final Organization savedOrganization = organizationRepository.save(organization);
    Assert.assertNotNull(savedOrganization);
    Assert.assertEquals(ORG_ID, savedOrganization.getId());
}
Also used : ContactPoint(org.devgateway.ocds.persistence.mongo.ContactPoint) Organization(org.devgateway.ocds.persistence.mongo.Organization) Identifier(org.devgateway.ocds.persistence.mongo.Identifier) Address(org.devgateway.ocds.persistence.mongo.Address) Before(org.junit.Before)

Example 8 with Organization

use of org.devgateway.ocds.persistence.mongo.Organization in project ocvn by devgateway.

the class OrganizationEndpointsTest method testBuyerSearchText.

@Test
public void testBuyerSearchText() {
    final TextSearchRequest osr = new TextSearchRequest();
    osr.setText("Development");
    final List<Organization> organizations = buyerSearchController.searchText(osr);
    Assert.assertEquals(1, organizations.size(), 0);
}
Also used : TextSearchRequest(org.devgateway.ocds.web.rest.controller.request.TextSearchRequest) Organization(org.devgateway.ocds.persistence.mongo.Organization) Test(org.junit.Test) AbstractWebTest(org.devgateway.toolkit.web.AbstractWebTest)

Example 9 with Organization

use of org.devgateway.ocds.persistence.mongo.Organization in project ocvn by devgateway.

the class AbstractOrganizationSearchController method organizationSearchTextByType.

protected List<Organization> organizationSearchTextByType(final TextSearchRequest request, Organization.OrganizationType type) {
    Query query = null;
    if (request.getText() == null) {
        query = new Query();
    } else {
        //this is for Full Text Search, in case we need this later, right now it's not very useful
        //query = TextQuery.queryText(new TextCriteria().matching(request.getText())).sortByScore();
        query = new Query().addCriteria(Criteria.where("name").regex(Pattern.compile(request.getText(), Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE)));
    }
    if (type != null) {
        query.addCriteria(Criteria.where("roles").is(type)).with(new PageRequest(request.getPageNumber(), request.getPageSize()));
    }
    List<Organization> orgs = mongoTemplate.find(query, Organization.class);
    return orgs;
}
Also used : PageRequest(org.springframework.data.domain.PageRequest) Organization(org.devgateway.ocds.persistence.mongo.Organization) Query(org.springframework.data.mongodb.core.query.Query)

Example 10 with Organization

use of org.devgateway.ocds.persistence.mongo.Organization in project ocvn by devgateway.

the class VNImportAndEndpointsTest method testProcuringEntitySearchController.

@Test
public void testProcuringEntitySearchController() {
    List<Organization> procuringEntities = procuringEntitySearchController.searchText(new TextSearchRequest());
    Assert.assertEquals(3, procuringEntities.size(), 0);
}
Also used : TextSearchRequest(org.devgateway.ocds.web.rest.controller.request.TextSearchRequest) Organization(org.devgateway.ocds.persistence.mongo.Organization) Test(org.junit.Test) AbstractWebTest(org.devgateway.toolkit.web.AbstractWebTest)

Aggregations

Organization (org.devgateway.ocds.persistence.mongo.Organization)19 Test (org.junit.Test)11 AbstractWebTest (org.devgateway.toolkit.web.AbstractWebTest)9 Identifier (org.devgateway.ocds.persistence.mongo.Identifier)5 TextSearchRequest (org.devgateway.ocds.web.rest.controller.request.TextSearchRequest)5 Address (org.devgateway.ocds.persistence.mongo.Address)3 Amount (org.devgateway.ocds.persistence.mongo.Amount)3 ContactPoint (org.devgateway.ocds.persistence.mongo.ContactPoint)3 Release (org.devgateway.ocds.persistence.mongo.Release)3 VNTender (org.devgateway.ocvn.persistence.mongo.dao.VNTender)3 Detail (org.devgateway.ocds.persistence.mongo.Detail)2 VNAward (org.devgateway.ocvn.persistence.mongo.dao.VNAward)2 VNTendererOrganization (org.devgateway.ocvn.persistence.mongo.dao.VNTendererOrganization)2 AbstractMongoTest (org.devgateway.toolkit.persistence.mongo.AbstractMongoTest)2 Before (org.junit.Before)2 Period (org.devgateway.ocds.persistence.mongo.Period)1 ContrMethod (org.devgateway.ocvn.persistence.mongo.dao.ContrMethod)1 VNOrganization (org.devgateway.ocvn.persistence.mongo.dao.VNOrganization)1 VNPlanning (org.devgateway.ocvn.persistence.mongo.dao.VNPlanning)1 PageRequest (org.springframework.data.domain.PageRequest)1