FELIX-4505 Set up bind methods for 1.3 parameter checking
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1615441 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurableComponentHolder.java b/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurableComponentHolder.java
index 80043dd..b0d6dfa 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurableComponentHolder.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurableComponentHolder.java
@@ -439,7 +439,7 @@
private Map<String, Object> mergeProperties(String servicePid) {
Map<String, Object> properties = new HashMap<String, Object>(m_componentMetadata.getProperties());
List<String> pids = null;
- boolean isDS13 = m_componentMetadata.isDS13();
+ boolean isDS13 = m_componentMetadata.getDSVersion().isDS13();
if (isDS13)
{
pids = new ArrayList<String>();
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/helper/ActivateMethod.java b/scr/src/main/java/org/apache/felix/scr/impl/helper/ActivateMethod.java
index 77bc2fa..ac59407 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/helper/ActivateMethod.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/helper/ActivateMethod.java
@@ -22,6 +22,7 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+import org.apache.felix.scr.impl.metadata.DSVersion;
import org.osgi.service.log.LogService;
@@ -35,9 +36,9 @@
public ActivateMethod( final String methodName,
- final boolean methodRequired, final Class componentClass, final boolean isDS11, final boolean isDS12Felix )
+ final boolean methodRequired, final Class componentClass, final DSVersion dsVersion, final boolean configurableServiceProperties )
{
- super( methodName, methodRequired, componentClass, isDS11, isDS12Felix );
+ super( methodName, methodRequired, componentClass, dsVersion, configurableServiceProperties );
}
@@ -60,7 +61,7 @@
suitableMethodNotAccessible = true;
}
- if ( isDS11() )
+ if ( getDSVersion().isDS11() )
{
// check methods with MethodTester
Method[] methods = targetClass.getDeclaredMethods();
@@ -236,13 +237,13 @@
protected Class[] getAcceptedParameterTypes()
{
- return isDS11() ? ACTIVATE_TYPES_DS11 : ACTIVATE_TYPES_DS10;
+ return getDSVersion().isDS11() ? ACTIVATE_TYPES_DS11 : ACTIVATE_TYPES_DS10;
}
protected boolean acceptEmpty()
{
- return isDS11();
+ return getDSVersion().isDS11();
}
}
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/helper/BaseMethod.java b/scr/src/main/java/org/apache/felix/scr/impl/helper/BaseMethod.java
index a3b2565..f12e370 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/helper/BaseMethod.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/helper/BaseMethod.java
@@ -27,6 +27,7 @@
import java.util.Arrays;
import java.util.Map;
+import org.apache.felix.scr.impl.metadata.DSVersion;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.service.component.ComponentContext;
@@ -42,12 +43,11 @@
// class references to simplify parameter checking
protected static final Class<?> COMPONENT_CONTEXT_CLASS = ComponentContext.class;
protected static final Class<?> BUNDLE_CONTEXT_CLASS = BundleContext.class;
- protected static final Class<?> SERVICE_REFERENCE_CLASS = ServiceReference.class;
protected static final Class<?> MAP_CLASS = Map.class;
protected static final Class<?> INTEGER_CLASS = Integer.class;
- private final boolean isDS11;
- private final boolean isDS12Felix;
+ private final DSVersion dsVersion;
+ private final boolean configurableServiceProperties;
private final String m_methodName;
private final Class<?> m_componentClass;
@@ -59,20 +59,20 @@
private volatile State m_state;
protected BaseMethod( final String methodName,
- final Class<?> componentClass, final boolean ds11, final boolean ds12Felix )
+ final Class<?> componentClass, final DSVersion dsVersion, final boolean configurableServiceProperties )
{
- this( methodName, methodName != null, componentClass, ds11, ds12Felix );
+ this( methodName, methodName != null, componentClass, dsVersion, configurableServiceProperties );
}
protected BaseMethod( final String methodName,
- final boolean methodRequired, final Class<?> componentClass, final boolean ds11, final boolean ds12Felix )
+ final boolean methodRequired, final Class<?> componentClass, final DSVersion dsVersion, final boolean configurableServiceProperties )
{
m_methodName = methodName;
m_methodRequired = methodRequired;
m_componentClass = componentClass;
- isDS11 = ds11;
- isDS12Felix = ds12Felix;
+ this.dsVersion = dsVersion;
+ this.configurableServiceProperties = configurableServiceProperties;
if ( m_methodName == null )
{
m_state = NotApplicable.INSTANCE;
@@ -83,15 +83,15 @@
}
}
- protected final boolean isDS11()
+ protected final DSVersion getDSVersion()
{
- return isDS11;
+ return dsVersion;
}
protected final boolean isDS12Felix()
{
- return isDS12Felix;
+ return configurableServiceProperties;
}
@@ -158,8 +158,8 @@
*/
private Method findMethod( SimpleLogger logger ) throws InvocationTargetException
{
- boolean acceptPrivate = isDS11();
- boolean acceptPackage = isDS11();
+ boolean acceptPrivate = getDSVersion().isDS11();
+ boolean acceptPackage = getDSVersion().isDS11();
final Class<?> targetClass = getComponentClass();
final ClassLoader targetClasslLoader = targetClass.getClassLoader();
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/helper/BindMethod.java b/scr/src/main/java/org/apache/felix/scr/impl/helper/BindMethod.java
index cb2de3c..f02943d 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/helper/BindMethod.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/helper/BindMethod.java
@@ -21,11 +21,17 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
import org.apache.felix.scr.impl.Activator;
import org.apache.felix.scr.impl.manager.ComponentContextImpl;
import org.apache.felix.scr.impl.manager.RefPair;
+import org.apache.felix.scr.impl.metadata.DSVersion;
+import org.apache.felix.scr.impl.metadata.ReferenceMetadata;
+import org.apache.felix.scr.impl.metadata.ReferenceMetadata.ReferenceScope;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceObjects;
import org.osgi.framework.ServiceReference;
import org.osgi.service.log.LogService;
import org.osgi.service.packageadmin.ExportedPackage;
@@ -39,21 +45,48 @@
{
private static final Class<?> OBJECT_CLASS = Object.class;
+
+ protected static final Class<?> SERVICE_REFERENCE_CLASS = ServiceReference.class;
+ private static final Class<?> SERVICE_OBJECTS_CLASS;
+
+ static {
+ Class<?> serviceObjectsClass = null;
+ try {
+ serviceObjectsClass = ServiceObjects.class;
+ }
+ catch (Throwable t)
+ {
+ //can't load class
+ }
+ SERVICE_OBJECTS_CLASS = serviceObjectsClass;
+ }
private final String m_referenceClassName;
+
+ private final ReferenceMetadata.ReferenceScope m_referenceScope;
- private static final int SERVICE_REFERENCE = 1;
- private static final int SERVICE_OBJECT = 2;
- private static final int SERVICE_OBJECT_AND_MAP = 3;
+// private static final int SERVICE_REFERENCE = 1;
+// private static final int SERVICE_OBJECT = 2;
+// private static final int SERVICE_OBJECT_AND_MAP = 3;
- private int m_paramStyle;
+// private int m_paramStyle;
+
+ private enum ParamType {
+ serviceReference,
+ serviceObjects,
+ serviceType,
+ map
+ }
+
+ private List<ParamType> m_paramTypes = new ArrayList<ParamType>();
public BindMethod( final String methodName,
- final Class<?> componentClass, final String referenceClassName, final boolean isDS11, final boolean isDS12Felix )
+ final Class<?> componentClass, final String referenceClassName, final DSVersion dsVersion, final boolean configurableServiceProperties, ReferenceScope referenceScope )
{
- super( methodName, componentClass, isDS11, isDS12Felix );
+ super( methodName, componentClass, dsVersion, configurableServiceProperties );
m_referenceClassName = referenceClassName;
+ m_referenceScope = referenceScope;
}
@@ -78,12 +111,14 @@
protected Method doFindMethod( Class<?> targetClass, boolean acceptPrivate, boolean acceptPackage, SimpleLogger logger )
throws SuitableMethodNotAccessibleException, InvocationTargetException
{
- // 112.3.1 The method is searched for using the following priority
- // 1 - Service reference parameter
- // 2 - Service object parameter
- // 3 - Service interface assignement compatible methods
- // 4 - same as 2, but with Map param (DS 1.1 only)
- // 5 - same as 3, but with Map param (DS 1.1 only)
+ /* 112.3.1 The method is searched for using the following priority
+ 1 - ServiceReference single parameter
+ 2 - ServiceObjects single parameter (DS 1.3+ only)
+ 3 - Service object single parameter
+ 4 - Service interface assignment compatible single parameter
+ 5 - two parameters, first the type of or assignment compatible with the service, the second Map (DS 1.1, 1.2 only)
+ 6 - one or more parameters of types ServiceReference, ServiceObjects, interface type, or assignment compatible to interface type, in any order. (DS 1.3+ only)
+ */
// flag indicating a suitable but inaccessible method has been found
boolean suitableMethodNotAccessible = false;
@@ -105,7 +140,26 @@
{
logger.log( LogService.LOG_DEBUG, "doFindMethod: Found Method " + method, null );
}
- m_paramStyle = SERVICE_REFERENCE;
+ m_paramTypes.add(ParamType.serviceReference);
+ return method;
+ }
+ }
+ catch ( SuitableMethodNotAccessibleException ex )
+ {
+ suitableMethodNotAccessible = true;
+ }
+
+ //case 2 ServiceObjects parameter
+ try
+ {
+ method = getServiceObjectsMethod( targetClass, acceptPrivate, acceptPackage, logger );
+ if ( method != null )
+ {
+ if ( logger.isLogEnabled( LogService.LOG_DEBUG ) )
+ {
+ logger.log( LogService.LOG_DEBUG, "doFindMethod: Found Method " + method, null );
+ }
+ m_paramTypes.add(ParamType.serviceObjects);
return method;
}
}
@@ -133,7 +187,7 @@
method = getServiceObjectMethod( targetClass, parameterClass, acceptPrivate, acceptPackage, logger );
if ( method != null )
{
- m_paramStyle = SERVICE_OBJECT;
+ m_paramTypes.add(ParamType.serviceType);
return method;
}
}
@@ -148,7 +202,7 @@
method = getServiceObjectAssignableMethod( targetClass, parameterClass, acceptPrivate, acceptPackage, logger );
if ( method != null )
{
- m_paramStyle = SERVICE_OBJECT;
+ m_paramTypes.add(ParamType.serviceType);
return method;
}
}
@@ -158,7 +212,7 @@
}
// signatures taking a map are only supported starting with DS 1.1
- if ( isDS11() )
+ if ( getDSVersion().isDS11() && !getDSVersion().isDS13() )
{
// Case 4 - same as case 2, but + Map param (DS 1.1 only)
@@ -167,7 +221,8 @@
method = getServiceObjectWithMapMethod( targetClass, parameterClass, acceptPrivate, acceptPackage, logger );
if ( method != null )
{
- m_paramStyle = SERVICE_OBJECT_AND_MAP;
+ m_paramTypes.add(ParamType.serviceType);
+ m_paramTypes.add(ParamType.map);
return method;
}
}
@@ -183,7 +238,8 @@
acceptPackage );
if ( method != null )
{
- m_paramStyle = SERVICE_OBJECT_AND_MAP;
+ m_paramTypes.add(ParamType.serviceType);
+ m_paramTypes.add(ParamType.map);
return method;
}
}
@@ -193,7 +249,10 @@
}
}
-
+ if ( getDSVersion().isDS13() )
+ {
+ //TODO
+ }
}
else if ( logger.isLogEnabled( LogService.LOG_WARNING ) )
{
@@ -355,6 +414,18 @@
{ SERVICE_REFERENCE_CLASS }, acceptPrivate, acceptPackage, logger );
}
+ private Method getServiceObjectsMethod( final Class<?> targetClass, boolean acceptPrivate, boolean acceptPackage, SimpleLogger logger )
+ throws SuitableMethodNotAccessibleException, InvocationTargetException
+ {
+ if ( m_referenceScope == ReferenceMetadata.ReferenceScope.prototype )
+ {
+ return getMethod(targetClass, getMethodName(),
+ new Class[] { SERVICE_OBJECTS_CLASS }, acceptPrivate, acceptPackage,
+ logger);
+ }
+ return null;
+ }
+
/**
* Returns a method taking a single parameter of the exact type declared
@@ -569,7 +640,7 @@
//??? this resolves which we need.... better way?
if ( refPair.getServiceObject(key) == null && methodExists( logger ) )
{
- if (m_paramStyle == SERVICE_OBJECT || m_paramStyle == SERVICE_OBJECT_AND_MAP) {
+ if ( m_paramTypes.contains(ParamType.serviceType) ) {
return refPair.getServiceObject(key, context, logger);
}
}
@@ -579,20 +650,32 @@
protected Object[] getParameters( Method method, BindParameters bp )
{
ComponentContextImpl key = bp.getComponentContext();
+ Object[] result = new Object[ m_paramTypes.size()];
RefPair<?, ?> refPair = bp.getRefPair();
- if (m_paramStyle == SERVICE_REFERENCE )
- {
- return new Object[] {refPair.getRef()};
+ int i = 0;
+ for ( ParamType pt: m_paramTypes ) {
+ switch (pt) {
+ case serviceReference:
+ result[i++] = refPair.getRef();
+ break;
+
+ case serviceObjects:
+ result[i++] = refPair.getServiceObjects();
+ break;
+
+ case map:
+ result[i++] = new ReadOnlyDictionary<String, Object>( refPair.getRef() );
+ break;
+
+ case serviceType:
+ result[i++] = refPair.getServiceObject(key);
+ break;
+
+ default: throw new IllegalStateException("unexpected ParamType: " + pt);
+
+ }
}
- if (m_paramStyle == SERVICE_OBJECT)
- {
- return new Object[] {refPair.getServiceObject(key)};
- }
- if (m_paramStyle == SERVICE_OBJECT_AND_MAP )
- {
- return new Object[] {refPair.getServiceObject(key), new ReadOnlyDictionary<String, Object>( refPair.getRef() )};
- }
- throw new IllegalStateException( "Unexpected m_paramStyle of " + m_paramStyle );
+ return result;
}
@@ -601,16 +684,4 @@
return "bind";
}
- //---------- Service abstraction ------------------------------------
-
- public static interface Service
- {
-
- ServiceReference getReference();
-
-
- Object getInstance();
-
- }
-
}
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/helper/BindMethods.java b/scr/src/main/java/org/apache/felix/scr/impl/helper/BindMethods.java
index 249bdae..af94e57 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/helper/BindMethods.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/helper/BindMethods.java
@@ -21,6 +21,7 @@
package org.apache.felix.scr.impl.helper;
+import org.apache.felix.scr.impl.metadata.DSVersion;
import org.apache.felix.scr.impl.metadata.ReferenceMetadata;
/**
@@ -33,25 +34,26 @@
private final UnbindMethod m_unbind;
BindMethods( ReferenceMetadata m_dependencyMetadata, Class<?> instanceClass,
- final boolean isDS11, final boolean isDS12Felix )
+ final DSVersion dsVersion, final boolean configurableServiceProperties )
{
+ ReferenceMetadata.ReferenceScope referenceScope = m_dependencyMetadata.getScope();
m_bind = new BindMethod(
m_dependencyMetadata.getBind(),
instanceClass,
m_dependencyMetadata.getInterface(),
- isDS11, isDS12Felix
+ dsVersion, configurableServiceProperties, referenceScope
);
m_updated = new UpdatedMethod(
m_dependencyMetadata.getUpdated(),
instanceClass,
m_dependencyMetadata.getInterface(),
- isDS11, isDS12Felix
+ dsVersion, configurableServiceProperties, referenceScope
);
m_unbind = new UnbindMethod(
m_dependencyMetadata.getUnbind(),
instanceClass,
m_dependencyMetadata.getInterface(),
- isDS11, isDS12Felix
+ dsVersion, configurableServiceProperties, referenceScope
);
}
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/helper/ComponentMethods.java b/scr/src/main/java/org/apache/felix/scr/impl/helper/ComponentMethods.java
index 01465e4..c6489f2 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/helper/ComponentMethods.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/helper/ComponentMethods.java
@@ -24,6 +24,7 @@
import java.util.Map;
import org.apache.felix.scr.impl.metadata.ComponentMetadata;
+import org.apache.felix.scr.impl.metadata.DSVersion;
import org.apache.felix.scr.impl.metadata.ReferenceMetadata;
@@ -44,19 +45,19 @@
{
return;
}
- boolean isDS11 = componentMetadata.isDS11();
- boolean isDS12Felix = componentMetadata.isDS12Felix();
+ DSVersion dsVersion = componentMetadata.getDSVersion();
+ boolean configurableServiceProperties = componentMetadata.isConfigurableServiceProperties();
m_activateMethod = new ActivateMethod( componentMetadata.getActivate(), componentMetadata
- .isActivateDeclared(), implementationObjectClass, isDS11, isDS12Felix );
+ .isActivateDeclared(), implementationObjectClass, dsVersion, configurableServiceProperties );
m_deactivateMethod = new DeactivateMethod( componentMetadata.getDeactivate(),
- componentMetadata.isDeactivateDeclared(), implementationObjectClass, isDS11, isDS12Felix );
+ componentMetadata.isDeactivateDeclared(), implementationObjectClass, dsVersion, configurableServiceProperties );
- m_modifiedMethod = new ModifiedMethod( componentMetadata.getModified(), implementationObjectClass, isDS11, isDS12Felix );
+ m_modifiedMethod = new ModifiedMethod( componentMetadata.getModified(), implementationObjectClass, dsVersion, configurableServiceProperties );
for ( ReferenceMetadata referenceMetadata: componentMetadata.getDependencies() )
{
String refName = referenceMetadata.getName();
- BindMethods bindMethods = new BindMethods( referenceMetadata, implementationObjectClass, isDS11, isDS12Felix);
+ BindMethods bindMethods = new BindMethods( referenceMetadata, implementationObjectClass, dsVersion, configurableServiceProperties);
bindMethodMap.put( refName, bindMethods );
}
}
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/helper/DeactivateMethod.java b/scr/src/main/java/org/apache/felix/scr/impl/helper/DeactivateMethod.java
index df5fcd7..d5b7754 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/helper/DeactivateMethod.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/helper/DeactivateMethod.java
@@ -18,6 +18,8 @@
*/
package org.apache.felix.scr.impl.helper;
+import org.apache.felix.scr.impl.metadata.DSVersion;
+
public class DeactivateMethod extends ActivateMethod
{
@@ -27,15 +29,15 @@
public DeactivateMethod( final String methodName,
- final boolean methodRequired, final Class<?> componentClass, final boolean isDS11, final boolean isDS12Felix )
+ final boolean methodRequired, final Class<?> componentClass, final DSVersion dsVersion, final boolean configurableServiceProperties )
{
- super( methodName, methodRequired, componentClass, isDS11, isDS12Felix );
+ super( methodName, methodRequired, componentClass, dsVersion, configurableServiceProperties );
}
protected Class[] getAcceptedParameterTypes()
{
- return isDS11() ? DEACTIVATE_TYPES_DS11 : ACTIVATE_TYPES_DS10;
+ return getDSVersion().isDS11() ? DEACTIVATE_TYPES_DS11 : ACTIVATE_TYPES_DS10;
}
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/helper/ModifiedMethod.java b/scr/src/main/java/org/apache/felix/scr/impl/helper/ModifiedMethod.java
index b16ea48..107832b 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/helper/ModifiedMethod.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/helper/ModifiedMethod.java
@@ -18,14 +18,16 @@
*/
package org.apache.felix.scr.impl.helper;
+import org.apache.felix.scr.impl.metadata.DSVersion;
+
public class ModifiedMethod extends ActivateMethod
{
public ModifiedMethod( final String methodName,
- final Class<?> componentClass, final boolean isDS11, final boolean isDS12Felix )
+ final Class<?> componentClass, final DSVersion dsVersion, final boolean configurableServiceProperties )
{
- super( methodName, methodName != null, componentClass, isDS11, isDS12Felix );
+ super( methodName, methodName != null, componentClass, dsVersion, configurableServiceProperties );
}
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/helper/UnbindMethod.java b/scr/src/main/java/org/apache/felix/scr/impl/helper/UnbindMethod.java
index 2fc2ab9..ebc12da 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/helper/UnbindMethod.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/helper/UnbindMethod.java
@@ -18,6 +18,9 @@
*/
package org.apache.felix.scr.impl.helper;
+import org.apache.felix.scr.impl.metadata.DSVersion;
+import org.apache.felix.scr.impl.metadata.ReferenceMetadata;
+
/**
* Component method to be invoked on service unbinding.
@@ -26,9 +29,9 @@
{
public UnbindMethod( final String methodName,
- final Class<?> componentClass, final String referenceClassName, final boolean isDS11, final boolean isDS12Felix )
+ final Class<?> componentClass, final String referenceClassName, final DSVersion dsVersion, final boolean configurableServiceProperties, ReferenceMetadata.ReferenceScope referenceScope )
{
- super( methodName, componentClass, referenceClassName, isDS11, isDS12Felix );
+ super( methodName, componentClass, referenceClassName, dsVersion, configurableServiceProperties, referenceScope );
}
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/helper/UpdatedMethod.java b/scr/src/main/java/org/apache/felix/scr/impl/helper/UpdatedMethod.java
index 91ab29c..1f6c921 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/helper/UpdatedMethod.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/helper/UpdatedMethod.java
@@ -18,6 +18,9 @@
*/
package org.apache.felix.scr.impl.helper;
+import org.apache.felix.scr.impl.metadata.DSVersion;
+import org.apache.felix.scr.impl.metadata.ReferenceMetadata;
+
/**
* Component method to be invoked on service property update of a bound service.
@@ -26,9 +29,9 @@
{
public UpdatedMethod( final String methodName,
- final Class<?> componentClass, final String referenceClassName, final boolean isDS11, final boolean isDS12Felix )
+ final Class<?> componentClass, final String referenceClassName, final DSVersion dsVersion, final boolean configurableServiceProperties, ReferenceMetadata.ReferenceScope referenceScope )
{
- super( methodName, componentClass, referenceClassName, isDS11, isDS12Felix );
+ super( methodName, componentClass, referenceClassName, dsVersion, configurableServiceProperties, referenceScope );
}
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java b/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java
index 6419b3f..61af91b 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java
@@ -159,7 +159,7 @@
LogService.LOG_DEBUG,
"Component {0} created: DS={1}, implementation={2}, immediate={3}, default-enabled={4}, factory={5}, configuration-policy={6}, activate={7}, deactivate={8}, modified={9} configuration-pid={10}",
new Object[]
- { metadata.getName(), metadata.getNamespaceCode(),
+ { metadata.getName(), metadata.getDSVersion(),
metadata.getImplementationClassName(), metadata.isImmediate(),
metadata.isEnabled(), metadata.getFactoryIdentifier(),
metadata.getConfigurationPolicy(), metadata.getActivate(), metadata.getDeactivate(),
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/manager/MultiplePrototypeRefPair.java b/scr/src/main/java/org/apache/felix/scr/impl/manager/MultiplePrototypeRefPair.java
index 5454cf1..3c41c13 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/manager/MultiplePrototypeRefPair.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/manager/MultiplePrototypeRefPair.java
@@ -44,6 +44,14 @@
super(ref);
this.serviceObjects = context.getServiceObjects(ref);
}
+
+ @Override
+ public Object getServiceObjects()
+ {
+ return serviceObjects;
+ }
+
+
@Override
public T getServiceObject(ComponentContextImpl<S> key)
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/manager/RefPair.java b/scr/src/main/java/org/apache/felix/scr/impl/manager/RefPair.java
index ba57204..435c6ab 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/manager/RefPair.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/manager/RefPair.java
@@ -44,6 +44,11 @@
return ref;
}
+ public Object getServiceObjects()
+ {
+ return null;
+ }
+
public abstract boolean getServiceObject( ComponentContextImpl<S> key, BundleContext context, SimpleLogger logger );
public abstract T getServiceObject(ComponentContextImpl<S> key);
@@ -72,4 +77,5 @@
this.deleted = deleted;
}
+
}
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/manager/SingleComponentManager.java b/scr/src/main/java/org/apache/felix/scr/impl/manager/SingleComponentManager.java
index 23254a5..42ad2e8 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/manager/SingleComponentManager.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/manager/SingleComponentManager.java
@@ -433,7 +433,7 @@
if ( m_factoryProperties != null)
{
props.putAll(m_factoryProperties);
- if (getComponentMetadata().isDS13() && m_factoryProperties.containsKey(Constants.SERVICE_PID))
+ if (getComponentMetadata().getDSVersion().isDS13() && m_factoryProperties.containsKey(Constants.SERVICE_PID))
{
List<String> servicePids = (List<String>) m_configurationProperties.get(Constants.SERVICE_PID);
if (servicePids == null)
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/manager/SinglePrototypeRefPair.java b/scr/src/main/java/org/apache/felix/scr/impl/manager/SinglePrototypeRefPair.java
index 0de682a..07b677f 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/manager/SinglePrototypeRefPair.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/manager/SinglePrototypeRefPair.java
@@ -42,6 +42,12 @@
}
@Override
+ public Object getServiceObjects()
+ {
+ return serviceObjects;
+ }
+
+ @Override
public String toString()
{
return "[SinglePrototypeRefPair: ref: [" + getRef() + "] service: [" + getServiceObject(null) + "]]";
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/metadata/ComponentMetadata.java b/scr/src/main/java/org/apache/felix/scr/impl/metadata/ComponentMetadata.java
index 8ff781c..c19f54b 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/metadata/ComponentMetadata.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/metadata/ComponentMetadata.java
@@ -63,7 +63,7 @@
// the namespace code of the namespace declaring this component, this is
// one of the XmlHandler.DS_VERSION_* constants
- private final int m_namespaceCode;
+ private final DSVersion m_dsVersion;
// 112.4.3: A Globally unique component name (required)
private String m_name;
@@ -137,9 +137,9 @@
}
- public ComponentMetadata( int namespaceCode )
+ public ComponentMetadata( DSVersion dsVersion )
{
- this.m_namespaceCode = namespaceCode;
+ this.m_dsVersion = dsVersion;
}
/////////////////////////////////////////// SETTERS //////////////////////////////////////
@@ -420,67 +420,13 @@
* declaring this component. This is one of the XmlHandler.DS_VERSION_*
* constants.
*/
- public int getNamespaceCode()
+ public DSVersion getDSVersion()
{
- return m_namespaceCode;
+ return m_dsVersion;
}
-
- /**
- * Returns <code>true</code> if the metadata declaration has used the
- * Declarative Services version 1.1 namespace or a later namespace.
- */
- public boolean isDS11()
- {
- return getNamespaceCode() >= XmlHandler.DS_VERSION_1_1;
- }
-
-
- /**
- * Returns <code>true</code> if the metadata declaration has used the
- * Declarative Services version 1.1-felix namespace or a later namespace.
- *
- * @see <a href="https://issues.apache.org/jira/browse/FELIX-1893">FELIX-1893</a>
- */
- public boolean isDS11Felix()
- {
- return getNamespaceCode() >= XmlHandler.DS_VERSION_1_1_FELIX;
- }
-
-
- /**
- * Returns <code>true</code> if the metadata declaration has used the
- * Declarative Services version 1.2 namespace or a later namespace.
- */
- public boolean isDS12()
- {
- return getNamespaceCode() >= XmlHandler.DS_VERSION_1_2;
- }
-
-
- /**
- * Returns <code>true</code> if the metadata declaration has used the
- * Declarative Services version 1.2-felix namespace or a later namespace.
- *
- * @see <a href="https://issues.apache.org/jira/browse/FELIX-3377">FELIX-3377</a>
- */
- public boolean isDS12Felix()
- {
- return getNamespaceCode() >= XmlHandler.DS_VERSION_1_2_FELIX;
- }
/**
- * Returns <code>true</code> if the metadata declaration has used the
- * Declarative Services version 1.3 namespace or a later namespace.
- */
- public boolean isDS13()
- {
- return getNamespaceCode() >= XmlHandler.DS_VERSION_1_3;
- }
-
-
-
- /**
* Returns the name of the component
*
* @return A string containing the name of the component
@@ -810,7 +756,7 @@
if ( m_name == null )
{
// 112.4.3 name is optional defaulting to implementation class name since DS 1.1
- if ( m_namespaceCode < XmlHandler.DS_VERSION_1_1 )
+ if ( !m_dsVersion.isDS11() )
{
throw new ComponentException( "The component name has not been set" );
}
@@ -833,7 +779,7 @@
// default if not specified or pre DS 1.1
m_configurationPolicy = CONFIGURATION_POLICY_OPTIONAL;
}
- else if ( m_namespaceCode < XmlHandler.DS_VERSION_1_1 )
+ else if ( !m_dsVersion.isDS11() )
{
throw validationFailure( "configuration-policy declaration requires DS 1.1 or later namespace " );
}
@@ -848,7 +794,7 @@
// default if not specified or pre DS 1.1
m_activate = "activate";
}
- else if ( m_namespaceCode < XmlHandler.DS_VERSION_1_1 )
+ else if ( !m_dsVersion.isDS11() )
{
throw validationFailure( "activate method declaration requires DS 1.1 or later namespace " );
}
@@ -859,13 +805,13 @@
// default if not specified or pre DS 1.1
m_deactivate = "deactivate";
}
- else if ( m_namespaceCode < XmlHandler.DS_VERSION_1_1 )
+ else if ( !m_dsVersion.isDS11() )
{
throw validationFailure( "deactivate method declaration requires DS 1.1 or later namespace " );
}
// 112.??.?? modified can be specified (since DS 1.1)
- if ( m_modified != null && m_namespaceCode < XmlHandler.DS_VERSION_1_1 )
+ if ( m_modified != null && !m_dsVersion.isDS11() )
{
throw validationFailure( "modified method declaration requires DS 1.1 or later namespace " );
}
@@ -877,7 +823,7 @@
}
else
{
- if ( m_namespaceCode < XmlHandler.DS_VERSION_1_2 )
+ if ( !m_dsVersion.isDS12() )
{
throw validationFailure( "configuration-pid attribute requires DS 1.2 or later namespace " );
}
@@ -885,7 +831,7 @@
{
throw validationFailure( "configuration-pid nust not be empty string " );
}
- if (m_configurationPid.size() > 1 && m_namespaceCode < XmlHandler.DS_VERSION_1_3)
+ if (m_configurationPid.size() > 1 && !m_dsVersion.isDS13())
{
throw validationFailure( "multiple configuration-pid requires DS 1.3 or later namespace " );
}
@@ -893,7 +839,7 @@
{
if ("$".equals( m_configurationPid.get(i)))
{
- if (m_namespaceCode < XmlHandler.DS_VERSION_1_3)
+ if (!m_dsVersion.isDS13())
{
throw validationFailure( "Use of '$' configuration-pid wildcard requires DS 1.3 or later namespace " );
}
@@ -970,19 +916,19 @@
}
}
- if (m_namespaceCode == XmlHandler.DS_VERSION_1_2_FELIX)
+ if (m_dsVersion == DSVersion.DS12Felix)
{
m_configurableServiceProperties = true;
}
- if (m_namespaceCode >= XmlHandler.DS_VERSION_1_3)
+ if (m_dsVersion.isDS13())
{
m_deleteCallsModify = true; //spec behavior as of 1.3
}
- if (m_namespaceCode < XmlHandler.DS_VERSION_1_3 && m_configureWithInterfaces)
+ if ( !m_dsVersion.isDS13() && m_configureWithInterfaces)
{
throw validationFailure("Configuration with interfaces or annotations only possible with version 1.3 or later");
}
- if (m_namespaceCode >= XmlHandler.DS_VERSION_1_3 && m_obsoleteFactoryComponentFactory)
+ if (m_dsVersion.isDS13() && m_obsoleteFactoryComponentFactory)
{
throw validationFailure("Configuration of component factory instances through config admin factory pids supported only through the 1.2 namespace");
}
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/metadata/DSVersion.java b/scr/src/main/java/org/apache/felix/scr/impl/metadata/DSVersion.java
new file mode 100644
index 0000000..39cd693
--- /dev/null
+++ b/scr/src/main/java/org/apache/felix/scr/impl/metadata/DSVersion.java
@@ -0,0 +1,40 @@
+package org.apache.felix.scr.impl.metadata;
+
+public enum DSVersion
+{
+ DSnone(-1),
+ DS10(0),
+ DS11(1),
+ DS11Felix(2),
+ DS12(3),
+ DS12Felix(4),
+ DS13(5);
+
+ private final int version;
+
+ DSVersion(int version)
+ {
+ this.version = version;
+ }
+
+ public boolean isDS10()
+ {
+ return version >=DS10.version;
+ }
+
+ public boolean isDS11()
+ {
+ return version >=DS11.version;
+ }
+
+ public boolean isDS12()
+ {
+ return version >=DS12.version;
+ }
+
+ public boolean isDS13()
+ {
+ return version >=DS13.version;
+ }
+
+}
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/metadata/PropertyMetadata.java b/scr/src/main/java/org/apache/felix/scr/impl/metadata/PropertyMetadata.java
index fc7a838..5dd37dd 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/metadata/PropertyMetadata.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/metadata/PropertyMetadata.java
@@ -145,12 +145,12 @@
{
m_type = "String";
}
- else if ( componentMetadata.isDS11() && m_type.equals( "Char" ) )
+ else if ( componentMetadata.getDSVersion().isDS11() && m_type.equals( "Char" ) )
{
throw componentMetadata
.validationFailure( "Illegal property type 'Char' used for DS 1.1 descriptor, use 'Character' instead" );
}
- else if ( !componentMetadata.isDS11() && m_type.equals( "Character" ) )
+ else if ( !componentMetadata.getDSVersion().isDS11() && m_type.equals( "Character" ) )
{
throw componentMetadata
.validationFailure( "Illegal property type 'Character' used for DS 1.0 descriptor, use 'Char' instead" );
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/metadata/ReferenceMetadata.java b/scr/src/main/java/org/apache/felix/scr/impl/metadata/ReferenceMetadata.java
index c6d53d6..2903998 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/metadata/ReferenceMetadata.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/metadata/ReferenceMetadata.java
@@ -464,10 +464,11 @@
*/
void validate( final ComponentMetadata componentMetadata, final Logger logger )
{
+ DSVersion dsVersion = componentMetadata.getDSVersion();
if ( m_name == null )
{
// 112.10 name attribute is optional, defaults to interface since DS 1.1
- if ( !componentMetadata.isDS11() )
+ if ( !dsVersion.isDS11() )
{
throw componentMetadata.validationFailure( "A name must be declared for the reference" );
}
@@ -506,21 +507,21 @@
{
throw componentMetadata.validationFailure( "Policy option must be one of " + POLICY_OPTION_VALID );
}
- else if ( !componentMetadata.isDS12() && !POLICY_OPTION_RELUCTANT.equals( m_policy_option ) )
+ else if ( !dsVersion.isDS12() && !POLICY_OPTION_RELUCTANT.equals( m_policy_option ) )
{
throw componentMetadata.validationFailure( "Policy option must be reluctant for DS < 1.2" );
}
// updated method is only supported in namespace xxx and later
- if ( m_updated != null && !componentMetadata.isDS11Felix() )
+ if ( m_updated != null && !(dsVersion.isDS12() || dsVersion == DSVersion.DS11Felix) )
{
// FELIX-3648 validation must fail (instead of just ignore)
throw componentMetadata.validationFailure( "updated method declaration requires DS 1.2 or later namespace " );
}
if (m_scopeName != null) {
- if (componentMetadata.getNamespaceCode() < XmlHandler.DS_VERSION_1_3)
+ if ( !dsVersion.isDS13() )
{
throw componentMetadata.validationFailure( "reference scope can be set only for DS >= 1.3");
}
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/metadata/ServiceMetadata.java b/scr/src/main/java/org/apache/felix/scr/impl/metadata/ServiceMetadata.java
index 6788534..ea7b348 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/metadata/ServiceMetadata.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/metadata/ServiceMetadata.java
@@ -111,7 +111,7 @@
}
if (m_serviceFactory != null)
{
- if (componentMetadata.getNamespaceCode() >= XmlHandler.DS_VERSION_1_3)
+ if ( componentMetadata.getDSVersion().isDS13() )
{
throw componentMetadata.validationFailure("service-factory can only be specified in version 1.2 and earlier");
}
@@ -119,8 +119,8 @@
}
if ( m_scopeName != null )
{
- if (componentMetadata.getNamespaceCode() < XmlHandler.DS_VERSION_1_3)
- {
+ if ( !componentMetadata.getDSVersion().isDS13() )
+ {
throw componentMetadata.validationFailure("service scope can only be specified in version 1.3 and later");
}
try
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/metadata/XmlHandler.java b/scr/src/main/java/org/apache/felix/scr/impl/metadata/XmlHandler.java
index 7600cea..c058923 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/metadata/XmlHandler.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/metadata/XmlHandler.java
@@ -101,7 +101,7 @@
public static final int DS_VERSION_1_3 = 5;
// mapping of namespace URI to namespace code
- private static final Map<String, Integer> NAMESPACE_CODE_MAP;
+ private static final Map<String, DSVersion> NAMESPACE_CODE_MAP;
// the bundle containing the XML resource being parsed
private final Bundle m_bundle;
@@ -136,14 +136,14 @@
static
{
- NAMESPACE_CODE_MAP = new HashMap<String, Integer>();
- NAMESPACE_CODE_MAP.put( NAMESPACE_URI_EMPTY, DS_VERSION_1_0 );
- NAMESPACE_CODE_MAP.put( NAMESPACE_URI, DS_VERSION_1_0 );
- NAMESPACE_CODE_MAP.put( NAMESPACE_URI_1_1, DS_VERSION_1_1 );
- NAMESPACE_CODE_MAP.put( NAMESPACE_URI_1_1_FELIX, DS_VERSION_1_1_FELIX );
- NAMESPACE_CODE_MAP.put( NAMESPACE_URI_1_2, DS_VERSION_1_2 );
- NAMESPACE_CODE_MAP.put( NAMESPACE_URI_1_2_FELIX, DS_VERSION_1_2_FELIX );
- NAMESPACE_CODE_MAP.put( NAMESPACE_URI_1_3, DS_VERSION_1_3 );
+ NAMESPACE_CODE_MAP = new HashMap<String, DSVersion>();
+ NAMESPACE_CODE_MAP.put( NAMESPACE_URI_EMPTY, DSVersion.DS10 );
+ NAMESPACE_CODE_MAP.put( NAMESPACE_URI, DSVersion.DS10 );
+ NAMESPACE_CODE_MAP.put( NAMESPACE_URI_1_1, DSVersion.DS11 );
+ NAMESPACE_CODE_MAP.put( NAMESPACE_URI_1_1_FELIX, DSVersion.DS11Felix );
+ NAMESPACE_CODE_MAP.put( NAMESPACE_URI_1_2, DSVersion.DS12 );
+ NAMESPACE_CODE_MAP.put( NAMESPACE_URI_1_2_FELIX, DSVersion.DS12Felix );
+ NAMESPACE_CODE_MAP.put( NAMESPACE_URI_1_3, DSVersion.DS13 );
}
@@ -205,7 +205,7 @@
}
// get the namespace code for the namespace uri
- Integer namespaceCode = (Integer) NAMESPACE_CODE_MAP.get( uri );
+ DSVersion namespaceCode = NAMESPACE_CODE_MAP.get( uri );
// from now on uri points to the namespace
if ( namespaceCode != null )
{
@@ -218,7 +218,7 @@
this.isComponent = true;
// Create a new ComponentMetadata
- m_currentComponent = new ComponentMetadata( namespaceCode.intValue() );
+ m_currentComponent = new ComponentMetadata( namespaceCode );
// name attribute is optional (since DS 1.1)
if ( attributes.getAttribute( "name" ) != null )
diff --git a/scr/src/test/java/org/apache/felix/scr/impl/config/ConfiguredComponentHolderTest.java b/scr/src/test/java/org/apache/felix/scr/impl/config/ConfiguredComponentHolderTest.java
index f3ab4bf..121d6c1 100644
--- a/scr/src/test/java/org/apache/felix/scr/impl/config/ConfiguredComponentHolderTest.java
+++ b/scr/src/test/java/org/apache/felix/scr/impl/config/ConfiguredComponentHolderTest.java
@@ -32,6 +32,7 @@
import org.apache.felix.scr.impl.helper.ComponentMethods;
import org.apache.felix.scr.impl.manager.SingleComponentManager;
import org.apache.felix.scr.impl.metadata.ComponentMetadata;
+import org.apache.felix.scr.impl.metadata.DSVersion;
import org.apache.felix.scr.impl.metadata.XmlHandler;
@@ -163,7 +164,7 @@
private static ComponentMetadata createComponentMetadata( String name )
{
- final ComponentMetadata metadata = new ComponentMetadata( XmlHandler.DS_VERSION_1_1 );
+ final ComponentMetadata metadata = new ComponentMetadata( DSVersion.DS11 );
metadata.setName( name );
metadata.setImplementationClassName(Object.class.getName());
metadata.validate(null);
diff --git a/scr/src/test/java/org/apache/felix/scr/impl/helper/ActivateMethodTest.java b/scr/src/test/java/org/apache/felix/scr/impl/helper/ActivateMethodTest.java
index ce3dfae..5cd7af1 100644
--- a/scr/src/test/java/org/apache/felix/scr/impl/helper/ActivateMethodTest.java
+++ b/scr/src/test/java/org/apache/felix/scr/impl/helper/ActivateMethodTest.java
@@ -29,6 +29,7 @@
import org.apache.felix.scr.impl.config.ComponentContainer;
import org.apache.felix.scr.impl.manager.SingleComponentManager;
import org.apache.felix.scr.impl.metadata.ComponentMetadata;
+import org.apache.felix.scr.impl.metadata.DSVersion;
import org.apache.felix.scr.impl.metadata.XmlHandler;
import org.apache.felix.scr.impl.metadata.instances.AcceptMethod;
import org.apache.felix.scr.impl.metadata.instances.BaseObject;
@@ -268,7 +269,7 @@
{
ComponentContainer container = newContainer();
SingleComponentManager icm = new SingleComponentManager( container, new ComponentMethods() );
- ActivateMethod am = new ActivateMethod( methodName, methodName != null, obj.getClass(), true, false );
+ ActivateMethod am = new ActivateMethod( methodName, methodName != null, obj.getClass(), DSVersion.DS11, false );
am.invoke( obj, new ActivatorParameter( m_ctx, -1 ), null, icm );
Method m = get(am, "m_method");
assertNotNull( m );
@@ -302,7 +303,7 @@
private ComponentMetadata newMetadata() {
- ComponentMetadata metadata = new ComponentMetadata( XmlHandler.DS_VERSION_1_1 );
+ ComponentMetadata metadata = new ComponentMetadata( DSVersion.DS11 );
metadata.setName("foo");
metadata.setImplementationClassName(Object.class.getName());
metadata.validate(null);
@@ -323,7 +324,7 @@
{
ComponentContainer container = newContainer();
SingleComponentManager icm = new SingleComponentManager( container, new ComponentMethods() );
- ActivateMethod am = new ActivateMethod( methodName, methodName != null, obj.getClass(), true, false );
+ ActivateMethod am = new ActivateMethod( methodName, methodName != null, obj.getClass(), DSVersion.DS11, false );
am.invoke( obj, new ActivatorParameter( m_ctx, -1 ), null, icm );
assertNull( get( am, "m_method" ) );
assertNull( obj.getCalledMethod() );
diff --git a/scr/src/test/java/org/apache/felix/scr/impl/helper/BindMethodTest.java b/scr/src/test/java/org/apache/felix/scr/impl/helper/BindMethodTest.java
index b0a18b2..f0baef1 100644
--- a/scr/src/test/java/org/apache/felix/scr/impl/helper/BindMethodTest.java
+++ b/scr/src/test/java/org/apache/felix/scr/impl/helper/BindMethodTest.java
@@ -33,6 +33,8 @@
import org.apache.felix.scr.impl.manager.components.T3;
import org.apache.felix.scr.impl.manager.components2.T2;
import org.apache.felix.scr.impl.metadata.ComponentMetadata;
+import org.apache.felix.scr.impl.metadata.DSVersion;
+import org.apache.felix.scr.impl.metadata.ReferenceMetadata;
import org.apache.felix.scr.impl.metadata.XmlHandler;
import org.easymock.EasyMock;
import org.osgi.framework.BundleContext;
@@ -68,374 +70,374 @@
public void test_Unexistent()
{
- testMethod( "unexistent", new T1(), false, null );
- testMethod( "unexistent", new T1(), true, null );
- testMethod( "unexistent", new T2(), false, null );
- testMethod( "unexistent", new T2(), true, null );
- testMethod( "unexistent", new T3(), false, null );
- testMethod( "unexistent", new T3(), true, null );
+ testMethod( "unexistent", new T1(), DSVersion.DS10, null );
+ testMethod( "unexistent", new T1(), DSVersion.DS11, null );
+ testMethod( "unexistent", new T2(), DSVersion.DS10, null );
+ testMethod( "unexistent", new T2(), DSVersion.DS11, null );
+ testMethod( "unexistent", new T3(), DSVersion.DS10, null );
+ testMethod( "unexistent", new T3(), DSVersion.DS11, null );
}
public void test_privateT1()
{
- testMethod( "privateT1", new T1(), false, null );
- testMethod( "privateT1", new T1(), true, null );
- testMethod( "privateT1", new T2(), false, null );
- testMethod( "privateT1", new T2(), true, null );
- testMethod( "privateT1", new T3(), false, null );
- testMethod( "privateT1", new T3(), true, null );
+ testMethod( "privateT1", new T1(), DSVersion.DS10, null );
+ testMethod( "privateT1", new T1(), DSVersion.DS11, null );
+ testMethod( "privateT1", new T2(), DSVersion.DS10, null );
+ testMethod( "privateT1", new T2(), DSVersion.DS11, null );
+ testMethod( "privateT1", new T3(), DSVersion.DS10, null );
+ testMethod( "privateT1", new T3(), DSVersion.DS11, null );
}
public void test_privateT1SR()
{
- testMethod( "privateT1SR", new T1(), false, null );
- testMethod( "privateT1SR", new T1(), true, "privateT1SR" );
- testMethod( "privateT1SR", new T2(), false, null );
- testMethod( "privateT1SR", new T2(), true, null );
+ testMethod( "privateT1SR", new T1(), DSVersion.DS10, null );
+ testMethod( "privateT1SR", new T1(), DSVersion.DS11, "privateT1SR" );
+ testMethod( "privateT1SR", new T2(), DSVersion.DS10, null );
+ testMethod( "privateT1SR", new T2(), DSVersion.DS11, null );
}
public void test_privateT1SI()
{
- testMethod( "privateT1SI", new T1(), false, null );
- testMethod( "privateT1SI", new T1(), true, "privateT1SI" );
- testMethod( "privateT1SI", new T2(), false, null );
- testMethod( "privateT1SI", new T2(), true, null );
+ testMethod( "privateT1SI", new T1(), DSVersion.DS10, null );
+ testMethod( "privateT1SI", new T1(), DSVersion.DS11, "privateT1SI" );
+ testMethod( "privateT1SI", new T2(), DSVersion.DS10, null );
+ testMethod( "privateT1SI", new T2(), DSVersion.DS11, null );
}
public void test_privateT1SIMap()
{
- testMethod( "privateT1SIMap", new T1(), false, null );
- testMethod( "privateT1SIMap", new T1(), true, "privateT1SIMap" );
- testMethod( "privateT1SIMap", new T2(), false, null );
- testMethod( "privateT1SIMap", new T2(), true, null );
+ testMethod( "privateT1SIMap", new T1(), DSVersion.DS10, null );
+ testMethod( "privateT1SIMap", new T1(), DSVersion.DS11, "privateT1SIMap" );
+ testMethod( "privateT1SIMap", new T2(), DSVersion.DS10, null );
+ testMethod( "privateT1SIMap", new T2(), DSVersion.DS11, null );
}
public void test_privateT1SSI()
{
- testMethod( "privateT1SSI", new T1(), false, null );
- testMethod( "privateT1SSI", new T1(), true, "privateT1SSI" );
- testMethod( "privateT1SSI", new T2(), false, null );
- testMethod( "privateT1SSI", new T2(), true, null );
+ testMethod( "privateT1SSI", new T1(), DSVersion.DS10, null );
+ testMethod( "privateT1SSI", new T1(), DSVersion.DS11, "privateT1SSI" );
+ testMethod( "privateT1SSI", new T2(), DSVersion.DS10, null );
+ testMethod( "privateT1SSI", new T2(), DSVersion.DS11, null );
}
public void test_privateT1SSIMap()
{
- testMethod( "privateT1SSIMap", new T1(), false, null );
- testMethod( "privateT1SSIMap", new T1(), true, "privateT1SSIMap" );
- testMethod( "privateT1SSIMap", new T2(), false, null );
- testMethod( "privateT1SSIMap", new T2(), true, null );
+ testMethod( "privateT1SSIMap", new T1(), DSVersion.DS10, null );
+ testMethod( "privateT1SSIMap", new T1(), DSVersion.DS11, "privateT1SSIMap" );
+ testMethod( "privateT1SSIMap", new T2(), DSVersion.DS10, null );
+ testMethod( "privateT1SSIMap", new T2(), DSVersion.DS11, null );
}
public void test_privateT2()
{
- testMethod( "privateT2", new T1(), false, null );
- testMethod( "privateT2", new T1(), true, null );
- testMethod( "privateT2", new T2(), false, null );
- testMethod( "privateT2", new T2(), true, null );
+ testMethod( "privateT2", new T1(), DSVersion.DS10, null );
+ testMethod( "privateT2", new T1(), DSVersion.DS11, null );
+ testMethod( "privateT2", new T2(), DSVersion.DS10, null );
+ testMethod( "privateT2", new T2(), DSVersion.DS11, null );
}
public void test_privateT2SR()
{
- testMethod( "privateT2SR", new T1(), false, null );
- testMethod( "privateT2SR", new T1(), true, null );
- testMethod( "privateT2SR", new T2(), false, null );
- testMethod( "privateT2SR", new T2(), true, "privateT2SR" );
+ testMethod( "privateT2SR", new T1(), DSVersion.DS10, null );
+ testMethod( "privateT2SR", new T1(), DSVersion.DS11, null );
+ testMethod( "privateT2SR", new T2(), DSVersion.DS10, null );
+ testMethod( "privateT2SR", new T2(), DSVersion.DS11, "privateT2SR" );
}
public void test_privateT2SI()
{
- testMethod( "privateT2SI", new T1(), false, null );
- testMethod( "privateT2SI", new T1(), true, null );
- testMethod( "privateT2SI", new T2(), false, null );
- testMethod( "privateT2SI", new T2(), true, "privateT2SI" );
+ testMethod( "privateT2SI", new T1(), DSVersion.DS10, null );
+ testMethod( "privateT2SI", new T1(), DSVersion.DS11, null );
+ testMethod( "privateT2SI", new T2(), DSVersion.DS10, null );
+ testMethod( "privateT2SI", new T2(), DSVersion.DS11, "privateT2SI" );
}
public void test_privateT2SIMap()
{
- testMethod( "privateT2SIMap", new T1(), false, null );
- testMethod( "privateT2SIMap", new T1(), true, null );
- testMethod( "privateT2SIMap", new T2(), false, null );
- testMethod( "privateT2SIMap", new T2(), true, "privateT2SIMap" );
+ testMethod( "privateT2SIMap", new T1(), DSVersion.DS10, null );
+ testMethod( "privateT2SIMap", new T1(), DSVersion.DS11, null );
+ testMethod( "privateT2SIMap", new T2(), DSVersion.DS10, null );
+ testMethod( "privateT2SIMap", new T2(), DSVersion.DS11, "privateT2SIMap" );
}
public void test_privateT2SSI()
{
- testMethod( "privateT2SSI", new T1(), false, null );
- testMethod( "privateT2SSI", new T1(), true, null );
- testMethod( "privateT2SSI", new T2(), false, null );
- testMethod( "privateT2SSI", new T2(), true, "privateT2SSI" );
+ testMethod( "privateT2SSI", new T1(), DSVersion.DS10, null );
+ testMethod( "privateT2SSI", new T1(), DSVersion.DS11, null );
+ testMethod( "privateT2SSI", new T2(), DSVersion.DS10, null );
+ testMethod( "privateT2SSI", new T2(), DSVersion.DS11, "privateT2SSI" );
}
public void test_privateT2SSIMap()
{
- testMethod( "privateT2SSIMap", new T1(), false, null );
- testMethod( "privateT2SSIMap", new T1(), true, null );
- testMethod( "privateT2SSIMap", new T2(), false, null );
- testMethod( "privateT2SSIMap", new T2(), true, "privateT2SSIMap" );
+ testMethod( "privateT2SSIMap", new T1(), DSVersion.DS10, null );
+ testMethod( "privateT2SSIMap", new T1(), DSVersion.DS11, null );
+ testMethod( "privateT2SSIMap", new T2(), DSVersion.DS10, null );
+ testMethod( "privateT2SSIMap", new T2(), DSVersion.DS11, "privateT2SSIMap" );
}
public void test_packageT1()
{
- testMethod( "packageT1", new T1(), false, null );
- testMethod( "packageT1", new T1(), true, null );
- testMethod( "packageT1", new T2(), false, null );
- testMethod( "packageT1", new T2(), true, null );
- testMethod( "packageT1", new T3(), false, null );
- testMethod( "packageT1", new T3(), true, null );
- testMethod( "packageT1", new T1a(), false, null );
- testMethod( "packageT1", new T1a(), true, null );
+ testMethod( "packageT1", new T1(), DSVersion.DS10, null );
+ testMethod( "packageT1", new T1(), DSVersion.DS11, null );
+ testMethod( "packageT1", new T2(), DSVersion.DS10, null );
+ testMethod( "packageT1", new T2(), DSVersion.DS11, null );
+ testMethod( "packageT1", new T3(), DSVersion.DS10, null );
+ testMethod( "packageT1", new T3(), DSVersion.DS11, null );
+ testMethod( "packageT1", new T1a(), DSVersion.DS10, null );
+ testMethod( "packageT1", new T1a(), DSVersion.DS11, null );
}
public void test_packageT1SR()
{
- testMethod( "packageT1SR", new T1(), false, null );
- testMethod( "packageT1SR", new T1(), true, "packageT1SR" );
- testMethod( "packageT1SR", new T2(), false, null );
- testMethod( "packageT1SR", new T2(), true, null );
- testMethod( "packageT1SR", new T3(), false, null );
- testMethod( "packageT1SR", new T3(), true, null );
- testMethod( "packageT1SR", new T1a(), false, null );
- testMethod( "packageT1SR", new T1a(), true, "packageT1SR" );
+ testMethod( "packageT1SR", new T1(), DSVersion.DS10, null );
+ testMethod( "packageT1SR", new T1(), DSVersion.DS11, "packageT1SR" );
+ testMethod( "packageT1SR", new T2(), DSVersion.DS10, null );
+ testMethod( "packageT1SR", new T2(), DSVersion.DS11, null );
+ testMethod( "packageT1SR", new T3(), DSVersion.DS10, null );
+ testMethod( "packageT1SR", new T3(), DSVersion.DS11, null );
+ testMethod( "packageT1SR", new T1a(), DSVersion.DS10, null );
+ testMethod( "packageT1SR", new T1a(), DSVersion.DS11, "packageT1SR" );
}
public void test_packageT1SI()
{
- testMethod( "packageT1SI", new T1(), false, null );
- testMethod( "packageT1SI", new T1(), true, "packageT1SI" );
- testMethod( "packageT1SI", new T2(), false, null );
- testMethod( "packageT1SI", new T2(), true, null );
- testMethod( "packageT1SI", new T3(), false, null );
- testMethod( "packageT1SI", new T3(), true, null );
- testMethod( "packageT1SI", new T1a(), false, null );
- testMethod( "packageT1SI", new T1a(), true, "packageT1SI" );
+ testMethod( "packageT1SI", new T1(), DSVersion.DS10, null );
+ testMethod( "packageT1SI", new T1(), DSVersion.DS11, "packageT1SI" );
+ testMethod( "packageT1SI", new T2(), DSVersion.DS10, null );
+ testMethod( "packageT1SI", new T2(), DSVersion.DS11, null );
+ testMethod( "packageT1SI", new T3(), DSVersion.DS10, null );
+ testMethod( "packageT1SI", new T3(), DSVersion.DS11, null );
+ testMethod( "packageT1SI", new T1a(), DSVersion.DS10, null );
+ testMethod( "packageT1SI", new T1a(), DSVersion.DS11, "packageT1SI" );
}
public void test_packageT1SIMap()
{
- testMethod( "packageT1SIMap", new T1(), false, null );
- testMethod( "packageT1SIMap", new T1(), true, "packageT1SIMap" );
- testMethod( "packageT1SIMap", new T2(), false, null );
- testMethod( "packageT1SIMap", new T2(), true, null );
- testMethod( "packageT1SIMap", new T3(), false, null );
- testMethod( "packageT1SIMap", new T3(), true, null );
- testMethod( "packageT1SIMap", new T1a(), false, null );
- testMethod( "packageT1SIMap", new T1a(), true, "packageT1SIMap" );
+ testMethod( "packageT1SIMap", new T1(), DSVersion.DS10, null );
+ testMethod( "packageT1SIMap", new T1(), DSVersion.DS11, "packageT1SIMap" );
+ testMethod( "packageT1SIMap", new T2(), DSVersion.DS10, null );
+ testMethod( "packageT1SIMap", new T2(), DSVersion.DS11, null );
+ testMethod( "packageT1SIMap", new T3(), DSVersion.DS10, null );
+ testMethod( "packageT1SIMap", new T3(), DSVersion.DS11, null );
+ testMethod( "packageT1SIMap", new T1a(), DSVersion.DS10, null );
+ testMethod( "packageT1SIMap", new T1a(), DSVersion.DS11, "packageT1SIMap" );
}
public void test_packageT1SSI()
{
- testMethod( "packageT1SSI", new T1(), false, null );
- testMethod( "packageT1SSI", new T1(), true, "packageT1SSI" );
- testMethod( "packageT1SSI", new T2(), false, null );
- testMethod( "packageT1SSI", new T2(), true, null );
- testMethod( "packageT1SSI", new T3(), false, null );
- testMethod( "packageT1SSI", new T3(), true, null );
- testMethod( "packageT1SSI", new T1a(), false, null );
- testMethod( "packageT1SSI", new T1a(), true, "packageT1SSI" );
+ testMethod( "packageT1SSI", new T1(), DSVersion.DS10, null );
+ testMethod( "packageT1SSI", new T1(), DSVersion.DS11, "packageT1SSI" );
+ testMethod( "packageT1SSI", new T2(), DSVersion.DS10, null );
+ testMethod( "packageT1SSI", new T2(), DSVersion.DS11, null );
+ testMethod( "packageT1SSI", new T3(), DSVersion.DS10, null );
+ testMethod( "packageT1SSI", new T3(), DSVersion.DS11, null );
+ testMethod( "packageT1SSI", new T1a(), DSVersion.DS10, null );
+ testMethod( "packageT1SSI", new T1a(), DSVersion.DS11, "packageT1SSI" );
}
public void test_packageT1SSIMap()
{
- testMethod( "packageT1SSIMap", new T1(), false, null );
- testMethod( "packageT1SSIMap", new T1(), true, "packageT1SSIMap" );
- testMethod( "packageT1SSIMap", new T2(), false, null );
- testMethod( "packageT1SSIMap", new T2(), true, null );
- testMethod( "packageT1SSIMap", new T3(), false, null );
- testMethod( "packageT1SSIMap", new T3(), true, null );
- testMethod( "packageT1SSIMap", new T1a(), false, null );
- testMethod( "packageT1SSIMap", new T1a(), true, "packageT1SSIMap" );
+ testMethod( "packageT1SSIMap", new T1(), DSVersion.DS10, null );
+ testMethod( "packageT1SSIMap", new T1(), DSVersion.DS11, "packageT1SSIMap" );
+ testMethod( "packageT1SSIMap", new T2(), DSVersion.DS10, null );
+ testMethod( "packageT1SSIMap", new T2(), DSVersion.DS11, null );
+ testMethod( "packageT1SSIMap", new T3(), DSVersion.DS10, null );
+ testMethod( "packageT1SSIMap", new T3(), DSVersion.DS11, null );
+ testMethod( "packageT1SSIMap", new T1a(), DSVersion.DS10, null );
+ testMethod( "packageT1SSIMap", new T1a(), DSVersion.DS11, "packageT1SSIMap" );
}
public void test_packageT2()
{
- testMethod( "packageT2", new T1(), false, null );
- testMethod( "packageT2", new T1(), true, null );
- testMethod( "packageT2", new T2(), false, null );
- testMethod( "packageT2", new T2(), true, null );
+ testMethod( "packageT2", new T1(), DSVersion.DS10, null );
+ testMethod( "packageT2", new T1(), DSVersion.DS11, null );
+ testMethod( "packageT2", new T2(), DSVersion.DS10, null );
+ testMethod( "packageT2", new T2(), DSVersion.DS11, null );
}
public void test_packageT2SR()
{
- testMethod( "packageT2SR", new T1(), false, null );
- testMethod( "packageT2SR", new T1(), true, null );
- testMethod( "packageT2SR", new T2(), false, null );
- testMethod( "packageT2SR", new T2(), true, "packageT2SR" );
+ testMethod( "packageT2SR", new T1(), DSVersion.DS10, null );
+ testMethod( "packageT2SR", new T1(), DSVersion.DS11, null );
+ testMethod( "packageT2SR", new T2(), DSVersion.DS10, null );
+ testMethod( "packageT2SR", new T2(), DSVersion.DS11, "packageT2SR" );
}
public void test_packageT2SI()
{
- testMethod( "packageT2SI", new T1(), false, null );
- testMethod( "packageT2SI", new T1(), true, null );
- testMethod( "packageT2SI", new T2(), false, null );
- testMethod( "packageT2SI", new T2(), true, "packageT2SI" );
+ testMethod( "packageT2SI", new T1(), DSVersion.DS10, null );
+ testMethod( "packageT2SI", new T1(), DSVersion.DS11, null );
+ testMethod( "packageT2SI", new T2(), DSVersion.DS10, null );
+ testMethod( "packageT2SI", new T2(), DSVersion.DS11, "packageT2SI" );
}
public void test_packageT2SIMap()
{
- testMethod( "packageT2SIMap", new T1(), false, null );
- testMethod( "packageT2SIMap", new T1(), true, null );
- testMethod( "packageT2SIMap", new T2(), false, null );
- testMethod( "packageT2SIMap", new T2(), true, "packageT2SIMap" );
+ testMethod( "packageT2SIMap", new T1(), DSVersion.DS10, null );
+ testMethod( "packageT2SIMap", new T1(), DSVersion.DS11, null );
+ testMethod( "packageT2SIMap", new T2(), DSVersion.DS10, null );
+ testMethod( "packageT2SIMap", new T2(), DSVersion.DS11, "packageT2SIMap" );
}
public void test_packageT2SSI()
{
- testMethod( "packageT2SSI", new T1(), false, null );
- testMethod( "packageT2SSI", new T1(), true, null );
- testMethod( "packageT2SSI", new T2(), false, null );
- testMethod( "packageT2SSI", new T2(), true, "packageT2SSI" );
+ testMethod( "packageT2SSI", new T1(), DSVersion.DS10, null );
+ testMethod( "packageT2SSI", new T1(), DSVersion.DS11, null );
+ testMethod( "packageT2SSI", new T2(), DSVersion.DS10, null );
+ testMethod( "packageT2SSI", new T2(), DSVersion.DS11, "packageT2SSI" );
}
public void test_packageT2SSIMap()
{
- testMethod( "packageT2SSIMap", new T1(), false, null );
- testMethod( "packageT2SSIMap", new T1(), true, null );
- testMethod( "packageT2SSIMap", new T2(), false, null );
- testMethod( "packageT2SSIMap", new T2(), true, "packageT2SSIMap" );
+ testMethod( "packageT2SSIMap", new T1(), DSVersion.DS10, null );
+ testMethod( "packageT2SSIMap", new T1(), DSVersion.DS11, null );
+ testMethod( "packageT2SSIMap", new T2(), DSVersion.DS10, null );
+ testMethod( "packageT2SSIMap", new T2(), DSVersion.DS11, "packageT2SSIMap" );
}
public void test_protectedT1()
{
- testMethod( "protectedT1", new T1(), false, null );
- testMethod( "protectedT1", new T1(), true, null );
- testMethod( "protectedT1", new T2(), false, null );
- testMethod( "protectedT1", new T2(), true, null );
+ testMethod( "protectedT1", new T1(), DSVersion.DS10, null );
+ testMethod( "protectedT1", new T1(), DSVersion.DS11, null );
+ testMethod( "protectedT1", new T2(), DSVersion.DS10, null );
+ testMethod( "protectedT1", new T2(), DSVersion.DS11, null );
}
public void test_protectedT1SR()
{
- testMethod( "protectedT1SR", new T1(), false, "protectedT1SR" );
- testMethod( "protectedT1SR", new T1(), true, "protectedT1SR" );
- testMethod( "protectedT1SR", new T2(), false, "protectedT1SR" );
- testMethod( "protectedT1SR", new T2(), true, "protectedT1SR" );
+ testMethod( "protectedT1SR", new T1(), DSVersion.DS10, "protectedT1SR" );
+ testMethod( "protectedT1SR", new T1(), DSVersion.DS11, "protectedT1SR" );
+ testMethod( "protectedT1SR", new T2(), DSVersion.DS10, "protectedT1SR" );
+ testMethod( "protectedT1SR", new T2(), DSVersion.DS11, "protectedT1SR" );
}
public void test_protectedT1SI()
{
- testMethod( "protectedT1SI", new T1(), false, "protectedT1SI" );
- testMethod( "protectedT1SI", new T1(), true, "protectedT1SI" );
- testMethod( "protectedT1SI", new T2(), false, "protectedT1SI" );
- testMethod( "protectedT1SI", new T2(), true, "protectedT1SI" );
+ testMethod( "protectedT1SI", new T1(), DSVersion.DS10, "protectedT1SI" );
+ testMethod( "protectedT1SI", new T1(), DSVersion.DS11, "protectedT1SI" );
+ testMethod( "protectedT1SI", new T2(), DSVersion.DS10, "protectedT1SI" );
+ testMethod( "protectedT1SI", new T2(), DSVersion.DS11, "protectedT1SI" );
}
public void test_protectedT1SSI()
{
- testMethod( "protectedT1SSI", new T1(), false, "protectedT1SSI" );
- testMethod( "protectedT1SSI", new T1(), true, "protectedT1SSI" );
- testMethod( "protectedT1SSI", new T2(), false, "protectedT1SSI" );
- testMethod( "protectedT1SSI", new T2(), true, "protectedT1SSI" );
+ testMethod( "protectedT1SSI", new T1(), DSVersion.DS10, "protectedT1SSI" );
+ testMethod( "protectedT1SSI", new T1(), DSVersion.DS11, "protectedT1SSI" );
+ testMethod( "protectedT1SSI", new T2(), DSVersion.DS10, "protectedT1SSI" );
+ testMethod( "protectedT1SSI", new T2(), DSVersion.DS11, "protectedT1SSI" );
}
public void test_publicT1()
{
- testMethod( "publicT1", new T1(), false, null );
- testMethod( "publicT1", new T1(), true, null );
- testMethod( "publicT1", new T2(), false, null );
- testMethod( "publicT1", new T2(), true, null );
+ testMethod( "publicT1", new T1(), DSVersion.DS10, null );
+ testMethod( "publicT1", new T1(), DSVersion.DS11, null );
+ testMethod( "publicT1", new T2(), DSVersion.DS10, null );
+ testMethod( "publicT1", new T2(), DSVersion.DS11, null );
}
public void test_publicT1SR()
{
- testMethod( "publicT1SR", new T1(), false, "publicT1SR" );
- testMethod( "publicT1SR", new T1(), true, "publicT1SR" );
- testMethod( "publicT1SR", new T2(), false, "publicT1SR" );
- testMethod( "publicT1SR", new T2(), true, "publicT1SR" );
+ testMethod( "publicT1SR", new T1(), DSVersion.DS10, "publicT1SR" );
+ testMethod( "publicT1SR", new T1(), DSVersion.DS11, "publicT1SR" );
+ testMethod( "publicT1SR", new T2(), DSVersion.DS10, "publicT1SR" );
+ testMethod( "publicT1SR", new T2(), DSVersion.DS11, "publicT1SR" );
}
public void test_publicT1SI()
{
- testMethod( "publicT1SI", new T1(), false, "publicT1SI" );
- testMethod( "publicT1SI", new T1(), true, "publicT1SI" );
- testMethod( "publicT1SI", new T2(), false, "publicT1SI" );
- testMethod( "publicT1SI", new T2(), true, "publicT1SI" );
+ testMethod( "publicT1SI", new T1(), DSVersion.DS10, "publicT1SI" );
+ testMethod( "publicT1SI", new T1(), DSVersion.DS11, "publicT1SI" );
+ testMethod( "publicT1SI", new T2(), DSVersion.DS10, "publicT1SI" );
+ testMethod( "publicT1SI", new T2(), DSVersion.DS11, "publicT1SI" );
}
public void test_publicT1SIMap()
{
- testMethod( "publicT1SIMap", new T1(), false, null );
- testMethod( "publicT1SIMap", new T1(), true, "publicT1SIMap" );
- testMethod( "publicT1SIMap", new T2(), false, null );
- testMethod( "publicT1SIMap", new T2(), true, "publicT1SIMap" );
+ testMethod( "publicT1SIMap", new T1(), DSVersion.DS10, null );
+ testMethod( "publicT1SIMap", new T1(), DSVersion.DS11, "publicT1SIMap" );
+ testMethod( "publicT1SIMap", new T2(), DSVersion.DS10, null );
+ testMethod( "publicT1SIMap", new T2(), DSVersion.DS11, "publicT1SIMap" );
}
public void test_publicT1SSI()
{
- testMethod( "publicT1SSI", new T1(), false, "publicT1SSI" );
- testMethod( "publicT1SSI", new T1(), true, "publicT1SSI" );
- testMethod( "publicT1SSI", new T2(), false, "publicT1SSI" );
- testMethod( "publicT1SSI", new T2(), true, "publicT1SSI" );
+ testMethod( "publicT1SSI", new T1(), DSVersion.DS10, "publicT1SSI" );
+ testMethod( "publicT1SSI", new T1(), DSVersion.DS11, "publicT1SSI" );
+ testMethod( "publicT1SSI", new T2(), DSVersion.DS10, "publicT1SSI" );
+ testMethod( "publicT1SSI", new T2(), DSVersion.DS11, "publicT1SSI" );
}
public void test_publicT1SSIMap()
{
- testMethod( "publicT1SSIMap", new T1(), false, null );
- testMethod( "publicT1SSIMap", new T1(), true, "publicT1SSIMap" );
- testMethod( "publicT1SSIMap", new T2(), false, null );
- testMethod( "publicT1SSIMap", new T2(), true, "publicT1SSIMap" );
+ testMethod( "publicT1SSIMap", new T1(), DSVersion.DS10, null );
+ testMethod( "publicT1SSIMap", new T1(), DSVersion.DS11, "publicT1SSIMap" );
+ testMethod( "publicT1SSIMap", new T2(), DSVersion.DS10, null );
+ testMethod( "publicT1SSIMap", new T2(), DSVersion.DS11, "publicT1SSIMap" );
}
public void test_suitable()
{
// T1 should use its own public implementation
- testMethod( "suitable", new T1(), false, "suitableT1" );
- testMethod( "suitable", new T1(), true, "suitableT1" );
+ testMethod( "suitable", new T1(), DSVersion.DS10, "suitableT1" );
+ testMethod( "suitable", new T1(), DSVersion.DS11, "suitableT1" );
// T2's private implementation is only visible for DS 1.1
- testMethod( "suitable", new T2(), false, null );
- testMethod( "suitable", new T2(), true, "suitableT2" );
+ testMethod( "suitable", new T2(), DSVersion.DS10, null );
+ testMethod( "suitable", new T2(), DSVersion.DS11, "suitableT2" );
// T3 extends T2 and cannot see T2's private method
- testMethod( "suitable", new T3(), false, null );
- testMethod( "suitable", new T3(), true, null );
+ testMethod( "suitable", new T3(), DSVersion.DS10, null );
+ testMethod( "suitable", new T3(), DSVersion.DS11, null );
// T1a extends T1 and uses T1's public method
- testMethod( "suitable", new T1a(), false, "suitableT1" );
- testMethod( "suitable", new T1a(), true, "suitableT1" );
+ testMethod( "suitable", new T1a(), DSVersion.DS10, "suitableT1" );
+ testMethod( "suitable", new T1a(), DSVersion.DS11, "suitableT1" );
}
- private void testMethod( final String methodName, final T1 component, final boolean isDS11,
+ private void testMethod( final String methodName, final T1 component, final DSVersion dsVersion,
final String expectCallPerformed )
{
ComponentContainer container = newContainer();
SingleComponentManager icm = new SingleComponentManager( container, new ComponentMethods() );
BindMethod bm = new BindMethod( methodName, component.getClass(),
- FakeService.class.getName(), isDS11, false );
+ FakeService.class.getName(), dsVersion, false, ReferenceMetadata.ReferenceScope.bundle );
RefPair refPair = new SingleRefPair( m_serviceReference );
ComponentContextImpl<T1> cc = new ComponentContextImpl(icm, null);
assertTrue( bm.getServiceObject( cc, refPair, m_context, icm ) );
@@ -468,7 +470,7 @@
}
private ComponentMetadata newMetadata() {
- ComponentMetadata metadata = new ComponentMetadata( XmlHandler.DS_VERSION_1_1 );
+ ComponentMetadata metadata = new ComponentMetadata( DSVersion.DS11 );
metadata.setName("foo");
metadata.setImplementationClassName(Object.class.getName());
metadata.validate(null);
diff --git a/scr/src/test/java/org/apache/felix/scr/impl/metadata/ComponentMetadataTest.java b/scr/src/test/java/org/apache/felix/scr/impl/metadata/ComponentMetadataTest.java
index 55d7410..be8e71e 100644
--- a/scr/src/test/java/org/apache/felix/scr/impl/metadata/ComponentMetadataTest.java
+++ b/scr/src/test/java/org/apache/felix/scr/impl/metadata/ComponentMetadataTest.java
@@ -505,7 +505,7 @@
// updated method accepted for DS 1.1-felix
final ReferenceMetadata rm3 = createReferenceMetadata( "test" );
rm3.setUpdated( "my_updated_method" );
- final ComponentMetadata cm3 = createComponentMetadata( XmlHandler.DS_VERSION_1_1_FELIX, Boolean.TRUE, null );
+ final ComponentMetadata cm3 = createComponentMetadata( DSVersion.DS11Felix, Boolean.TRUE, null );
cm3.addDependency( rm3 );
// validates fine and logs no message
@@ -520,7 +520,7 @@
// updated method accepted for DS 1.2
final ReferenceMetadata rm3 = createReferenceMetadata( "test" );
rm3.setUpdated( "my_updated_method" );
- final ComponentMetadata cm3 = createComponentMetadata( XmlHandler.DS_VERSION_1_2, Boolean.TRUE, null );
+ final ComponentMetadata cm3 = createComponentMetadata( DSVersion.DS12, Boolean.TRUE, null );
cm3.addDependency( rm3 );
// validates fine and logs no message
@@ -741,16 +741,16 @@
public void test_get_configuration_pid_method()
{
- doTest_get_configuration_pid_method(XmlHandler.DS_VERSION_1_0);
- doTest_get_configuration_pid_method(XmlHandler.DS_VERSION_1_1);
- doTest_get_configuration_pid_method(XmlHandler.DS_VERSION_1_2);
+ doTest_get_configuration_pid_method(DSVersion.DS10);
+ doTest_get_configuration_pid_method(DSVersion.DS11);
+ doTest_get_configuration_pid_method(DSVersion.DS12);
}
- private void doTest_get_configuration_pid_method(int specVersion)
+ private void doTest_get_configuration_pid_method(DSVersion specVersion)
{
// Make sure that getConfigurationPid returns the default component name (implementation class name).
// We only do this kind of test if spec is greater than ds 1.0, because in ds 1.0, the component name is mandatory.
- if (specVersion > XmlHandler.DS_VERSION_1_0)
+ if ( specVersion.isDS11() )
{
ComponentMetadata cm = new ComponentMetadata( specVersion );
try
@@ -820,9 +820,9 @@
// Creates Component Metadata for the given namespace
- private ComponentMetadata createComponentMetadata( int nameSpaceCode, Boolean immediate, String factory )
+ private ComponentMetadata createComponentMetadata( DSVersion dsVersion, Boolean immediate, String factory )
{
- ComponentMetadata meta = new ComponentMetadata( nameSpaceCode );
+ ComponentMetadata meta = new ComponentMetadata( dsVersion );
meta.setName( "place.holder" );
meta.setImplementationClassName( "place.holder.implementation" );
if ( immediate != null )
@@ -840,20 +840,20 @@
// Creates DS 1.0 Component Metadata
private ComponentMetadata createComponentMetadata( Boolean immediate, String factory )
{
- return createComponentMetadata( XmlHandler.DS_VERSION_1_0, immediate, factory );
+ return createComponentMetadata( DSVersion.DS10, immediate, factory );
}
// Creates DS 1.1 Component Metadata
private ComponentMetadata createComponentMetadata11( Boolean immediate, String factory )
{
- return createComponentMetadata( XmlHandler.DS_VERSION_1_1, immediate, factory );
+ return createComponentMetadata( DSVersion.DS11, immediate, factory );
}
// Creates DS 1.2 Component Metadata
private ComponentMetadata createComponentMetadata12( Boolean immediate, String factory )
{
- return createComponentMetadata( XmlHandler.DS_VERSION_1_2, immediate, factory );
+ return createComponentMetadata( DSVersion.DS12, immediate, factory );
}
private ServiceMetadata createServiceMetadata( Boolean serviceFactory )
diff --git a/scr/src/test/java/org/apache/felix/scr/impl/metadata/XmlHandlerTest.java b/scr/src/test/java/org/apache/felix/scr/impl/metadata/XmlHandlerTest.java
index 56c0b38..f1d2831 100644
--- a/scr/src/test/java/org/apache/felix/scr/impl/metadata/XmlHandlerTest.java
+++ b/scr/src/test/java/org/apache/felix/scr/impl/metadata/XmlHandlerTest.java
@@ -97,7 +97,7 @@
final List metadataList = readMetadataFromString( "<scr:component xmlns:scr=\"http://www.osgi.org/xmlns/scr/v1.0.0\" name=\"n\" ><implementation class=\"n\"/></scr:component>" );
assertEquals( "1 Descriptor expected", 1, metadataList.size() );
final ComponentMetadata metadata = ( ComponentMetadata ) metadataList.get( 0 );
- assertEquals( "Expect NS 1.0.0", XmlHandler.DS_VERSION_1_0, metadata.getNamespaceCode() );
+ assertEquals( "Expect NS 1.0.0", DSVersion.DS10, metadata.getDSVersion() );
}
@@ -106,7 +106,7 @@
final List metadataList = readMetadataFromString( "<scr:component xmlns:scr=\"http://www.osgi.org/xmlns/scr/v1.1.0\" name=\"n\" ><implementation class=\"n\"/></scr:component>" );
assertEquals( "1 Descriptor expected", 1, metadataList.size() );
final ComponentMetadata metadata = ( ComponentMetadata ) metadataList.get( 0 );
- assertEquals( "Expect NS 1.1.0", XmlHandler.DS_VERSION_1_1, metadata.getNamespaceCode() );
+ assertEquals( "Expect NS 1.1.0", DSVersion.DS11, metadata.getDSVersion() );
}
@@ -115,7 +115,7 @@
final List metadataList = readMetadataFromString( "<scr:component xmlns:scr=\"http://felix.apache.org/xmlns/scr/v1.1.0-felix\" name=\"n\" ><implementation class=\"n\"/></scr:component>" );
assertEquals( "1 Descriptor expected", 1, metadataList.size() );
final ComponentMetadata metadata = ( ComponentMetadata ) metadataList.get( 0 );
- assertEquals( "Expect NS 1.1.0-felix", XmlHandler.DS_VERSION_1_1_FELIX, metadata.getNamespaceCode() );
+ assertEquals( "Expect NS 1.1.0-felix", DSVersion.DS11Felix, metadata.getDSVersion() );
}
@@ -124,7 +124,7 @@
final List metadataList = readMetadataFromString( "<scr:component xmlns:scr=\"http://www.osgi.org/xmlns/scr/v1.2.0\" name=\"n\" ><implementation class=\"n\"/></scr:component>" );
assertEquals( "1 Descriptor expected", 1, metadataList.size() );
final ComponentMetadata metadata = ( ComponentMetadata ) metadataList.get( 0 );
- assertEquals( "Expect NS 1.2.0", XmlHandler.DS_VERSION_1_2, metadata.getNamespaceCode() );
+ assertEquals( "Expect NS 1.2.0", DSVersion.DS12, metadata.getDSVersion() );
}
@@ -133,7 +133,7 @@
final List metadataList = readMetadataFromString( "<scr:component xmlns:scr=\"http://felix.apache.org/xmlns/scr/v1.2.0-felix\" name=\"n\" ><implementation class=\"n\"/></scr:component>" );
assertEquals( "1 Descriptor expected", 1, metadataList.size() );
final ComponentMetadata metadata = ( ComponentMetadata ) metadataList.get( 0 );
- assertEquals( "Expect NS 1.2.0-felix", XmlHandler.DS_VERSION_1_2_FELIX, metadata.getNamespaceCode() );
+ assertEquals( "Expect NS 1.2.0-felix", DSVersion.DS12Felix, metadata.getDSVersion() );
}
@@ -150,7 +150,7 @@
assertEquals( "1 Descriptor expected", 1, metadataList.size() );
final ComponentMetadata metadata = ( ComponentMetadata ) metadataList.get( 0 );
- assertEquals( "Expect NS 1.0.0", XmlHandler.DS_VERSION_1_0, metadata.getNamespaceCode() );
+ assertEquals( "Expect NS 1.0.0", DSVersion.DS10, metadata.getDSVersion() );
}
@@ -168,7 +168,7 @@
assertEquals( "Component Descriptors", 1, metadataList11.size() );
final ComponentMetadata cm11 = ( ComponentMetadata ) metadataList11.get( 0 );
cm11.validate( logger );
- assertEquals( "DS Version 1.1", XmlHandler.DS_VERSION_1_1, cm11.getNamespaceCode() );
+ assertEquals( "DS Version 1.1", DSVersion.DS11, cm11.getDSVersion() );
assertEquals( "Expected Activate Method set", "myactivate", cm11.getActivate() );
assertTrue( "Activate method expected to be declared", cm11.isActivateDeclared() );
assertEquals( "Expected Deactivate Method set", "mydeactivate", cm11.getDeactivate() );
@@ -234,8 +234,8 @@
// dont validate this, we test the raw reading
// ds namespace
- assertEquals( "DS Version 1.0", XmlHandler.DS_VERSION_1_0, cm10.getNamespaceCode() );
- assertFalse( "DS Version 1.0", cm10.isDS11() );
+ assertEquals( "DS Version 1.0", DSVersion.DS10, cm10.getDSVersion() );
+ assertFalse( "DS Version 1.0", cm10.getDSVersion().isDS11() );
// base component attributes
assertEquals( "component name", true, cm10.isEnabled() );
@@ -458,8 +458,8 @@
// dont validate this, we test the raw reading
// ds namespace
- assertEquals( "DS Version 1.1", XmlHandler.DS_VERSION_1_1, cm11.getNamespaceCode() );
- assertTrue( "DS Version 1.1", cm11.isDS11() );
+ assertEquals( "DS Version 1.1", DSVersion.DS11, cm11.getDSVersion() );
+ assertTrue( "DS Version 1.1", cm11.getDSVersion().isDS11() );
assertEquals( "component name", "DummyClass", cm11.getName() );
assertEquals( "component name", "DummyClass", cm11.getImplementationClassName() );