Fix issue Felix-1002
Static binding policy now stop the entire instance and restart it when the dependency is broken. POJO objects are lost, and service tracking is reinitialized (this means that services may be injected in a different order).
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@758767 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/ServiceImporter.java b/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/ServiceImporter.java
index dcc9e4a..6036f1c 100644
--- a/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/ServiceImporter.java
+++ b/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/ServiceImporter.java
@@ -190,6 +190,13 @@
public void freeze() {
m_isFrozen = true;
}
+
+ /**
+ * Unfreezes.
+ */
+ public void unfreeze() {
+ m_isFrozen = false;
+ }
public boolean isFrozen() {
return m_isFrozen;
diff --git a/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/SvcInstance.java b/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/SvcInstance.java
index 965ef72..9457edf 100644
--- a/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/SvcInstance.java
+++ b/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/SvcInstance.java
@@ -124,6 +124,14 @@
public void freeze() {
m_isFrozen = true;
}
+
+ /**
+ * Unfreezes.
+ */
+ public void unfreeze() {
+ m_isFrozen = false;
+ }
+
/**
* Create an instance for the given reference. The instance is not added inside the map.
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java
index ba3b829..8a353ea 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java
@@ -202,6 +202,14 @@
public synchronized boolean isFrozen() {
return m_isFrozen;
}
+
+ /**
+ * Unfreeze the dependency.
+ * @see org.apache.felix.ipojo.util.DependencyModel#unfreeze()
+ */
+ public synchronized void unfreeze() {
+ m_isFrozen = false;
+ }
/**
* Call the bind method.
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/util/DependencyModel.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/util/DependencyModel.java
index 3ba0ebf..f97857b 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/util/DependencyModel.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/util/DependencyModel.java
@@ -201,6 +201,7 @@
* @see DependencyModel#computeDependencyState()
*/
public void start() {
+ m_state = UNRESOLVED;
m_tracker = new Tracker(m_context, m_specification.getName(), this);
m_tracker.open();
computeDependencyState();
@@ -216,6 +217,7 @@
m_tracker.close();
m_tracker = null;
}
+ m_matchingRefs.clear();
ungetAllServices();
m_state = UNRESOLVED;
}
@@ -253,6 +255,16 @@
public boolean isFrozen() {
return false;
}
+
+
+ /**
+ * Unfreezes the dependency.
+ * This method must be overide by concrete dependency to support
+ * the static binding policy. This method is called after tracking restarting.
+ */
+ public void unfreeze() {
+ // nothing to do
+ }
/**
* Does the service reference match ? This method must be override by
@@ -353,7 +365,6 @@
* @param ref the new reference
*/
private void manageArrival(ServiceReference ref) {
-
// Create a local copy of the state and of the list size.
int state = m_state;
int size;
@@ -427,7 +438,15 @@
if (isFrozen() && obj != null) {
if (m_state != BROKEN) {
m_state = BROKEN;
- invalidate();
+ invalidate(); // This will invalidate the instance.
+ // Reinitialize the dependency tracking
+ ComponentInstance instance = null;
+ synchronized (this) {
+ instance = m_instance;
+ }
+ instance.stop(); // Stop the instance
+ unfreeze();
+ instance.start();
}
} else {
synchronized (this) {
diff --git a/ipojo/tests/core/service-dependency-bindingpolicy/pom.xml b/ipojo/tests/core/service-dependency-bindingpolicy/pom.xml
index 1289243..59ed4a5 100644
--- a/ipojo/tests/core/service-dependency-bindingpolicy/pom.xml
+++ b/ipojo/tests/core/service-dependency-bindingpolicy/pom.xml
@@ -99,6 +99,22 @@
<target>1.4</target>
</configuration>
</plugin>
+ <!--<plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-junit4osgi-plugin
+ </artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <hideOutputs>false</hideOutputs>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>-->
</plugins>
</build>
</project>
diff --git a/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/MethodSimpleDependencies.java b/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/MethodSimpleDependencies.java
index 66f75fd..6630313 100644
--- a/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/MethodSimpleDependencies.java
+++ b/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/MethodSimpleDependencies.java
@@ -99,6 +99,7 @@
fooProvider.stop();
+ arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
@@ -136,6 +137,7 @@
fooProvider.stop();
+ arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance4.getInstanceName());
id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
@@ -173,6 +175,7 @@
fooProvider.stop();
+ arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance5.getInstanceName());
id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
diff --git a/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/MultipleDependencies.java b/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/MultipleDependencies.java
index 3b036a5..6f64a65 100644
--- a/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/MultipleDependencies.java
+++ b/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/MultipleDependencies.java
@@ -108,6 +108,7 @@
assertEquals("Check FS invocation (double) - 1", ((Double)props.get("double")).doubleValue(), 1.0);
fooProvider2.start();
+ Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
@@ -126,9 +127,10 @@
assertEquals("Check FS invocation (double) - 2", ((Double)props.get("double")).doubleValue(), 1.0);
fooProvider1.stop();
-
+ // instance is stopped and then restarted, so bound to fooprovider 2.
+ arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
- assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.INVALID);
+ assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
id = null;
cs = null;
@@ -182,9 +184,10 @@
assertEquals("Check FS invocation (double) - 2", ((Double) props.get("double")).doubleValue(), 1.0);
fooProvider1.stop();
-
+
+ arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance2.getInstanceName());
id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
- assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.INVALID);
+ assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
id = null;
cs = null;
@@ -238,9 +241,10 @@
assertEquals("Check FS invocation (double) - 2", ((Double) props.get("double")).doubleValue(), 1.0);
fooProvider1.stop();
-
+ // Instance stopped and then restarted, bound to foo provider 2.
+ arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
- assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.INVALID);
+ assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
id = null;
cs = null;
@@ -294,9 +298,10 @@
assertEquals("Check FS invocation (double) - 2", ((Double) props.get("double")).doubleValue(), 1.0);
fooProvider1.stop();
-
+ // Stop and then restarted, bound to foo provider 2.
+ arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance4.getInstanceName());
id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
- assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.INVALID);
+ assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
id = null;
cs = null;
diff --git a/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/OptionalDependencies.java b/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/OptionalDependencies.java
index dad741d..842e3d4 100644
--- a/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/OptionalDependencies.java
+++ b/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/OptionalDependencies.java
@@ -81,7 +81,7 @@
fooProvider = null;
}
- public void atestSimple() {
+ public void testSimple() {
ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
@@ -107,6 +107,7 @@
fooProvider.start();
+ arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
@@ -129,6 +130,7 @@
fooProvider.stop();
+ arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
@@ -138,7 +140,7 @@
getContext().ungetService(cs_ref);
}
- public void atestDelayedSimple() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException {
+ public void testDelayedSimple() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException {
instance1.stop();
fooProvider.start();
instance1.start();
@@ -167,9 +169,9 @@
assertEquals("Check FS invocation (double) - 2", ((Double)props.get("double")).doubleValue(), 1.0);
fooProvider.stop();
-
+ arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
- assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.INVALID); // Dependency broken
+ assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID); // Dependency broken,re started with no service.
id = null;
cs = null;
@@ -177,7 +179,7 @@
getContext().ungetService(cs_ref);
}
- public void atestVoid() {
+ public void testVoid() {
ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance2.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
@@ -202,6 +204,7 @@
fooProvider.start();
+ arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance2.getInstanceName());
id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
@@ -223,6 +226,7 @@
fooProvider.stop();
+ arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance2.getInstanceName());
id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
@@ -276,9 +280,11 @@
assertEquals("Check FS invocation (double) - 2", ((Double)props.get("double")).doubleValue(), 1.0);
fooProvider.stop();
+ // The instance is restarted.
+ arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance2.getInstanceName());
id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
- assertTrue("Check instance validity - 3 (" + id.getState() + ")", id.getState() == ComponentInstance.INVALID); // Dependency broken
+ assertTrue("Check instance validity - 3 (" + id.getState() + ")", id.getState() == ComponentInstance.VALID); // Dependency broken and then (no service injected) restarted
id = null;
cs = null;
@@ -286,7 +292,7 @@
getContext().ungetService(cs_ref);
}
- public void atestObject() {
+ public void testObject() {
ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
@@ -307,6 +313,7 @@
fooProvider.start();
+ arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
@@ -324,6 +331,7 @@
fooProvider.stop();
+ arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
@@ -344,7 +352,7 @@
getContext().ungetService(cs_ref);
}
- public void atestDelayedObject() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException {
+ public void testDelayedObject() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException {
instance3.stop();
fooProvider.start();
instance3.start();
@@ -374,8 +382,9 @@
fooProvider.stop();
+ arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
- assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.INVALID); // Dependency broken
+ assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID); // Dependency broken and restarted with no service
id = null;
cs = null;
diff --git a/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/SimpleDependencies.java b/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/SimpleDependencies.java
index a145022..b3948ba 100644
--- a/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/SimpleDependencies.java
+++ b/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/SimpleDependencies.java
@@ -24,11 +24,10 @@
import org.apache.felix.ipojo.architecture.Architecture;
import org.apache.felix.ipojo.architecture.InstanceDescription;
import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.test.scenarios.service.dependency.service.CheckService;
import org.apache.felix.ipojo.test.scenarios.util.Utils;
import org.osgi.framework.ServiceReference;
-import org.apache.felix.ipojo.test.scenarios.service.dependency.service.CheckService;
-
public class SimpleDependencies extends OSGiTestCase {
ComponentInstance instance1, instance2, instance3, instance4, instance5;
@@ -98,22 +97,29 @@
assertTrue("check CheckService invocation", cs.check());
fooProvider.stop();
+ // instance1 has to be stopped and restarted.
+
+ arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
fooProvider.start();
+ arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
- assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.INVALID);
+ assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID); // The instance was invalidated and revalidated.
cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
- assertNull("Check CheckService availability", cs_ref);
+ assertNotNull("Check CheckService availability", cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
+ assertTrue("check CheckService invocation", cs.check());
fooProvider.stop();
+ arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
- assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
+ assertTrue("Check instance invalidity - 3", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
@@ -148,20 +154,23 @@
assertEquals("check both unbind callback invocation -1", ((Integer)props.get("bothU")).intValue(), 0);
fooProvider.stop();
-
+
+ arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance2.getInstanceName());
id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
fooProvider.start();
+ arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance2.getInstanceName());
id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
- assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.INVALID);
+ assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID); // The instance was revalidated.
cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
- assertNull("Check CheckService availability - 2", cs_ref);
+ assertNotNull("Check CheckService availability - 2", cs_ref);
fooProvider.stop();
+ arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance2.getInstanceName());
id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
@@ -198,19 +207,22 @@
fooProvider.stop();
+ arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
fooProvider.start();
+ arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
- assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.INVALID);
+ assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
- assertNull("Check CheckService availability - 2", cs_ref);
+ assertNotNull("Check CheckService availability - 2", cs_ref);
fooProvider.stop();
+ arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
@@ -247,19 +259,23 @@
fooProvider.stop();
+ arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance4.getInstanceName());
id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
fooProvider.start();
+ arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance4.getInstanceName());
id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
- assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.INVALID);
+ assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
+
cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance4.getInstanceName());
- assertNull("Check CheckService availability - 2", cs_ref);
+ assertNotNull("Check CheckService availability - 2", cs_ref);
fooProvider.stop();
+ arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance4.getInstanceName());
id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
@@ -296,19 +312,22 @@
fooProvider.stop();
+ arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance4.getInstanceName());
id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
fooProvider.start();
+ arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance4.getInstanceName());
id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
- assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.INVALID);
+ assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance5.getInstanceName());
- assertNull("Check CheckService availability - 2", cs_ref);
+ assertNotNull("Check CheckService availability - 2", cs_ref);
fooProvider.stop();
+ arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance4.getInstanceName());
id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);