fix compile errors

This commit is contained in:
Martijn van Groningen 2015-11-26 17:00:16 +01:00
parent 9d1fa0d6da
commit 9aff8c6352
1 changed files with 19 additions and 21 deletions

View File

@ -29,9 +29,7 @@ import org.junit.Before;
import java.io.IOException; import java.io.IOException;
import java.util.*; import java.util.*;
import static org.elasticsearch.ingest.IngestDocument.MetaData.ID; import static org.elasticsearch.ingest.IngestDocument.MetaData.*;
import static org.elasticsearch.ingest.IngestDocument.MetaData.INDEX;
import static org.elasticsearch.ingest.IngestDocument.MetaData.TYPE;
import static org.elasticsearch.plugin.ingest.transport.simulate.SimulatePipelineRequest.Fields; import static org.elasticsearch.plugin.ingest.transport.simulate.SimulatePipelineRequest.Fields;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.Matchers.nullValue;
@ -64,17 +62,17 @@ public class SimulatePipelineRequestParsingTests extends ESTestCase {
String index = randomAsciiOfLengthBetween(1, 10); String index = randomAsciiOfLengthBetween(1, 10);
String type = randomAsciiOfLengthBetween(1, 10); String type = randomAsciiOfLengthBetween(1, 10);
String id = randomAsciiOfLengthBetween(1, 10); String id = randomAsciiOfLengthBetween(1, 10);
doc.put(Fields.INDEX, index); doc.put(INDEX.getFieldName(), index);
doc.put(Fields.TYPE, type); doc.put(TYPE.getFieldName(), type);
doc.put(Fields.ID, id); doc.put(ID.getFieldName(), id);
String fieldName = randomAsciiOfLengthBetween(1, 10); String fieldName = randomAsciiOfLengthBetween(1, 10);
String fieldValue = randomAsciiOfLengthBetween(1, 10); String fieldValue = randomAsciiOfLengthBetween(1, 10);
doc.put(Fields.SOURCE, Collections.singletonMap(fieldName, fieldValue)); doc.put(Fields.SOURCE, Collections.singletonMap(fieldName, fieldValue));
docs.add(doc); docs.add(doc);
Map<String, Object> expectedDoc = new HashMap<>(); Map<String, Object> expectedDoc = new HashMap<>();
expectedDoc.put(Fields.INDEX, index); expectedDoc.put(INDEX.getFieldName(), index);
expectedDoc.put(Fields.TYPE, type); expectedDoc.put(TYPE.getFieldName(), type);
expectedDoc.put(Fields.ID, id); expectedDoc.put(ID.getFieldName(), id);
expectedDoc.put(Fields.SOURCE, Collections.singletonMap(fieldName, fieldValue)); expectedDoc.put(Fields.SOURCE, Collections.singletonMap(fieldName, fieldValue));
expectedDocs.add(expectedDoc); expectedDocs.add(expectedDoc);
} }
@ -86,9 +84,9 @@ public class SimulatePipelineRequestParsingTests extends ESTestCase {
for (IngestDocument ingestDocument : actualRequest.getDocuments()) { for (IngestDocument ingestDocument : actualRequest.getDocuments()) {
Map<String, Object> expectedDocument = expectedDocsIterator.next(); Map<String, Object> expectedDocument = expectedDocsIterator.next();
assertThat(ingestDocument.getSource(), equalTo(expectedDocument.get(Fields.SOURCE))); assertThat(ingestDocument.getSource(), equalTo(expectedDocument.get(Fields.SOURCE)));
assertThat(ingestDocument.getMetadata(INDEX), equalTo(expectedDocument.get(Fields.INDEX))); assertThat(ingestDocument.getMetadata(INDEX), equalTo(expectedDocument.get(INDEX.getFieldName())));
assertThat(ingestDocument.getMetadata(TYPE), equalTo(expectedDocument.get(Fields.TYPE))); assertThat(ingestDocument.getMetadata(TYPE), equalTo(expectedDocument.get(TYPE.getFieldName())));
assertThat(ingestDocument.getMetadata(ID), equalTo(expectedDocument.get(Fields.ID))); assertThat(ingestDocument.getMetadata(ID), equalTo(expectedDocument.get(ID.getFieldName())));
} }
assertThat(actualRequest.getPipeline().getId(), equalTo(SimulatePipelineRequest.SIMULATED_PIPELINE_ID)); assertThat(actualRequest.getPipeline().getId(), equalTo(SimulatePipelineRequest.SIMULATED_PIPELINE_ID));
@ -108,17 +106,17 @@ public class SimulatePipelineRequestParsingTests extends ESTestCase {
String index = randomAsciiOfLengthBetween(1, 10); String index = randomAsciiOfLengthBetween(1, 10);
String type = randomAsciiOfLengthBetween(1, 10); String type = randomAsciiOfLengthBetween(1, 10);
String id = randomAsciiOfLengthBetween(1, 10); String id = randomAsciiOfLengthBetween(1, 10);
doc.put(Fields.INDEX, index); doc.put(INDEX.getFieldName(), index);
doc.put(Fields.TYPE, type); doc.put(TYPE.getFieldName(), type);
doc.put(Fields.ID, id); doc.put(ID.getFieldName(), id);
String fieldName = randomAsciiOfLengthBetween(1, 10); String fieldName = randomAsciiOfLengthBetween(1, 10);
String fieldValue = randomAsciiOfLengthBetween(1, 10); String fieldValue = randomAsciiOfLengthBetween(1, 10);
doc.put(Fields.SOURCE, Collections.singletonMap(fieldName, fieldValue)); doc.put(Fields.SOURCE, Collections.singletonMap(fieldName, fieldValue));
docs.add(doc); docs.add(doc);
Map<String, Object> expectedDoc = new HashMap<>(); Map<String, Object> expectedDoc = new HashMap<>();
expectedDoc.put(Fields.INDEX, index); expectedDoc.put(INDEX.getFieldName(), index);
expectedDoc.put(Fields.TYPE, type); expectedDoc.put(TYPE.getFieldName(), type);
expectedDoc.put(Fields.ID, id); expectedDoc.put(ID.getFieldName(), id);
expectedDoc.put(Fields.SOURCE, Collections.singletonMap(fieldName, fieldValue)); expectedDoc.put(Fields.SOURCE, Collections.singletonMap(fieldName, fieldValue));
expectedDocs.add(expectedDoc); expectedDocs.add(expectedDoc);
} }
@ -139,9 +137,9 @@ public class SimulatePipelineRequestParsingTests extends ESTestCase {
for (IngestDocument ingestDocument : actualRequest.getDocuments()) { for (IngestDocument ingestDocument : actualRequest.getDocuments()) {
Map<String, Object> expectedDocument = expectedDocsIterator.next(); Map<String, Object> expectedDocument = expectedDocsIterator.next();
assertThat(ingestDocument.getSource(), equalTo(expectedDocument.get(Fields.SOURCE))); assertThat(ingestDocument.getSource(), equalTo(expectedDocument.get(Fields.SOURCE)));
assertThat(ingestDocument.getMetadata(INDEX), equalTo(expectedDocument.get(Fields.INDEX))); assertThat(ingestDocument.getMetadata(INDEX), equalTo(expectedDocument.get(INDEX.getFieldName())));
assertThat(ingestDocument.getMetadata(TYPE), equalTo(expectedDocument.get(Fields.TYPE))); assertThat(ingestDocument.getMetadata(TYPE), equalTo(expectedDocument.get(TYPE.getFieldName())));
assertThat(ingestDocument.getMetadata(ID), equalTo(expectedDocument.get(Fields.ID))); assertThat(ingestDocument.getMetadata(ID), equalTo(expectedDocument.get(ID.getFieldName())));
} }
assertThat(actualRequest.getPipeline().getId(), equalTo(SimulatePipelineRequest.SIMULATED_PIPELINE_ID)); assertThat(actualRequest.getPipeline().getId(), equalTo(SimulatePipelineRequest.SIMULATED_PIPELINE_ID));