Make methods static 27/22027/3
authorRobert Varga <rovarga@cisco.com>
Sat, 6 Jun 2015 13:34:44 +0000 (15:34 +0200)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 12 Jun 2015 13:08:54 +0000 (13:08 +0000)
These methods can be made static, make them such. Also fix raw types.

Change-Id: I4b697026857aae8579f0545e7e1284a7b8d00d04
Signed-off-by: Robert Varga <rovarga@cisco.com>
code-generator/binding-java-api-generator/src/test/java/org/opendaylight/yangtools/sal/java/api/generator/test/UnionTypedefUnusedImportTest.java
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/codec/BooleanStringCodec.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/leafref/context/test/DataTreeCandidateValidatorTest.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/ListConstraintsValidationTest.java

index 39f3607cf82d69bee8986726d4702eaf20d2a063..ffe2c80fbafd94ee8f15681f7bb92b3e7d6110a8 100644 (file)
@@ -15,7 +15,6 @@ import static org.opendaylight.yangtools.sal.java.api.generator.test.Compilation
 import static org.opendaylight.yangtools.sal.java.api.generator.test.CompilationTestUtils.cleanUp;
 import static org.opendaylight.yangtools.sal.java.api.generator.test.CompilationTestUtils.getSourceFiles;
 import static org.opendaylight.yangtools.sal.java.api.generator.test.CompilationTestUtils.testCompilation;
-
 import java.io.File;
 import java.io.IOException;
 import java.net.URISyntaxException;
@@ -52,12 +51,12 @@ public class UnionTypedefUnusedImportTest extends BaseCompilationTest {
         cleanUp(sourcesOutputDir, compiledOutputDir);
     }
 
-    private String readFile(String path, Charset encoding) throws IOException {
+    private static String readFile(final String path, final Charset encoding) throws IOException {
         byte[] encoded = Files.readAllBytes(Paths.get(path));
         return new String(encoded, encoding);
     }
 
-    private boolean containsImport(final String fullImport) throws URISyntaxException, IOException {
+    private static boolean containsImport(final String fullImport) throws URISyntaxException, IOException {
         final String filePath = GENERATOR_OUTPUT_PATH + FS + "union-typedef" + FS + "org" + FS + "opendaylight" + FS + "yang" + FS + "gen" + FS + "v1" + FS + "org" + FS + "opendaylight" + FS + "yangtools" + FS + "union" + FS + "typedef" + FS + "rev141124" + FS + "TypedefUnionBuilder.java";
         final String fileContent = readFile(filePath, StandardCharsets.UTF_8);
 
index 28212224f63dec3a8f6289107036558574ac2545..6bec3166725111ad2371c5ddb61df26a2dba18a8 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.yangtools.yang.data.impl.codec;
 
 import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
-
 import org.opendaylight.yangtools.yang.data.api.codec.BooleanCodec;
 import org.opendaylight.yangtools.yang.model.api.type.BooleanTypeDefinition;
 
@@ -34,7 +33,7 @@ class BooleanStringCodec extends TypeDefinitionAwareCodec<Boolean, BooleanTypeDe
         return Boolean.valueOf(stringRepresentation);
     }
 
-    private void validate(final String string) {
+    private static void validate(final String string) {
         Preconditions.checkArgument(string.toLowerCase().equals("true")
                 || string.toLowerCase().equals("false"),
                 "Invalid value '%s' for boolean type. Allowed values are true and false", string);
index 2c2d5631b293460baad310130238379428837d11..e35a43ec206bd2ac6e59135b8d794fce3e2d72f5 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.yangtools.yang.data.impl.leafref.context.test;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
-
 import java.io.File;
 import java.io.IOException;
 import java.net.URISyntaxException;
@@ -214,7 +213,7 @@ public class DataTreeCandidateValidatorTest {
         writeIntoMapEntry();
     }
 
-    private void writeContributors() {
+    private static void writeContributors() {
 
         final ContainerSchemaNode contributorContSchemaNode = (ContainerSchemaNode) valModule
                 .getDataChildByName(odlContributor);
@@ -255,7 +254,7 @@ public class DataTreeCandidateValidatorTest {
 
     }
 
-    private void writeIntoMapEntry() {
+    private static void writeIntoMapEntry() {
 
         final Map<QName, Object> keys = new HashMap<QName, Object>();
         keys.put(name, "New Project");
@@ -300,7 +299,7 @@ public class DataTreeCandidateValidatorTest {
 
     }
 
-    private void writeMapEntry() {
+    private static void writeMapEntry() {
 
         final Map<QName, Object> keys = new HashMap<QName, Object>();
         keys.put(name, "New Project");
@@ -350,7 +349,7 @@ public class DataTreeCandidateValidatorTest {
 
     }
 
-    private void write() {
+    private static void write() {
 
         final ContainerSchemaNode contributorContSchemaNode = (ContainerSchemaNode) valModule
                 .getDataChildByName(odlContributor);
@@ -396,7 +395,7 @@ public class DataTreeCandidateValidatorTest {
         assertTrue(exception);
     }
 
-    private void write2() {
+    private static void write2() {
 
         final ContainerSchemaNode odlCon = (ContainerSchemaNode) valModule
                 .getDataChildByName(odl);
@@ -424,7 +423,7 @@ public class DataTreeCandidateValidatorTest {
                 con3);
         writeModification.write(con3Path, con3Node);
 
-        final LeafSetNode leafListNode = createLeafRefLeafListNode();
+        final LeafSetNode<?> leafListNode = createLeafRefLeafListNode();
         final YangInstanceIdentifier leafListPath = YangInstanceIdentifier.of(odl)
                 .node(leafrefLeafList);
         writeModification.write(leafListPath, leafListNode);
@@ -457,7 +456,7 @@ public class DataTreeCandidateValidatorTest {
 
     }
 
-    private LeafSetNode createLeafRefLeafListNode() {
+    private static LeafSetNode<?> createLeafRefLeafListNode() {
 
         final ListNodeBuilder<Object, LeafSetEntryNode<Object>> leafSetBuilder = Builders
                 .leafSetBuilder();
@@ -470,7 +469,7 @@ public class DataTreeCandidateValidatorTest {
         return leafSetBuilder.build();
     }
 
-    private ContainerNode createCon3Node() {
+    private static ContainerNode createCon3Node() {
 
         final CollectionNodeBuilder<MapEntryNode, MapNode> mapBuilder = Builders
                 .mapBuilder();
@@ -494,7 +493,7 @@ public class DataTreeCandidateValidatorTest {
         return containerBuilder.build();
     }
 
-    private MapEntryNode createList3Entry(final String kVal, final String l3Val1,
+    private static MapEntryNode createList3Entry(final String kVal, final String l3Val1,
             final String l3Val2, final String l3Val3) {
         final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> mapEntryBuilder = Builders
                 .mapEntryBuilder();
@@ -515,7 +514,7 @@ public class DataTreeCandidateValidatorTest {
         return mapEntryBuilder.build();
     }
 
-    private LeafSetEntryNode<Object> createLeafSetEntry(final QName qname, final String val) {
+    private static LeafSetEntryNode<Object> createLeafSetEntry(final QName qname, final String val) {
         final NormalizedNodeAttrBuilder<NodeWithValue, Object, LeafSetEntryNode<Object>> leafSetEntryBuilder = Builders
                 .leafSetEntryBuilder();
         leafSetEntryBuilder.withNodeIdentifier(new NodeWithValue(qname, val));
@@ -523,7 +522,7 @@ public class DataTreeCandidateValidatorTest {
         return leafSetEntryBuilder.build();
     }
 
-    private ChoiceNode createChoiceNode() {
+    private static ChoiceNode createChoiceNode() {
 
         final CollectionNodeBuilder<MapEntryNode, MapNode> listInChoiceBuilder = Builders
                 .mapBuilder();
@@ -551,7 +550,7 @@ public class DataTreeCandidateValidatorTest {
         return choiceBuilder.build();
     }
 
-    private MapEntryNode createListInChoiceEntry(final String keyVal,
+    private static MapEntryNode createListInChoiceEntry(final String keyVal,
             final String leafrefInChoiceVal, final String leafrefInChoiceToChoiceVal) {
 
         final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> mapEntryBuilder = Builders
@@ -570,7 +569,7 @@ public class DataTreeCandidateValidatorTest {
         return mapEntryBuilder.build();
     }
 
-    private void delete() {
+    private static void delete() {
 
         final YangInstanceIdentifier contributorPath = YangInstanceIdentifier
                 .of(odlContributor);
@@ -606,7 +605,7 @@ public class DataTreeCandidateValidatorTest {
 
     }
 
-    private ContainerNode createContributorContainer(
+    private static ContainerNode createContributorContainer(
             final ContainerSchemaNode contributorContSchemaNode) {
 
         final ListSchemaNode contributorListSchemaNode = (ListSchemaNode) contributorContSchemaNode
@@ -624,7 +623,7 @@ public class DataTreeCandidateValidatorTest {
 
     }
 
-    private MapNode createContributorList(
+    private static MapNode createContributorList(
             final ListSchemaNode contributorListSchemaNode) {
 
         final CollectionNodeBuilder<MapEntryNode, MapNode> contributorMapBldr = Builders
@@ -675,7 +674,7 @@ public class DataTreeCandidateValidatorTest {
 
     }
 
-    private MapEntryNode createContributorListEntry(final String loginVal,
+    private static MapEntryNode createContributorListEntry(final String loginVal,
             final String contributorNameVal, final String odlProjectNameVal,
             final String odlProjectDescVal, final ListSchemaNode contributorListSchemaNode) {
 
@@ -763,7 +762,7 @@ public class DataTreeCandidateValidatorTest {
         return projMapEntry;
     }
 
-    private ContainerNode createBasicContributorContainer(
+    private static ContainerNode createBasicContributorContainer(
             final ContainerSchemaNode contributorContSchemaNode) {
 
         final ListSchemaNode contributorListSchemaNode = (ListSchemaNode) contributorContSchemaNode
@@ -781,7 +780,7 @@ public class DataTreeCandidateValidatorTest {
 
     }
 
-    private MapNode createBasicContributorList(
+    private static MapNode createBasicContributorList(
             final ListSchemaNode contributorListSchemaNode) {
 
         final CollectionNodeBuilder<MapEntryNode, MapNode> contributorMapBldr = Builders
@@ -804,7 +803,5 @@ public class DataTreeCandidateValidatorTest {
         final MapNode contributorMap = contributorMapBldr.build();
 
         return contributorMap;
-
     }
-
 }
index 3f6bca552d5e1b4f8e6a507b84c8547edebf0327..0ce89fbc411e5b45a72b13b187a4b734ab02240a 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.yangtools.yang.data.impl.schema.tree;
 
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
-
 import com.google.common.base.Optional;
 import java.io.InputStream;
 import java.util.ArrayList;
@@ -158,7 +157,7 @@ public class ListConstraintsValidationTest {
         InMemoryDataTreeSnapshot snapshotAfterCommit = inMemoryDataTree.takeSnapshot();
         Optional<NormalizedNode<?, ?>> minMaxListRead = snapshotAfterCommit.readNode(MIN_MAX_LIST_PATH);
         assertTrue(minMaxListRead.isPresent());
-        assertTrue(((NormalizedNodeContainer) minMaxListRead.get()).getValue().size() == 2);
+        assertTrue(((NormalizedNodeContainer<?, ?, ?>) minMaxListRead.get()).getValue().size() == 2);
 
         modificationTree = inMemoryDataTree.takeSnapshot().newModification();
         modificationTree.write(gooPath, gooEntryNode);
@@ -170,7 +169,7 @@ public class ListConstraintsValidationTest {
         snapshotAfterCommit = inMemoryDataTree.takeSnapshot();
         minMaxListRead = snapshotAfterCommit.readNode(MIN_MAX_LIST_PATH);
         assertTrue(minMaxListRead.isPresent());
-        assertTrue(((NormalizedNodeContainer) minMaxListRead.get()).getValue().size() == 3);
+        assertTrue(((NormalizedNodeContainer<?, ?, ?>) minMaxListRead.get()).getValue().size() == 3);
 
         modificationTree = inMemoryDataTree.takeSnapshot().newModification();
 
@@ -210,7 +209,7 @@ public class ListConstraintsValidationTest {
         final InMemoryDataTreeSnapshot snapshotAfterCommit = inMemoryDataTree.takeSnapshot();
         final Optional<NormalizedNode<?, ?>> masterContainer = snapshotAfterCommit.readNode(MASTER_CONTAINER_PATH);
         assertTrue(masterContainer.isPresent());
-        final Optional<NormalizedNodeContainer> leafList = ((NormalizedNodeContainer) masterContainer.get()).getChild(
+        final Optional<NormalizedNodeContainer<?, ?, ?>> leafList = ((NormalizedNodeContainer) masterContainer.get()).getChild(
                 new YangInstanceIdentifier.NodeIdentifier(MIN_MAX_LEAF_LIST_QNAME));
         assertTrue(leafList.isPresent());
         assertTrue(leafList.get().getValue().size() == 2);