Skip to content

Commit

Permalink
Correct compilation problems and @ignore tests for which the Resource…
Browse files Browse the repository at this point in the history
… has not been implemented.
  • Loading branch information
lewismc committed Aug 19, 2020
1 parent 8ce9f83 commit b3892c6
Show file tree
Hide file tree
Showing 6 changed files with 184 additions and 134 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@
import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
import org.apache.cxf.jaxrs.client.WebClient;
import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
import org.apache.tika.server.ServerStatus;
import org.apache.tika.server.TikaServerParseExceptionMapper;
import org.apache.tika.server.api.impl.DetectorResourceApiServiceImpl;
import org.apache.tika.server.writer.TarWriter;
import org.apache.tika.server.writer.ZipWriter;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;

import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
Expand Down Expand Up @@ -81,7 +83,7 @@ public void setup() {
protected void setUpResources(JAXRSServerFactoryBean sf) {
sf.setResourceClasses(DetectorResourceApiServiceImpl.class);
sf.setResourceProvider(DetectorResourceApiServiceImpl.class,
new SingletonResourceProvider(new DetectorResourceApiServiceImpl()));
new SingletonResourceProvider(new DetectorResourceApiServiceImpl(new ServerStatus())));

}

Expand All @@ -95,6 +97,7 @@ protected void setUpProviders(JAXRSServerFactoryBean sf) {

}

@Ignore("Skip until relevant resource is implemented.")
@Test
public void testDetectCsvWithExt() throws Exception {
String url = endPoint + DETECT_STREAM_PATH;
Expand All @@ -112,6 +115,7 @@ public void testDetectCsvWithExt() throws Exception {

}

@Ignore("Skip until relevant resource is implemented.")
@Test
public void testDetectCsvNoExt() throws Exception {
String url = endPoint + DETECT_STREAM_PATH;
Expand Down Expand Up @@ -150,6 +154,7 @@ public void testDetectCsvNoExt() throws Exception {
* @throws ApiException
* if the Api call fails
*/
@Ignore("Skip until the DetectorResourceApi is implemented.")
@Test
public void putStreamTest() {
//String response = api.putStream();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

import org.junit.Test;
import org.junit.Before;
import org.junit.Ignore;
import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
import org.apache.cxf.jaxrs.client.ClientConfiguration;
import org.apache.cxf.jaxrs.client.WebClient;
Expand Down Expand Up @@ -97,6 +98,7 @@ protected void setUpProviders(JAXRSServerFactoryBean sf) {

}

@Ignore("Skip until relevant resource is implemented.")
@Test
public void testDetectEnglishString() throws Exception {
String url = endPoint + LANG_STRING_PATH;
Expand All @@ -108,6 +110,7 @@ public void testDetectEnglishString() throws Exception {
assertEquals("en", readLang);
}

@Ignore("Skip until relevant resource is implemented.")
@Test
public void testDetectFrenchString() throws Exception {
String url = endPoint + LANG_STRING_PATH;
Expand All @@ -119,6 +122,7 @@ public void testDetectFrenchString() throws Exception {
assertEquals("fr", readLang);
}

@Ignore("Skip until relevant resource is implemented.")
@Test
public void testDetectEnglishFile() throws Exception {
String url = endPoint + LANG_STREAM_PATH;
Expand All @@ -131,6 +135,7 @@ public void testDetectEnglishFile() throws Exception {
assertEquals("en", readLang);
}

@Ignore("Skip until relevant resource is implemented.")
@Test
public void testDetectFrenchFile() throws Exception {
String url = endPoint + LANG_STREAM_PATH;
Expand All @@ -142,7 +147,7 @@ public void testDetectFrenchFile() throws Exception {
.getEntity());
assertEquals("fr", readLang);
}

/**
* POST a UTF-8 text file to the LanguageIdentifier to identify its language.
*
Expand All @@ -151,6 +156,7 @@ public void testDetectFrenchFile() throws Exception {
* @throws ApiException
* if the Api call fails
*/
@Ignore("Skip until relevant resource is implemented.")
@Test
public void postLanguageStreamTest() {
//String response = api.postLanguageStream();
Expand All @@ -168,6 +174,7 @@ public void postLanguageStreamTest() {
* @throws ApiException
* if the Api call fails
*/
@Ignore("Skip until relevant resource is implemented.")
@Test
public void postLanguageStringTest() {
//String response = api.postLanguageString();
Expand All @@ -185,6 +192,7 @@ public void postLanguageStringTest() {
* @throws ApiException
* if the Api call fails
*/
@Ignore("Skip until relevant resource is implemented.")
@Test
public void putLanguageStreamTest() {
//String response = api.putLanguageStream();
Expand All @@ -202,6 +210,7 @@ public void putLanguageStreamTest() {
* @throws ApiException
* if the Api call fails
*/
@Ignore("Skip until relevant resource is implemented.")
@Test
public void putLanguageStringTest() {
//String response = api.putLanguageString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
import org.junit.Test;
import org.junit.Before;
import org.junit.Ignore;
import org.apache.tika.metadata.Metadata;
import org.apache.tika.metadata.TikaCoreProperties;
import org.apache.tika.metadata.serialization.JsonMetadata;
Expand Down Expand Up @@ -107,6 +108,7 @@ protected void setUpProviders(JAXRSServerFactoryBean sf) {
sf.setProviders(providers);
}

@Ignore("Skip until relevant resource is implemented.")
@Test
public void testSimpleWord() throws Exception {
Response response = WebClient
Expand Down Expand Up @@ -136,6 +138,7 @@ public void testSimpleWord() throws Exception {
metadata.get("X-TIKA:digest:MD5"));
}

@Ignore("Skip until relevant resource is implemented.")
@Test
public void testPasswordProtected() throws Exception {
Response response = WebClient
Expand Down Expand Up @@ -185,6 +188,7 @@ public void testPasswordProtected() throws Exception {
assertEquals("pavel", metadata.get(TikaCoreProperties.CREATOR.getName()));
}

@Ignore("Skip until relevant resource is implemented.")
@Test
public void testJSON() throws Exception {
Response response = WebClient
Expand All @@ -201,6 +205,7 @@ public void testJSON() throws Exception {
assertEquals("Maxim Valyanskiy", metadata.get(TikaCoreProperties.CREATOR));
}

@Ignore("Skip until relevant resource is implemented.")
@Test
public void testXMP() throws Exception {
Response response = WebClient
Expand All @@ -215,13 +220,15 @@ public void testXMP() throws Exception {
}

//Now test requesting one field
@Ignore("Skip until relevant resource is implemented.")
@Test
public void testGetField_XXX_NotFound() throws Exception {
Response response = WebClient.create(endPoint + META_PATH + "/xxx").type("application/msword")
.accept(MediaType.APPLICATION_JSON).put(ClassLoader.getSystemResourceAsStream(TikaResourceApiTest.TEST_DOC));
Assert.assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatus());
}

@Ignore("Skip until relevant resource is implemented.")
@Test
public void testGetField_Author_TEXT_Partial_BAD_REQUEST() throws Exception {

Expand All @@ -232,6 +239,7 @@ public void testGetField_Author_TEXT_Partial_BAD_REQUEST() throws Exception {
Assert.assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatus());
}

@Ignore("Skip until relevant resource is implemented.")
@Test
public void testGetField_Author_TEXT_Partial_Found() throws Exception {

Expand All @@ -245,6 +253,7 @@ public void testGetField_Author_TEXT_Partial_Found() throws Exception {
assertEquals("Maxim Valyanskiy", s);
}

@Ignore("Skip until relevant resource is implemented.")
@Test
public void testGetField_Author_JSON_Partial_Found() throws Exception {

Expand All @@ -260,6 +269,7 @@ public void testGetField_Author_JSON_Partial_Found() throws Exception {
assertEquals(1, metadata.names().length);
}

@Ignore("Skip until relevant resource is implemented.")
@Test
public void testGetField_Author_XMP_Partial_Found() throws Exception {

Expand All @@ -280,6 +290,7 @@ public void testGetField_Author_XMP_Partial_Found() throws Exception {
* @throws ApiException
* if the Api call fails
*/
@Ignore("Skip until relevant resource is implemented.")
@Test
public void putDocumentGetMetaValueTest() {
String metadataKey = null;
Expand All @@ -298,6 +309,7 @@ public void putDocumentGetMetaValueTest() {
* @throws ApiException
* if the Api call fails
*/
@Ignore("Skip until relevant resource is implemented.")
@Test
public void putDocumentMetaTest() {
//Map<String, String> response = api.putDocumentMeta();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import org.apache.tika.server.writer.MetadataListMessageBodyWriter;
import org.junit.Test;
import org.junit.Before;
import org.junit.Ignore;

import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;

Expand Down Expand Up @@ -104,6 +105,7 @@ protected void setUpProviders(JAXRSServerFactoryBean sf) {
sf.setProviders(providers);
}

@Ignore("Skip until relevant resource is implemented.")
@Test
public void testSimpleWord() throws Exception {
Response response = WebClient
Expand All @@ -122,6 +124,7 @@ public void testSimpleWord() throws Exception {
assertEquals("a38e6c7b38541af87148dee9634cb811", metadataList.get(10).get("X-TIKA:digest:MD5"));
}

@Ignore("Skip until relevant resource is implemented.")
@Test
public void testPasswordProtected() throws Exception {
Response response = WebClient
Expand Down Expand Up @@ -152,6 +155,7 @@ public void testPasswordProtected() throws Exception {
assertEquals("pavel", metadataList.get(0).get(TikaCoreProperties.CREATOR));
}

@Ignore("Skip until relevant resource is implemented.")
@Test
public void testHandlerType() throws Exception {
//default unspecified
Expand Down Expand Up @@ -228,6 +232,7 @@ public void testHandlerType() throws Exception {

}

@Ignore("Skip until relevant resource is implemented.")
@Test
public void testHandlerTypeInMultipartXML() throws Exception {
//default unspecified
Expand Down Expand Up @@ -318,6 +323,7 @@ public void testHandlerTypeInMultipartXML() throws Exception {
* @throws ApiException
* if the Api call fails
*/
@Ignore("Skip until relevant resource is implemented.")
@Test
public void putRmetaTest() {
//String response = api.putRmeta();
Expand Down
Loading

0 comments on commit b3892c6

Please sign in to comment.