From 607e3cb63d4e5b1abd36a5519b4e08b2af391622 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Sat, 20 Apr 2019 14:10:24 +0200 Subject: Avoid '*' imports. Some minor cleanup while reading code. --- .../main/java/com/yahoo/vespafeeder/Arguments.java | 30 +++++++++++----------- .../com/yahoo/vespafeeder/VespaFeederTestCase.java | 16 +++++++----- 2 files changed, 24 insertions(+), 22 deletions(-) (limited to 'vespaclient-java/src') diff --git a/vespaclient-java/src/main/java/com/yahoo/vespafeeder/Arguments.java b/vespaclient-java/src/main/java/com/yahoo/vespafeeder/Arguments.java index 0d23af1fec5..fa28f56e34a 100644 --- a/vespaclient-java/src/main/java/com/yahoo/vespafeeder/Arguments.java +++ b/vespaclient-java/src/main/java/com/yahoo/vespafeeder/Arguments.java @@ -22,19 +22,19 @@ import static java.lang.System.out; * Argument parsing class for the vespa feeder. */ public class Arguments { - public FeederConfig getFeederConfig() { + FeederConfig getFeederConfig() { return new FeederConfig(feederConfigBuilder); } - public List getFiles() { + List getFiles() { return files; } - public String getMode() { + String getMode() { return mode; } - public boolean isVerbose() { + boolean isVerbose() { return verbose; } @@ -44,12 +44,12 @@ public class Arguments { private String mode = "standard"; private boolean validateOnly = false; private boolean verbose = false; - SessionFactory sessionFactory; - MessagePropertyProcessor propertyProcessor = null; + private SessionFactory sessionFactory; + private MessagePropertyProcessor propertyProcessor = null; private String priority = null; private int numThreads = 1; - public MessagePropertyProcessor getPropertyProcessor() { + MessagePropertyProcessor getPropertyProcessor() { return propertyProcessor; } @@ -89,11 +89,11 @@ public class Arguments { " -v [ --verbose ] Enable verbose output of progress.\n"); } - public class HelpShownException extends Exception { + class HelpShownException extends Exception { } - public Arguments(String[] argList, SessionFactory factory) throws HelpShownException, FileNotFoundException { + Arguments(String[] argList, SessionFactory factory) throws HelpShownException, FileNotFoundException { parse(argList); if (factory != null) { @@ -101,17 +101,17 @@ public class Arguments { } else if (validateOnly) { if (dumpDocumentsFile != null) { BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(dumpDocumentsFile)); - sessionFactory = new DummySessionFactory(null, out); + sessionFactory = new DummySessionFactory(out); } else { - sessionFactory = new DummySessionFactory(null, null); + sessionFactory = new DummySessionFactory(null); } } else { sessionFactory = new MessageBusSessionFactory(propertyProcessor); } } - void parse(String[] argList) throws HelpShownException { - List args = new LinkedList(); + private void parse(String[] argList) throws HelpShownException { + List args = new LinkedList<>(); args.addAll(Arrays.asList(argList)); while (!args.isEmpty()) { @@ -187,11 +187,11 @@ public class Arguments { return priority; } - public int getNumThreads() { + int getNumThreads() { return numThreads; } - public SessionFactory getSessionFactory() { + SessionFactory getSessionFactory() { return sessionFactory; } diff --git a/vespaclient-java/src/test/java/com/yahoo/vespafeeder/VespaFeederTestCase.java b/vespaclient-java/src/test/java/com/yahoo/vespafeeder/VespaFeederTestCase.java index 4de286398e9..0fc0cdf017c 100644 --- a/vespaclient-java/src/test/java/com/yahoo/vespafeeder/VespaFeederTestCase.java +++ b/vespaclient-java/src/test/java/com/yahoo/vespafeeder/VespaFeederTestCase.java @@ -1,12 +1,9 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespafeeder; -import static org.junit.Assert.*; - import java.io.BufferedInputStream; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; -import java.io.FileNotFoundException; import java.io.IOException; import java.io.PrintStream; import java.util.ArrayList; @@ -16,17 +13,23 @@ import com.yahoo.clientmetrics.RouteMetricSet; import com.yahoo.document.DocumentTypeManager; import com.yahoo.document.DocumentTypeManagerConfigurer; import com.yahoo.document.DocumentUpdate; -import com.yahoo.documentapi.messagebus.protocol.*; +import com.yahoo.documentapi.messagebus.protocol.DocumentProtocol; +import com.yahoo.documentapi.messagebus.protocol.PutDocumentMessage; +import com.yahoo.documentapi.messagebus.protocol.RemoveDocumentMessage; +import com.yahoo.documentapi.messagebus.protocol.UpdateDocumentMessage; import com.yahoo.feedapi.DummySessionFactory; import com.yahoo.feedhandler.VespaFeedHandler; import com.yahoo.text.Utf8; import com.yahoo.vespaclient.config.FeederConfig; -import com.yahoo.vespafeeder.Arguments.HelpShownException; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + public class VespaFeederTestCase { @Rule @@ -203,8 +206,7 @@ public class VespaFeederTestCase { feed("src/test/files/malformedfeed.json", false); } - protected FeedFixture feed(String feed, boolean abortOnDataError) throws HelpShownException, - FileNotFoundException, Exception { + protected FeedFixture feed(String feed, boolean abortOnDataError) throws Exception { String abortOnDataErrorArgument = abortOnDataError ? "" : " --abortondataerror no"; FeedFixture feedFixture = new FeedFixture(); Arguments arguments = new Arguments(("--file " -- cgit v1.2.3