diff options
Diffstat (limited to 'vespaclient-container-plugin/src/test/java/com/yahoo/vespaxmlparser/MockReader.java')
-rw-r--r-- | vespaclient-container-plugin/src/test/java/com/yahoo/vespaxmlparser/MockReader.java | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/vespaclient-container-plugin/src/test/java/com/yahoo/vespaxmlparser/MockReader.java b/vespaclient-container-plugin/src/test/java/com/yahoo/vespaxmlparser/MockReader.java index 606d21c0059..eabbb2dab20 100644 --- a/vespaclient-container-plugin/src/test/java/com/yahoo/vespaxmlparser/MockReader.java +++ b/vespaclient-container-plugin/src/test/java/com/yahoo/vespaxmlparser/MockReader.java @@ -7,7 +7,6 @@ import com.yahoo.document.DocumentType; import com.yahoo.document.DocumentUpdate; import com.yahoo.vespa.http.server.MetaStream; import com.yahoo.vespa.http.server.util.ByteLimitedInputStream; -import com.yahoo.vespaxmlparser.VespaXMLFeedReader.Operation; import java.io.InputStream; import java.lang.reflect.Field; @@ -46,9 +45,8 @@ public class MockReader implements FeedReader { @Override public FeedOperation read() throws Exception { - Operation operation = new Operation(); if (finished) { - return operation; + return FeedOperation.INVALID; } byte whatToDo = stream.getNextOperation(); @@ -56,22 +54,16 @@ public class MockReader implements FeedReader { DocumentType docType = new DocumentType("banana"); switch (whatToDo) { case 0: - finished = true; - break; + return FeedOperation.INVALID; case 1: - Document doc = new Document(docType, id); - operation.setDocument(doc); - break; + return new DocumentFeedOperation(new Document(docType, id)); case 2: - operation.setRemove(id); - break; + return new RemoveFeedOperation(id); case 3: - operation.setDocumentUpdate(new DocumentUpdate(docType, id)); - break; - case 4: + return new DocumentUpdateFeedOperation(new DocumentUpdate(docType, id)); + default: throw new RuntimeException("boom"); } - return operation; } } |