added test to load a record to public - required property file not to be committed
This commit is contained in:
parent
df1fd92628
commit
14e56b63a8
|
@ -32,6 +32,25 @@ public class GraphDbReaderAndESIndexTest {
|
||||||
|
|
||||||
private RunSPARQLQueryService runSPQRLQuery;
|
private RunSPARQLQueryService runSPQRLQuery;
|
||||||
|
|
||||||
|
private final static String STAGING_PROPERTIES = "application.properties";
|
||||||
|
private final static String PROD_PROPERTIES = "application-prod-DO-NOT-COMMIT.properties";
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void loadToPublic() throws Exception {
|
||||||
|
String uri = "https://ariadne-infrastructure.eu/aocat/Resource/HNM/307D659C-42FA-3FA2-8326-1302F24DCC82";
|
||||||
|
String datasource = "hnm";
|
||||||
|
String apiId = "hnmad";
|
||||||
|
readAndIndexProd(true, uri, datasource, apiId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testWithNotProvidedARIADNESubject() throws Exception {
|
||||||
|
String record ="https://ariadne-infrastructure.eu/aocat/Resource/ADS/28986CB2-37B1-31F8-98B5-E86F9BD98946";
|
||||||
|
String datasource = "ads";
|
||||||
|
String apiId = "archives";
|
||||||
|
readAndIndexTest(true, record, datasource, apiId);
|
||||||
|
|
||||||
|
}
|
||||||
@Test
|
@Test
|
||||||
public void testADS1093() throws Exception {
|
public void testADS1093() throws Exception {
|
||||||
String coll ="https://ariadne-infrastructure.eu/aocat/Collection/ADS/5910411B-ED97-364E-8D28-6024558AA14B";
|
String coll ="https://ariadne-infrastructure.eu/aocat/Collection/ADS/5910411B-ED97-364E-8D28-6024558AA14B";
|
||||||
|
@ -104,6 +123,15 @@ public class GraphDbReaderAndESIndexTest {
|
||||||
readAndIndexTest(true, id, datasource, apiId);
|
readAndIndexTest(true, id, datasource, apiId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void uploadADSArchivesBoundingBoxTest() throws Exception {
|
||||||
|
boolean isRecord = true;
|
||||||
|
String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/90D1C95D-E249-3E74-92D9-B58FDF690CC7";
|
||||||
|
String datasource = "ads";
|
||||||
|
String collectionId = "archives";
|
||||||
|
readAndIndexTest(isRecord, recordId, datasource, collectionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFindSampoCollection() throws Exception {
|
public void testFindSampoCollection() throws Exception {
|
||||||
|
@ -218,14 +246,7 @@ public class GraphDbReaderAndESIndexTest {
|
||||||
readAndIndexTest(isRecord, recordId, datasource, collectionId);
|
readAndIndexTest(isRecord, recordId, datasource, collectionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void uploadADSArchivesBoundingBoxTest() throws Exception {
|
|
||||||
boolean isRecord = true;
|
|
||||||
String recordId = "https://ariadne-infrastructure.eu/aocat/Resource/90D1C95D-E249-3E74-92D9-B58FDF690CC7";
|
|
||||||
String datasource = "ads";
|
|
||||||
String collectionId = "archives";
|
|
||||||
readAndIndexTest(isRecord, recordId, datasource, collectionId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void uploadDansSpatialTest() throws Exception {
|
public void uploadDansSpatialTest() throws Exception {
|
||||||
|
@ -483,10 +504,21 @@ public class GraphDbReaderAndESIndexTest {
|
||||||
boolean isRecord = false;
|
boolean isRecord = false;
|
||||||
String recordId = "https://ariadne-infrastructure.eu/aocat/Collection/THANADOS/3E6614E4-EA97-3E7D-BA72-B0343A63FA39";
|
String recordId = "https://ariadne-infrastructure.eu/aocat/Collection/THANADOS/3E6614E4-EA97-3E7D-BA72-B0343A63FA39";
|
||||||
String datasource = "thanados";
|
String datasource = "thanados";
|
||||||
String collectionId = "test";
|
String collectionId = "api";
|
||||||
readAndIndexTest(isRecord, recordId, datasource, collectionId);
|
readAndIndexTest(isRecord, recordId, datasource, collectionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void collectionInCollectionWithGeoPointTest() throws Exception {
|
||||||
|
boolean isRecord = false;
|
||||||
|
String recordId = "https://ariadne-infrastructure.eu/aocat/Collection/THANADOS/6AA9483F-549C-3908-B7C0-1A5BAA521371";
|
||||||
|
String datasource = "thanados";
|
||||||
|
String collectionId = "api";
|
||||||
|
readAndIndexTest(isRecord, recordId, datasource, collectionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void recordInCollectionTest() throws Exception {
|
public void recordInCollectionTest() throws Exception {
|
||||||
boolean isRecord = true;
|
boolean isRecord = true;
|
||||||
|
@ -622,10 +654,17 @@ public class GraphDbReaderAndESIndexTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void readAndIndexTest(boolean isRecord, String recordId, String datasource, String collectionId) throws Exception {
|
private void readAndIndexTest(boolean isRecord, String recordId, String datasource, String collectionId) throws Exception {
|
||||||
final ClassPathResource resource = new ClassPathResource("application.properties");
|
readAndIndex( isRecord, recordId, datasource, collectionId, "application.properties");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void readAndIndexProd(boolean isRecord, String recordId, String datasource, String collectionId) throws Exception {
|
||||||
|
readAndIndex( isRecord, recordId, datasource, collectionId, "application-prod-DO-NOT-COMMIT.properties");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void readAndIndex(boolean isRecord, String recordId, String datasource, String collectionId, String propertyFile) throws Exception {
|
||||||
|
final ClassPathResource resource = new ClassPathResource(propertyFile);
|
||||||
Properties appProps = new Properties();
|
Properties appProps = new Properties();
|
||||||
appProps.load(resource.getInputStream());
|
appProps.load(resource.getInputStream());
|
||||||
|
|
||||||
runSPQRLQuery = new RunSPARQLQueryService();
|
runSPQRLQuery = new RunSPARQLQueryService();
|
||||||
runSPQRLQuery.setupReadOnlyConnection(
|
runSPQRLQuery.setupReadOnlyConnection(
|
||||||
appProps.getProperty("graphdb.serverUrl"),
|
appProps.getProperty("graphdb.serverUrl"),
|
||||||
|
@ -641,10 +680,10 @@ public class GraphDbReaderAndESIndexTest {
|
||||||
appProps.getProperty("exclude.predicates"),
|
appProps.getProperty("exclude.predicates"),
|
||||||
appProps.getProperty("class.map.specifications")
|
appProps.getProperty("class.map.specifications")
|
||||||
);
|
);
|
||||||
runSPQRLQuery.setResourceManager(resourceManager);
|
runSPQRLQuery.setResourceManager(resourceManager);
|
||||||
BulkUpload bulkUpload = new BulkUpload();
|
BulkUpload bulkUpload = new BulkUpload();
|
||||||
bulkUpload.init(appProps.getProperty("elasticsearch.hostname"),appProps.getProperty("elasticsearch.indexname"));
|
bulkUpload.init(appProps.getProperty("elasticsearch.hostname"),appProps.getProperty("elasticsearch.indexname"));
|
||||||
runSPQRLQuery.setBulkUpload(bulkUpload);
|
runSPQRLQuery.setBulkUpload(bulkUpload);
|
||||||
final ClassPathResource queryTemplateResource;
|
final ClassPathResource queryTemplateResource;
|
||||||
if (isRecord) {
|
if (isRecord) {
|
||||||
queryTemplateResource = new ClassPathResource("eu/dnetlib/ariadneplus/sparql/read_record_data_template.sparql");
|
queryTemplateResource = new ClassPathResource("eu/dnetlib/ariadneplus/sparql/read_record_data_template.sparql");
|
||||||
|
|
Loading…
Reference in New Issue