Remove warnings from code 07/51107/1
authorliamfallon <liam.fallon@ericsson.com>
Mon, 11 Jun 2018 09:06:54 +0000 (10:06 +0100)
committerliamfallon <liam.fallon@ericsson.com>
Mon, 11 Jun 2018 09:07:06 +0000 (10:07 +0100)
Remove "final" from variables and add setters in test
case to get rid of "dead code" warnings

Change implementation in typeutils grammar generation
to remove depricated warning

Change-Id: I24c4bb3f06f4c6fa227d8d191dc2fb6a6cf0b6fb
Issue-ID: POLICY-716
Signed-off-by: liamfallon <liam.fallon@ericsson.com>
model/utilities/pom.xml
model/utilities/src/main/java/org/onap/policy/apex/model/utilities/typeutils/TypeBuilder.java
model/utilities/src/test/java/org/onap/policy/apex/model/utilities/typeutils/ParserTest.java
services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperCarrierTechnologyParameters.java

index 7247423..722ee65 100644 (file)
@@ -45,7 +45,7 @@
             <plugin>
                 <groupId>org.antlr</groupId>
                 <artifactId>antlr4-maven-plugin</artifactId>
-                <version>4.6</version>
+                <version>4.7.1</version>
                 <executions>
                     <execution>
                         <id>antlr-sources</id>
index a3f22a4..0e38515 100644 (file)
@@ -23,14 +23,14 @@ package org.onap.policy.apex.model.utilities.typeutils;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 
-import org.antlr.v4.runtime.ANTLRInputStream;
 import org.antlr.v4.runtime.BailErrorStrategy;
 import org.antlr.v4.runtime.CharStream;
+import org.antlr.v4.runtime.CharStreams;
 import org.antlr.v4.runtime.CommonTokenStream;
 import org.antlr.v4.runtime.TokenStream;
 
 /**
- * This class .
+ * This class builds a type from a grammar using ANTLR.
  */
 public final class TypeBuilder {
     /**
@@ -51,7 +51,7 @@ public final class TypeBuilder {
         }
 
         try {
-            final CharStream stream = new ANTLRInputStream(type);
+            final CharStream stream = CharStreams.fromString(type);
             final TokenStream tokenStream = new CommonTokenStream(new ParametrizedTypeLexer(stream));
 
             final ParametrizedTypeParser parser = new ParametrizedTypeParser(tokenStream);
index bf42261..a979afd 100644 (file)
@@ -25,9 +25,9 @@ import static org.junit.Assert.fail;
 
 import java.lang.reflect.Type;
 
-import org.antlr.v4.runtime.ANTLRInputStream;
 import org.antlr.v4.runtime.BailErrorStrategy;
 import org.antlr.v4.runtime.CharStream;
+import org.antlr.v4.runtime.CharStreams;
 import org.antlr.v4.runtime.CommonTokenStream;
 import org.antlr.v4.runtime.TokenStream;
 import org.junit.Test;
@@ -38,7 +38,7 @@ import org.junit.Test;
 public class ParserTest {
     @Test
     public void testParser() {
-        final CharStream stream = new ANTLRInputStream(
+        final CharStream stream = CharStreams.fromString(
                 "java.util.Map<java.util.List<java.lang.Integer>,java.util.Set<java.lang.String>>");
         final TokenStream tokenStream = new CommonTokenStream(new ParametrizedTypeLexer(stream));
 
index ffbd1c0..604849f 100644 (file)
@@ -72,23 +72,23 @@ public class SuperDooperCarrierTechnologyParameters extends CarrierTechnologyPar
     private static final String PROPERTY_VALUE_DESERIALIZER = "value.deserializer";
 
     // superDooper carrier parameters
-    private final String bootstrapServers = DEFAULT_BOOTSTRAP_SERVERS;
-    private final String acks = DEFAULT_ACKS;
-    private final int retries = DEFAULT_RETRIES;
-    private final int batchSize = DEFAULT_BATCH_SIZE;
-    private final int lingerTime = DEFAULT_LINGER_TIME;
-    private final long bufferMemory = DEFAULT_BUFFER_MEMORY;
-    private final String groupId = DEFAULT_GROUP_ID;
-    private final boolean enableAutoCommit = DEFAULT_ENABLE_AUTO_COMMIT;
-    private final int autoCommitTime = DEFAULT_AUTO_COMMIT_TIME;
-    private final int sessionTimeout = DEFAULT_SESSION_TIMEOUT;
-    private final String producerTopic = DEFAULT_PRODUCER_TOPIC;
-    private final int consumerPollTime = DEFAULT_CONSUMER_POLL_TIME;
-    private final String[] consumerTopicList = DEFAULT_CONSUMER_TOPIC_LIST;
-    private final String keySerializer = DEFAULT_KEY_SERIALIZER;
-    private final String valueSerializer = DEFAULT_VALUE_SERIALIZER;
-    private final String keyDeserializer = DEFAULT_KEY_DESERIALIZER;
-    private final String valueDeserializer = DEFAULT_VALUE_DESERIALIZER;
+    private String bootstrapServers = DEFAULT_BOOTSTRAP_SERVERS;
+    private String acks = DEFAULT_ACKS;
+    private int retries = DEFAULT_RETRIES;
+    private int batchSize = DEFAULT_BATCH_SIZE;
+    private int lingerTime = DEFAULT_LINGER_TIME;
+    private long bufferMemory = DEFAULT_BUFFER_MEMORY;
+    private String groupId = DEFAULT_GROUP_ID;
+    private boolean enableAutoCommit = DEFAULT_ENABLE_AUTO_COMMIT;
+    private int autoCommitTime = DEFAULT_AUTO_COMMIT_TIME;
+    private int sessionTimeout = DEFAULT_SESSION_TIMEOUT;
+    private String producerTopic = DEFAULT_PRODUCER_TOPIC;
+    private int consumerPollTime = DEFAULT_CONSUMER_POLL_TIME;
+    private String[] consumerTopicList = DEFAULT_CONSUMER_TOPIC_LIST;
+    private String keySerializer = DEFAULT_KEY_SERIALIZER;
+    private String valueSerializer = DEFAULT_VALUE_SERIALIZER;
+    private String keyDeserializer = DEFAULT_KEY_DESERIALIZER;
+    private String valueDeserializer = DEFAULT_VALUE_DESERIALIZER;
 
     /**
      * Constructor to create a file carrier technology parameters instance and register the instance
@@ -298,6 +298,159 @@ public class SuperDooperCarrierTechnologyParameters extends CarrierTechnologyPar
         return valueDeserializer;
     }
 
+    /**
+     * Sets the bootstrap servers.
+     *
+     * @param bootstrapServers the new bootstrap servers
+     */
+    public void setBootstrapServers(String bootstrapServers) {
+        this.bootstrapServers = bootstrapServers;
+    }
+
+    /**
+     * Sets the acks.
+     *
+     * @param acks the new acks
+     */
+    public void setAcks(String acks) {
+        this.acks = acks;
+    }
+
+    /**
+     * Sets the retries.
+     *
+     * @param retries the new retries
+     */
+    public void setRetries(int retries) {
+        this.retries = retries;
+    }
+
+    /**
+     * Sets the batch size.
+     *
+     * @param batchSize the new batch size
+     */
+    public void setBatchSize(int batchSize) {
+        this.batchSize = batchSize;
+    }
+
+    /**
+     * Sets the linger time.
+     *
+     * @param lingerTime the new linger time
+     */
+    public void setLingerTime(int lingerTime) {
+        this.lingerTime = lingerTime;
+    }
+
+    /**
+     * Sets the buffer memory.
+     *
+     * @param bufferMemory the new buffer memory
+     */
+    public void setBufferMemory(long bufferMemory) {
+        this.bufferMemory = bufferMemory;
+    }
+
+    /**
+     * Sets the group id.
+     *
+     * @param groupId the new group id
+     */
+    public void setGroupId(String groupId) {
+        this.groupId = groupId;
+    }
+
+    /**
+     * Sets the enable auto commit.
+     *
+     * @param enableAutoCommit the new enable auto commit
+     */
+    public void setEnableAutoCommit(boolean enableAutoCommit) {
+        this.enableAutoCommit = enableAutoCommit;
+    }
+
+    /**
+     * Sets the auto commit time.
+     *
+     * @param autoCommitTime the new auto commit time
+     */
+    public void setAutoCommitTime(int autoCommitTime) {
+        this.autoCommitTime = autoCommitTime;
+    }
+
+    /**
+     * Sets the session timeout.
+     *
+     * @param sessionTimeout the new session timeout
+     */
+    public void setSessionTimeout(int sessionTimeout) {
+        this.sessionTimeout = sessionTimeout;
+    }
+
+    /**
+     * Sets the producer topic.
+     *
+     * @param producerTopic the new producer topic
+     */
+    public void setProducerTopic(String producerTopic) {
+        this.producerTopic = producerTopic;
+    }
+
+    /**
+     * Sets the consumer poll time.
+     *
+     * @param consumerPollTime the new consumer poll time
+     */
+    public void setConsumerPollTime(int consumerPollTime) {
+        this.consumerPollTime = consumerPollTime;
+    }
+
+    /**
+     * Sets the consumer topic list.
+     *
+     * @param consumerTopicList the new consumer topic list
+     */
+    public void setConsumerTopicList(String[] consumerTopicList) {
+        this.consumerTopicList = consumerTopicList;
+    }
+
+    /**
+     * Sets the key serializer.
+     *
+     * @param keySerializer the new key serializer
+     */
+    public void setKeySerializer(String keySerializer) {
+        this.keySerializer = keySerializer;
+    }
+
+    /**
+     * Sets the value serializer.
+     *
+     * @param valueSerializer the new value serializer
+     */
+    public void setValueSerializer(String valueSerializer) {
+        this.valueSerializer = valueSerializer;
+    }
+
+    /**
+     * Sets the key deserializer.
+     *
+     * @param keyDeserializer the new key deserializer
+     */
+    public void setKeyDeserializer(String keyDeserializer) {
+        this.keyDeserializer = keyDeserializer;
+    }
+
+    /**
+     * Sets the value deserializer.
+     *
+     * @param valueDeserializer the new value deserializer
+     */
+    public void setValueDeserializer(String valueDeserializer) {
+        this.valueDeserializer = valueDeserializer;
+    }
+
     /*
      * (non-Javadoc)
      *