X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fclustering%2Fintegrationtest%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fclustering%2Fservices_implementation%2Finternal%2FClusteringServicesIT.java;h=166dec4b480d4ccf85731eaaa2ecd627a31369a0;hp=80f5558bcf853d91e03cf35ed95ceac3bb1419b0;hb=405ea7ce68d22bd3d2501857c5253793b581b086;hpb=1d125367e70817a6c6fdcb253a00a0cfaa7d7e3e diff --git a/opendaylight/clustering/integrationtest/src/test/java/org/opendaylight/controller/clustering/services_implementation/internal/ClusteringServicesIT.java b/opendaylight/clustering/integrationtest/src/test/java/org/opendaylight/controller/clustering/services_implementation/internal/ClusteringServicesIT.java index 80f5558bcf..166dec4b48 100644 --- a/opendaylight/clustering/integrationtest/src/test/java/org/opendaylight/controller/clustering/services_implementation/internal/ClusteringServicesIT.java +++ b/opendaylight/clustering/integrationtest/src/test/java/org/opendaylight/controller/clustering/services_implementation/internal/ClusteringServicesIT.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.clustering.services_implementation.internal; import static org.junit.Assert.assertEquals; @@ -19,7 +26,6 @@ import java.util.Dictionary; import java.util.HashSet; import java.util.Hashtable; import java.util.Set; -import java.util.List; import java.util.concurrent.ConcurrentMap; import javax.inject.Inject; @@ -39,12 +45,11 @@ import org.opendaylight.controller.clustering.services.ICacheUpdateAware; import org.opendaylight.controller.sal.utils.ServiceHelper; import org.opendaylight.controller.sal.core.UpdateType; import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.junit.Configuration; +import org.ops4j.pax.exam.Configuration; import org.ops4j.pax.exam.junit.PaxExam; import org.ops4j.pax.exam.util.PathUtils; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceReference; import org.osgi.framework.ServiceRegistration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -101,9 +106,10 @@ public class ClusteringServicesIT { mavenBundle("org.opendaylight.controller", "sal").versionAsInProject(), mavenBundle("org.opendaylight.controller", "sal.implementation").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "configuration").versionAsInProject(), mavenBundle("org.opendaylight.controller", "containermanager").versionAsInProject(), mavenBundle("org.opendaylight.controller", - "containermanager.implementation").versionAsInProject(), + "containermanager.it.implementation").versionAsInProject(), mavenBundle("org.jboss.spec.javax.transaction", "jboss-transaction-api_1.1_spec").versionAsInProject(), mavenBundle("org.apache.commons", "commons-lang3").versionAsInProject(), @@ -111,6 +117,7 @@ public class ClusteringServicesIT { "org.apache.felix.dependencymanager").versionAsInProject(), mavenBundle("org.apache.felix", "org.apache.felix.dependencymanager.shell").versionAsInProject(), + mavenBundle("eclipselink", "javax.resource").versionAsInProject(), junitBundles()); } @@ -134,10 +141,10 @@ public class ClusteringServicesIT { assertNotNull(bc); boolean debugit = false; Bundle b[] = bc.getBundles(); - for (int i = 0; i < b.length; i++) { - int state = b[i].getState(); + for (Bundle element : b) { + int state = element.getState(); if (state != Bundle.ACTIVE && state != Bundle.RESOLVED) { - log.debug("Bundle:" + b[i].getSymbolicName() + " state:" + log.debug("Bundle:" + element.getSymbolicName() + " state:" + stateToString(state)); debugit = true; } @@ -362,6 +369,25 @@ public class ClusteringServicesIT { assertTrue(up.value.equals("baz")); assertTrue(up.cacheName.equals(cache1)); + /**********************************/ + /* RE-UPDATE AN EXISTING KEY CASE */ + /**********************************/ + // Start monitoring the updates + res = listener.restart(1); + // modify the cache + cm11.put(k1, "baz"); + // Wait + res.await(100L, TimeUnit.SECONDS); + // Analyze the updates + ups = listener.getUpdates(); + assertTrue(ups.size() == 1); + // Validate we get an update with expect fields + up = ups.get(0); + assertTrue(up.t.equals(UpdateType.CHANGED)); + assertTrue(up.key.equals(k1)); + assertTrue(up.value.equals("baz")); + assertTrue(up.cacheName.equals(cache1)); + /********************************/ /* REMOVAL OF EXISTING KEY CASE */ /********************************/