Commit a34b5aaf authored by Gwenael Cattez's avatar Gwenael Cattez

Add comment for BindingProcessorItf and implementations

parent dfd31288
......@@ -36,24 +36,88 @@ import org.ow2.frascati.remote.introspection.binding.BindingAttribute;
import org.ow2.frascati.remote.introspection.resources.BindingKind;
/**
*
* Interface for Introspection Binding processors
*/
public interface BindingProcessorItf
{
/**
* @return the identifier of the kind of process binding (WS,RMI,REST....)
* @return the identifier of the kind of binding processed (WS,RMI,REST....)
*/
public BindingKind getBindingKind();
public void bindReference(Interface itf, String interfaceName, Map<String,String> stringHints) throws BindingProcessorException;
public void exportService(Interface itf, String interfaceName, Map<String,String> stringHints) throws BindingProcessorException;
public void unbindReference(Component owner, String interfaceName, Object boundedObject) throws BindingProcessorException;
public void unexportService(Component owner, String interfaceName, Object boundedObject) throws BindingProcessorException;
public void setAttribute(Object boundedObject, String attribute, String newValue) throws BindingProcessorException;
/**
* Create a binding for fractal named interface referenceName own by referenceItf's owner based on stringHints
*
* @param referenceItf the fractal interface to bind
* @param referenceName the name of the interface to bind
* @param stringHints parameters for the new Binding
* @throws BindingProcessorException if a problem occurred during binding phase
*/
public void bindReference(Interface referenceItf, String referenceName, Map<String,String> stringHints) throws BindingProcessorException;
/**
* Export a service for fractal named serviceName interfaceName own by serviceItf's owner based on stringHints
*
* @param serviceItf the fractal interface to export
* @param serviceName the name of the interface to export
* @param stringHints parameters for the new Binding
* @throws BindingProcessorException if a problem occurred during export phase
*/
public void exportService(Interface serviceItf, String serviceName, Map<String,String> stringHints) throws BindingProcessorException;
/**
* Unbind boundedObject from fractal interface named referenceName own by owner
*
* @param owner of the reference
* @param referenceName name of the reference to unbind
* @param boundedObject the object bound to the reference interface
* @throws BindingProcessorException if a problem occurred during unbind phase
*/
public void unbindReference(Component owner, String referenceName, Object boundedObject) throws BindingProcessorException;
/**
* Unexport boundedObject from fractal interface named serviceName own by owner
*
* @param owner of the service
* @param serviceName name of the service to unexport
* @param boundedObject the object bound to the service interface
* @throws BindingProcessorException if a problem occurred during unexport phase
*/
public void unexportService(Component owner, String serviceName, Object boundedObject) throws BindingProcessorException;
/**
* Set attribute of an Object bound to fractal reference
*
* @param boundedObject the object bound to the fractal interface
* @param attribute the name of the attribute to set
* @param newValue the new value to set
* @throws BindingProcessorException if a problem occurred during set attribute phase
*/
public void setAttribute(Object boundedObject, String attributeName, String newValue) throws BindingProcessorException;
/**
* Get the list of @see org.ow2.frascati.remote.introspection.binding.BindingAttribute related to Object bound to fractal interface
*
* @param boundedObject the object bound to the fractal interface
* @return List of the BindingAttribute related to boundedObject
* @throws BindingProcessorException if a problem occurred during get attribute phase
*/
public List<BindingAttribute> getAttributes(Object boundedObject) throws BindingProcessorException;
/**
* @param skelton a skelton Object bound to a fractal interface
* @return true if the skelton is processed by this BindingProcessorItf, false otherwise
*/
public boolean isProcessedService(Object skelton);
/**
* @param stub a stub Object bound to a fractal interface
* @return true if the stub is processed by this BindingProcessorItf, false otherwise
*/
public boolean isProcessedReference(Object stub);
}
......@@ -44,13 +44,12 @@ import org.objectweb.fractal.bf.connectors.common.StubContentAttributes;
import org.objectweb.fractal.util.AttributesHelper;
import org.osoa.sca.annotations.Reference;
import org.ow2.frascati.remote.introspection.binding.BindingAttribute;
import org.ow2.frascati.remote.introspection.resources.Attribute;
import org.ow2.frascati.remote.introspection.resources.BindingKind;
import org.ow2.frascati.remote.introspection.util.FractalUtilItf;
/**
*
* BindingProcessor for BindingKing that delegate binding operation to BindingFactory
*/
public abstract class AbstractBindingProcessor implements BindingProcessorItf
{
......@@ -65,16 +64,40 @@ public abstract class AbstractBindingProcessor implements BindingProcessorItf
@Reference(name="fractalUtil")
protected FractalUtilItf fractalUtil;
/**
* BindingKind of this processor
*/
private BindingKind bindingKind;
/**
* The suffix a of skelton Object name proceed by this BindingProcessor
*/
private String skeltonSuffix;
/**
* The suffix a of stub Object name proceed by this BindingProcessor
*/
private String stubSuffix;
private Class<?> skeltonClass;
private Class<?> stubClass;
/**
* SkeletonContentAttributes class proceed by this BindingProcessor
*/
private Class<? extends SkeletonContentAttributes> skeltonClass;
/**
* StubContentAttributes class proceed by this BindingProcessor
*/
private Class<? extends StubContentAttributes> stubClass;
/**
* @param bindingKind BindingKind of this processor
* @param skeltonSuffix The suffix a of skelton Object name proceed by this BindingProcessor
* @param stubSuffix The suffix a of stub Object name proceed by this BindingProcessor
* @param skeltonClass SkeletonContentAttributes class proceed by this BindingProcessor
* @param stubClass StubContentAttributes class proceed by this BindingProcessor
*/
public AbstractBindingProcessor(BindingKind bindingKind, String skeltonSuffix, String stubSuffix, Class<? extends SkeletonContentAttributes> skeltonClass, Class<? extends StubContentAttributes> stubClass)
{
this.bindingKind=bindingKind;
......@@ -84,16 +107,25 @@ public abstract class AbstractBindingProcessor implements BindingProcessorItf
this.stubClass=stubClass;
}
/**
* @see org.ow2.frascati.remote.introspection.binding.processor.BindingProcessorItf#getBindingKind()
*/
public BindingKind getBindingKind()
{
return bindingKind;
}
/**
* @return the plugin id need by the BindingFactory to perform binding
*/
public String getPluginId()
{
return getBindingKind().name().toLowerCase();
}
/**
* @see org.ow2.frascati.remote.introspection.binding.processor.BindingProcessorItf#bindReference(org.objectweb.fractal.api.Interface, java.lang.String, java.util.Map)
*/
public void bindReference(Interface itf, String interfaceName, Map<String,String> stringHints) throws BindingProcessorException
{
logger.fine(this.getBindingKind().name()+" bindReference interface : "+itf.getFcItfName()+" interfaceName "+interfaceName);
......@@ -108,6 +140,9 @@ public abstract class AbstractBindingProcessor implements BindingProcessorItf
}
}
/**
* @see org.ow2.frascati.remote.introspection.binding.processor.BindingProcessorItf#exportService(org.objectweb.fractal.api.Interface, java.lang.String, java.util.Map)
*/
public void exportService(Interface itf, String interfaceName, Map<String,String> stringHints) throws BindingProcessorException
{
logger.fine(this.getBindingKind().name()+" exportService interface : "+itf.getFcItfName()+" interfaceName "+interfaceName);
......@@ -122,6 +157,9 @@ public abstract class AbstractBindingProcessor implements BindingProcessorItf
}
}
/**
* @see org.ow2.frascati.remote.introspection.binding.processor.BindingProcessorItf#unbindReference(org.objectweb.fractal.api.Component, java.lang.String, java.lang.Object)
*/
public void unbindReference(Component owner, String interfaceName, Object boundedObject) throws BindingProcessorException
{
logger.fine(this.getBindingKind().name()+" unbindReference owner : "+fractalUtil.getComponentName(owner)+" interfaceName "+interfaceName);
......@@ -136,6 +174,9 @@ public abstract class AbstractBindingProcessor implements BindingProcessorItf
}
}
/**
* @see org.ow2.frascati.remote.introspection.binding.processor.BindingProcessorItf#unexportService(org.objectweb.fractal.api.Component, java.lang.String, java.lang.Object)
*/
public void unexportService(Component owner, String interfaceName, Object boundedObject) throws BindingProcessorException
{
logger.fine(this.getBindingKind().name()+" unexportService owner : "+fractalUtil.getComponentName(owner)+" interfaceName "+interfaceName);
......@@ -149,6 +190,9 @@ public abstract class AbstractBindingProcessor implements BindingProcessorItf
}
}
/**
* @see org.ow2.frascati.remote.introspection.binding.processor.BindingProcessorItf#setAttribute(java.lang.Object, java.lang.String, java.lang.String)
*/
public void setAttribute(Object boundedObject, String attribute, String newValue) throws BindingProcessorException
{
try
......@@ -170,6 +214,9 @@ public abstract class AbstractBindingProcessor implements BindingProcessorItf
}
}
/**
* @see org.ow2.frascati.remote.introspection.binding.processor.BindingProcessorItf#getAttributes(java.lang.Object)
*/
public List<BindingAttribute> getAttributes(Object boundedObject) throws BindingProcessorException
{
try
......@@ -204,16 +251,30 @@ public abstract class AbstractBindingProcessor implements BindingProcessorItf
}
}
/**
* @see org.ow2.frascati.remote.introspection.binding.processor.BindingProcessorItf#isProcessedService(java.lang.Object)
*/
public boolean isProcessedService(Object stub)
{
return isProcessedComponent(stub, this.skeltonSuffix, this.skeltonClass);
}
/**
* @see org.ow2.frascati.remote.introspection.binding.processor.BindingProcessorItf#isProcessedReference(java.lang.Object)
*/
public boolean isProcessedReference(Object skelton)
{
return isProcessedComponent(skelton, this.stubSuffix, this.stubClass);
}
/**
* Return true if componentObject's AttributeController isInstance of attributeClass or if componentObject's name end with suffix
*
* @param componentObject the fractal component to resolve
* @param suffix this.skeltonSuffix or this.stubSuffix
* @param attributeClass skeltonClass or stubClass
* @return true if the componentObject is a fractal component that AttributeController instance of attributeClass or name end with suffix, otherwise false
*/
private boolean isProcessedComponent(Object componentObject, String suffix, Class<?> attributeClass)
{
logger.finest("isProcessedComponent "+this.getBindingKind().name()+" "+suffix+" "+attributeClass);
......@@ -249,6 +310,13 @@ public abstract class AbstractBindingProcessor implements BindingProcessorItf
return isValidName || isValidAttribute;
}
/**
* Util method to finalize hints generation
*
* @param itf interface to process binding to
* @param params string hints of the binding to proceed
* @return the hints to pass to BindingFactory
*/
private Map<String, Object> processHints(Interface itf,Map<String, String> params)
{
Map<String, Object> hints = extractHints(params);
......@@ -257,6 +325,12 @@ public abstract class AbstractBindingProcessor implements BindingProcessorItf
return hints;
}
/**
* Extract binding hints from Map<String,String>
*
* @param params string hints of the binding to proceed
* @return the hints to pass to BindingFactory less CLASSLOADER and PLUGIN_ID hints
*/
protected abstract Map<String, Object> extractHints(Map<String, String> params);
}
......@@ -36,7 +36,7 @@ import org.objectweb.fractal.bf.connectors.jms.JmsStubContentAttributes;
import org.ow2.frascati.remote.introspection.resources.BindingKind;
/**
*
* JMS BindingProcessor
*/
@Scope("COMPOSITE")
public class JMSBindingProcessor extends AbstractBindingProcessor
......@@ -47,7 +47,7 @@ public class JMSBindingProcessor extends AbstractBindingProcessor
super(BindingKind.JMS,"-jms-skeleton","-jms-stub",JmsSkeletonContentAttributes.class, JmsStubContentAttributes.class);
}
/** (non-Javadoc)
/**
* @see org.ow2.frascati.remote.introspection.hints.HintsBindingProcessorItf#extractHints(javax.ws.rs.core.MultivaluedMap)
*/
public Map<String, Object> extractHints(Map<String, String> params)
......
......@@ -36,7 +36,7 @@ import org.objectweb.fractal.bf.connectors.jsonrpc.JsonRpcStubContentAttributes;
import org.ow2.frascati.remote.introspection.resources.BindingKind;
/**
*
* JSON_RPC BindingProcessor
*/
public class JSONRPCBindingProcessor extends AbstractBindingProcessor
{
......@@ -54,6 +54,9 @@ public class JSONRPCBindingProcessor extends AbstractBindingProcessor
return "jsonrpc";
}
/**
* @see org.ow2.frascati.remote.introspection.binding.processor.AbstractBindingProcessor#extractHints(java.util.Map)
*/
public Map<String, Object> extractHints(Map<String, String> params)
{
Map<String, Object> hints = new HashMap<String, Object>();
......
......@@ -37,7 +37,7 @@ import org.objectweb.fractal.bf.connectors.rest.RestStubContentAttributes;
import org.ow2.frascati.remote.introspection.resources.BindingKind;
/**
*
* REST BindingProcessor
*/
@Scope("COMPOSITE")
public class RESTBindingProcessor extends AbstractBindingProcessor
......@@ -47,6 +47,9 @@ public class RESTBindingProcessor extends AbstractBindingProcessor
super(BindingKind.REST,"-RESTful-skeleton","",RestSkeletonContentAttributes.class, RestStubContentAttributes.class);
}
/**
* @see org.ow2.frascati.remote.introspection.binding.processor.AbstractBindingProcessor#extractHints(java.util.Map)
*/
public Map<String, Object> extractHints(Map<String, String> params)
{
Map<String, Object> hints = new HashMap<String, Object>();
......
......@@ -35,7 +35,7 @@ import org.objectweb.fractal.bf.connectors.rmi.RmiConnectorConstants;
import org.ow2.frascati.remote.introspection.resources.BindingKind;
/**
*
* RMI BindingProcessor
*/
@Scope("COMPOSITE")
public class RMIBindingProcessor extends AbstractBindingProcessor
......@@ -47,7 +47,7 @@ public class RMIBindingProcessor extends AbstractBindingProcessor
super(BindingKind.RMI,"","-rmi-stub", null,null);
}
/** (non-Javadoc)
/**
* @see org.ow2.frascati.remote.introspection.hints.HintsBindingProcessorItf#extractHints(javax.ws.rs.core.MultivaluedMap)
*/
public Map<String, Object> extractHints(Map<String, String> params)
......
......@@ -55,11 +55,7 @@ public class SCABindingProcessor implements BindingProcessorItf
@Reference(name="fractalUtil")
protected FractalUtilItf fractalUtil;
public SCABindingProcessor()
{
}
/* (non-Javadoc)
/**
* @see org.ow2.frascati.remote.introspection.binding.processor.BindingProcessorItf#getBindingKind()
*/
public BindingKind getBindingKind()
......@@ -92,16 +88,16 @@ public class SCABindingProcessor implements BindingProcessorItf
logger.exiting(SCABindingProcessor.class.getName(), method, params);
}
/** (non-Javadoc)
/**
* @see org.ow2.frascati.remote.introspection.binding.processor.BindingProcessorItf#isProcessedService(org.objectweb.fractal.api.Component)
*/
public boolean isProcessedService(Object skelton)
{
//No service is proceed by SCA binding
/**No service is proceed by SCA binding*/
return false;
}
/** (non-Javadoc)
/**
* @see org.ow2.frascati.remote.introspection.binding.processor.BindingProcessorItf#isProcessedReference(org.objectweb.fractal.api.Component)
*/
public boolean isProcessedReference(Object stub)
......@@ -111,7 +107,7 @@ public class SCABindingProcessor implements BindingProcessorItf
return this.getScaBindingScaInvocationHandler(stub)!=null;
}
/* (non-Javadoc)
/**
* @see org.ow2.frascati.remote.introspection.binding.processor.BindingProcessorItf#bindReference(org.objectweb.fractal.api.Interface, java.lang.String, java.util.Map)
*/
public void bindReference(Interface reference, String referenceName, Map<String, String> stringHints) throws BindingProcessorException
......@@ -191,7 +187,7 @@ public class SCABindingProcessor implements BindingProcessorItf
}
/* (non-Javadoc)
/**
* @see org.ow2.frascati.remote.introspection.binding.processor.BindingProcessorItf#exportService(org.objectweb.fractal.api.Interface, java.lang.String, java.util.Map)
*/
public void exportService(Interface itf, String interfaceName, Map<String, String> stringHints) throws BindingProcessorException
......@@ -199,7 +195,7 @@ public class SCABindingProcessor implements BindingProcessorItf
throw new BindingProcessorException("Can not apply SCA binding on a service (serviceName : "+itf.getFcItfName()+")");
}
/* (non-Javadoc)
/**
* @see org.ow2.frascati.remote.introspection.binding.processor.BindingProcessorItf#unbindReference(org.objectweb.fractal.api.Component, java.lang.String, java.lang.Object)
*/
public void unbindReference(Component owner, String interfaceName, Object boundedObject) throws BindingProcessorException
......@@ -222,7 +218,7 @@ public class SCABindingProcessor implements BindingProcessorItf
}
/* (non-Javadoc)
/**
* @see org.ow2.frascati.remote.introspection.binding.processor.BindingProcessorItf#unexportService(org.objectweb.fractal.api.Component, java.lang.String, java.lang.Object)
*/
public void unexportService(Component owner, String interfaceName, Object boundedObject) throws BindingProcessorException
......@@ -230,7 +226,7 @@ public class SCABindingProcessor implements BindingProcessorItf
throw new BindingProcessorException("Can not apply SCA binding on a service (serviceName : "+interfaceName+")");
}
/* (non-Javadoc)
/**
* @see org.ow2.frascati.remote.introspection.binding.processor.BindingProcessorItf#setAttribute(java.lang.Object, java.lang.String, java.lang.String)
*/
public void setAttribute(Object boundedObject, String attribute, String newValue) throws BindingProcessorException
......@@ -260,6 +256,9 @@ public class SCABindingProcessor implements BindingProcessorItf
scaBindingScaInvocationHandler.setDelegate(service);
}
/**
* @see org.ow2.frascati.remote.introspection.binding.processor.BindingProcessorItf#getAttributes(java.lang.Object)
*/
public List<BindingAttribute> getAttributes(Object boundedObject) throws BindingProcessorException
{
ScaBindingScaInvocationHandler scaBindingScaInvocationHandler=getScaBindingScaInvocationHandler(boundedObject);
......@@ -273,6 +272,12 @@ public class SCABindingProcessor implements BindingProcessorItf
return bindingAttributes;
}
/**
* Determine if boundedObject is ScaBindingScaProxy
*
* @param boundedObject the Object bound to fractal interface
* @return ScaBindingScaInvocationHandler if boundedObject is a proxy for SCa binding, null otherwise
*/
private ScaBindingScaInvocationHandler getScaBindingScaInvocationHandler(Object boundedObject)
{
if(!Proxy.isProxyClass(boundedObject.getClass()) || !(Proxy.getInvocationHandler(boundedObject) instanceof ScaBindingScaInvocationHandler))
......
......@@ -36,7 +36,7 @@ import org.objectweb.fractal.bf.connectors.upnp.UPnPStubContentAttributes;
import org.ow2.frascati.remote.introspection.resources.BindingKind;
/**
*
* UPnP BindingProcessor
*/
@Scope("COMPOSITE")
public class UPnPBindingProcessor extends AbstractBindingProcessor
......@@ -47,7 +47,7 @@ public class UPnPBindingProcessor extends AbstractBindingProcessor
super(BindingKind.UPNP,"-upnp-skeleton","",UPnPSkeletonContentAttributes.class, UPnPStubContentAttributes.class);
}
/* (non-Javadoc)
/**
* @see org.ow2.frascati.remote.introspection.binding.processor.AbstractBindingProcessor#extractHints(java.util.Map)
*/
@Override
......
......@@ -35,7 +35,7 @@ import org.objectweb.fractal.bf.connectors.ws.WsStubContentAttributes;
import org.ow2.frascati.remote.introspection.resources.BindingKind;
/**
*
* WS BindingProcessor
*/
public class WSBindingProcessor extends AbstractBindingProcessor
{
......@@ -48,6 +48,9 @@ public class WSBindingProcessor extends AbstractBindingProcessor
super(BindingKind.WS,"-ws-skeleton","-ws-stub",WsSkeletonContentAttributes.class,WsStubContentAttributes.class);
}
/**
* @see org.ow2.frascati.remote.introspection.binding.processor.AbstractBindingProcessor#extractHints(java.util.Map)
*/
protected Map<String, Object> extractHints(Map<String, String> params)
{
Map<String, Object> hints = new HashMap<String, Object>();
......
......@@ -162,7 +162,7 @@ public class BindingManagerTest
public void jmsBindingProcessor() throws NoSuchInterfaceException, UnsupportedBindingComponentException, UnsupportedBindingException
{
JMSBindingProcessorTest jmsBindingProcessorTest=new JMSBindingProcessorTest();
jmsBindingProcessorTest.initTest(fractalUtil);
jmsBindingProcessorTest.initTest();
this.getBindinProcessor(jmsBindingProcessorTest);
this.getClientBindingBundle(jmsBindingProcessorTest);
this.getServerBindingBundle(jmsBindingProcessorTest);
......@@ -173,7 +173,7 @@ public class BindingManagerTest
public void jsonrpcBindingProcessor() throws NoSuchInterfaceException, UnsupportedBindingComponentException, UnsupportedBindingException
{
JSONRPCBindingProcessorTest jsonrpcBindingProcessorTest=new JSONRPCBindingProcessorTest();
jsonrpcBindingProcessorTest.initTest(fractalUtil);
jsonrpcBindingProcessorTest.initTest();
this.getBindinProcessor(jsonrpcBindingProcessorTest);
this.getClientBindingBundle(jsonrpcBindingProcessorTest);
this.getServerBindingBundle(jsonrpcBindingProcessorTest);
......@@ -184,7 +184,7 @@ public class BindingManagerTest
public void restBindingProcessor() throws NoSuchInterfaceException, UnsupportedBindingComponentException, UnsupportedBindingException
{
RestBindingProcessorTest restBindingProcessorTest=new RestBindingProcessorTest();
restBindingProcessorTest.initTest(fractalUtil);
restBindingProcessorTest.initTest();
this.getBindinProcessor(restBindingProcessorTest);
this.getClientBindingBundle(restBindingProcessorTest);
this.getServerBindingBundle(restBindingProcessorTest);
......@@ -195,7 +195,7 @@ public class BindingManagerTest
public void rmiBindingProcessor() throws NoSuchInterfaceException, UnsupportedBindingComponentException, UnsupportedBindingException
{
SCABindingProcessorTest scaBindingProcessorTest=new SCABindingProcessorTest();
scaBindingProcessorTest.initTest(fractalUtil);
scaBindingProcessorTest.initTest();
this.getBindinProcessor(scaBindingProcessorTest);
this.getClientBindingBundle(scaBindingProcessorTest);
//TODO RMI server is not proceed
......@@ -206,7 +206,7 @@ public class BindingManagerTest
public void scaBindingProcessor() throws NoSuchInterfaceException, UnsupportedBindingComponentException, UnsupportedBindingException
{
SCABindingProcessorTest scaBindingProcessorTest=new SCABindingProcessorTest();
scaBindingProcessorTest.initTest(fractalUtil);
scaBindingProcessorTest.initTest();
this.getBindinProcessor(scaBindingProcessorTest);
this.getClientBindingBundle(scaBindingProcessorTest);
/**SCA binding on a service is a non sense*/
......@@ -217,7 +217,7 @@ public class BindingManagerTest
public void upnpBindingProcessor() throws NoSuchInterfaceException, UnsupportedBindingComponentException, UnsupportedBindingException
{
UPnPBindingProcessorTest upnpBindingProcessorTest=new UPnPBindingProcessorTest();
upnpBindingProcessorTest.initTest(fractalUtil);
upnpBindingProcessorTest.initTest();
this.getBindinProcessor(upnpBindingProcessorTest);
this.getClientBindingBundle(upnpBindingProcessorTest);
this.getServerBindingBundle(upnpBindingProcessorTest);
......@@ -228,7 +228,7 @@ public class BindingManagerTest
public void wsBindingProcessor() throws NoSuchInterfaceException, UnsupportedBindingComponentException, UnsupportedBindingException
{
WSBindingProcessorTest upnpBindingProcessorTest=new WSBindingProcessorTest();
upnpBindingProcessorTest.initTest(fractalUtil);
upnpBindingProcessorTest.initTest();
this.getBindinProcessor(upnpBindingProcessorTest);
this.getClientBindingBundle(upnpBindingProcessorTest);
this.getServerBindingBundle(upnpBindingProcessorTest);
......
......@@ -27,7 +27,6 @@
package org.ow2.frascati.remote.introspection.binding.processor;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import java.util.ArrayList;
......@@ -36,9 +35,6 @@ import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import junit.framework.TestCase;
import org.junit.Test;
import org.objectweb.fractal.api.Interface;
import org.objectweb.fractal.api.NoSuchInterfaceException;
import org.ow2.frascati.remote.IntrospectionTestSuite;
......@@ -54,6 +50,7 @@ public abstract class BindingProcessorTest
protected Logger logger=Logger.getLogger(BindingProcessorTest.class.getName());
protected List<String> deployedComposites;
protected FractalUtilItf fractalUtil;
protected BindingKind bindingKind;
protected String serverInterfacePath;
......@@ -71,9 +68,10 @@ public abstract class BindingProcessorTest
this.clientInterfacePath=clientInterfacePath;
}
public void initTest(FractalUtilItf fractalUtil) throws NoSuchInterfaceException
public void initTest() throws NoSuchInterfaceException
{
logger.info("Init test "+this.getClass().getName());
this.fractalUtil=IntrospectionTestSuite.getFractalUtil();
this.deployedComposites=new ArrayList<String>();
List<String> contributionsToDeploy=this.getContributionsToDeploy();
......@@ -102,7 +100,7 @@ public abstract class BindingProcessorTest
this.serverInterfaceFc=fractalUtil.getInterface(this.serverInterfacePath);
assertNotNull(this.serverInterfaceFc);
List<Object> clientInterfaces=fractalUtil.getClientInterfaces(this.serverInterfaceFc);
if(clientInterfaces.size()>0)
if(!clientInterfaces.isEmpty())
{
this.skeltonInterfaceFc=clientInterfaces.get(0);
assertNotNull(skeltonInterfaceFc);
......@@ -125,12 +123,36 @@ public abstract class BindingProcessorTest
return new HashMap<String, String>();
}
public void finishTest()
protected void removeServerBinding()
{
for(String deployedComposite : this.deployedComposites)
{
IntrospectionTestSuite.undeployComposite(deployedComposite);
}
}
protected void removeClientBinding()
{