Commit 8f3b793f authored by Stefan Funk's avatar Stefan Funk 🐧
Browse files

Add to tests

parent 10815af0
......@@ -117,7 +117,7 @@ import info.textgrid.utils.httpclient.TGHttpClient;
* @version 2021-11-08
* @since 2009-08-26
**/
@Ignore
// @Ignore
public class TestTGCrudServiceOnline {
// **
......@@ -281,7 +281,8 @@ public class TestTGCrudServiceOnline {
private static String createBugTG1157Filename;
private static String createBugTG1157MetadataFilename;
private static String createBugTG1860MetadataFilename;
private static String createBug36304MetadataFilename;
private static String createBug36304EditionMetadataFilename;
private static String createBug36304CollectionMetadataFilename;
private static String readBugTG1929ObjectUri;
private static String loadtestsSmallFilename;
private static String loadtestsSmallMetadataFilename;
......@@ -514,7 +515,9 @@ public class TestTGCrudServiceOnline {
loadtestsLargeFilename = p.getProperty("create_loadtestsLarge");
loadtestsLargeMetadataFilename = p.getProperty("create_loadtestsLargeMetadata");
createBug9442MetadataFilename = p.getProperty("create_bug9442MetadataFilename");
createBug36304MetadataFilename = p.getProperty("create_bug36304MetadataFilename");
createBug36304EditionMetadataFilename = p.getProperty("create_bug36304EditionMetadataFilename");
createBug36304CollectionMetadataFilename =
p.getProperty("create_bug36304CollectionMetadataFilename");
// Get properties for #MOVESTATIC.
crudPublishSecret = p.getProperty("tgcrud_publishSecret");
......@@ -3599,7 +3602,7 @@ public class TestTGCrudServiceOnline {
* @throws NoSuchAlgorithmException
*/
@Test
public void testBug36304()
public void testBug36304Edition()
throws FileNotFoundException, IOException, MetadataParseFault, IoFault, ObjectNotFoundFault,
AuthFault, RelationsExistFault, ProtocolNotImplementedFault, NoSuchAlgorithmException {
......@@ -3623,7 +3626,7 @@ public class TestTGCrudServiceOnline {
// Finally ingest the edition.
MetadataContainerType metadataEdition = TGCrudClientUtils.create(tgcrud, tgsearch,
rbacSessionId, logParameter, projectId, createBug36304MetadataFilename,
rbacSessionId, logParameter, projectId, createBug36304EditionMetadataFilename,
createEditionFilename, NO_URI, NO_URI, NO_URI, NO_URI, NO_URI);
String editionUri =
......@@ -3637,6 +3640,60 @@ public class TestTGCrudServiceOnline {
}
}
/**
* <p>
* Ingests an edition with no <collection> metadata --> #36304.
* </p>
*
* @throws FileNotFoundException
* @throws IOException
* @throws MetadataParseFault
* @throws IoFault
* @throws ObjectNotFoundFault
* @throws AuthFault
* @throws RelationsExistFault
* @throws ProtocolNotImplementedFault
* @throws NoSuchAlgorithmException
*/
@Test
public void testBug36304Collection()
throws FileNotFoundException, IOException, MetadataParseFault, IoFault, ObjectNotFoundFault,
AuthFault, RelationsExistFault, ProtocolNotImplementedFault, NoSuchAlgorithmException {
System.out.println("Testing TG-crud edition ingest with empty <collection> tag (#36304)");
// No work!
// No items!
// Create the edition's aggregation file and store it as temp file.
String collectionString = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
+ "<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" "
+ "xmlns:ore=\"http://www.openarchives.org/ore/terms/\">\n"
+ "\t<rdf:Description rdf:about=\"\">\n" + "\t\t<ore:aggregates rdf:resource=\"\" />\n"
+ "\t</rdf:Description>\n" + "</rdf:RDF>";
File collectionFile = TGCrudClientUtils.getResource(createEditionFilename);
collectionFile.createNewFile();
FileOutputStream editionStream = new FileOutputStream(collectionFile);
editionStream.write(collectionString.getBytes("UTF-8"));
editionStream.close();
// Finally ingest the edition.
MetadataContainerType metadataCollection = TGCrudClientUtils.create(tgcrud, tgsearch,
rbacSessionId, logParameter, projectId, createBug36304CollectionMetadataFilename,
createEditionFilename, NO_URI, NO_URI, NO_URI, NO_URI, NO_URI);
String collectionUri =
metadataCollection.getObject().getGeneric().getGenerated().getTextgridUri().getValue();
// Read again to check file and metadata sizes.
TGCrudClientUtils.read(tgcrud, rbacSessionId, logParameter, collectionUri);
if (DELETE) {
TGCrudClientUtils.delete(tgcrud, tgsearch, rbacSessionId, logParameter, collectionUri);
}
}
/**
* <p>
* Test the lol file: https://en.wikipedia.org/wiki/Billion_laughs
......
<?xml version='1.0' encoding='UTF-8'?>
<object xmlns:tg="http://textgrid.info/relation-ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://textgrid.info/namespaces/metadata/core/2010">
<generic>
<provided>
<title>Eine Kollektion bitte</title>
<format>text/tg.collection+tg.aggregation+xml</format>
<notes />
</provided>
</generic>
<collection />
<custom />
<relations />
</object>
......@@ -138,6 +138,8 @@ create_loadtestsSmallMetadata = bugs/loadtests/small/test-file.meta.xml
create_loadtestsMediumMetadata = bugs/loadtests/medium/test-file.meta.xml
create_loadtestsLargeMetadata = bugs/loadtests/large/test-file.meta.xml
create_bug9442MetadataFilename = bugs/#9442/Edition_des_funfzehnten_Briefs_aus_Lessings_aestetischen_Schriften.h4k5.0.edition.meta
create_bug36304EditionMetadataFilename = bugs/#36304/create-edition-with-empty-edition-metadata-tag.meta.xml
create_bug36304CollectionMetadataFilename = bugs/#36304/create-collection-with-empty-collection-metadata-tag.meta.xml
create_lolFilename = create/lol.xml
create_lolMetadataFilename = create/lol.meta.xml
create_arglMD5Filename = create/argl.txt
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment