This commit is contained in:
Enrico Ottonello 2020-07-08 22:00:33 +02:00
commit 31b7c61f62
4 changed files with 255 additions and 0 deletions

View File

@ -127,6 +127,13 @@
<artifactId>elasticsearch-rest-client</artifactId>
<version>7.4.2</version>
</dependency>
<dependency>
<groupId>org.skyscreamer</groupId>
<artifactId>jsonassert</artifactId>
<version>1.5.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>

View File

@ -0,0 +1,29 @@
package eu.dnetlib.ariadneplus.elasticsearch;
import org.apache.commons.io.IOUtils;
import org.json.JSONException;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
import org.springframework.core.io.ClassPathResource;
import java.io.IOException;
public class IndexedJsonTest {
@Test
public void testSimple() throws JSONException {
String old = getJSONResult("eu/dnetlib/ariadneplus/elasticsearch/old.json");
String the_new = getJSONResult("eu/dnetlib/ariadneplus/elasticsearch/new.json");
JSONAssert.assertEquals(old, the_new, false); // Pass
//JSONAssert.assertEquals(old, the_new, true); // Fail
}
private String getJSONResult(String s) {
try {
final ClassPathResource resource = new ClassPathResource(s);
return IOUtils.toString(resource.getInputStream(), "UTF-8");
}catch(IOException e){
return null;
}
}
}

View File

@ -0,0 +1,162 @@
{
"aatSubjects": [
{
"id": "",
"label": "",
"lang": ""
}
],
"accessPolicy": "",
"accessRights": "",
"archaeologicalResourceType": {
"id": 0,
"name": ""
},
"contributor": [
{
"email": "",
"name": "",
"phone": "",
"type": ""
}
],
"creator": [
{
"email": "",
"name": "",
"phone": "",
"type": ""
}
],
"derivedSubject": [
{
"prefLabel": "",
"source": ""
}
],
"description": "",
"distribution": [
{
"accessURL": "",
"description": "",
"issued": "",
"modified": "",
"publisher": [
{
"email": "",
"name": "",
"phone": "",
"type": ""
}
],
"title": ""
}
],
"publisher": [
{
"email": "",
"name": "",
"phone": "",
"type": ""
}
],
"title": "",
"hasItemMetadataStructure": [
{
"characterSet": ""
}
],
"hasMetadataRecord": [
{
"conformsTo": [
{
"characterSet": "",
"description": ""
}
],
"xmlDoc": ""
}
],
"identifier": "",
"isPartOf": [
""
],
"issued": "",
"keyword": [
""
],
"landingPage": "",
"language": "",
"legalResponsible": [
{
"email": "",
"name": "",
"phone": "",
"type": ""
}
],
"modified": "",
"nativeSubject": [
{
"prefLabel": "",
"rdfAbout": ""
}
],
"originalId": "580969",
"owner": [
{
"email": "",
"name": "",
"phone": "",
"type": ""
}
],
"resourceType": "",
"scientificResponsible": [
{
"email": "",
"name": "",
"phone": "",
"type": ""
}
],
"spatial": [
{
"address": "",
"coordinateSystem": "",
"country": "",
"location": {
"lat": 0.0,
"lon": 0.0
},
"placeName": "",
"postcode": ""
}
],
"technicalResponsible": [
{
"email": "",
"name": "",
"phone": "",
"type": ""
}
],
"temporal": [
{
"from": "",
"periodName": "",
"until": "",
"uri": ""
}
],
"accrualPeriodicity": "",
"audience": "",
"contactPoint": "",
"extent": "",
"providerId": "",
"packageId": "",
"placeName": "",
"postcode": "",
"rdfAbout": "",
"rights": ""
}

View File

@ -0,0 +1,57 @@
{
"publisher": [
{
"type": "",
"name": ""
}
],
"identifier": "",
"description": "",
"language": "",
"title": "",
"archaeologicalResourceType": {
"id": 0,
"name": ""
},
"issued": "",
"temporal": [
{
"from": "",
"until": ""
}
],
"isPartOf": [
""
],
"originalId": "580969",
"modified": "",
"accessRights": "",
"accessPolicy": "",
"resourceType": "",
"providerId": "",
"packageId": "",
"spatial": [
{
"placeName": "",
"country": "",
"location": {
"lat": 0.0,
"lon": 0.0
},
"coordinateSystem": ""
}
],
"contributor": [
{
"type": "",
"name": ""
}
],
"landingPage": "",
"nativeSubject": [
{
"prefLabel": ""
}
]
}
}