From: Tony Tkacik Date: Mon, 10 Nov 2014 08:56:24 +0000 (+0000) Subject: Merge "Fix raw references to Promise" X-Git-Tag: release/lithium~900 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=b17a51ecb983331f0e521e40f9dd2474f268de13;hp=1cfb737124f7aabb4b7cacb5840298edce5ad607 Merge "Fix raw references to Promise" --- diff --git a/features/base/pom.xml b/features/base/pom.xml index cd84eeaf33..3dbb9391b0 100644 --- a/features/base/pom.xml +++ b/features/base/pom.xml @@ -443,7 +443,6 @@ org.opendaylight.yangtools features-test - 0.7.0-SNAPSHOT diff --git a/opendaylight/commons/filter-valve/src/test/java/org/opendaylight/controller/filtervalve/cors/model/UrlMatcherTest.java b/opendaylight/commons/filter-valve/src/test/java/org/opendaylight/controller/filtervalve/cors/model/UrlMatcherTest.java index 07f6354b19..6276deab78 100644 --- a/opendaylight/commons/filter-valve/src/test/java/org/opendaylight/controller/filtervalve/cors/model/UrlMatcherTest.java +++ b/opendaylight/commons/filter-valve/src/test/java/org/opendaylight/controller/filtervalve/cors/model/UrlMatcherTest.java @@ -24,14 +24,11 @@ public class UrlMatcherTest { final String jspFilter = "jspFilter"; final String exactMatch = "/somePath"; final String prefixFilter = "prefixFilter"; - LinkedHashMap patternMap = new LinkedHashMap() { - { - put(exactMatch, exactMatchFilter); - put("/*", defaultFilter); - put("*.jsp", jspFilter); - put("/foo/*", prefixFilter); - } - }; + LinkedHashMap patternMap = new LinkedHashMap<>(); + patternMap.put(exactMatch, exactMatchFilter); + patternMap.put("/*", defaultFilter); + patternMap.put("*.jsp", jspFilter); + patternMap.put("/foo/*", prefixFilter); urlMatcher = new UrlMatcher<>(patternMap); assertMatches("/abc", defaultFilter); assertMatches(exactMatch, exactMatchFilter, defaultFilter); diff --git a/opendaylight/commons/httpclient/pom.xml b/opendaylight/commons/httpclient/pom.xml index 39364cbcba..3848044b43 100644 --- a/opendaylight/commons/httpclient/pom.xml +++ b/opendaylight/commons/httpclient/pom.xml @@ -62,7 +62,6 @@ org.apache.maven.plugins maven-checkstyle-plugin - ${checkstyle.version} true controller/checkstyle.xml diff --git a/opendaylight/commons/integrationtest/pom.xml b/opendaylight/commons/integrationtest/pom.xml index ad4e166cbd..4769a03b2f 100644 --- a/opendaylight/commons/integrationtest/pom.xml +++ b/opendaylight/commons/integrationtest/pom.xml @@ -80,7 +80,6 @@ org.apache.maven.plugins maven-checkstyle-plugin - ${checkstyle.version} true controller/checkstyle.xml @@ -96,7 +95,6 @@ org.apache.maven.plugins maven-surefire-plugin - ${surefire.version} true diff --git a/opendaylight/commons/opendaylight/pom.xml b/opendaylight/commons/opendaylight/pom.xml index ae37f4ae2a..f61094ab48 100644 --- a/opendaylight/commons/opendaylight/pom.xml +++ b/opendaylight/commons/opendaylight/pom.xml @@ -1965,7 +1965,6 @@ org.apache.maven.plugins maven-checkstyle-plugin - ${checkstyle.version} true controller/checkstyle.xml @@ -2051,7 +2050,6 @@ org.apache.maven.plugins maven-surefire-plugin - ${surefire.version} ${testvm.argLine} ${jacoco.agent.ut.arg} diff --git a/opendaylight/config/config-persister-api/src/test/java/org/opendaylight/controller/config/persist/test/PropertiesProviderTest.java b/opendaylight/config/config-persister-api/src/test/java/org/opendaylight/controller/config/persist/test/PropertiesProviderTest.java index 3d4757b926..2c60310e8a 100644 --- a/opendaylight/config/config-persister-api/src/test/java/org/opendaylight/controller/config/persist/test/PropertiesProviderTest.java +++ b/opendaylight/config/config-persister-api/src/test/java/org/opendaylight/controller/config/persist/test/PropertiesProviderTest.java @@ -12,7 +12,7 @@ import java.util.Map; import org.opendaylight.controller.config.persist.api.PropertiesProvider; public class PropertiesProviderTest implements PropertiesProvider { - private final Map properties = new HashMap(); + private final Map properties = new HashMap<>(); public void addProperty(String key,String value){ properties.put(key,value); diff --git a/opendaylight/distribution/opendaylight-karaf-empty/pom.xml b/opendaylight/distribution/opendaylight-karaf-empty/pom.xml index 72eaf005ad..a66a502a70 100644 --- a/opendaylight/distribution/opendaylight-karaf-empty/pom.xml +++ b/opendaylight/distribution/opendaylight-karaf-empty/pom.xml @@ -156,7 +156,6 @@ org.apache.maven.plugins maven-checkstyle-plugin - ${checkstyle.version} **\/target\/,**\/bin\/,**\/target-ide\/,**\/configuration\/initial\/ diff --git a/opendaylight/distribution/opendaylight-karaf/pom.xml b/opendaylight/distribution/opendaylight-karaf/pom.xml index 3a2f4b0580..e44b569759 100644 --- a/opendaylight/distribution/opendaylight-karaf/pom.xml +++ b/opendaylight/distribution/opendaylight-karaf/pom.xml @@ -221,7 +221,6 @@ org.apache.maven.plugins maven-checkstyle-plugin - ${checkstyle.version} **\/target\/,**\/bin\/,**\/target-ide\/,**\/configuration\/initial\/ diff --git a/opendaylight/distribution/opendaylight/pom.xml b/opendaylight/distribution/opendaylight/pom.xml index f6ecb44fa1..cd02759f5a 100644 --- a/opendaylight/distribution/opendaylight/pom.xml +++ b/opendaylight/distribution/opendaylight/pom.xml @@ -773,7 +773,6 @@ org.apache.maven.plugins maven-checkstyle-plugin - ${checkstyle.version} **\/target\/,**\/bin\/,**\/target-ide\/,**\/configuration\/initial\/ @@ -825,7 +824,6 @@ commons-lang commons-lang - 2.4 org.apache.servicemix.bundles @@ -1020,7 +1018,6 @@ org.opendaylight.controller sal-inmemory-datastore - 1.2.0-SNAPSHOT org.opendaylight.controller @@ -1133,24 +1130,20 @@ org.opendaylight.controller.model model-topology - 1.2.0-SNAPSHOT org.opendaylight.controller.samples sample-toaster - ${mdsal.version} org.opendaylight.controller.samples sample-toaster-consumer - ${mdsal.version} org.opendaylight.controller.samples sample-toaster-provider - ${mdsal.version} org.apache.sshd @@ -1286,12 +1279,10 @@ org.opendaylight.yangtools.thirdparty antlr4-runtime-osgi-nohead - 4.0 org.opendaylight.yangtools.thirdparty xtend-lib-osgi - 2.4.3 org.openexi diff --git a/opendaylight/md-sal/sal-akka-raft/pom.xml b/opendaylight/md-sal/sal-akka-raft/pom.xml index 53353cded1..4b6091b429 100644 --- a/opendaylight/md-sal/sal-akka-raft/pom.xml +++ b/opendaylight/md-sal/sal-akka-raft/pom.xml @@ -13,7 +13,6 @@ org.opendaylight.controller sal-clustering-commons - 1.2.0-SNAPSHOT com.google.guava @@ -81,7 +80,6 @@ org.slf4j slf4j-simple - ${slf4j.version} test diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/ExampleActor.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/ExampleActor.java index 2437bb4b7d..cb375c2490 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/ExampleActor.java +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/ExampleActor.java @@ -118,12 +118,12 @@ public class ExampleActor extends RaftActor { @Override protected void applySnapshot(final ByteString snapshot) { state.clear(); try { - state.putAll((HashMap) toObject(snapshot)); + state.putAll((Map) toObject(snapshot)); } catch (Exception e) { LOG.error(e, "Exception in applying snapshot"); } if(LOG.isDebugEnabled()) { - LOG.debug("Snapshot applied to state : {}", ((HashMap) state).size()); + LOG.debug("Snapshot applied to state : {}", ((Map) state).size()); } } diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/Leader.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/Leader.java index ef104e7f58..d83362b580 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/Leader.java +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/Leader.java @@ -70,7 +70,7 @@ import java.util.concurrent.atomic.AtomicLong; public class Leader extends AbstractRaftActorBehavior { - protected final Map followerToLog = new HashMap(); + protected final Map followerToLog = new HashMap<>(); protected final Map mapFollowerToSnapshot = new HashMap<>(); private final Set followers; diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/AppendEntries.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/AppendEntries.java index 5149cf9f34..14eb8a4b77 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/AppendEntries.java +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/AppendEntries.java @@ -25,7 +25,7 @@ import java.util.Map; */ public class AppendEntries extends AbstractRaftRPC { - public static final Class SERIALIZABLE_CLASS = AppendEntriesMessages.AppendEntries.class; + public static final Class SERIALIZABLE_CLASS = AppendEntriesMessages.AppendEntries.class; private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory.getLogger(AppendEntries.class); diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/InstallSnapshot.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/InstallSnapshot.java index c084cba822..5a0cc95c21 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/InstallSnapshot.java +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/InstallSnapshot.java @@ -13,7 +13,7 @@ import org.opendaylight.controller.protobuff.messages.cluster.raft.InstallSnapsh public class InstallSnapshot extends AbstractRaftRPC { - public static final Class SERIALIZABLE_CLASS = InstallSnapshotMessages.InstallSnapshot.class; + public static final Class SERIALIZABLE_CLASS = InstallSnapshotMessages.InstallSnapshot.class; private final String leaderId; private final long lastIncludedIndex; diff --git a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/MockRaftActorContext.java b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/MockRaftActorContext.java index 0d5f644b3d..a1088aa7f2 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/MockRaftActorContext.java +++ b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/MockRaftActorContext.java @@ -33,7 +33,7 @@ public class MockRaftActorContext implements RaftActorContext { private long lastApplied = 0; private final ElectionTerm electionTerm; private ReplicatedLog replicatedLog; - private Map peerAddresses = new HashMap(); + private Map peerAddresses = new HashMap<>(); private ConfigParams configParams; public MockRaftActorContext(){ diff --git a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/RaftActorTest.java b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/RaftActorTest.java index 87e40f236c..8244604552 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/RaftActorTest.java +++ b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/RaftActorTest.java @@ -176,7 +176,7 @@ public class RaftActorTest extends AbstractActorTest { Object data = toObject(snapshot); System.out.println("!!!!!applyRecoverySnapshot: "+data); if (data instanceof List) { - state.addAll((List) data); + state.addAll((List) data); } } catch (Exception e) { e.printStackTrace(); @@ -246,7 +246,7 @@ public class RaftActorTest extends AbstractActorTest { return raftActor; } - public boolean waitForLogMessage(final Class logEventClass, String message){ + public boolean waitForLogMessage(final Class logEventClass, String message){ // Wait for a specific log message to show up return new JavaTestKit.EventFilter(logEventClass diff --git a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/LeaderTest.java b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/LeaderTest.java index 705c69607c..168eb3e5f2 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/LeaderTest.java +++ b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/LeaderTest.java @@ -76,7 +76,7 @@ public class LeaderTest extends AbstractRaftActorBehaviorTest { MockRaftActorContext actorContext = (MockRaftActorContext) createActorContext(); - Map peerAddresses = new HashMap(); + Map peerAddresses = new HashMap<>(); peerAddresses.put(followerActor.path().toString(), followerActor.path().toString()); @@ -121,7 +121,7 @@ public class LeaderTest extends AbstractRaftActorBehaviorTest { MockRaftActorContext actorContext = (MockRaftActorContext) createActorContext(); - Map peerAddresses = new HashMap(); + Map peerAddresses = new HashMap<>(); peerAddresses.put(followerActor.path().toString(), followerActor.path().toString()); @@ -216,7 +216,7 @@ public class LeaderTest extends AbstractRaftActorBehaviorTest { new JavaTestKit(getSystem()) {{ ActorRef followerActor = getSystem().actorOf(Props.create(MessageCollectorActor.class)); - Map peerAddresses = new HashMap(); + Map peerAddresses = new HashMap<>(); peerAddresses.put(followerActor.path().toString(), followerActor.path().toString()); @@ -300,7 +300,7 @@ public class LeaderTest extends AbstractRaftActorBehaviorTest { ActorRef followerActor = getTestActor(); - Map peerAddresses = new HashMap(); + Map peerAddresses = new HashMap<>(); peerAddresses.put(followerActor.path().toString(), followerActor.path().toString()); @@ -371,7 +371,7 @@ public class LeaderTest extends AbstractRaftActorBehaviorTest { ActorRef followerActor = getTestActor(); - Map peerAddresses = new HashMap(); + Map peerAddresses = new HashMap<>(); peerAddresses.put(followerActor.path().toString(), followerActor.path().toString()); @@ -434,7 +434,7 @@ public class LeaderTest extends AbstractRaftActorBehaviorTest { ActorRef followerActor = getTestActor(); - Map peerAddresses = new HashMap(); + Map peerAddresses = new HashMap<>(); peerAddresses.put(followerActor.path().toString(), followerActor.path().toString()); @@ -514,7 +514,7 @@ public class LeaderTest extends AbstractRaftActorBehaviorTest { ActorRef followerActor = getTestActor(); - Map peerAddresses = new HashMap(); + Map peerAddresses = new HashMap<>(); peerAddresses.put(followerActor.path().toString(), followerActor.path().toString()); @@ -690,7 +690,7 @@ public class LeaderTest extends AbstractRaftActorBehaviorTest { ForwardMessageToBehaviorActor.setBehavior(follower); - Map peerAddresses = new HashMap(); + Map peerAddresses = new HashMap<>(); peerAddresses.put(followerActor.path().toString(), followerActor.path().toString()); @@ -760,7 +760,7 @@ public class LeaderTest extends AbstractRaftActorBehaviorTest { ForwardMessageToBehaviorActor.setBehavior(follower); - Map peerAddresses = new HashMap(); + Map peerAddresses = new HashMap<>(); peerAddresses.put(followerActor.path().toString(), followerActor.path().toString()); @@ -823,7 +823,7 @@ public class LeaderTest extends AbstractRaftActorBehaviorTest { MockRaftActorContext leaderActorContext = new MockRaftActorContext("leader", getSystem(), leaderActor); - Map peerAddresses = new HashMap(); + Map peerAddresses = new HashMap<>(); peerAddresses.put("follower-1", followerActor.path().toString()); @@ -858,7 +858,7 @@ public class LeaderTest extends AbstractRaftActorBehaviorTest { leaderActorContext.setReplicatedLog( new MockRaftActorContext.MockReplicatedLogBuilder().createEntries(0, 3, 1).build()); - Map peerAddresses = new HashMap(); + Map peerAddresses = new HashMap<>(); peerAddresses.put("follower-1", followerActor.path().toString()); diff --git a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/utils/MessageCollectorActor.java b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/utils/MessageCollectorActor.java index 3e2e4a05ea..2a79c8f4bc 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/utils/MessageCollectorActor.java +++ b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/utils/MessageCollectorActor.java @@ -54,7 +54,7 @@ public class MessageCollectorActor extends UntypedActor { * @param clazz * @return */ - public static Object getFirstMatching(ActorRef actor, Class clazz) throws Exception { + public static Object getFirstMatching(ActorRef actor, Class clazz) throws Exception { List allMessages = getAllMessages(actor); for(Object message : allMessages){ @@ -66,7 +66,7 @@ public class MessageCollectorActor extends UntypedActor { return null; } - public static List getAllMatching(ActorRef actor, Class clazz) throws Exception { + public static List getAllMatching(ActorRef actor, Class clazz) throws Exception { List allMessages = getAllMessages(actor); List output = Lists.newArrayList(); diff --git a/opendaylight/md-sal/sal-binding-broker/pom.xml b/opendaylight/md-sal/sal-binding-broker/pom.xml index 7482c52fdd..ade3e1b8f6 100644 --- a/opendaylight/md-sal/sal-binding-broker/pom.xml +++ b/opendaylight/md-sal/sal-binding-broker/pom.xml @@ -70,7 +70,6 @@ org.opendaylight.yangtools binding-data-codec - 0.7.0-SNAPSHOT org.opendaylight.yangtools diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/RuntimeMappingModule.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/RuntimeMappingModule.java index 754d14f2c4..0ad0434892 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/RuntimeMappingModule.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/RuntimeMappingModule.java @@ -7,42 +7,25 @@ */ package org.opendaylight.controller.config.yang.md.sal.binding.impl; -import com.google.common.base.Optional; import com.google.common.base.Preconditions; import java.util.Hashtable; -import java.util.Map.Entry; -import java.util.Set; import javassist.ClassPool; import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec; import org.opendaylight.controller.sal.binding.codegen.impl.SingletonHolder; import org.opendaylight.yangtools.binding.data.codec.gen.impl.StreamWriterGenerator; import org.opendaylight.yangtools.binding.data.codec.impl.BindingNormalizedNodeCodecRegistry; -import org.opendaylight.yangtools.concepts.Delegator; import org.opendaylight.yangtools.sal.binding.generator.impl.GeneratedClassLoadingStrategy; import org.opendaylight.yangtools.sal.binding.generator.impl.RuntimeGeneratedMappingServiceImpl; -import org.opendaylight.yangtools.yang.binding.DataContainer; -import org.opendaylight.yangtools.yang.binding.DataObject; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.RpcService; -import org.opendaylight.yangtools.yang.common.QName; -import org.opendaylight.yangtools.yang.data.api.CompositeNode; -import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.impl.codec.BindingIndependentMappingService; -import org.opendaylight.yangtools.yang.data.impl.codec.CodecRegistry; -import org.opendaylight.yangtools.yang.data.impl.codec.DeserializationException; import org.opendaylight.yangtools.yang.model.api.SchemaContextListener; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * */ public final class RuntimeMappingModule extends AbstractRuntimeMappingModule { - private static final Logger LOG = LoggerFactory.getLogger(RuntimeMappingModule.class); - private BundleContext bundleContext; public RuntimeMappingModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, @@ -72,7 +55,7 @@ public final class RuntimeMappingModule extends AbstractRuntimeMappingModule { public java.lang.AutoCloseable createInstance() { final GeneratedClassLoadingStrategy classLoading = getGlobalClassLoadingStrategy(); final BindingIndependentMappingService legacyMapping = getGlobalLegacyMappingService(classLoading); - BindingNormalizedNodeCodecRegistry codecRegistry = new BindingNormalizedNodeCodecRegistry(new StreamWriterGenerator(SingletonHolder.JAVASSIST)); + BindingNormalizedNodeCodecRegistry codecRegistry = new BindingNormalizedNodeCodecRegistry(StreamWriterGenerator.create(SingletonHolder.JAVASSIST)); BindingToNormalizedNodeCodec instance = new BindingToNormalizedNodeCodec(classLoading, legacyMapping, codecRegistry); bundleContext.registerService(SchemaContextListener.class, instance, new Hashtable()); return instance; @@ -108,93 +91,4 @@ public final class RuntimeMappingModule extends AbstractRuntimeMappingModule { public void setBundleContext(final BundleContext bundleContext) { this.bundleContext = bundleContext; } - - private static final class RuntimeGeneratedMappingServiceProxy implements // - BindingIndependentMappingService, // - Delegator, // - AutoCloseable { - - private BindingIndependentMappingService delegate; - private ServiceReference reference; - private BundleContext bundleContext; - - public RuntimeGeneratedMappingServiceProxy(final BundleContext bundleContext, - final ServiceReference serviceRef, - final BindingIndependentMappingService delegate) { - this.bundleContext = Preconditions.checkNotNull(bundleContext); - this.reference = Preconditions.checkNotNull(serviceRef); - this.delegate = Preconditions.checkNotNull(delegate); - } - - @Override - public CodecRegistry getCodecRegistry() { - return delegate.getCodecRegistry(); - } - - @Override - public CompositeNode toDataDom(final DataObject data) { - return delegate.toDataDom(data); - } - - @Override - public Entry toDataDom( - final Entry, DataObject> entry) { - return delegate.toDataDom(entry); - } - - @Override - public YangInstanceIdentifier toDataDom(final InstanceIdentifier path) { - return delegate.toDataDom(path); - } - - @Override - public DataObject dataObjectFromDataDom( - final InstanceIdentifier path, - final CompositeNode result) throws DeserializationException { - return delegate.dataObjectFromDataDom(path, result); - } - - @Override - public InstanceIdentifier fromDataDom(final YangInstanceIdentifier entry) - throws DeserializationException { - return delegate.fromDataDom(entry); - } - - @Override - public Set getRpcQNamesFor(final Class service) { - return delegate.getRpcQNamesFor(service); - } - - @Override - public Optional> getRpcServiceClassFor(final String namespace, final String revision) { - return delegate.getRpcServiceClassFor(namespace,revision); - } - - @Override - public DataContainer dataObjectFromDataDom(final Class inputClass, final CompositeNode domInput) { - return delegate.dataObjectFromDataDom(inputClass, domInput); - } - - @Override - public void close() { - if(delegate != null) { - delegate = null; - - try { - bundleContext.ungetService(reference); - } catch (IllegalStateException e) { - // Indicates the BundleContext is no longer valid which can happen normally on shutdown. - LOG.debug( "Error unregistering service", e ); - } - - bundleContext= null; - reference = null; - } - } - - @Override - public BindingIndependentMappingService getDelegate() { - return delegate; - } - } } diff --git a/opendaylight/md-sal/sal-binding-dom-it/pom.xml b/opendaylight/md-sal/sal-binding-dom-it/pom.xml index fefd85b44b..01cd1f88ba 100644 --- a/opendaylight/md-sal/sal-binding-dom-it/pom.xml +++ b/opendaylight/md-sal/sal-binding-dom-it/pom.xml @@ -52,7 +52,6 @@ org.opendaylight.controller sal-test-model - 1.2.0-SNAPSHOT diff --git a/opendaylight/md-sal/sal-clustering-commons/pom.xml b/opendaylight/md-sal/sal-clustering-commons/pom.xml index 54a1fe7a95..f6d7dbab1a 100644 --- a/opendaylight/md-sal/sal-clustering-commons/pom.xml +++ b/opendaylight/md-sal/sal-clustering-commons/pom.xml @@ -55,7 +55,6 @@ com.google.code.findbugs jsr305 - 2.0.1 com.google.guava @@ -111,7 +110,6 @@ xmlunit xmlunit - 1.5 junit @@ -131,7 +129,6 @@ org.slf4j slf4j-simple - ${slf4j.version} test @@ -185,7 +182,6 @@ xmlunit xmlunit - 1.5 @@ -199,13 +195,11 @@ org.slf4j slf4j-simple - ${slf4j.version} test com.google.code.findbugs jsr305 - 2.0.1 com.codahale.metrics diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/ValueSerializer.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/ValueSerializer.java index aac45e18b5..bb7f9c35ee 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/ValueSerializer.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/ValueSerializer.java @@ -28,7 +28,7 @@ public class ValueSerializer { builder.setInstanceIdentifierValue( InstanceIdentifierUtils.toSerializable((YangInstanceIdentifier) value, context)); } else if(value instanceof Set) { - Set set = (Set) value; + Set set = (Set) value; if (!set.isEmpty()) { for (Object o : set) { if (o instanceof String) { @@ -59,7 +59,7 @@ public class ValueSerializer { return InstanceIdentifierUtils.fromSerializable( node.getInstanceIdentifierValue(), context); } else if(node.getIntValueType() == ValueType.BITS_TYPE.ordinal()){ - return new HashSet(node.getBitsValueList()); + return new HashSet<>(node.getBitsValueList()); } else if(node.getIntValueType() == ValueType.BINARY_TYPE.ordinal()){ return node.getBytesValue().toByteArray(); } diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/ValueType.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/ValueType.java index 6c884734e2..2007544b7e 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/ValueType.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/ValueType.java @@ -32,7 +32,7 @@ public enum ValueType { BIG_DECIMAL_TYPE, BINARY_TYPE; - private static Map types = new HashMap<>(); + private static Map, ValueType> types = new HashMap<>(); static { types.put(String.class, STRING_TYPE); diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/NormalizedNodeOutputStreamWriter.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/NormalizedNodeOutputStreamWriter.java index cbd7bf8853..08567fd79e 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/NormalizedNodeOutputStreamWriter.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/NormalizedNodeOutputStreamWriter.java @@ -204,7 +204,7 @@ public class NormalizedNodeOutputStreamWriter implements NormalizedNodeStreamWri } } - private void writeObjSet(Set set) throws IOException { + private void writeObjSet(Set set) throws IOException { if(!set.isEmpty()){ writer.writeInt(set.size()); for(Object o : set){ @@ -329,7 +329,7 @@ public class NormalizedNodeOutputStreamWriter implements NormalizedNodeStreamWri writer.writeShort((Short) value); break; case ValueTypes.BITS_TYPE: - writeObjSet((Set) value); + writeObjSet((Set) value); break; case ValueTypes.YANG_IDENTIFIER_TYPE: writeYangInstanceIdentifier((YangInstanceIdentifier) value); diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/ValueTypes.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/ValueTypes.java index 6035e3c644..80fa527b46 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/ValueTypes.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/ValueTypes.java @@ -31,7 +31,7 @@ public class ValueTypes { public static final byte BIG_INTEGER_TYPE = 10; public static final byte BIG_DECIMAL_TYPE = 11; - private static Map types = new HashMap<>(); + private static Map, Byte> types = new HashMap<>(); static { types.put(String.class, Byte.valueOf(STRING_TYPE)); diff --git a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/PathUtilsTest.java b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/PathUtilsTest.java index d1e3eb202f..75e8e2aa4a 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/PathUtilsTest.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/PathUtilsTest.java @@ -1,15 +1,13 @@ package org.opendaylight.controller.cluster.datastore.node.utils; +import com.google.common.collect.ImmutableSet; import org.junit.Test; import org.opendaylight.controller.cluster.datastore.util.TestModel; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; - import java.util.HashMap; -import java.util.HashSet; import java.util.Map; import java.util.Set; - import static junit.framework.TestCase.assertEquals; public class PathUtilsTest { @@ -92,8 +90,7 @@ public class PathUtilsTest { } private YangInstanceIdentifier.AugmentationIdentifier augmentationIdentifier(){ - Set childNames = new HashSet(); - childNames.add(QNameFactory.create("(urn:opendaylight:flow:table:statistics?revision=2013-12-15)flow-table-statistics")); + Set childNames = ImmutableSet.of(QNameFactory.create("(urn:opendaylight:flow:table:statistics?revision=2013-12-15)flow-table-statistics")); return new YangInstanceIdentifier.AugmentationIdentifier(childNames); } diff --git a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/ValueSerializerTest.java b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/ValueSerializerTest.java index 88c2695075..d0be36beeb 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/ValueSerializerTest.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/ValueSerializerTest.java @@ -355,8 +355,8 @@ public class ValueSerializerTest{ nodeBuilder.build()); assertTrue(o instanceof Set); - assertTrue(((Set)o).contains("foo")); - assertTrue(((Set) o).contains("bar")); + assertTrue(((Set)o).contains("foo")); + assertTrue(((Set) o).contains("bar")); } diff --git a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/util/InstanceIdentifierUtilsTest.java b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/util/InstanceIdentifierUtilsTest.java index 6cd06e9c1c..d15f534f80 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/util/InstanceIdentifierUtilsTest.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/util/InstanceIdentifierUtilsTest.java @@ -10,6 +10,7 @@ package org.opendaylight.controller.cluster.datastore.util; +import com.google.common.collect.ImmutableSet; import org.junit.Assert; import org.junit.Test; import org.opendaylight.controller.cluster.datastore.node.utils.serialization.QNameDeSerializationContext; @@ -20,7 +21,6 @@ import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import java.util.ArrayList; import java.util.Arrays; -import java.util.HashSet; import java.util.List; public class InstanceIdentifierUtilsTest { @@ -116,8 +116,8 @@ public class InstanceIdentifierUtilsTest { @Test public void testAugmentationIdentifier() { - YangInstanceIdentifier.PathArgument p1 = new YangInstanceIdentifier.AugmentationIdentifier(new HashSet( - Arrays.asList(TEST_QNAME))); + YangInstanceIdentifier.PathArgument p1 = new YangInstanceIdentifier.AugmentationIdentifier( + ImmutableSet.of(TEST_QNAME)); List arguments = new ArrayList<>(); diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionChainProxy.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionChainProxy.java index 2e671e3ce2..87959efe8a 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionChainProxy.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionChainProxy.java @@ -11,11 +11,9 @@ package org.opendaylight.controller.cluster.datastore; import akka.actor.ActorSelection; import akka.dispatch.OnComplete; import com.google.common.base.Preconditions; -import java.util.AbstractMap.SimpleEntry; import java.util.Collections; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicReferenceFieldUpdater; import org.opendaylight.controller.cluster.datastore.messages.CloseTransactionChain; import org.opendaylight.controller.cluster.datastore.utils.ActorContext; import org.opendaylight.controller.md.sal.common.api.data.TransactionChainClosedException; @@ -38,39 +36,31 @@ public class TransactionChainProxy implements DOMStoreTransactionChain { private interface State { boolean isReady(); - SimpleEntry>> getReadyFutures(); - - void setReadyFutures(Object txIdentifier, List> readyFutures); + List> getPreviousReadyFutures(); } private static class Allocated implements State { - private volatile SimpleEntry>> readyFutures; + private final ChainedTransactionProxy transaction; - @Override - public boolean isReady() { - return readyFutures != null; + Allocated(ChainedTransactionProxy transaction) { + this.transaction = transaction; } @Override - public SimpleEntry>> getReadyFutures() { - return readyFutures != null ? readyFutures : EMPTY_READY_FUTURES; + public boolean isReady() { + return transaction.isReady(); } @Override - public void setReadyFutures(Object txIdentifier, List> readyFutures) { - this.readyFutures = new SimpleEntry<>(txIdentifier, readyFutures); + public List> getPreviousReadyFutures() { + return transaction.getReadyFutures(); } } private static abstract class AbstractDefaultState implements State { @Override - public SimpleEntry>> getReadyFutures() { - return EMPTY_READY_FUTURES; - } - - @Override - public void setReadyFutures(Object txIdentifier, List> readyFutures) { - throw new IllegalStateException("No transaction is allocated"); + public List> getPreviousReadyFutures() { + return Collections.emptyList(); } } @@ -88,21 +78,15 @@ public class TransactionChainProxy implements DOMStoreTransactionChain { } }; - private static final SimpleEntry>> EMPTY_READY_FUTURES = - new SimpleEntry>>("", - Collections.>emptyList()); - - private static final AtomicReferenceFieldUpdater STATE_UPDATER = - AtomicReferenceFieldUpdater.newUpdater(TransactionChainProxy.class, State.class, "state"); + private static final AtomicInteger counter = new AtomicInteger(0); private final ActorContext actorContext; private final String transactionChainId; - private volatile State state = IDLE_STATE; - private static final AtomicInteger counter = new AtomicInteger(0); + private volatile State currentState = IDLE_STATE; public TransactionChainProxy(ActorContext actorContext) { this.actorContext = actorContext; - transactionChainId = actorContext.getCurrentMemberName() + "-transaction-chain-" + counter.incrementAndGet(); + transactionChainId = actorContext.getCurrentMemberName() + "-txn-chain-" + counter.incrementAndGet(); } public String getTransactionChainId() { @@ -111,8 +95,11 @@ public class TransactionChainProxy implements DOMStoreTransactionChain { @Override public DOMStoreReadTransaction newReadOnlyTransaction() { - checkReadyState(); - return new ChainedTransactionProxy(actorContext, TransactionProxy.TransactionType.READ_ONLY); + State localState = currentState; + checkReadyState(localState); + + return new ChainedTransactionProxy(actorContext, TransactionProxy.TransactionType.READ_ONLY, + transactionChainId, localState.getPreviousReadyFutures()); } @Override @@ -127,36 +114,61 @@ public class TransactionChainProxy implements DOMStoreTransactionChain { @Override public void close() { - state = CLOSED_STATE; + currentState = CLOSED_STATE; // Send a close transaction chain request to each and every shard actorContext.broadcast(new CloseTransactionChain(transactionChainId)); } private ChainedTransactionProxy allocateWriteTransaction(TransactionProxy.TransactionType type) { - checkReadyState(); + State localState = currentState; + + checkReadyState(localState); - ChainedTransactionProxy txProxy = new ChainedTransactionProxy(actorContext, type); - STATE_UPDATER.compareAndSet(this, IDLE_STATE, new Allocated()); + // Pass the ready Futures from the previous Tx. + ChainedTransactionProxy txProxy = new ChainedTransactionProxy(actorContext, type, + transactionChainId, localState.getPreviousReadyFutures()); + + currentState = new Allocated(txProxy); return txProxy; } - private void checkReadyState() { - Preconditions.checkState(state.isReady(), "Previous transaction %s is not ready yet", - state.getReadyFutures().getKey()); + private void checkReadyState(State state) { + Preconditions.checkState(state.isReady(), "Previous transaction is not ready yet"); } - private class ChainedTransactionProxy extends TransactionProxy { + private static class ChainedTransactionProxy extends TransactionProxy { + + /** + * Stores the ready Futures from the previous Tx in the chain. + */ + private final List> previousReadyFutures; + + /** + * Stores the ready Futures from this transaction when it is readied. + */ + private volatile List> readyFutures; - ChainedTransactionProxy(ActorContext actorContext, TransactionType transactionType) { + private ChainedTransactionProxy(ActorContext actorContext, TransactionType transactionType, + String transactionChainId, List> previousReadyFutures) { super(actorContext, transactionType, transactionChainId); + this.previousReadyFutures = previousReadyFutures; + } + + List> getReadyFutures() { + return readyFutures; + } + + boolean isReady() { + return readyFutures != null; } @Override protected void onTransactionReady(List> readyFutures) { - LOG.debug("onTransactionReady {} pending readyFutures size {} chain {}", getIdentifier(), readyFutures.size(), TransactionChainProxy.this.transactionChainId); - state.setReadyFutures(getIdentifier(), readyFutures); + LOG.debug("onTransactionReady {} pending readyFutures size {} chain {}", getIdentifier(), + readyFutures.size(), getTransactionChainId()); + this.readyFutures = readyFutures; } /** @@ -169,32 +181,13 @@ public class TransactionChainProxy implements DOMStoreTransactionChain { final Object serializedCreateMessage) { // Check if there are any previous ready Futures, otherwise let the super class handle it. - // The second check is done to ensure the the previous ready Futures aren't for this - // Tx instance as deadlock would occur if we tried to wait on our own Futures. This can - // occur in this scenario: - // - // - the TransactionProxy is created and the client does a write. - // - // - the TransactionProxy then attempts to create the shard Tx. However it first - // sends a FindPrimaryShard message to the shard manager to find the local shard - // This call is done async. - // - // - the client submits the Tx and the TransactionProxy is readied and we cache - // the ready Futures here. - // - // - then the FindPrimaryShard call completes and this method is called to create - // the shard Tx. However the cached Futures were from the ready on this Tx. If we - // tried to wait on them, it would cause a form of deadlock as the ready Future - // would be waiting on the Tx create Future and vice versa. - SimpleEntry>> readyFuturesEntry = state.getReadyFutures(); - List> readyFutures = readyFuturesEntry.getValue(); - if(readyFutures.isEmpty() || getIdentifier().equals(readyFuturesEntry.getKey())) { + if(previousReadyFutures.isEmpty()) { return super.sendCreateTransaction(shard, serializedCreateMessage); } // Combine the ready Futures into 1. Future> combinedFutures = akka.dispatch.Futures.sequence( - readyFutures, actorContext.getActorSystem().dispatcher()); + previousReadyFutures, getActorContext().getActorSystem().dispatcher()); // Add a callback for completion of the combined Futures. final Promise createTxPromise = akka.dispatch.Futures.promise(); @@ -205,15 +198,18 @@ public class TransactionChainProxy implements DOMStoreTransactionChain { // A Ready Future failed so fail the returned Promise. createTxPromise.failure(failure); } else { + LOG.debug("Previous Tx readied - sending CreateTransaction for {} on chain {}", + getIdentifier(), getTransactionChainId()); + // Send the CreateTx message and use the resulting Future to complete the // returned Promise. - createTxPromise.completeWith(actorContext.executeOperationAsync(shard, + createTxPromise.completeWith(getActorContext().executeOperationAsync(shard, serializedCreateMessage)); } } }; - combinedFutures.onComplete(onComplete, actorContext.getActorSystem().dispatcher()); + combinedFutures.onComplete(onComplete, getActorContext().getActorSystem().dispatcher()); return createTxPromise.future(); } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionProxy.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionProxy.java index 226ac75467..443e0af9e0 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionProxy.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionProxy.java @@ -534,6 +534,10 @@ public class TransactionProxy implements DOMStoreReadWriteTransaction { return transactionChainId; } + protected ActorContext getActorContext() { + return actorContext; + } + /** * Interface for a transaction operation to be invoked later. */ diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreIntegrationTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreIntegrationTest.java index 4f1a02e435..9f5aded352 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreIntegrationTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreIntegrationTest.java @@ -9,6 +9,8 @@ import akka.actor.PoisonPill; import com.google.common.base.Optional; import com.google.common.util.concurrent.CheckedFuture; import com.google.common.util.concurrent.Uninterruptibles; +import java.util.ArrayList; +import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutionException; @@ -633,6 +635,60 @@ public class DistributedDataStoreIntegrationTest extends AbstractActorTest { }}; } + @Test + public void testCreateChainedTransactionsInQuickSuccession() throws Exception{ + new IntegrationTestKit(getSystem()) {{ + DistributedDataStore dataStore = setupDistributedDataStore( + "testCreateChainedTransactionsInQuickSuccession", "test-1"); + + DOMStoreTransactionChain txChain = dataStore.createTransactionChain(); + + NormalizedNode testNode = ImmutableNodes.containerNode(TestModel.TEST_QNAME); + + int nTxs = 20; + List cohorts = new ArrayList<>(nTxs); + for(int i = 0; i < nTxs; i++) { + DOMStoreReadWriteTransaction rwTx = txChain.newReadWriteTransaction(); + + rwTx.merge(TestModel.TEST_PATH, testNode); + + cohorts.add(rwTx.ready()); + + } + + for(DOMStoreThreePhaseCommitCohort cohort: cohorts) { + doCommit(cohort); + } + + txChain.close(); + + cleanup(dataStore); + }}; + } + + @Test + public void testCreateChainedTransactionAfterEmptyTxReadied() throws Exception{ + new IntegrationTestKit(getSystem()) {{ + DistributedDataStore dataStore = setupDistributedDataStore( + "testCreateChainedTransactionAfterEmptyTxReadied", "test-1"); + + DOMStoreTransactionChain txChain = dataStore.createTransactionChain(); + + DOMStoreReadWriteTransaction rwTx1 = txChain.newReadWriteTransaction(); + + rwTx1.ready(); + + DOMStoreReadWriteTransaction rwTx2 = txChain.newReadWriteTransaction(); + + Optional> optional = rwTx2.read(TestModel.TEST_PATH).get(5, TimeUnit.SECONDS); + assertEquals("isPresent", false, optional.isPresent()); + + txChain.close(); + + cleanup(dataStore); + }}; + } + @Test public void testCreateChainedTransactionWhenPreviousNotReady() throws Throwable { new IntegrationTestKit(getSystem()) {{ diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTestKit.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTestKit.java index 79d5c5116d..fa15db6949 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTestKit.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTestKit.java @@ -30,7 +30,7 @@ class ShardTestKit extends JavaTestKit { super(actorSystem); } - protected void waitForLogMessage(final Class logLevel, ActorRef subject, String logMessage){ + protected void waitForLogMessage(final Class logLevel, ActorRef subject, String logMessage){ // Wait for a specific log message to show up final boolean result = new JavaTestKit.EventFilter(logLevel diff --git a/opendaylight/md-sal/sal-dom-broker/pom.xml b/opendaylight/md-sal/sal-dom-broker/pom.xml index dc20296ff5..264709f687 100644 --- a/opendaylight/md-sal/sal-dom-broker/pom.xml +++ b/opendaylight/md-sal/sal-dom-broker/pom.xml @@ -45,8 +45,6 @@ org.opendaylight.controller sal-inmemory-datastore - 1.2.0-SNAPSHOT - org.opendaylight.yangtools @@ -74,7 +72,6 @@ org.slf4j slf4j-simple - ${slf4j.version} test diff --git a/opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/sal/dom/broker/BackwardsCompatibleMountPointTest.java b/opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/sal/dom/broker/BackwardsCompatibleMountPointTest.java index cb1a99b4c0..f1b7261bcb 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/sal/dom/broker/BackwardsCompatibleMountPointTest.java +++ b/opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/sal/dom/broker/BackwardsCompatibleMountPointTest.java @@ -139,7 +139,7 @@ public class BackwardsCompatibleMountPointTest { private DataNormalizer mockNormalizer() throws DataNormalizationException { final DataNormalizer mock = mock(DataNormalizer.class); - doReturn(new AbstractMap.SimpleEntry>(id, normalizedNode) {}) + doReturn(new AbstractMap.SimpleEntry>(id, normalizedNode)) .when(mock).toNormalized(any(YangInstanceIdentifier.class), any(CompositeNode.class)); doReturn(compositeNode).when(mock).toLegacy(any(YangInstanceIdentifier.class), any(NormalizedNode.class)); doReturn(id).when(mock).toLegacy(any(YangInstanceIdentifier.class)); diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrint.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrint.java index 7b51d03a97..867c7a47b5 100644 --- a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrint.java +++ b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrint.java @@ -163,23 +163,23 @@ public class XSQLBluePrint implements DatabaseMetaData, Serializable { return cacheLoadedSuccessfuly; } - private static Map> superClassMap = new HashMap>(); + private static Map, Set>> superClassMap = new HashMap<>(); - public static Set getInheritance(Class myObjectClass, - Class returnType) { + public static Set> getInheritance(Class myObjectClass, + Class returnType) { if (returnType != null && myObjectClass.equals(returnType)) { - return new HashSet(); + return new HashSet<>(); } - Set result = superClassMap.get(myObjectClass); + Set> result = superClassMap.get(myObjectClass); if (result != null) { return result; } - result = new HashSet(); + result = new HashSet<>(); superClassMap.put(myObjectClass, result); if (returnType != null) { if (!returnType.equals(myObjectClass)) { - Class mySuperClass = myObjectClass.getSuperclass(); + Class mySuperClass = myObjectClass.getSuperclass(); while (mySuperClass != null) { result.add(mySuperClass); mySuperClass = mySuperClass.getSuperclass(); @@ -190,11 +190,11 @@ public class XSQLBluePrint implements DatabaseMetaData, Serializable { return result; } - public static Set collectInterfaces(Class cls) { - Set result = new HashSet(); - Class myInterfaces[] = cls.getInterfaces(); + public static Set> collectInterfaces(Class cls) { + Set> result = new HashSet<>(); + Class myInterfaces[] = cls.getInterfaces(); if (myInterfaces != null) { - for (Class in : myInterfaces) { + for (Class in : myInterfaces) { result.add(in); result.addAll(collectInterfaces(in)); } @@ -213,20 +213,20 @@ public class XSQLBluePrint implements DatabaseMetaData, Serializable { map.put(blNode.getBluePrintNodeName(), blNode); } - public Class getGenericType(ParameterizedType type) { + public Class getGenericType(ParameterizedType type) { Type[] typeArguments = type.getActualTypeArguments(); for (Type typeArgument : typeArguments) { if (typeArgument instanceof ParameterizedType) { ParameterizedType pType = (ParameterizedType) typeArgument; - return (Class) pType.getRawType(); + return (Class) pType.getRawType(); } else if (typeArgument instanceof Class) { - return (Class) typeArgument; + return (Class) typeArgument; } } return null; } - public Class getMethodReturnTypeFromGeneric(Method m) { + public Class getMethodReturnTypeFromGeneric(Method m) { Type rType = m.getGenericReturnType(); if (rType instanceof ParameterizedType) { return getGenericType((ParameterizedType) rType); diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrintNode.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrintNode.java index 8d905f2081..8e9ed3a26b 100644 --- a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrintNode.java +++ b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrintNode.java @@ -85,7 +85,7 @@ public class XSQLBluePrintNode implements Serializable { this.children.add(ch); } - public boolean isModelChild(Class p) { + public boolean isModelChild(Class p) { if (this.relations.size() == 0) { return false; } @@ -227,7 +227,7 @@ public class XSQLBluePrintNode implements Serializable { return "Unknown"; } - public Class getInterface() { + public Class getInterface() { return this.myInterface; } diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrintRelation.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrintRelation.java index 1cb3aa5559..38a96dc457 100644 --- a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrintRelation.java +++ b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrintRelation.java @@ -80,20 +80,20 @@ public class XSQLBluePrintRelation implements Serializable { } } - public List execute(Object o) { - List result = new LinkedList(); + public List execute(Object o) { + List result = new LinkedList<>(); if (o == null) { return null; } if (Set.class.isAssignableFrom(o.getClass())) { - Set lst = (Set) o; + Set lst = (Set) o; for (Object oo : lst) { addToResult(result, execute(oo)); } return result; } else if (List.class.isAssignableFrom(o.getClass())) { - List lst = (List) o; + List lst = (List) o; for (Object oo : lst) { addToResult(result, execute(oo)); } @@ -111,17 +111,17 @@ public class XSQLBluePrintRelation implements Serializable { return result; } - public static void addToResult(List result, Object o) { + private static void addToResult(List result, Object o) { if (o == null) { return; } if (Set.class.isAssignableFrom(o.getClass())) { - Set lst = (Set) o; + Set lst = (Set) o; for (Object oo : lst) { result.add(oo); } } else if (List.class.isAssignableFrom(o.getClass())) { - List lst = (List) o; + List lst = (List) o; for (Object oo : lst) { result.add(oo); } diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLColumn.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLColumn.java index 4c6cca7fa6..d3d57bd814 100644 --- a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLColumn.java +++ b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLColumn.java @@ -6,7 +6,7 @@ public class XSQLColumn implements Serializable, Comparable { private String name = null; private String tableName = null; private int charWidth = -1; - private Class type = null; + private Class type = null; private transient Object bluePrintNode = null; private String origName = null; private String origTableName = null; diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLODLUtils.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLODLUtils.java index 6a27230664..17b8ae5f29 100644 --- a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLODLUtils.java +++ b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLODLUtils.java @@ -32,7 +32,7 @@ public class XSQLODLUtils { types.put(Status.class, Status.class); } - public static boolean isColumnType(Class cls) { + public static boolean isColumnType(Class cls) { return types.containsKey(cls); } @@ -229,7 +229,7 @@ public class XSQLODLUtils { return "NULL"; } - public static Class getTypeForODLColumn(Object odlNode){ + public static Class getTypeForODLColumn(Object odlNode){ Object type = get(odlNode,"type"); if(type instanceof Uint32 || type instanceof Uint64){ return long.class; diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCResultSet.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCResultSet.java index 021f6ee19b..e47bf870cc 100644 --- a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCResultSet.java +++ b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCResultSet.java @@ -127,7 +127,7 @@ public class JDBCResultSet implements Serializable, ResultSet, return 1; } - public int isObjectFitCriteria(Object element, Class cls) { + public int isObjectFitCriteria(Object element, Class cls) { Map> tblCriteria = criteria.get(cls .getName()); if (tblCriteria == null) { diff --git a/opendaylight/md-sal/sal-remoterpc-connector/pom.xml b/opendaylight/md-sal/sal-remoterpc-connector/pom.xml index d16f67209f..ec5bb215bf 100644 --- a/opendaylight/md-sal/sal-remoterpc-connector/pom.xml +++ b/opendaylight/md-sal/sal-remoterpc-connector/pom.xml @@ -136,7 +136,6 @@ org.slf4j slf4j-simple - ${slf4j.version} test diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/registry/RpcRegistryTest.java b/opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/registry/RpcRegistryTest.java index e6489c0a5c..ee96cb897f 100644 --- a/opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/registry/RpcRegistryTest.java +++ b/opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/registry/RpcRegistryTest.java @@ -200,7 +200,7 @@ public class RpcRegistryTest { Messages.BucketStoreMessages.UpdateRemoteBuckets.class); } - private JavaTestKit createProbeForMessage(ActorSystem node, ActorPath subjectPath, final Class clazz) { + private JavaTestKit createProbeForMessage(ActorSystem node, ActorPath subjectPath, final Class clazz) { final JavaTestKit probe = new JavaTestKit(node); ConditionalProbe conditionalProbe = diff --git a/opendaylight/md-sal/sal-rest-docgen/pom.xml b/opendaylight/md-sal/sal-rest-docgen/pom.xml index 5abb4f8910..3d3c52d7d1 100644 --- a/opendaylight/md-sal/sal-rest-docgen/pom.xml +++ b/opendaylight/md-sal/sal-rest-docgen/pom.xml @@ -10,10 +10,6 @@ sal-rest-docgen bundle - - 3.0.4.Final - - com.fasterxml.jackson.core @@ -42,7 +38,6 @@ org.jboss.resteasy jaxrs-api - ${jaxrs-api.version} diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/impl/NotificationServiceImpl.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/impl/NotificationServiceImpl.java index c08f329f0d..192836e9fa 100644 --- a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/impl/NotificationServiceImpl.java +++ b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/impl/NotificationServiceImpl.java @@ -39,7 +39,7 @@ public class NotificationServiceImpl implements NotificationService { notifications.add(new QName(notificationType.toString())); String notificationStreamName = RemoteStreamTools.createNotificationStream(salRemoteService, notifications); final Map desiredEventStream = RemoteStreamTools.createEventStream(restconfClientContext, notificationStreamName); - RemoteNotificationListener remoteNotificationListener = new RemoteNotificationListener(listener); + RemoteNotificationListener remoteNotificationListener = new RemoteNotificationListener(listener); final ListenerRegistration listenerRegistration = restconfClientContext.getEventStreamContext(desiredEventStream.get(desiredEventStream.get(notificationStreamName))) .registerNotificationListener(remoteNotificationListener); diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/listeners/RemoteNotificationListener.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/listeners/RemoteNotificationListener.java index 895a5030e9..82fa2ae2e9 100644 --- a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/listeners/RemoteNotificationListener.java +++ b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/listeners/RemoteNotificationListener.java @@ -8,15 +8,16 @@ package org.opendaylight.controller.sal.restconf.broker.listeners; import org.opendaylight.controller.sal.binding.api.NotificationListener; +import org.opendaylight.yangtools.yang.binding.Notification; -public class RemoteNotificationListener implements org.opendaylight.yangtools.yang.binding.NotificationListener { +public class RemoteNotificationListener implements org.opendaylight.yangtools.yang.binding.NotificationListener { - org.opendaylight.controller.sal.binding.api.NotificationListener listener; + NotificationListener listener; - public RemoteNotificationListener(NotificationListener listener){ + public RemoteNotificationListener(NotificationListener listener){ this.listener = listener; } - public NotificationListener getListener(){ + public NotificationListener getListener() { return this.listener; } diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/listeners/SalNotificationListener.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/listeners/SalNotificationListener.java index 16ca0aee93..3c4bbba4a4 100644 --- a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/listeners/SalNotificationListener.java +++ b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/listeners/SalNotificationListener.java @@ -11,14 +11,14 @@ import org.opendaylight.controller.sal.binding.api.NotificationListener; import org.opendaylight.yangtools.yang.binding.Notification; -public class SalNotificationListener implements NotificationListener { - private NotificationListener notificationListener; +public class SalNotificationListener implements NotificationListener { + private NotificationListener notificationListener; - public SalNotificationListener( NotificationListener notificationListener){ + public SalNotificationListener( NotificationListener notificationListener){ this.notificationListener = notificationListener; } @Override public void onNotification(Notification notification) { - this.notificationListener.onNotification(notification); + this.notificationListener.onNotification((T)notification); } } diff --git a/opendaylight/md-sal/statistics-manager/pom.xml b/opendaylight/md-sal/statistics-manager/pom.xml index 1a443177c6..eb6c51b351 100644 --- a/opendaylight/md-sal/statistics-manager/pom.xml +++ b/opendaylight/md-sal/statistics-manager/pom.xml @@ -45,7 +45,6 @@ org.slf4j slf4j-log4j12 - ${slf4j.version} test diff --git a/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/toxml/SimpleUnionAttributeWritingStrategy.java b/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/toxml/SimpleUnionAttributeWritingStrategy.java index 4b2b47fbe7..4802cba7af 100644 --- a/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/toxml/SimpleUnionAttributeWritingStrategy.java +++ b/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/toxml/SimpleUnionAttributeWritingStrategy.java @@ -32,7 +32,7 @@ public class SimpleUnionAttributeWritingStrategy extends SimpleAttributeWritingS Util.checkType(listOfStrings, List.class); StringBuilder b = new StringBuilder(); - for (Object character: (List)listOfStrings) { + for (Object character: (List)listOfStrings) { Util.checkType(character, String.class); b.append(character); } diff --git a/opendaylight/netconf/config-netconf-connector/src/test/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/runtimerpc/RuntimeRpcElementResolvedTest.java b/opendaylight/netconf/config-netconf-connector/src/test/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/runtimerpc/RuntimeRpcElementResolvedTest.java index 816e118f39..3c4213cbc3 100644 --- a/opendaylight/netconf/config-netconf-connector/src/test/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/runtimerpc/RuntimeRpcElementResolvedTest.java +++ b/opendaylight/netconf/config-netconf-connector/src/test/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/runtimerpc/RuntimeRpcElementResolvedTest.java @@ -9,13 +9,12 @@ package org.opendaylight.controller.netconf.confignetconfconnector.operations.runtimerpc; import static org.junit.Assert.assertEquals; - +import com.google.common.collect.ImmutableMap; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.Map; - import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -35,9 +34,7 @@ public class RuntimeRpcElementResolvedTest { return Arrays.asList(new Object[][] { // With namespaces { "/a:modules/a:module[a:name='instanceName'][a:type='moduleType']/b:listener-state[b:peer-id='127.0.0.1']", - new HashMap() {{ - put("listener-state", "127.0.0.1"); - }}}, + new HashMap<>(ImmutableMap.of("listener-state", "127.0.0.1"))}, { "/a:modules/a:module[a:name='instanceName'][a:type='moduleType']", null}, @@ -57,10 +54,7 @@ public class RuntimeRpcElementResolvedTest { { "/modules/module[name=instanceName and type=moduleType]/inner[key=\"b\"]", Collections.singletonMap("inner", "b")}, { "/modules/module[name=instanceName and type=\"moduleType\"]/inner[key2=a]/inner2[key=b]", - new HashMap() {{ - put("inner", "a"); - put("inner2", "b"); - }} + new HashMap<>(ImmutableMap.of("inner", "a", "inner2", "b")) }, }); } diff --git a/opendaylight/netconf/netconf-client/src/test/java/org/opendaylight/controller/netconf/client/NetconfClientSessionNegotiatorTest.java b/opendaylight/netconf/netconf-client/src/test/java/org/opendaylight/controller/netconf/client/NetconfClientSessionNegotiatorTest.java index ac715d87d8..187f13b258 100644 --- a/opendaylight/netconf/netconf-client/src/test/java/org/opendaylight/controller/netconf/client/NetconfClientSessionNegotiatorTest.java +++ b/opendaylight/netconf/netconf-client/src/test/java/org/opendaylight/controller/netconf/client/NetconfClientSessionNegotiatorTest.java @@ -122,7 +122,7 @@ public class NetconfClientSessionNegotiatorTest { NetconfClientSessionNegotiator negotiator = createNetconfClientSessionNegotiator(promise, null); negotiator.channelActive(null); - Set caps = Sets.newSet("a", "b"); + Set caps = Sets.newSet("a", "b"); NetconfHelloMessage helloServerMessage = NetconfHelloMessage.createServerHello(caps, 10); negotiator.handleMessage(helloServerMessage); verify(promise).setSuccess(anyObject()); @@ -137,7 +137,7 @@ public class NetconfClientSessionNegotiatorTest { NetconfClientSessionNegotiator negotiator = createNetconfClientSessionNegotiator(promise, exiMessage); negotiator.channelActive(null); - Set caps = Sets.newSet("exi:1.0"); + Set caps = Sets.newSet("exi:1.0"); NetconfHelloMessage helloMessage = NetconfHelloMessage.createServerHello(caps, 10); doAnswer(new Answer() { diff --git a/opendaylight/netconf/netconf-client/src/test/java/org/opendaylight/controller/netconf/client/SimpleNetconfClientSessionListenerTest.java b/opendaylight/netconf/netconf-client/src/test/java/org/opendaylight/controller/netconf/client/SimpleNetconfClientSessionListenerTest.java index 29b903f235..9065ca45a2 100644 --- a/opendaylight/netconf/netconf-client/src/test/java/org/opendaylight/controller/netconf/client/SimpleNetconfClientSessionListenerTest.java +++ b/opendaylight/netconf/netconf-client/src/test/java/org/opendaylight/controller/netconf/client/SimpleNetconfClientSessionListenerTest.java @@ -25,7 +25,7 @@ public class SimpleNetconfClientSessionListenerTest { private Channel channel; private ChannelFuture channelFuture; - Set caps; + Set caps; private NetconfHelloMessage helloMessage; private NetconfMessage message; private NetconfClientSessionListener sessionListener; diff --git a/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/NetconfMonitoringServiceImplTest.java b/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/NetconfMonitoringServiceImplTest.java index a188550d40..2125035799 100644 --- a/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/NetconfMonitoringServiceImplTest.java +++ b/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/NetconfMonitoringServiceImplTest.java @@ -73,8 +73,8 @@ public class NetconfMonitoringServiceImplTest { public void testGetSchemas3() throws Exception { doReturn("").when(managementSession).toString(); Capability cap = mock(Capability.class); - Set caps = Sets.newHashSet(cap); - Set services = Sets.newHashSet(operationService); + Set caps = Sets.newHashSet(cap); + Set services = Sets.newHashSet(operationService); doReturn(snapshot).when(operationProvider).openSnapshot(anyString()); doReturn(services).when(snapshot).getServices(); doReturn(caps).when(operationService).getCapabilities(); diff --git a/opendaylight/netconf/netconf-netty-util/pom.xml b/opendaylight/netconf/netconf-netty-util/pom.xml index a9c1e8336d..f1f7375f0a 100644 --- a/opendaylight/netconf/netconf-netty-util/pom.xml +++ b/opendaylight/netconf/netconf-netty-util/pom.xml @@ -104,7 +104,6 @@ org.apache.maven.plugins maven-jar-plugin - 2.4 diff --git a/opendaylight/netconf/pom.xml b/opendaylight/netconf/pom.xml index b392c5b672..0a3a77cc60 100644 --- a/opendaylight/netconf/pom.xml +++ b/opendaylight/netconf/pom.xml @@ -112,7 +112,6 @@ org.apache.maven.plugins maven-checkstyle-plugin - 2.12 false false diff --git a/opendaylight/northbound/bundlescanner/implementation/src/main/java/org/opendaylight/controller/northbound/bundlescanner/internal/BundleScanner.java b/opendaylight/northbound/bundlescanner/implementation/src/main/java/org/opendaylight/controller/northbound/bundlescanner/internal/BundleScanner.java index c590da4dbc..2fee2720c2 100644 --- a/opendaylight/northbound/bundlescanner/implementation/src/main/java/org/opendaylight/controller/northbound/bundlescanner/internal/BundleScanner.java +++ b/opendaylight/northbound/bundlescanner/implementation/src/main/java/org/opendaylight/controller/northbound/bundlescanner/internal/BundleScanner.java @@ -294,8 +294,8 @@ import org.slf4j.LoggerFactory; if (classes == null || classes.size() == 0) return; Map names = new HashMap(); StringBuilder conflictsMsg = new StringBuilder(); - for (Class c : classes) { - XmlRootElement root = (XmlRootElement) c.getAnnotation(XmlRootElement.class); + for (Class c : classes) { + XmlRootElement root = c.getAnnotation(XmlRootElement.class); if (root == null) continue; String rootName = root.name(); if ("##default".equals(rootName)) { diff --git a/opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallPolicyNorthbound.java b/opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallPolicyNorthbound.java index bfe2c922bd..cc45d6de5d 100644 --- a/opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallPolicyNorthbound.java +++ b/opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallPolicyNorthbound.java @@ -79,7 +79,7 @@ public class NeutronFirewallPolicyNorthbound { @QueryParam("name") String queryFirewallPolicyName, @QueryParam("description") String querySecurityPolicyDescription, @QueryParam("shared") String querySecurityPolicyIsShared, - @QueryParam("firewall_rules") List querySecurityPolicyFirewallRules, + @QueryParam("firewall_rules") List querySecurityPolicyFirewallRules, @QueryParam("audited") Boolean querySecurityPolicyIsAudited, // pagination @QueryParam("limit") String limit, diff --git a/opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronNetworkRequest.java b/opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronNetworkRequest.java index a4c113c2c1..2001fb758a 100644 --- a/opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronNetworkRequest.java +++ b/opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronNetworkRequest.java @@ -9,17 +9,15 @@ package org.opendaylight.controller.networkconfig.neutron.northbound; import java.util.List; - import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; - import org.opendaylight.controller.networkconfig.neutron.NeutronNetwork; @XmlRootElement @XmlAccessorType(XmlAccessType.NONE) -public class NeutronNetworkRequest implements INeutronRequest { +public class NeutronNetworkRequest implements INeutronRequest { // See OpenStack Network API v2.0 Reference for description of // annotated attributes @@ -50,14 +48,17 @@ public class NeutronNetworkRequest implements INeutronRequest { singletonNetwork = net; } + @Override public NeutronNetwork getSingleton() { return singletonNetwork; } + @Override public boolean isSingleton() { return (singletonNetwork != null); } + @Override public List getBulk() { return bulkRequest; } diff --git a/opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronPortRequest.java b/opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronPortRequest.java index 12b58aa2ab..3bfac8a4fd 100644 --- a/opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronPortRequest.java +++ b/opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronPortRequest.java @@ -9,17 +9,15 @@ package org.opendaylight.controller.networkconfig.neutron.northbound; import java.util.List; - import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; - import org.opendaylight.controller.networkconfig.neutron.NeutronPort; @XmlRootElement @XmlAccessorType(XmlAccessType.NONE) -public class NeutronPortRequest implements INeutronRequest { +public class NeutronPortRequest implements INeutronRequest { // See OpenStack Network API v2.0 Reference for description of // annotated attributes @@ -50,14 +48,17 @@ public class NeutronPortRequest implements INeutronRequest { singletonPort = port; } + @Override public NeutronPort getSingleton() { return singletonPort; } + @Override public boolean isSingleton() { return (singletonPort != null); } + @Override public List getBulk() { return bulkRequest; } diff --git a/opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSubnetRequest.java b/opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSubnetRequest.java index 57a724c1cc..4c230c525b 100644 --- a/opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSubnetRequest.java +++ b/opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSubnetRequest.java @@ -9,18 +9,15 @@ package org.opendaylight.controller.networkconfig.neutron.northbound; import java.util.List; - import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; - import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet; @XmlRootElement @XmlAccessorType(XmlAccessType.NONE) - -public class NeutronSubnetRequest implements INeutronRequest { +public class NeutronSubnetRequest implements INeutronRequest { // See OpenStack Network API v2.0 Reference for description of // annotated attributes @@ -54,14 +51,17 @@ public class NeutronSubnetRequest implements INeutronRequest { links = null; } + @Override public NeutronSubnet getSingleton() { return singletonSubnet; } + @Override public List getBulk() { return bulkRequest; } + @Override public boolean isSingleton() { return (singletonSubnet != null); } diff --git a/opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/PaginatedRequestFactory.java b/opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/PaginatedRequestFactory.java index 8f05e76e18..5f9653f902 100644 --- a/opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/PaginatedRequestFactory.java +++ b/opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/PaginatedRequestFactory.java @@ -10,6 +10,11 @@ package org.opendaylight.controller.networkconfig.neutron.northbound; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import javax.ws.rs.core.UriInfo; import org.opendaylight.controller.networkconfig.neutron.INeutronObject; import org.opendaylight.controller.networkconfig.neutron.NeutronNetwork; import org.opendaylight.controller.networkconfig.neutron.NeutronPort; @@ -17,12 +22,6 @@ import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet; import org.opendaylight.controller.northbound.commons.exception.BadRequestException; import org.opendaylight.controller.northbound.commons.exception.ResourceNotFoundException; -import javax.ws.rs.core.UriInfo; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; - public class PaginatedRequestFactory { public static class PaginationResults { @@ -35,26 +34,33 @@ public class PaginatedRequestFactory { } } - public static INeutronRequest createRequest(Integer limit, String marker, + /* + * SuppressWarnings is needed because the compiler does not understand that we + * are actually safe here. + * + * FIXME: the only caller performs a cast back, so this is not actually necessary. + */ + @SuppressWarnings("unchecked") + public static INeutronRequest createRequest(Integer limit, String marker, Boolean pageReverse, UriInfo uriInfo, List collection, Class clazz) { - PaginationResults results = _paginate(limit, marker, pageReverse, uriInfo, collection); + PaginationResults results = _paginate(limit, marker, pageReverse, uriInfo, collection); if (clazz.equals(NeutronNetwork.class)){ - return new NeutronNetworkRequest(results.collection, results.links); + return (INeutronRequest) new NeutronNetworkRequest((List) results.collection, results.links); } if (clazz.equals(NeutronSubnet.class)){ - return new NeutronSubnetRequest(results.collection, results.links); + return (INeutronRequest) new NeutronSubnetRequest((List) results.collection, results.links); } if (clazz.equals(NeutronPort.class)){ - return new NeutronPortRequest(results.collection, results.links); + return (INeutronRequest) new NeutronPortRequest((List) results.collection, results.links); } return null; } - private static PaginationResults _paginate(Integer limit, String marker, Boolean pageReverse, UriInfo uriInfo, List collection) { + private static PaginationResults _paginate(Integer limit, String marker, Boolean pageReverse, UriInfo uriInfo, List collection) { List links = new ArrayList<>(); Integer startPos = null; String startMarker; @@ -80,10 +86,12 @@ public class PaginatedRequestFactory { class MarkerObject implements INeutronObject { private String id; + @Override public String getID() { return id; } + @Override public void setID(String id) { this.id = id; } @@ -149,6 +157,6 @@ public class PaginatedRequestFactory { links.add(previous); } - return new PaginationResults(collection, links); + return new PaginationResults(collection, links); } } diff --git a/opendaylight/topologymanager/implementation/pom.xml b/opendaylight/topologymanager/implementation/pom.xml index 430dfca74d..e5616be222 100644 --- a/opendaylight/topologymanager/implementation/pom.xml +++ b/opendaylight/topologymanager/implementation/pom.xml @@ -44,7 +44,6 @@ org.apache.felix maven-bundle-plugin - ${bundle.plugin.version} true diff --git a/opendaylight/topologymanager/shell/pom.xml b/opendaylight/topologymanager/shell/pom.xml index 2de8c5c26c..4aa3e2791f 100644 --- a/opendaylight/topologymanager/shell/pom.xml +++ b/opendaylight/topologymanager/shell/pom.xml @@ -27,7 +27,6 @@ org.opendaylight.controller topologymanager - ${topologymanager.version} @@ -36,7 +35,6 @@ org.apache.felix maven-bundle-plugin - ${bundle.plugin.version} org.apache.felix.service.command,