Implement the new iPOJO introspection API.
Now, instances (primitive instances) are reconfigurable from their instance descriptions. Service dependencies can directly be reconfigured, as well as properties and published services.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@732628 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/PrimitiveInstanceDescription.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/PrimitiveInstanceDescription.java
index b7d135d..f09686e 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/PrimitiveInstanceDescription.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/PrimitiveInstanceDescription.java
@@ -20,6 +20,15 @@
import org.apache.felix.ipojo.architecture.ComponentTypeDescription;
import org.apache.felix.ipojo.architecture.InstanceDescription;
+import org.apache.felix.ipojo.architecture.PropertyDescription;
+import org.apache.felix.ipojo.handlers.configuration.ConfigurationHandler;
+import org.apache.felix.ipojo.handlers.configuration.ConfigurationHandlerDescription;
+import org.apache.felix.ipojo.handlers.dependency.DependencyDescription;
+import org.apache.felix.ipojo.handlers.dependency.DependencyHandler;
+import org.apache.felix.ipojo.handlers.dependency.DependencyHandlerDescription;
+import org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceDescription;
+import org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceHandler;
+import org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceHandlerDescription;
import org.apache.felix.ipojo.metadata.Attribute;
import org.apache.felix.ipojo.metadata.Element;
@@ -44,7 +53,6 @@
* @return the created objects.
*/
public String[] getCreatedObjects() {
- // TODO should get a copy
Object [] objs = ((InstanceManager) m_instance).getPojoObjects();
if (objs != null) {
String[] result = new String[objs.length];
@@ -58,6 +66,97 @@
}
/**
+ * Gets the instance service dependencies.
+ * @return the set of dependency description or an empty array if
+ * no dependencies.
+ */
+ public DependencyDescription[] getDependencies() {
+ Handler handler = ((InstanceManager) m_instance).getHandler("org.apache.felix.ipojo:requires");
+ if (handler == null) {
+ return new DependencyDescription[0];
+ } else {
+ return ((DependencyHandlerDescription) ((DependencyHandler) handler)
+ .getDescription()).getDependencies();
+ }
+ }
+
+ /**
+ * Gets the instance service dependency matching with the given service specification or id.
+ * @param specification the service specification of the looked specification.
+ * @return the dependency description matching with the given service specification or id.
+ * <code>null</code> is not found.
+ * no dependencies.
+ */
+ public DependencyDescription getDependency(String specification) {
+ DependencyDescription[] deps = getDependencies();
+ if (deps == null) {
+ return null;
+ } else {
+ for (int i = 0; i < deps.length; i++) {
+ if (specification.equals(deps[i].getId())
+ || specification.equals(deps[i].getSpecification())) {
+ return deps[i];
+ }
+
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Gets the instance provided service matching with the given service specification.
+ * @param specification the provided specification of the looked provided service.
+ * @return the provided service description matching with the given service specification.
+ * <code>null</code> is not found.
+ */
+ public ProvidedServiceDescription getProvidedService(String specification) {
+ ProvidedServiceDescription[] pss = getProvidedServices();
+ if (pss == null) {
+ return null;
+ } else {
+ for (int i = 0; i < pss.length; i++) {
+ String[] str = pss[i].getServiceSpecifications();
+ for (int j = 0; j < str.length; j++) {
+ if (specification.equals(str[j])) {
+ return pss[i];
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Gets the instance provided service.
+ * @return the set of provided service description or an empty array if
+ * no provided services.
+ */
+ public ProvidedServiceDescription[] getProvidedServices() {
+ Handler handler = ((InstanceManager) m_instance).getHandler("org.apache.felix.ipojo:provides");
+ if (handler == null) {
+ return new ProvidedServiceDescription[0];
+ } else {
+ return ((ProvidedServiceHandlerDescription) ((ProvidedServiceHandler) handler)
+ .getDescription()).getProvidedServices();
+ }
+ }
+
+ /**
+ * Gets the instance properties.
+ * @return the set of property descriptions or an empty array if
+ * no properties.
+ */
+ public PropertyDescription[] getProperties() {
+ Handler handler = ((InstanceManager) m_instance).getHandler("org.apache.felix.ipojo:properties");
+ if (handler == null) {
+ return new PropertyDescription[0];
+ } else {
+ return ((ConfigurationHandlerDescription) ((ConfigurationHandler) handler)
+ .getDescription()).getProperties();
+ }
+ }
+
+ /**
* Gets the instance description.
* Overridden to add created objects.
* @return the instance description
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/architecture/PropertyDescription.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/architecture/PropertyDescription.java
index 6af31f6..4b037b4 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/architecture/PropertyDescription.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/architecture/PropertyDescription.java
@@ -19,6 +19,7 @@
package org.apache.felix.ipojo.architecture;
import org.apache.felix.ipojo.ConfigurationException;
+import org.apache.felix.ipojo.handlers.configuration.ConfigurationHandler;
import org.apache.felix.ipojo.util.Property;
import org.osgi.framework.BundleContext;
@@ -40,10 +41,15 @@
private String m_type;
/**
- * Default value of the property.
+ * Value of the property.
*/
private String m_value = null;
+ /**
+ * Attached property object.
+ */
+ private Property m_property;
+
/**
* Immutable property flag
@@ -74,6 +80,18 @@
/**
* Constructor.
*
+ * @param prop the attache Property object.
+ */
+ public PropertyDescription(Property prop) {
+ m_property = prop;
+ m_name = prop.getName();
+ m_type = prop.getType();
+ m_value = null; // Living property, value will be asked at runtime.
+ }
+
+ /**
+ * Constructor.
+ *
* @param name the name of the property
* @param type the type of the property
* @param value the default value (String form) of the property, can be <code>null</code>
@@ -108,7 +126,31 @@
* <code>null</code> if the property hasn't a value..
*/
public String getValue() {
- return m_value;
+ if (m_property == null) {
+ return m_value;
+ } else {
+ Object value = m_property.getValue();
+ if (value == null) {
+ return "null";
+ } else {
+ return value.toString();
+ }
+ }
+ }
+
+ /**
+ * Sets the property value.
+ * This method can only be called on 'living' property
+ * (properties with a {@link Property} object).
+ * @param value the new value.
+ */
+ public void setValue(Object value) {
+ if (m_property == null) {
+ throw new UnsupportedOperationException("Cannot set the value of a non 'living' property");
+ } else {
+ ConfigurationHandler handler = (ConfigurationHandler) m_property.getHandler();
+ handler.reconfigureProperty(m_property, value);
+ }
}
/**
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurationHandler.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurationHandler.java
index e4986b3..6d52f87 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurationHandler.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurationHandler.java
@@ -28,6 +28,7 @@
import org.apache.felix.ipojo.HandlerFactory;
import org.apache.felix.ipojo.PrimitiveHandler;
import org.apache.felix.ipojo.architecture.ComponentTypeDescription;
+import org.apache.felix.ipojo.architecture.HandlerDescription;
import org.apache.felix.ipojo.architecture.PropertyDescription;
import org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceHandler;
import org.apache.felix.ipojo.metadata.Attribute;
@@ -93,6 +94,12 @@
* with the Configuration Admin.
*/
private String m_managedServicePID;
+
+ /**
+ * the handler description.
+ */
+ private ConfigurationHandlerDescription m_description;
+
/**
* Initialize the component type.
@@ -171,6 +178,7 @@
desc.addProperty(pd);
}
+
}
/**
@@ -229,6 +237,9 @@
getInstanceManager().register(field, prop);
}
}
+
+ m_description = new ConfigurationHandlerDescription(this, m_configurableProperties);
+
}
/**
@@ -365,7 +376,7 @@
* @param prop the property object to reconfigure
* @param value the new value.
*/
- private void reconfigureProperty(Property prop, Object value) {
+ public void reconfigureProperty(Property prop, Object value) {
if (prop.getValue() == null || ! prop.getValue().equals(value)) {
prop.setValue(value);
if (prop.hasField()) {
@@ -438,5 +449,14 @@
m_configurationAlreadyPushed = false;
}
}
+
+ /**
+ * Gets the configuration handler description.
+ * @return the configuration handler description.
+ * @see org.apache.felix.ipojo.Handler#getDescription()
+ */
+ public HandlerDescription getDescription() {
+ return m_description;
+ }
}
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurationHandlerDescription.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurationHandlerDescription.java
new file mode 100644
index 0000000..7083046
--- /dev/null
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurationHandlerDescription.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.handlers.configuration;
+
+import java.util.List;
+
+import org.apache.felix.ipojo.Handler;
+import org.apache.felix.ipojo.architecture.HandlerDescription;
+import org.apache.felix.ipojo.architecture.PropertyDescription;
+import org.apache.felix.ipojo.metadata.Attribute;
+import org.apache.felix.ipojo.metadata.Element;
+import org.apache.felix.ipojo.util.Property;
+
+/**
+ * Configuration handler description.
+ *
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class ConfigurationHandlerDescription extends HandlerDescription {
+
+ /**
+ * The property descriptions.
+ */
+ private PropertyDescription[] m_properties;
+
+ /**
+ * Creates the description object for the configuration handler description.
+ * @param handler the configuration handler.
+ * @param props the list of properties.
+ */
+ public ConfigurationHandlerDescription(Handler handler, List/*<Property>*/ props) {
+ super(handler);
+ m_properties = new PropertyDescription[props.size()];
+ for (int i = 0; i < props.size(); i++) {
+ m_properties[i] = new PropertyDescription((Property) props.get(i));
+ }
+ }
+
+ /**
+ * The handler information.
+ * @return the handler description.
+ * @see org.apache.felix.ipojo.architecture.HandlerDescription#getHandlerInfo()
+ */
+ public Element getHandlerInfo() {
+ Element elem = super.getHandlerInfo();
+ for (int i = 0; i < m_properties.length; i++) {
+ String name = m_properties[i].getName();
+ Object value = m_properties[i].getValue();
+ Element property = new Element("property", "");
+ elem.addElement(property);
+ if (name != null) {
+ property.addAttribute(new Attribute("name", name));
+ }
+ if (value != null) {
+ if (value == Property.NO_VALUE) {
+ property.addAttribute(new Attribute("value", "NO_VALUE"));
+ } else {
+ property.addAttribute(new Attribute("value", value.toString()));
+ }
+ }
+ }
+ return elem;
+ }
+
+ /**
+ * Gets the properties.
+ * @return the property set.
+ */
+ public PropertyDescription[] getProperties() {
+ return m_properties;
+ }
+
+}
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyDescription.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyDescription.java
index 483ae0e..659c564 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyDescription.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyDescription.java
@@ -18,8 +18,10 @@
*/
package org.apache.felix.ipojo.handlers.dependency;
+import java.util.Comparator;
import java.util.List;
+import org.osgi.framework.Filter;
import org.osgi.framework.ServiceReference;
/**
@@ -69,14 +71,14 @@
/**
* Gets the service reference list.
* @return the list of matching service reference,
- * null if no service reference.
+ * <code>null</code> if no service reference.
*/
public List getServiceReferences() { return m_dependency.getServiceReferencesAsList(); }
/**
* Gets the service reference if only one service reference is used.
* @return the ServiceReference (only if the cardinality could be 1),
- * or null if no service reference.
+ * or <code>null</code> if no service reference.
*/
public ServiceReference getServiceReference() {
List list = getServiceReferences();
@@ -90,8 +92,52 @@
/**
* Gets the used service set.
* @return the list [service reference] containing the used services,
- * null if no providers are used
+ * <code>null</code> if no providers are used
*/
public List getUsedServices() { return m_dependency.getUsedServiceReferences(); }
+
+ /**
+ * Sets the dependency comparator.
+ * The reference set will be sort at the next usage.
+ * @param cmp the comparator
+ */
+ public void setComparator(Comparator cmp) {
+ m_dependency.setComparator(cmp);
+ }
+
+ /**
+ * Sets the dependency filter.
+ * @param filter the new LDAP filter
+ */
+ public void setFilter(Filter filter) {
+ m_dependency.setFilter(filter);
+ }
+
+ /**
+ * Sets the dependency cardinality.
+ * @param isAgg if <code>true</code> sets the dependency to aggregate,
+ * if <code>false</code> sets the dependency to scalar.
+ */
+ public void setAggregate(boolean isAgg) {
+ m_dependency.setAggregate(isAgg);
+ }
+
+ /**
+ * Sets the dependency optionality.
+ * @param isOpt if <code>true</code> sets the dependency to optional,
+ * if <code>false</code> sets the dependency to mandatory.
+ */
+ public void setOptional(boolean isOpt) {
+ m_dependency.setOptionality(isOpt);
+ }
+
+ /**
+ * Gets the required service specification name.
+ * @return the required service specification class name.
+ */
+ public String getSpecification() {
+ return m_dependency.getSpecification().getName();
+ }
+
}
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceDescription.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceDescription.java
index c1cc148..ed17f32 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceDescription.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceDescription.java
@@ -18,6 +18,7 @@
*/
package org.apache.felix.ipojo.handlers.providedservice;
+import java.util.Dictionary;
import java.util.Properties;
import org.apache.felix.ipojo.util.Property;
@@ -54,10 +55,10 @@
}
/**
- * Get the list of provided service specifications.
+ * Gets the list of provided service specifications.
* @return the provided contract name.
*/
- public String[] getServiceSpecification() {
+ public String[] getServiceSpecifications() {
return m_ps.getServiceSpecifications();
}
@@ -76,9 +77,27 @@
}
return props;
}
+
+ /**
+ * Adds and Updates service properties.
+ * Existing properties are updated.
+ * New ones are added.
+ * @param props the new properties
+ */
+ public void addProperties(Dictionary props) {
+ m_ps.addProperties(props);
+ }
+
+ /**
+ * Removes service properties.
+ * @param props the properties to remove
+ */
+ public void removeProperties(Dictionary props) {
+ m_ps.deleteProperties(props);
+ }
/**
- * Get provided service state.
+ * Gets provided service state.
* @return the state of the provided service (UNREGISTERED | REGISTRED).
*/
public int getState() {
@@ -86,11 +105,30 @@
}
/**
- * Get the service reference.
+ * Gets the service reference.
* @return the service reference (null if the service is unregistered).
*/
public ServiceReference getServiceReference() {
return m_ps.getServiceReference();
}
+
+ /**
+ * Gets the 'main' service object.
+ * @return the 'main' service object or <code>null</code>
+ * if no service object are created.
+ */
+ public Object getService() {
+ Object[] objs = m_ps.getInstanceManager().getPojoObjects();
+ if (objs == null) {
+ return null;
+ } else {
+ return objs[0];
+ }
+ }
+
+ public Object[] getServices() {
+ return m_ps.getInstanceManager().getPojoObjects();
+ }
+
}
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandlerDescription.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandlerDescription.java
index 71a846b..df624c1 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandlerDescription.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandlerDescription.java
@@ -68,12 +68,12 @@
for (int i = 0; i < m_providedServices.length; i++) {
Element service = new Element("provides", null);
StringBuffer spec = new StringBuffer("[");
- for (int j = 0; j < m_providedServices[i].getServiceSpecification().length; j++) {
+ for (int j = 0; j < m_providedServices[i].getServiceSpecifications().length; j++) {
if (j == 0) {
- spec.append(m_providedServices[i].getServiceSpecification()[j]);
+ spec.append(m_providedServices[i].getServiceSpecifications()[j]);
} else {
spec.append(',');
- spec.append(m_providedServices[i].getServiceSpecification()[j]);
+ spec.append(m_providedServices[i].getServiceSpecifications()[j]);
}
}
spec.append(']');
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/util/Property.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/util/Property.java
index 6be8314..58a4478a 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/util/Property.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/util/Property.java
@@ -231,6 +231,10 @@
public String getField() {
return m_field;
}
+
+ public String getType() {
+ return m_type.getName();
+ }
/**
* Gets the method name,
@@ -530,4 +534,12 @@
setValue(value);
}
}
+
+ /**
+ * Gets the handler managing the property.
+ * @return the configuration handler.
+ */
+ public Handler getHandler() {
+ return m_handler;
+ }
}
diff --git a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/DependencyArchitectureTest.java b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/DependencyArchitectureTest.java
index c025168..8ace55d 100644
--- a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/DependencyArchitectureTest.java
+++ b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/DependencyArchitectureTest.java
@@ -24,6 +24,8 @@
import org.apache.felix.ipojo.PrimitiveInstanceDescription;
import org.apache.felix.ipojo.architecture.Architecture;
import org.apache.felix.ipojo.architecture.InstanceDescription;
+import org.apache.felix.ipojo.handlers.dependency.Dependency;
+import org.apache.felix.ipojo.handlers.dependency.DependencyDescription;
import org.apache.felix.ipojo.handlers.dependency.DependencyHandlerDescription;
import org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceHandlerDescription;
import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
@@ -95,6 +97,11 @@
}
}
+ private DependencyDescription getDependencyDescBySpecification(
+ PrimitiveInstanceDescription id, String spec) {
+ return id.getDependency(spec);
+ }
+
private ProvidedServiceHandlerDescription getPSDesc(InstanceDescription id) {
ProvidedServiceHandlerDescription handler = (ProvidedServiceHandlerDescription) id.getHandlerDescription("org.apache.felix.ipojo:provides");
if (handler == null) {
@@ -295,7 +302,10 @@
// Check dependency handler invalidity
DependencyHandlerDescription dhd = getDependencyDesc(id_dep);
+ DependencyDescription dd = getDependencyDescBySpecification(id_dep, FooService.class.getName());
assertFalse("Check dependency handler invalidity", dhd.isValid());
+ assertTrue("Check dependency invalidity", dd.getState() == Dependency.UNRESOLVED);
+
// Check dependency metadata
assertEquals("Check dependency interface", dhd.getDependencies()[0].getInterface(), FooService.class.getName());
@@ -303,6 +313,11 @@
assertFalse("Check dependency optionality", dhd.getDependencies()[0].isOptional());
assertNull("Check dependency ref -1", dhd.getDependencies()[0].getServiceReferences());
+ assertEquals("Check dependency interface", dd.getSpecification(), FooService.class.getName());
+ assertTrue("Check dependency cardinality", dd.isMultiple());
+ assertFalse("Check dependency optionality", dd.isOptional());
+ assertNull("Check dependency ref -1", dd.getServiceReferences());
+
fooProvider1.start();
ServiceReference arch_ps1 = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), fooProvider1.getInstanceName());
diff --git a/ipojo/tests/core/service-providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/ProvidedServiceArchitectureTest.java b/ipojo/tests/core/service-providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/ProvidedServiceArchitectureTest.java
index bcb3a4c..6476b1f 100644
--- a/ipojo/tests/core/service-providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/ProvidedServiceArchitectureTest.java
+++ b/ipojo/tests/core/service-providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/ProvidedServiceArchitectureTest.java
@@ -80,8 +80,8 @@
ProvidedServiceDescription[] ps = pshd.getProvidedServices();
assertEquals("Check ProvidedService number", ps.length, 1);
- assertEquals("Check Provided Service Specs - 1", ps[0].getServiceSpecification().length, 1);
- assertEquals("Check Provided Service Specs - 2", ps[0].getServiceSpecification()[0], FooService.class.getName());
+ assertEquals("Check Provided Service Specs - 1", ps[0].getServiceSpecifications().length, 1);
+ assertEquals("Check Provided Service Specs - 2", ps[0].getServiceSpecifications()[0], FooService.class.getName());
assertEquals("Check Provided Service availability", ps[0].getState(), ProvidedServiceDescription.REGISTERED);
Properties prop = ps[0].getProperties();
assertNotNull("Check Props", prop);
@@ -126,8 +126,8 @@
ProvidedServiceDescription[] ps = pshd.getProvidedServices();
assertEquals("Check ProvidedService number", ps.length, 1);
- assertEquals("Check Provided Service Specs - 1", ps[0].getServiceSpecification().length, 1);
- assertEquals("Check Provided Service Specs - 2", ps[0].getServiceSpecification()[0], FooService.class.getName());
+ assertEquals("Check Provided Service Specs - 1", ps[0].getServiceSpecifications().length, 1);
+ assertEquals("Check Provided Service Specs - 2", ps[0].getServiceSpecifications()[0], FooService.class.getName());
assertEquals("Check Provided Service availability", ps[0].getState(), ProvidedServiceDescription.REGISTERED);
Properties prop = ps[0].getProperties();
@@ -177,9 +177,9 @@
ProvidedServiceDescription[] ps = pshd.getProvidedServices();
assertEquals("Check ProvidedService number", ps.length, 1);
- assertEquals("Check Provided Service Specs - 1", ps[0].getServiceSpecification().length, 2);
- assertContains("Check provided service specs - 2", ps[0].getServiceSpecification(), FooService.class.getName());;
- assertContains("Check provided service specs - 2", ps[0].getServiceSpecification(), BarService.class.getName());
+ assertEquals("Check Provided Service Specs - 1", ps[0].getServiceSpecifications().length, 2);
+ assertContains("Check provided service specs - 2", ps[0].getServiceSpecifications(), FooService.class.getName());;
+ assertContains("Check provided service specs - 2", ps[0].getServiceSpecifications(), BarService.class.getName());
assertEquals("Check Provided Service availability", ps[0].getState(), ProvidedServiceDescription.REGISTERED);
}
@@ -220,8 +220,8 @@
ProvidedServiceDescription[] ps = pshd.getProvidedServices();
assertEquals("Check ProvidedService number", ps.length, 1);
- assertEquals("Check Provided Service Specs - 1", ps[0].getServiceSpecification().length, 1);
- assertEquals("Check Provided Service Specs - 2", ps[0].getServiceSpecification()[0], FooService.class.getName());
+ assertEquals("Check Provided Service Specs - 1", ps[0].getServiceSpecifications().length, 1);
+ assertEquals("Check Provided Service Specs - 2", ps[0].getServiceSpecifications()[0], FooService.class.getName());
assertEquals("Check Provided Service availability", ps[0].getState(), ProvidedServiceDescription.REGISTERED);
Properties prop = ps[0].getProperties();