diff --git a/entity-management-common/src/main/java/eu/europeana/entitymanagement/common/config/DataSource.java b/entity-management-common/src/main/java/eu/europeana/entitymanagement/common/config/DataSource.java index 776cfb7dd..c296e3adb 100644 --- a/entity-management-common/src/main/java/eu/europeana/entitymanagement/common/config/DataSource.java +++ b/entity-management-common/src/main/java/eu/europeana/entitymanagement/common/config/DataSource.java @@ -9,7 +9,6 @@ public class DataSource { public static final String FREQ_STATIC = "static"; public static final String EUROPEANA_ID = "europeana"; public static final String ZOHO_ID = "zoho-crm"; - public static final String ZOHO_HOST = "crm.zoho.eu"; @JacksonXmlProperty(isAttribute = true) private String url; diff --git a/entity-management-definitions/src/main/java/eu/europeana/entitymanagement/vocabulary/OrganizationSolrFields.java b/entity-management-definitions/src/main/java/eu/europeana/entitymanagement/vocabulary/OrganizationSolrFields.java index 79d1848c2..f286ec96c 100644 --- a/entity-management-definitions/src/main/java/eu/europeana/entitymanagement/vocabulary/OrganizationSolrFields.java +++ b/entity-management-definitions/src/main/java/eu/europeana/entitymanagement/vocabulary/OrganizationSolrFields.java @@ -16,11 +16,7 @@ public interface OrganizationSolrFields extends EntitySolrFields { public static final String FOAF_MBOX = "foaf_mbox"; public static final String EUROPEANA_ROLE = "europeanaRole"; public static final String EUROPEANA_ROLE_ALL = EUROPEANA_ROLE + EXTENSION_ALL; - public static final String COUNTRY_ID = "countryId"; - public static final String COUNTRY_PREF_LABEL_ALL = "countryPrefLabel.*"; - public static final String COUNTRY_PREF_LABEL = "countryPrefLabel"; - public static final String COUNTRY_LAT = "countryLatitude"; - public static final String COUNTRY_LONG = "countryLongitude"; + public static final String COUNTRY = "country"; public static final String VCARD_HAS_ADDRESS = "vcard_hasAddress.1"; public static final String VCARD_STREET_ADDRESS = "vcard_streetAddress.1"; public static final String VCARD_LOCALITY = "vcard_locality.1"; diff --git a/entity-management-definitions/src/main/java/eu/europeana/entitymanagement/vocabulary/WebEntityFields.java b/entity-management-definitions/src/main/java/eu/europeana/entitymanagement/vocabulary/WebEntityFields.java index 99eeb85ac..2b5b51e55 100644 --- a/entity-management-definitions/src/main/java/eu/europeana/entitymanagement/vocabulary/WebEntityFields.java +++ b/entity-management-definitions/src/main/java/eu/europeana/entitymanagement/vocabulary/WebEntityFields.java @@ -9,7 +9,7 @@ public interface WebEntityFields { public static final String LANGUAGE_EN = "en"; public static final String BASE_DATA_EUROPEANA_URI = "http://data.europeana.eu/"; public static final String WIKIDATA_HOST = "www.wikidata.org"; - public static final String ZOHO_CRM_HOST = "crm.zoho.com"; + public static final String ZOHO_CRM_HOST = "crm.zoho.eu"; // common fields public static final String ID = "id"; diff --git a/entity-management-solr/src/main/java/eu/europeana/entitymanagement/solr/model/SolrOrganization.java b/entity-management-solr/src/main/java/eu/europeana/entitymanagement/solr/model/SolrOrganization.java index 92e5a9e98..1e98d8a06 100644 --- a/entity-management-solr/src/main/java/eu/europeana/entitymanagement/solr/model/SolrOrganization.java +++ b/entity-management-solr/src/main/java/eu/europeana/entitymanagement/solr/model/SolrOrganization.java @@ -8,7 +8,6 @@ import org.apache.solr.client.solrj.beans.Field; import eu.europeana.entitymanagement.definitions.model.Address; import eu.europeana.entitymanagement.definitions.model.Organization; -import eu.europeana.entitymanagement.definitions.model.Place; import eu.europeana.entitymanagement.solr.SolrUtils; import eu.europeana.entitymanagement.utils.EntityUtils; import eu.europeana.entitymanagement.vocabulary.EntitySolrFields; @@ -40,17 +39,8 @@ public class SolrOrganization extends SolrEntity { @Field(OrganizationSolrFields.EUROPEANA_ROLE_ALL) private Map> europeanaRole; - @Field(OrganizationSolrFields.COUNTRY_ID) - private String countryId; - - @Field(OrganizationSolrFields.COUNTRY_PREF_LABEL_ALL) - private Map countryPrefLabel; - - @Field(OrganizationSolrFields.COUNTRY_LAT) - private Float countryLatitude; - - @Field(OrganizationSolrFields.COUNTRY_LONG) - private Float countryLongitude; + @Field(OrganizationSolrFields.COUNTRY) + private String country; @Field(OrganizationSolrFields.VCARD_HAS_ADDRESS) private String hasAddress; @@ -93,12 +83,7 @@ public SolrOrganization(Organization organization) { if (organization.getMbox() != null) this.mbox = new ArrayList<>(organization.getMbox()); setEuropeanaRole(organization.getEuropeanaRole()); - if(organization.getCountry()!=null) { - this.countryId = organization.getCountry().getEntityId(); - this.setCountryPrefLabel(organization.getCountry().getPrefLabel()); - this.countryLatitude = ((Place) organization.getCountry()).getLatitude(); - this.countryLongitude = ((Place) organization.getCountry()).getLongitude(); - } + this.country=organization.getCountryId(); if (organization.getSameReferenceLinks() != null) { this.sameAs = new ArrayList<>(organization.getSameReferenceLinks()); @@ -145,16 +130,6 @@ private void setEuropeanaRole(Map> europeanaRole) { } } - private void setCountryPrefLabel(Map prefLabel) { - if (MapUtils.isNotEmpty(prefLabel)) { - this.countryPrefLabel = - new HashMap<>( - SolrUtils.normalizeStringMapByAddingPrefix( - OrganizationSolrFields.COUNTRY_PREF_LABEL + EntitySolrFields.DYNAMIC_FIELD_SEPARATOR, - prefLabel)); - } - } - public Map getDescription() { return description; } @@ -220,19 +195,7 @@ protected void setSameReferenceLinks(ArrayList uris) { this.sameAs = uris; } - public String getCountryId() { - return countryId; - } - - public Map getCountryPrefLabel() { - return countryPrefLabel; - } - - public Float getCountryLatitude() { - return countryLatitude; - } - - public Float getCountryLongitude() { - return countryLongitude; + public String getCountry() { + return country; } } diff --git a/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/AbstractIntegrationTest.java b/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/AbstractIntegrationTest.java index 1ed56cb7e..97d192d17 100644 --- a/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/AbstractIntegrationTest.java +++ b/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/AbstractIntegrationTest.java @@ -65,7 +65,7 @@ public abstract class AbstractIntegrationTest { @Autowired protected ConceptSchemeService emConceptSchemeService; @Autowired protected EntityManagementConfiguration emConfig; @Autowired protected ZohoConfiguration zohoConfiguration; - + static { MONGO_CONTAINER = new MongoContainer("entity-management", "job-repository", "enrichment") @@ -78,6 +78,8 @@ public abstract class AbstractIntegrationTest { .withLogConsumer(new WaitingConsumer().andThen(new ToStringConsumer())); SOLR_CONTAINER.start(); + + } /** MockWebServer needs to be static, so we can inject its port into the Spring context. */ @@ -101,6 +103,7 @@ public static void setupAll() throws IOException { mockSearchAndRecord = new MockWebServer(); mockSearchAndRecord.setDispatcher(setupSearchAndRecordDispatcher()); mockSearchAndRecord.start(); + } @AfterAll diff --git a/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/service/DereferenceServiceIT.java b/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/service/DereferenceServiceIT.java index cc363b6fc..25e532607 100644 --- a/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/service/DereferenceServiceIT.java +++ b/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/service/DereferenceServiceIT.java @@ -84,9 +84,9 @@ public void zohoOrganizationDereferenceTest() throws Exception { Assertions.assertNotNull(org.getLogo()); Assertions.assertNotNull(org.getAddress().getVcardStreetAddress()); Assertions.assertNotNull(org.getAddress().getVcardCountryName()); + Assertions.assertTrue(org.getHiddenLabel().contains("BN Paris (blíže neurčeno)")); Assertions.assertTrue(org.getHiddenLabel().contains("Bibliothèque nationale")); - Assertions.assertTrue(org.getHiddenLabel().contains("Bibliothèque nationale Francaise")); - Assertions.assertTrue(org.getHiddenLabel().contains("French National Library")); + Assertions.assertTrue(org.getHiddenLabel().contains("Bibliothèque nationale Francaise French National Library")); } // @Test diff --git a/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/testutils/IntegrationTestUtils.java b/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/testutils/IntegrationTestUtils.java index 9ed6e4003..3d5442041 100644 --- a/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/testutils/IntegrationTestUtils.java +++ b/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/testutils/IntegrationTestUtils.java @@ -171,13 +171,14 @@ public class IntegrationTestUtils { public static final String ORGANIZATION_BNF_URI_ZOHO = "https://crm.zoho.eu/crm/org20085137532/tab/Accounts/486281000000938399"; public static final String ORGANIZATION_NATURALIS_URI_ZOHO = - "https://crm.zoho.com/crm/org51823723/tab/Accounts/1482250000000370517"; + "https://crm.zoho.eu/crm/org20085137532/tab/Accounts/486281000000923816"; public static final String ORGANIZATION_PCCE_URI_ZOHO = - "https://crm.zoho.com/crm/org51823723/tab/Accounts/1482250000000338555"; + "https://crm.zoho.eu/crm/org20085137532/tab/Accounts/486281000000923271"; public static final String ORGANIZATION_GFM_URI_ZOHO = - "https://crm.zoho.com/crm/org51823723/tab/Accounts/1482250000004503618"; + "https://crm.zoho.eu/crm/org20085137532/tab/Accounts/486281000000940433"; public static final String ORGANIZATION_BERGER_MUSEUM_URI_ZOHO = - "https://crm.zoho.com/crm/org51823723/tab/Accounts/1482250000004477407"; + "https://crm.zoho.eu/crm/org20085137532/tab/Accounts/486281000000939337"; + public static final String ORGANIZATION_NATURALIS_URI_WIKIDATA_PATH_SUFFIX = "/entity/Q641676"; public static final String ORGANIZATION_NATURALIS_URI_WIKIDATA_URI = WIKIDATA_BASE_URI + ORGANIZATION_NATURALIS_URI_WIKIDATA_PATH_SUFFIX; diff --git a/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/testutils/TestConfig.java b/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/testutils/TestConfig.java index 4de3f5e62..6e310b8bc 100644 --- a/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/testutils/TestConfig.java +++ b/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/testutils/TestConfig.java @@ -16,7 +16,7 @@ public class TestConfig { - public static final String MOCK_ZOHO_BASE_URL = "https://crm.zoho.com/crm/org51823723/tab/Accounts/"; + public static final String MOCK_ZOHO_BASE_URL = "https://crm.zoho.eu/crm/org20085137532/tab/Accounts/"; public static final String MOCK_ZOHO_COUNTRY_MAPPING_FILE = "/zoho_country_mapping_test.json"; @Autowired @@ -32,7 +32,7 @@ public ZohoConfiguration configureZoho() throws Exception { ZohoConfiguration zohoConfiguration = Mockito.mock(ZohoConfiguration.class); ZohoAccessClient zohoClient = Mockito.mock(ZohoAccessClient.class); Mockito.when(zohoConfiguration.getZohoAccessClient()).thenReturn(zohoClient); - Mockito.when(zohoConfiguration.getZohoBaseUrl()).thenReturn(zohoConfiguration.getZohoBaseUrl()); + Mockito.when(zohoConfiguration.getZohoBaseUrl()).thenReturn(MOCK_ZOHO_BASE_URL); // find matching JSON file based on zohoId argument, then create a Record object for it Mockito.doAnswer( diff --git a/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/testutils/ZohoRecordTestDeserializer.java b/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/testutils/ZohoRecordTestDeserializer.java index d5c0975f8..427edfe1c 100644 --- a/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/testutils/ZohoRecordTestDeserializer.java +++ b/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/testutils/ZohoRecordTestDeserializer.java @@ -20,11 +20,11 @@ import static eu.europeana.entitymanagement.zoho.utils.ZohoConstants.LOGO_LINK_TO_WIKIMEDIACOMMONS_FIELD; import static eu.europeana.entitymanagement.zoho.utils.ZohoConstants.LONGITUDE_FIELD; import static eu.europeana.entitymanagement.zoho.utils.ZohoConstants.OFFICIAL_LANGUAGE_FIELD; -import static eu.europeana.entitymanagement.zoho.utils.ZohoConstants.ORGANIZATION_COUNTRY_FIELD; import static eu.europeana.entitymanagement.zoho.utils.ZohoConstants.ORGANIZATION_ROLE_FIELD; import static eu.europeana.entitymanagement.zoho.utils.ZohoConstants.PO_BOX_FIELD; import static eu.europeana.entitymanagement.zoho.utils.ZohoConstants.SAME_AS_CODE_LENGTH; import static eu.europeana.entitymanagement.zoho.utils.ZohoConstants.SAME_AS_FIELD; +import static eu.europeana.entitymanagement.zoho.utils.ZohoConstants.STREET_FIELD; import static eu.europeana.entitymanagement.zoho.utils.ZohoConstants.WEBSITE_FIELD; import static eu.europeana.entitymanagement.zoho.utils.ZohoConstants.ZIP_CODE_FIELD; import java.io.IOException; @@ -57,7 +57,7 @@ public class ZohoRecordTestDeserializer extends StdDeserializer { ACRONYM_FIELD, LOGO_LINK_TO_WIKIMEDIACOMMONS_FIELD, WEBSITE_FIELD, - ORGANIZATION_COUNTRY_FIELD, + STREET_FIELD, CITY_FIELD, COUNTRY_FIELD, ZIP_CODE_FIELD, diff --git a/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/web/EntityRegistrationIT.java b/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/web/EntityRegistrationIT.java index 30aafb182..591c77ff9 100644 --- a/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/web/EntityRegistrationIT.java +++ b/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/web/EntityRegistrationIT.java @@ -273,7 +273,7 @@ public void registerZohoOrganizationBergerShouldBeSuccessful() throws Exception Matchers.hasItems( IntegrationTestUtils.ORGANIZATION_BERGER_MUSEUM_WIKIDATA_URI, IntegrationTestUtils.ORGANIZATION_BERGER_MUSEUM_URI_ZOHO))) - .andExpect(jsonPath("$.prefLabel[*]", hasSize(1))) + .andExpect(jsonPath("$.prefLabel[*]", hasSize(2))) // should have Europeana, Zoho and Wikidata proxies .andExpect(jsonPath("$.proxies", hasSize(3))); diff --git a/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/web/EntityRetrievalIT.java b/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/web/EntityRetrievalIT.java index f1e1429e0..ccf69eb6a 100644 --- a/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/web/EntityRetrievalIT.java +++ b/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/web/EntityRetrievalIT.java @@ -523,8 +523,7 @@ public void retrieveOrganizationJsonExternalWithCountryDereference() throws Exce .andExpect(jsonPath("$.id", is(entityId))) .andExpect(jsonPath("$.type", is(EntityTypes.Organization.getEntityType()))) .andExpect(jsonPath("$.sameAs").isNotEmpty()) - .andExpect(jsonPath("$.countryId", is("http://data.europeana.eu/place/1"))) - .andExpect(jsonPath("$.countryPlace.prefLabel.en", is("Sweden"))); + .andExpect(jsonPath("$.country.prefLabel.en", is("Sweden"))); } @Test @@ -547,7 +546,7 @@ public void retrieveOrganizationJsonExternal() throws Exception { .andExpect(jsonPath("$.id", is(entityId))) .andExpect(jsonPath("$.type", is(EntityTypes.Organization.getEntityType()))) .andExpect(jsonPath("$.sameAs").isNotEmpty()) - .andExpect(jsonPath("$.countryId").isNotEmpty()) + .andExpect(jsonPath("$.hasAddress.countryName").isNotEmpty()) .andExpect(jsonPath("$.countryPlace").doesNotExist()); } diff --git a/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/zoho/organization/ZohoTestDataGenerator.java b/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/zoho/organization/ZohoTestDataGenerator.java index 5eb2ba8ba..7fa028cf2 100644 --- a/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/zoho/organization/ZohoTestDataGenerator.java +++ b/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/zoho/organization/ZohoTestDataGenerator.java @@ -37,10 +37,10 @@ ZohoDereferenceService getZohoDereferenceService() { public void generateBNFJson() throws Exception { //get original zoho record Optional zohoOrganization = - zohoConfiguration.getZohoAccessClient().getZohoRecordOrganizationById(IntegrationTestUtils.ORGANIZATION_BNF_URI_ZOHO); + zohoConfiguration.getZohoAccessClient().getZohoRecordOrganizationById(IntegrationTestUtils.ORGANIZATION_PCCE_URI_ZOHO); String zohoRecord = getZohoDereferenceService().serialize(zohoOrganization.get()); //if you need to see original enable : System.out.println(zohoRecord); -// System.out.println(zohoRecord); + System.out.println(zohoRecord); //deserialize data with the test deserializer ZohoRecordTestDeserializer zohoRecordDeserializer = new ZohoRecordTestDeserializer(); diff --git a/entity-management-tests/src/integration-test/resources/content/organization.json b/entity-management-tests/src/integration-test/resources/content/organization.json index ec60d2f89..41462810a 100644 --- a/entity-management-tests/src/integration-test/resources/content/organization.json +++ b/entity-management-tests/src/integration-test/resources/content/organization.json @@ -1,6 +1,6 @@ { "@context": "http://www.europeana.eu/schemas/context/entity.jsonld", - "id": "http://data.europeana.eu/organization/1482250000000370517", + "id": "http://data.europeana.eu/organization/1", "type": "Organization", "depiction": { "id": "http://commons.wikimedia.org/wiki/Special:FilePath/WLANL%20-%20thedogg%20-%20Mammoet%20%282%29.jpg", diff --git a/entity-management-tests/src/integration-test/resources/content/organization_register_zoho_berger_museum.json b/entity-management-tests/src/integration-test/resources/content/organization_register_zoho_berger_museum.json index 09b532f7a..86d580897 100644 --- a/entity-management-tests/src/integration-test/resources/content/organization_register_zoho_berger_museum.json +++ b/entity-management-tests/src/integration-test/resources/content/organization_register_zoho_berger_museum.json @@ -1,4 +1,4 @@ { "type": "Organization", - "id": "https://crm.zoho.com/crm/org51823723/tab/Accounts/1482250000004477407" + "id": "https://crm.zoho.eu/crm/org20085137532/tab/Accounts/486281000000939337" } \ No newline at end of file diff --git a/entity-management-tests/src/integration-test/resources/content/organization_register_zoho_bnf.json b/entity-management-tests/src/integration-test/resources/content/organization_register_zoho_bnf.json index 89ecf2d47..32c78b332 100644 --- a/entity-management-tests/src/integration-test/resources/content/organization_register_zoho_bnf.json +++ b/entity-management-tests/src/integration-test/resources/content/organization_register_zoho_bnf.json @@ -1,6 +1,6 @@ { "type": "Organization", - "id": "https://crm.zoho.com/crm/org51823723/tab/Accounts/1482250000002112001", + "id": "https://crm.zoho.eu/crm/org20085137532/tab/Accounts/486281000000938399", "prefLabel": { "fr": "Bibliothèque nationale de France" }, diff --git a/entity-management-tests/src/integration-test/resources/content/organization_register_zoho_gfm.json b/entity-management-tests/src/integration-test/resources/content/organization_register_zoho_gfm.json index 626752a50..ba5e846a1 100644 --- a/entity-management-tests/src/integration-test/resources/content/organization_register_zoho_gfm.json +++ b/entity-management-tests/src/integration-test/resources/content/organization_register_zoho_gfm.json @@ -1,4 +1,4 @@ { "type": "Organization", - "id": "https://crm.zoho.com/crm/org51823723/tab/Accounts/1482250000004503618" + "id": "https://crm.zoho.eu/crm/org20085137532/tab/Accounts/486281000000940433" } \ No newline at end of file diff --git a/entity-management-tests/src/integration-test/resources/content/organization_register_zoho_naturalis.json b/entity-management-tests/src/integration-test/resources/content/organization_register_zoho_naturalis.json index 29ed51e0e..887a5a7c1 100644 --- a/entity-management-tests/src/integration-test/resources/content/organization_register_zoho_naturalis.json +++ b/entity-management-tests/src/integration-test/resources/content/organization_register_zoho_naturalis.json @@ -1,6 +1,6 @@ { "type": "Organization", - "id": "https://crm.zoho.com/crm/org51823723/tab/Accounts/1482250000000370517", + "id": "https://crm.zoho.eu/crm/org20085137532/tab/Accounts/486281000000923816", "prefLabel": { "fr": "Nauralis" }, diff --git a/entity-management-tests/src/integration-test/resources/content/organization_register_zoho_pcce.json b/entity-management-tests/src/integration-test/resources/content/organization_register_zoho_pcce.json index 41c3f9149..fe7cee3f7 100644 --- a/entity-management-tests/src/integration-test/resources/content/organization_register_zoho_pcce.json +++ b/entity-management-tests/src/integration-test/resources/content/organization_register_zoho_pcce.json @@ -1,4 +1,4 @@ { "type": "Organization", - "id": "https://crm.zoho.com/crm/org51823723/tab/Accounts/1482250000000338555" + "id": "https://crm.zoho.eu/crm/org20085137532/tab/Accounts/486281000000923271" } \ No newline at end of file diff --git a/entity-management-tests/src/integration-test/resources/solr-docker/conf/schema.xml b/entity-management-tests/src/integration-test/resources/solr-docker/conf/schema.xml index 9bca1f7d1..e7b4243a6 100644 --- a/entity-management-tests/src/integration-test/resources/solr-docker/conf/schema.xml +++ b/entity-management-tests/src/integration-test/resources/solr-docker/conf/schema.xml @@ -509,14 +509,8 @@ - - - -