branch for 2.0.x releases (first created for gCube 2.10.0)
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/branches/common/common-gcore-clients/2.0@57621 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
commit
af50b66160
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
|
||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
|
||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>common-gcore-clients</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
gCube System - License
|
||||
------------------------------------------------------------
|
||||
|
||||
The gCube/gCore software is licensed as Free Open Source software conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
The software and documentation is provided by its authors/distributors "as is" and no expressed or
|
||||
implied warranty is given for its use, quality or fitness for a particular case.
|
|
@ -0,0 +1,2 @@
|
|||
* Fabio Simeoni (fabio.simeoni@fao.org), FAO of the UN, Italy
|
||||
* Rena Tsantouli (e.tsantoylh@di.uoa.gr), University of Athens, Greece
|
|
@ -0,0 +1,39 @@
|
|||
The gCube System - ${name}
|
||||
----------------------
|
||||
|
||||
This work has been partially supported by the following European projects: DILIGENT (FP6-2003-IST-2), D4Science (FP7-INFRA-2007-1.2.2),
|
||||
D4Science-II (FP7-INFRA-2008-1.2.2), iMarine (FP7-INFRASTRUCTURES-2011-2), and EUBrazilOpenBio (FP7-ICT-2011-EU-Brazil).
|
||||
|
||||
Authors
|
||||
-------
|
||||
|
||||
* Fabio Simeoni (fabio.simeoni@fao.org), FAO of the UN, Italy.
|
||||
|
||||
Version and Release Date
|
||||
------------------------
|
||||
${version}
|
||||
|
||||
Description
|
||||
-----------
|
||||
${description}
|
||||
|
||||
Download information
|
||||
--------------------
|
||||
|
||||
Source code is available from SVN:
|
||||
${scm.url}
|
||||
|
||||
Binaries can be downloaded from:
|
||||
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
Documentation is available on-line from the Projects Documentation Wiki:
|
||||
https://https://gcube.wiki.gcube-system.org/gcube/index.php/Integration_and_Interoperability_Facilities_Framework:_Client_Libraries_Framework
|
||||
|
||||
|
||||
|
||||
Licensing
|
||||
---------
|
||||
|
||||
This software is licensed under the terms you may find in the file named "LICENSE" in this directory.
|
|
@ -0,0 +1,8 @@
|
|||
<ReleaseNotes>
|
||||
<Changeset component="${build.finalName}" date="2012-04-27">
|
||||
<Change>First Release</Change>
|
||||
</Changeset>
|
||||
<Changeset component="${build.finalName}" date="2012-09-01">
|
||||
<Change>Rewritten as a framework for the implementation of client libraries for gCore services which comply with the CL Design Model</Change>
|
||||
</Changeset>
|
||||
</ReleaseNotes>
|
|
@ -0,0 +1,42 @@
|
|||
<assembly
|
||||
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
|
||||
<id>servicearchive</id>
|
||||
<formats>
|
||||
<format>tar.gz</format>
|
||||
</formats>
|
||||
<baseDirectory>/</baseDirectory>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>${distroDirectory}</directory>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
<useDefaultExcludes>true</useDefaultExcludes>
|
||||
<includes>
|
||||
<include>README</include>
|
||||
<include>LICENSE</include>
|
||||
<include>INSTALL</include>
|
||||
<include>MAINTAINERS</include>
|
||||
<include>changelog.xml</include>
|
||||
</includes>
|
||||
<fileMode>755</fileMode>
|
||||
<filtered>true</filtered>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
<files>
|
||||
<file>
|
||||
<source>${distroDirectory}/profile.xml</source>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
<filtered>true</filtered>
|
||||
</file>
|
||||
<file>
|
||||
<source>target/${build.finalName}.jar</source>
|
||||
<outputDirectory>/${artifactId}</outputDirectory>
|
||||
</file>
|
||||
<file>
|
||||
<source>${distroDirectory}/svnpath.txt</source>
|
||||
<outputDirectory>/${artifactId}</outputDirectory>
|
||||
<filtered>true</filtered>
|
||||
</file>
|
||||
</files>
|
||||
</assembly>
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<ID />
|
||||
<Type>Service</Type>
|
||||
<Profile>
|
||||
<Description>${description}</Description>
|
||||
<Class>Common</Class>
|
||||
<Name>${artifactId}</Name>
|
||||
<Version>1.0.0</Version>
|
||||
<Packages>
|
||||
<Software>
|
||||
<Name>${artifactId}</Name>
|
||||
<Version>${version}</Version>
|
||||
<MavenCoordinates>
|
||||
<groupId>${groupId}</groupId>
|
||||
<artifactId>${artifactId}</artifactId>
|
||||
<version>${version}</version>
|
||||
</MavenCoordinates>
|
||||
<Files>
|
||||
<File>${build.finalName}.jar</File>
|
||||
</Files>
|
||||
</Software>
|
||||
</Packages>
|
||||
</Profile>
|
||||
</Resource>
|
||||
|
|
@ -0,0 +1 @@
|
|||
${scm.url}
|
|
@ -0,0 +1,127 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>maven-parent</artifactId>
|
||||
<groupId>org.gcube.tools</groupId>
|
||||
<version>1.0.0</version>
|
||||
<relativePath />
|
||||
</parent>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>common-gcore-clients</artifactId>
|
||||
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
<name>GCore Clients</name>
|
||||
|
||||
<description>A framework for client APIs that invoke GCore services</description>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.d4science.research-infrastructures.eu/gcube/trunk/Common/common-gcore-clients</connection>
|
||||
<developerConnection>scm:svn:https://svn.d4science.research-infrastructures.eu/gcube/trunk/Common/common-gcore-clients</developerConnection>
|
||||
<url>http://svn.d4science.research-infrastructures.eu/gcube/trunk/Common/common-gcore-clients</url>
|
||||
</scm>
|
||||
|
||||
<properties>
|
||||
<distroDirectory>distro</distroDirectory>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>gcf</artifactId>
|
||||
<version>[1.4.1-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>common-clients</artifactId>
|
||||
<version>[2.0.0-SNAPSHOT,3.0.0-SNAPSHOT)</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.6.4</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.10</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<version>1.6.4</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<version>1.8.5</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.5</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-profile</id>
|
||||
<phase>install</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>target</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${distroDirectory}</directory>
|
||||
<filtering>true</filtering>
|
||||
<includes>
|
||||
<include>profile.xml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>${distroDirectory}/descriptor.xml</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>servicearchive</id>
|
||||
<phase>install</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
|
||||
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,112 @@
|
|||
package org.gcube.common.clients.gcore;
|
||||
|
||||
import java.io.StringReader;
|
||||
import java.io.StringWriter;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
import javax.xml.ws.wsaddressing.W3CEndpointReference;
|
||||
import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder;
|
||||
|
||||
import org.apache.axis.message.MessageElement;
|
||||
import org.apache.axis.message.addressing.AttributedURI;
|
||||
import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||
import org.apache.axis.message.addressing.ReferencePropertiesType;
|
||||
import org.gcube.common.clients.builders.AddressingUtils;
|
||||
import org.globus.wsrf.impl.SimpleResourceKey;
|
||||
import org.globus.wsrf.utils.AnyHelper;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.xml.sax.InputSource;
|
||||
|
||||
/**
|
||||
* Conversion methods for addresses of service endpoints and service instances.
|
||||
*
|
||||
* @author Fabio Simeoni
|
||||
*
|
||||
*/
|
||||
public class Utils {
|
||||
|
||||
public static final String GCORE_CONTEXTPATH = "/wsrf/services/";
|
||||
|
||||
private static final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
private static final String addressElement="Address";
|
||||
private static final String referenceParametersElement = "ReferenceParameters";
|
||||
|
||||
static {
|
||||
factory.setNamespaceAware(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts an {@link EndpointReferenceType} address into a {@link W3CEndpointReference} address.
|
||||
* @param address the input address
|
||||
* @return the converted address
|
||||
* @throws IllegalArgumentException if an address cannot be derived from the inputs
|
||||
*/
|
||||
public static W3CEndpointReference convert(EndpointReferenceType address) throws IllegalArgumentException {
|
||||
|
||||
W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
|
||||
builder.address(address.getAddress().toString());
|
||||
|
||||
ReferencePropertiesType props = address.getProperties();
|
||||
|
||||
if (props!=null && props.get_any()!=null)
|
||||
for (MessageElement element : props.get_any())
|
||||
if (element.getLocalName().equals(AddressingUtils.keyElement)) {
|
||||
Element key = org.gcube.common.clients.builders.AddressingUtils.key(element.getNamespaceURI(),element.getValue());
|
||||
builder.referenceParameter(key);
|
||||
break;
|
||||
}
|
||||
|
||||
return builder.build();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a {@link W3CEndpointReference} address into a legacy {@link EndpointReferenceType} address.
|
||||
* @param address the input address
|
||||
* @return the converted address
|
||||
* @throws IllegalArgumentException if the input address does not contain an address
|
||||
*/
|
||||
public static EndpointReferenceType convert(W3CEndpointReference address) throws IllegalArgumentException {
|
||||
|
||||
try {
|
||||
|
||||
StringWriter writer = new StringWriter();
|
||||
address.writeTo(new StreamResult(writer));
|
||||
|
||||
Document document = factory.newDocumentBuilder().parse(new InputSource(new StringReader(writer.toString())));
|
||||
|
||||
NodeList addresses = document.getElementsByTagName(addressElement);
|
||||
|
||||
if (addresses.getLength()==0)
|
||||
throw new Exception ("address does not contain a URI");
|
||||
|
||||
EndpointReferenceType epr = new EndpointReferenceType();
|
||||
epr.setAddress(new AttributedURI(addresses.item(0).getTextContent()));
|
||||
|
||||
NodeList params = document.getElementsByTagName(referenceParametersElement);
|
||||
|
||||
for (int i=0; i<params.getLength(); i++) {
|
||||
Node param = params.item(i);
|
||||
Node child = param.getFirstChild();
|
||||
String keyElement = AddressingUtils.keyElement;
|
||||
if (child!=null && child.getLocalName().equals(keyElement)) {
|
||||
SimpleResourceKey resourceKey = new SimpleResourceKey(new QName(child.getNamespaceURI(),keyElement),child.getTextContent());
|
||||
ReferencePropertiesType props = new ReferencePropertiesType();
|
||||
AnyHelper.setAny(props, resourceKey.toSOAPElement());
|
||||
epr.setProperties(props);
|
||||
}
|
||||
}
|
||||
|
||||
return epr;
|
||||
}
|
||||
catch(Exception e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package org.gcube.common.clients.gcore.builders;
|
||||
|
||||
import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||
import org.gcube.common.clients.builders.SingletonBuilderAPI.Builder;
|
||||
|
||||
/**
|
||||
* A {@link Builder} for singleton gCore services.
|
||||
* @author Fabio Simeoni
|
||||
*
|
||||
* @param <P> the type of service proxies
|
||||
*/
|
||||
public interface SingletonBuilder<P> extends Builder<EndpointReferenceType,P> {}
|
|
@ -0,0 +1,54 @@
|
|||
package org.gcube.common.clients.gcore.builders;
|
||||
|
||||
import javax.xml.ws.wsaddressing.W3CEndpointReference;
|
||||
|
||||
import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||
import org.gcube.common.clients.builders.AbstractSingletonBuilder;
|
||||
import org.gcube.common.clients.cache.EndpointCache;
|
||||
import org.gcube.common.clients.config.Property;
|
||||
import org.gcube.common.clients.delegates.ProxyPlugin;
|
||||
import org.gcube.common.clients.gcore.Utils;
|
||||
import org.gcube.common.clients.gcore.plugins.Plugin;
|
||||
import org.gcube.common.clients.gcore.plugins.PluginAdapter;
|
||||
import org.gcube.common.clients.gcore.queries.GCoreQuery;
|
||||
|
||||
/**
|
||||
* Proxy builders for singleton gCore services.
|
||||
*
|
||||
* @author Fabio Simeoni
|
||||
*
|
||||
* @param <S> the type of service stubs
|
||||
* @param <P> the type of service proxies
|
||||
*/
|
||||
public final class SingletonBuilderImpl<S,P> extends AbstractSingletonBuilder<EndpointReferenceType,S,P> implements SingletonBuilder<P> {
|
||||
|
||||
/**
|
||||
* Constructs an instance with a given {@link ProxyPlugin} and zero or more default {@link Property}s.
|
||||
* @param plugin the {@link Plugin}
|
||||
* @param properties the properties
|
||||
*/
|
||||
public SingletonBuilderImpl(Plugin<S,P> plugin,Property<?> ... properties) {
|
||||
this(plugin,GCoreQuery.globalCache,properties);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an instance with a given {@link ProxyPlugin}, an {@link EndpointCache}, and zero or more default {@link Property}s.
|
||||
* @param plugin the {@link Plugin}
|
||||
* @param cache the cache
|
||||
* @param properties the properties
|
||||
*/
|
||||
public SingletonBuilderImpl(Plugin<S,P> plugin,EndpointCache<EndpointReferenceType> cache,Property<?> ... properties) {
|
||||
super(new PluginAdapter<S,P>(plugin),cache,properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EndpointReferenceType convertAddress(W3CEndpointReference address) {
|
||||
return Utils.convert(address);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String contextPath() {
|
||||
return Utils.GCORE_CONTEXTPATH;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package org.gcube.common.clients.gcore.builders;
|
||||
|
||||
import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||
import org.gcube.common.clients.builders.StatefulBuilderAPI.Builder;
|
||||
|
||||
/**
|
||||
* A {@link Builder} for stateful gCore services.
|
||||
* @author Fabio Simeoni
|
||||
*
|
||||
* @param <P> the type of service proxies
|
||||
*/
|
||||
public interface StatefulBuilder<P> extends Builder<EndpointReferenceType,P> {}
|
|
@ -0,0 +1,54 @@
|
|||
package org.gcube.common.clients.gcore.builders;
|
||||
|
||||
import javax.xml.ws.wsaddressing.W3CEndpointReference;
|
||||
|
||||
import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||
import org.gcube.common.clients.builders.AbstractStatefulBuilder;
|
||||
import org.gcube.common.clients.cache.EndpointCache;
|
||||
import org.gcube.common.clients.config.Property;
|
||||
import org.gcube.common.clients.delegates.ProxyPlugin;
|
||||
import org.gcube.common.clients.gcore.Utils;
|
||||
import org.gcube.common.clients.gcore.plugins.Plugin;
|
||||
import org.gcube.common.clients.gcore.plugins.PluginAdapter;
|
||||
import org.gcube.common.clients.gcore.queries.GCoreQuery;
|
||||
|
||||
/**
|
||||
* Proxy builders for stateful gCore services.
|
||||
*
|
||||
* @author Fabio Simeoni
|
||||
*
|
||||
* @param <S> the type of service stubs
|
||||
* @param <P> the type of service proxies
|
||||
*/
|
||||
public final class StatefulBuilderImpl<S,P> extends AbstractStatefulBuilder<EndpointReferenceType,S,P> implements StatefulBuilder<P> {
|
||||
|
||||
/**
|
||||
* Constructs an instance with a given {@link ProxyPlugin} and zero or more default {@link Property}s.
|
||||
* @param plugin the {@link Plugin}
|
||||
* @param properties the properties
|
||||
*/
|
||||
public StatefulBuilderImpl(Plugin<S,P> plugin,Property<?> ... properties) {
|
||||
this(plugin,GCoreQuery.globalCache,properties);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an instance with a given {@link ProxyPlugin}, an {@link EndpointCache}, and zero or more default {@link Property}s.
|
||||
* @param plugin the {@link Plugin}
|
||||
* @param cache the cache
|
||||
* @param properties the properties
|
||||
*/
|
||||
public StatefulBuilderImpl(Plugin<S,P> plugin,EndpointCache<EndpointReferenceType> cache,Property<?> ... properties) {
|
||||
super(new PluginAdapter<S,P>(plugin),cache,properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EndpointReferenceType convertAddress(W3CEndpointReference address) {
|
||||
return Utils.convert(address);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String contextPath() {
|
||||
return Utils.GCORE_CONTEXTPATH;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package org.gcube.common.clients.gcore.builders;
|
||||
|
||||
import org.gcube.common.clients.builders.StatelessBuilderAPI.Builder;
|
||||
|
||||
/**
|
||||
* A {@link Builder} for stateless gCore services.
|
||||
* @author Fabio Simeoni
|
||||
*
|
||||
* @param <P> the type of service proxies
|
||||
*/
|
||||
public interface StatelessBuilder<P> extends Builder<P> {}
|
|
@ -0,0 +1,77 @@
|
|||
package org.gcube.common.clients.gcore.builders;
|
||||
|
||||
import javax.xml.ws.wsaddressing.W3CEndpointReference;
|
||||
|
||||
import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||
import org.gcube.common.clients.builders.AbstractStatelessBuilder;
|
||||
import org.gcube.common.clients.cache.EndpointCache;
|
||||
import org.gcube.common.clients.config.Property;
|
||||
import org.gcube.common.clients.delegates.ProxyPlugin;
|
||||
import org.gcube.common.clients.gcore.Utils;
|
||||
import org.gcube.common.clients.gcore.plugins.Plugin;
|
||||
import org.gcube.common.clients.gcore.plugins.PluginAdapter;
|
||||
import org.gcube.common.clients.gcore.queries.GCoreQuery;
|
||||
import org.gcube.common.clients.gcore.queries.StatelessQuery;
|
||||
|
||||
/**
|
||||
* Proxy builders for stateless gCore services.
|
||||
*
|
||||
* @author Fabio Simeoni
|
||||
*
|
||||
* @param <S> the type of service stubs
|
||||
* @param <P> the type of service proxies
|
||||
*/
|
||||
public class StatelessBuilderImpl<S,P> extends AbstractStatelessBuilder<EndpointReferenceType,S,P> implements StatelessBuilder<P> {
|
||||
|
||||
/**
|
||||
* Constructs an instance with a given {@link ProxyPlugin} and zero or more default {@link Property}s.
|
||||
* @param plugin the {@link Plugin}
|
||||
* @param properties the properties
|
||||
*/
|
||||
public StatelessBuilderImpl(Plugin<S,P> plugin, Property<?> ... properties) {
|
||||
this(plugin,GCoreQuery.globalCache,properties);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an instance with a given {@link ProxyPlugin}, a {@link StatelessQuery}, and zero or more default {@link Property}s.
|
||||
* @param plugin the {@link Plugin}
|
||||
* @param query the {@link StatelessQuery}
|
||||
* @param properties the properties
|
||||
*/
|
||||
public StatelessBuilderImpl(Plugin<S,P> plugin, StatelessQuery query, Property<?> ... properties) {
|
||||
this(plugin,query,GCoreQuery.globalCache,properties);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructs an instance with a given {@link ProxyPlugin}, an {@link EndpointCache}, and zero or more default {@link Property}s.
|
||||
* @param plugin the {@link Plugin}
|
||||
* @param cache the {@link EndpointCache}
|
||||
* @param properties the properties
|
||||
*/
|
||||
public StatelessBuilderImpl(Plugin<S,P> plugin,EndpointCache<EndpointReferenceType> cache,Property<?> ... properties) {
|
||||
this(plugin,new StatelessQuery(plugin),cache,properties);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an instance with a given {@link ProxyPlugin},a {@link StatelessQuery}, an {@link EndpointCache}, and zero or more default {@link Property}s.
|
||||
* @param plugin the {@link Plugin}
|
||||
* @param query the {@link StatelessQuery}
|
||||
* @param cache the {@link EndpointCache}
|
||||
* @param properties the properties
|
||||
*/
|
||||
public StatelessBuilderImpl(Plugin<S,P> plugin,StatelessQuery query,EndpointCache<EndpointReferenceType> cache,Property<?> ... properties) {
|
||||
super(new PluginAdapter<S,P>(plugin),cache,query,properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EndpointReferenceType convertAddress(W3CEndpointReference address) {
|
||||
return Utils.convert(address);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String contextPath() {
|
||||
return Utils.GCORE_CONTEXTPATH;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package org.gcube.common.clients.gcore.plugins;
|
||||
|
||||
import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||
import org.gcube.common.clients.delegates.ProxyPlugin;
|
||||
|
||||
/**
|
||||
* A {@link ProxyPlugin} for gCore services
|
||||
*
|
||||
* @author Fabio Simeoni
|
||||
*
|
||||
* @param <S> the type of service proxies
|
||||
* @param <P> the type of service stubs
|
||||
*/
|
||||
public interface Plugin<S,P> extends ProxyPlugin<EndpointReferenceType, S,P> {
|
||||
|
||||
/**
|
||||
* Returns the gCube name of the service.
|
||||
* @return the name
|
||||
*/
|
||||
String serviceClass();
|
||||
|
||||
/**
|
||||
* Returns the gCube class of the service.
|
||||
* @return the class
|
||||
*/
|
||||
String serviceName();;
|
||||
}
|
|
@ -0,0 +1,106 @@
|
|||
package org.gcube.common.clients.gcore.plugins;
|
||||
|
||||
import java.rmi.Remote;
|
||||
|
||||
import org.apache.axis.client.Stub;
|
||||
import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||
import org.gcube.common.clients.config.ProxyConfig;
|
||||
import org.gcube.common.clients.delegates.ProxyDelegate;
|
||||
import org.gcube.common.core.contexts.GCUBERemotePortTypeContext;
|
||||
import org.gcube.common.core.scope.GCUBEScopeManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
/**
|
||||
* A {@link Plugin} that adapts an existing {@link Plugin}.
|
||||
*
|
||||
* @author Fabio Simeoni
|
||||
*
|
||||
* @param <S> the type of service stubs
|
||||
* @param <P> the type of service proxies
|
||||
*
|
||||
*/
|
||||
public final class PluginAdapter<S,P> implements Plugin<S,P> {
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(PluginAdapter.class);
|
||||
|
||||
private final Plugin<S,P> plugin;
|
||||
|
||||
public PluginAdapter(Plugin<S,P> plugin) {
|
||||
this.plugin=plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the service porttype.
|
||||
* @return the name
|
||||
*/
|
||||
public String name() {
|
||||
return plugin.name();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the gCube name of the service.
|
||||
* @return the name
|
||||
*/
|
||||
public String serviceClass() {
|
||||
return plugin.serviceClass();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the gCube class of the service.
|
||||
* @return the class
|
||||
*/
|
||||
public String serviceName() {
|
||||
return plugin.serviceName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the namespace of the service
|
||||
* @return the namespace
|
||||
*/
|
||||
public String namespace() {
|
||||
return plugin.serviceName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public S resolve(EndpointReferenceType address, ProxyConfig<?,?> config) throws Exception {
|
||||
|
||||
S stub = plugin.resolve(address,config);
|
||||
|
||||
Remote remote = null;
|
||||
//add scope
|
||||
if (stub instanceof Remote) {
|
||||
try {
|
||||
remote = GCUBERemotePortTypeContext.getProxy((Remote) stub,GCUBEScopeManager.DEFAULT);
|
||||
|
||||
}
|
||||
catch(Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
//set timeout
|
||||
if (remote instanceof Stub)
|
||||
((Stub) remote).setTimeout((int)config.timeout());
|
||||
else
|
||||
log.warn("could not set timeout on stub of {} as {} does not implement the org.apache.axis.client.Stub interface",name(),stub);
|
||||
}
|
||||
else
|
||||
log.error("could not set scope and timeout on stub of {} as {} does not implement the java.rmi.Remote interface",name(),stub);
|
||||
|
||||
return stub;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Exception convert(Exception fault,ProxyConfig<?,?> config) {
|
||||
|
||||
// TODO gcore-specific fault analysis
|
||||
|
||||
return plugin.convert(fault,config);
|
||||
}
|
||||
|
||||
@Override
|
||||
public P newProxy(ProxyDelegate<S> config) {
|
||||
return plugin.newProxy(config);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package org.gcube.common.clients.gcore.queries;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.common.clients.exceptions.DiscoveryException;
|
||||
import org.gcube.common.core.contexts.GHNContext;
|
||||
import org.gcube.common.core.informationsystem.client.AtomicCondition;
|
||||
import org.gcube.common.core.informationsystem.client.ISClient;
|
||||
import org.gcube.common.core.informationsystem.client.ISTemplateQuery;
|
||||
import org.gcube.common.core.scope.GCUBEScopeManager;
|
||||
|
||||
/**
|
||||
* Default {@link ISFacade} implementation.
|
||||
*
|
||||
*/
|
||||
public class DefaultISFacade implements ISFacade {
|
||||
|
||||
@Override
|
||||
public <R,Q extends ISTemplateQuery<R>> List<R> execute (Class<Q> queryClass,Map<String,String> conditions) throws DiscoveryException {
|
||||
|
||||
ISClient client = null;
|
||||
try {
|
||||
client = GHNContext.getImplementation(ISClient.class);
|
||||
if (client == null)
|
||||
throw new Exception();
|
||||
}
|
||||
catch(Exception e) {
|
||||
throw new RuntimeException("cannot locate ISClient implementation",e);
|
||||
}
|
||||
|
||||
//resolve query
|
||||
Q isquery=null;
|
||||
try {
|
||||
isquery = client.getQuery(queryClass);
|
||||
}
|
||||
catch(Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
//customises query
|
||||
for (Map.Entry<String,String> cond: conditions.entrySet())
|
||||
isquery.addAtomicConditions(new AtomicCondition(cond.getKey(), cond.getValue()));
|
||||
|
||||
//execte query
|
||||
try {
|
||||
return client.execute(isquery, GCUBEScopeManager.DEFAULT.getScope());
|
||||
}
|
||||
catch(RuntimeException e) {
|
||||
throw e;
|
||||
}
|
||||
catch(Exception e) {
|
||||
throw new DiscoveryException(e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package org.gcube.common.clients.gcore.queries;
|
||||
|
||||
import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||
import org.gcube.common.clients.cache.DefaultEndpointCache;
|
||||
import org.gcube.common.clients.cache.EndpointCache;
|
||||
import org.gcube.common.clients.gcore.plugins.Plugin;
|
||||
import org.gcube.common.clients.gcore.plugins.PluginAdapter;
|
||||
import org.gcube.common.clients.queries.AbstractQuery;
|
||||
import org.gcube.common.clients.queries.Query;
|
||||
|
||||
/**
|
||||
* Partial implementation of {@link Query}s for gCore services.
|
||||
*
|
||||
* @author Fabio Simeoni
|
||||
*
|
||||
* @param <R> the type of query results
|
||||
*/
|
||||
public abstract class GCoreQuery<R> extends AbstractQuery<EndpointReferenceType, R> {
|
||||
|
||||
public static EndpointCache<EndpointReferenceType> globalCache = new DefaultEndpointCache<EndpointReferenceType>();
|
||||
|
||||
private final ISFacade facade;
|
||||
|
||||
/**
|
||||
* Creates an instance with a {@link ISFacade}, a {@link PluginAdapter}, and a type of IS queries
|
||||
* @param facade the facade
|
||||
* @param plugin the plugin
|
||||
* @param queryClass the query type
|
||||
*/
|
||||
protected GCoreQuery(ISFacade facade, Plugin<?,?> plugin) {
|
||||
super(plugin);
|
||||
|
||||
this.facade=facade;
|
||||
|
||||
//adds systematically base conditions
|
||||
addCondition("//ServiceName", plugin.serviceName());
|
||||
addCondition("//ServiceClass", plugin.serviceClass());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link ISFacade} used for query execution.
|
||||
* @return the facade
|
||||
*/
|
||||
protected ISFacade facade() {
|
||||
return facade;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package org.gcube.common.clients.gcore.queries;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.common.clients.exceptions.DiscoveryException;
|
||||
import org.gcube.common.core.informationsystem.client.ISTemplateQuery;
|
||||
|
||||
/**
|
||||
* Executes {@link ISTemplateQuery}s.
|
||||
*
|
||||
* @author Fabio Simeoni
|
||||
*
|
||||
*/
|
||||
public interface ISFacade {
|
||||
|
||||
/**
|
||||
* Executes an query with a set of custom condition.
|
||||
* @param queryClass the query class
|
||||
* @param conditions the conditions
|
||||
* @return the list of results
|
||||
* @throws DiscoveryException if the query execution failed
|
||||
*
|
||||
*/
|
||||
public <R,Q extends ISTemplateQuery<R>> List<R> execute (Class<Q> queryClass, Map<String,String> conditions) throws DiscoveryException;
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package org.gcube.common.clients.gcore.queries;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||
import org.gcube.common.clients.exceptions.DiscoveryException;
|
||||
import org.gcube.common.clients.gcore.plugins.Plugin;
|
||||
import org.gcube.common.clients.gcore.plugins.PluginAdapter;
|
||||
import org.gcube.common.clients.queries.Query;
|
||||
import org.gcube.common.core.informationsystem.client.RPDocument;
|
||||
import org.gcube.common.core.informationsystem.client.queries.WSResourceQuery;
|
||||
|
||||
/**
|
||||
* A {@link Query} for stateful gCore services.
|
||||
*
|
||||
* @author Fabio Simeoni
|
||||
*
|
||||
*/
|
||||
public final class StatefulQuery extends GCoreQuery<RPDocument> {
|
||||
|
||||
/**
|
||||
* Creates an instance with a {@link PluginAdapter} and a {@link ISFacade}.
|
||||
* @param facade the facade
|
||||
* @param plugin the plugin
|
||||
*/
|
||||
public StatefulQuery(ISFacade facade, Plugin<?,?> plugin) {
|
||||
super(facade,plugin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an instance with a {@link PluginAdapter}.
|
||||
* @param plugin the plugin
|
||||
*/
|
||||
public StatefulQuery(Plugin<?,?> plugin) {
|
||||
this(new DefaultISFacade(),plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<RPDocument> fire(Map<String, String> conditions) throws DiscoveryException {
|
||||
return facade().execute(WSResourceQuery.class,conditions);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EndpointReferenceType address(RPDocument doc) throws IllegalArgumentException {
|
||||
if (doc.getEndpoint().getAddress().getPath().endsWith(plugin().name()))
|
||||
return doc.getEndpoint();
|
||||
else
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
package org.gcube.common.clients.gcore.queries;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||
import org.gcube.common.clients.exceptions.DiscoveryException;
|
||||
import org.gcube.common.clients.gcore.plugins.Plugin;
|
||||
import org.gcube.common.clients.gcore.plugins.PluginAdapter;
|
||||
import org.gcube.common.clients.queries.Query;
|
||||
import org.gcube.common.core.informationsystem.client.queries.GCUBERIQuery;
|
||||
import org.gcube.common.core.resources.GCUBERunningInstance;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* A {@link Query} for stateless gCore services.
|
||||
*
|
||||
* @author Fabio Simeoni
|
||||
*
|
||||
*/
|
||||
public final class StatelessQuery extends GCoreQuery<GCUBERunningInstance> {
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(StatelessQuery.class);
|
||||
|
||||
/**
|
||||
* Creates an instance with a {@link ISFacade}, a {@link PluginAdapter}
|
||||
* @param facade the facade
|
||||
* @param plugin the plugin
|
||||
*/
|
||||
public StatelessQuery(ISFacade runner,Plugin<?,?> plugin) {
|
||||
super(runner,plugin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an instance with a {@link PluginAdapter} and a default {@link ISFacade}.
|
||||
* @param plugin the plugin
|
||||
*/
|
||||
public StatelessQuery(Plugin<?,?> plugin) {
|
||||
this(new DefaultISFacade(),plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<GCUBERunningInstance> fire(Map<String, String> conditions) throws DiscoveryException {
|
||||
return facade().execute(GCUBERIQuery.class,conditions);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EndpointReferenceType address(GCUBERunningInstance instance) throws IllegalArgumentException {
|
||||
EndpointReferenceType address = instance.getAccessPoint().getEndpoint(plugin().name());
|
||||
if (address==null) {
|
||||
log.warn("Running instance does not match {}: malformed profile or plugin misconfiguration",plugin().name());
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
else
|
||||
return address;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,163 @@
|
|||
package org.gcube.common.clients.gcore;
|
||||
|
||||
import static java.util.Arrays.*;
|
||||
import static junit.framework.Assert.*;
|
||||
import static org.mockito.Matchers.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.axis.message.addressing.AttributedURI;
|
||||
import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||
import org.gcube.common.clients.gcore.plugins.Plugin;
|
||||
import org.gcube.common.clients.gcore.queries.ISFacade;
|
||||
import org.gcube.common.clients.gcore.queries.StatefulQuery;
|
||||
import org.gcube.common.clients.gcore.queries.StatelessQuery;
|
||||
import org.gcube.common.clients.queries.ResultMatcher;
|
||||
import org.gcube.common.core.informationsystem.client.RPDocument;
|
||||
import org.gcube.common.core.resources.GCUBERunningInstance;
|
||||
import org.gcube.common.resources.kxml.runninginstance.KGCUBERunningInstance;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class QueryTest {
|
||||
|
||||
@Mock ISFacade facade;
|
||||
@Mock ISFacade statefulFacade;
|
||||
@Mock Plugin<Object,Object> plugin;
|
||||
@Mock ResultMatcher<GCUBERunningInstance> matcher;
|
||||
@Mock ResultMatcher<RPDocument> instanceMatcher;
|
||||
|
||||
String name = "name";
|
||||
String serviceName = "servicename";
|
||||
String serviceclass = "serviceclass";
|
||||
|
||||
StatelessQuery query;
|
||||
StatefulQuery statefulQuery;
|
||||
|
||||
GCUBERunningInstance result = new KGCUBERunningInstance();
|
||||
|
||||
@Mock RPDocument instance;
|
||||
|
||||
@Before
|
||||
@SuppressWarnings("all")
|
||||
public void setup() throws Exception {
|
||||
|
||||
//stage mock plugin
|
||||
when(plugin.name()).thenReturn(name);
|
||||
when(plugin.serviceName()).thenReturn(serviceName);
|
||||
when(plugin.serviceClass()).thenReturn(serviceclass);
|
||||
|
||||
when(facade.execute(any(Class.class),anyMap())).thenReturn(asList(result));
|
||||
when(statefulFacade.execute(any(Class.class),anyMap())).thenReturn(asList(instance));
|
||||
|
||||
//parse sample results
|
||||
result.load(new InputStreamReader(this.getClass().getResourceAsStream("/ri.xml")));
|
||||
|
||||
EndpointReferenceType epr = new EndpointReferenceType();
|
||||
epr.setAddress(new AttributedURI("http://acme.org/wsrf/services"+name));
|
||||
|
||||
when(instance.getEndpoint()).thenReturn(epr);
|
||||
|
||||
query = new StatelessQuery(facade,plugin);
|
||||
statefulQuery = new StatefulQuery(statefulFacade, plugin);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void queriesAreValueObjects() {
|
||||
|
||||
StatelessQuery query2 = new StatelessQuery(facade,plugin);
|
||||
|
||||
assertEquals(query, query2);
|
||||
|
||||
query.addCondition("a","val");
|
||||
query2.addCondition("a","val");
|
||||
|
||||
assertEquals(query, query2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void statefulQueriesAreValueObjects() {
|
||||
|
||||
StatefulQuery statefulQuery2 = new StatefulQuery(statefulFacade,plugin);
|
||||
|
||||
assertEquals(statefulQuery, statefulQuery2);
|
||||
|
||||
statefulQuery.addCondition("a","val");
|
||||
statefulQuery2.addCondition("a","val");
|
||||
|
||||
assertEquals(statefulQuery, statefulQuery2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void queriesDispatchQueriesAndResults() {
|
||||
|
||||
List<EndpointReferenceType> results = query.fire();
|
||||
|
||||
assertTrue(results.size()==1);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void statefulQueriesDispatchQueriesAndResults() {
|
||||
|
||||
List<EndpointReferenceType> results = statefulQuery.fire();
|
||||
|
||||
assertTrue(results.size()==1);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void queriesExcludeResults() {
|
||||
|
||||
when(plugin.name()).thenReturn("bad");
|
||||
|
||||
List<EndpointReferenceType> results = query.fire();
|
||||
|
||||
assertTrue(results.size()==0);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void statefulQueriesExcludeResults() {
|
||||
|
||||
when(plugin.name()).thenReturn("bad");
|
||||
|
||||
List<EndpointReferenceType> results = statefulQuery.fire();
|
||||
|
||||
assertTrue(results.size()==0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void queriesMatchResults() {
|
||||
|
||||
when(matcher.match(result)).thenReturn(false);
|
||||
|
||||
query.setMatcher(matcher);
|
||||
|
||||
List<EndpointReferenceType> results = query.fire();
|
||||
|
||||
assertTrue(results.size()==0);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void statefulQueriesMatchResults() {
|
||||
|
||||
when(matcher.match(result)).thenReturn(false);
|
||||
|
||||
statefulQuery.setMatcher(instanceMatcher);
|
||||
|
||||
List<EndpointReferenceType> results = statefulQuery.fire();
|
||||
|
||||
assertTrue(results.size()==0);
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
<Resource version="1.3.0">
|
||||
<ID>575829a0-95f4-11e1-9a09-9eb8fdf43a40</ID>
|
||||
<Type>RunningInstance</Type>
|
||||
<Scopes>
|
||||
<Scope>/gcube/devsec</Scope>
|
||||
<Scope>/gcube</Scope>
|
||||
</Scopes>
|
||||
<Profile>
|
||||
<Version>1.00.00</Version>
|
||||
<GHN UniqueID="b9ca73f0-95f3-11e1-a793-be288ddac994" />
|
||||
<Service UniqueID="5715a260-95f4-11e1-9a09-9eb8fdf43a40" />
|
||||
<ServiceName>servicename</ServiceName>
|
||||
<ServiceClass>serviceclass</ServiceClass>
|
||||
<DeploymentData>
|
||||
<ActivationTime value="2012-05-04T16:20:46+02:00" />
|
||||
<Status>failed</Status>
|
||||
</DeploymentData>
|
||||
<AccessPoint>
|
||||
<RunningInstanceInterfaces>
|
||||
<Endpoint EntryName="name">http://acme.org/name</Endpoint>
|
||||
<Endpoint EntryName="name2">http://acme.org/name2</Endpoint>
|
||||
</RunningInstanceInterfaces>
|
||||
</AccessPoint>
|
||||
</Profile>
|
||||
</Resource>
|
Loading…
Reference in New Issue