moved to jakarta and SG4
This commit is contained in:
parent
a6552698f8
commit
8544191e4e
30
pom.xml
30
pom.xml
|
@ -1,4 +1,5 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
<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>
|
||||
|
@ -9,20 +10,27 @@
|
|||
</parent>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>common-clients</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<name>Common Clients</name>
|
||||
<description>A framework for client APIs</description>
|
||||
<scm>
|
||||
<connection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</connection>
|
||||
<developerConnection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</developerConnection>
|
||||
<connection>
|
||||
scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</connection>
|
||||
<developerConnection>
|
||||
scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</developerConnection>
|
||||
<url>https://code-repo.d4science.org/gCubeSystem/${project.artifactId}</url>
|
||||
</scm>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
</properties>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.gcube.distribution</groupId>
|
||||
<artifactId>gcube-bom</artifactId>
|
||||
<version>3.0.1-SNAPSHOT</version>
|
||||
<version>4.0.0-SNAPSHOT</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
@ -38,8 +46,12 @@
|
|||
<artifactId>slf4j-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.xml.ws</groupId>
|
||||
<artifactId>jaxws-api</artifactId>
|
||||
<groupId>jakarta.xml.bind</groupId>
|
||||
<artifactId>jakarta.xml.bind-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.xml.ws</groupId>
|
||||
<artifactId>jakarta.xml.ws-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
|
@ -59,5 +71,9 @@
|
|||
<version>1.6.4</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>common-security</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -5,8 +5,6 @@ import java.util.Map;
|
|||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.xml.ws.wsaddressing.W3CEndpointReference;
|
||||
|
||||
import org.gcube.common.clients.cache.EndpointCache;
|
||||
import org.gcube.common.clients.config.DiscoveryConfig;
|
||||
import org.gcube.common.clients.config.EndpointConfig;
|
||||
|
@ -17,6 +15,8 @@ import org.gcube.common.clients.delegates.ProxyDelegate;
|
|||
import org.gcube.common.clients.delegates.ProxyPlugin;
|
||||
import org.gcube.common.clients.queries.Query;
|
||||
|
||||
import jakarta.xml.ws.wsaddressing.W3CEndpointReference;
|
||||
|
||||
/**
|
||||
* Partial implementation of proxy builders.
|
||||
*
|
||||
|
@ -40,7 +40,9 @@ public abstract class AbstractBuilder<A,S,P> {
|
|||
private final Map<String, Object> properties = new HashMap<String, Object>();
|
||||
|
||||
/**
|
||||
* Constructs an instance with a given {@link ProxyPlugin}, and {@link EndpointCache}, and zero or more default {@link Property}s.
|
||||
* Constructs an instance with a given {@link ProxyPlugin}, and
|
||||
* {@link EndpointCache}, and zero or more default {@link Property}s.
|
||||
*
|
||||
* @param plugin the plugin
|
||||
* @param cache the cache
|
||||
* @param properties the properties
|
||||
|
@ -60,13 +62,16 @@ public abstract class AbstractBuilder<A,S,P> {
|
|||
|
||||
/**
|
||||
* Returns the {@link ProxyPlugin}.
|
||||
*
|
||||
* @return the plugin
|
||||
*/
|
||||
protected ProxyPlugin<A, S, P> plugin() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the query.
|
||||
*
|
||||
* @param query the query
|
||||
*/
|
||||
protected void setQuery(Query<A> query) {
|
||||
|
@ -75,6 +80,7 @@ public abstract class AbstractBuilder<A,S,P> {
|
|||
|
||||
/**
|
||||
* Sets the timeout.
|
||||
*
|
||||
* @param timeout the timout
|
||||
*/
|
||||
protected void setTimeout(int timeout) {
|
||||
|
@ -83,6 +89,7 @@ public abstract class AbstractBuilder<A,S,P> {
|
|||
|
||||
/**
|
||||
* Sets the address.
|
||||
*
|
||||
* @param address the address
|
||||
*/
|
||||
protected void setAddress(W3CEndpointReference address) {
|
||||
|
@ -91,6 +98,7 @@ public abstract class AbstractBuilder<A,S,P> {
|
|||
|
||||
/**
|
||||
* Adds a custom property.
|
||||
*
|
||||
* @param property the property
|
||||
*/
|
||||
protected void addProperty(Property<?> property) {
|
||||
|
@ -102,13 +110,11 @@ public abstract class AbstractBuilder<A,S,P> {
|
|||
|
||||
ProxyDelegate<S> delegate = null;
|
||||
if (address == null) {
|
||||
DiscoveryConfig<A,S> config =
|
||||
new DiscoveryConfig<A,S>(plugin,query,cache);
|
||||
DiscoveryConfig<A, S> config = new DiscoveryConfig<A, S>(plugin, query, cache);
|
||||
for (Entry<String, Object> prop : properties.entrySet())
|
||||
config.addProperty(prop.getKey(), prop.getValue());
|
||||
delegate = new DiscoveryDelegate<A, S>(config);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
EndpointConfig<A, S> config = new EndpointConfig<A, S>(plugin, convertAddress(address));
|
||||
for (Entry<String, Object> prop : properties.entrySet())
|
||||
config.addProperty(prop.getKey(), prop.getValue());
|
||||
|
@ -120,11 +126,11 @@ public abstract class AbstractBuilder<A,S,P> {
|
|||
|
||||
/**
|
||||
* Converts a {@link W3CEndpointReference} in a service address.
|
||||
*
|
||||
* @param address the address as a {@link W3CEndpointReference}
|
||||
* @return the converted address
|
||||
*/
|
||||
protected abstract A convertAddress(W3CEndpointReference address);
|
||||
|
||||
|
||||
protected abstract String contextPath();
|
||||
}
|
||||
|
|
|
@ -4,8 +4,6 @@ import java.net.URI;
|
|||
import java.net.URL;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.xml.ws.wsaddressing.W3CEndpointReference;
|
||||
|
||||
import org.gcube.common.clients.builders.StatefulBuilderAPI.Builder;
|
||||
import org.gcube.common.clients.builders.StatefulBuilderAPI.FinalClause;
|
||||
import org.gcube.common.clients.builders.StatefulBuilderAPI.SecondClause;
|
||||
|
@ -14,6 +12,8 @@ import org.gcube.common.clients.config.Property;
|
|||
import org.gcube.common.clients.delegates.ProxyPlugin;
|
||||
import org.gcube.common.clients.queries.Query;
|
||||
|
||||
import jakarta.xml.ws.wsaddressing.W3CEndpointReference;
|
||||
|
||||
/**
|
||||
* Partial implementation of proxy builders for stateful services.
|
||||
*
|
||||
|
|
|
@ -4,12 +4,13 @@ import java.net.URI;
|
|||
import java.net.URL;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.ws.wsaddressing.W3CEndpointReference;
|
||||
import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import jakarta.xml.ws.wsaddressing.W3CEndpointReference;
|
||||
import jakarta.xml.ws.wsaddressing.W3CEndpointReferenceBuilder;
|
||||
|
||||
/**
|
||||
* Factory methods for addresses of service endpoints and service instances.
|
||||
*
|
||||
|
|
|
@ -4,11 +4,11 @@ import java.net.URI;
|
|||
import java.net.URL;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.xml.ws.wsaddressing.W3CEndpointReference;
|
||||
|
||||
import org.gcube.common.clients.config.Property;
|
||||
import org.gcube.common.clients.queries.Query;
|
||||
|
||||
import jakarta.xml.ws.wsaddressing.W3CEndpointReference;
|
||||
|
||||
/**
|
||||
* Defines a DSL for proxy builders of stateful services.
|
||||
*
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.gcube.common.clients;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.io.StringReader;
|
||||
import java.io.StringWriter;
|
||||
|
@ -8,7 +8,6 @@ import java.net.URI;
|
|||
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
import javax.xml.ws.wsaddressing.W3CEndpointReference;
|
||||
|
||||
import org.gcube.common.clients.builders.AddressingUtils;
|
||||
import org.junit.BeforeClass;
|
||||
|
@ -17,6 +16,8 @@ import org.w3c.dom.Document;
|
|||
import org.w3c.dom.NodeList;
|
||||
import org.xml.sax.InputSource;
|
||||
|
||||
import jakarta.xml.ws.wsaddressing.W3CEndpointReference;
|
||||
|
||||
public class AddressingUtilsTest {
|
||||
|
||||
private static final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
|
|
|
@ -109,12 +109,6 @@ public class AsyncDelegateTest {
|
|||
SecretManagerProvider.set(new Secret() {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isExpired() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Owner getOwner() {
|
||||
// TODO Auto-generated method stub
|
||||
|
@ -131,6 +125,12 @@ public class AsyncDelegateTest {
|
|||
public String getContext() {
|
||||
return scope;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
// TODO Auto-generated method stub
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
//stage call
|
||||
|
@ -175,7 +175,7 @@ public class AsyncDelegateTest {
|
|||
|
||||
|
||||
@Override
|
||||
public boolean isExpired() {
|
||||
public boolean isValid() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
package org.gcube.common.clients;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.Matchers.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.io.StringWriter;
|
||||
import java.net.URI;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
import javax.xml.ws.wsaddressing.W3CEndpointReference;
|
||||
|
||||
import org.gcube.common.clients.builders.AbstractBuilder;
|
||||
import org.gcube.common.clients.builders.AbstractStatefulBuilder;
|
||||
|
@ -37,6 +37,8 @@ import org.mockito.invocation.InvocationOnMock;
|
|||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
import org.mockito.stubbing.Answer;
|
||||
|
||||
import jakarta.xml.ws.wsaddressing.W3CEndpointReference;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class BuildersTest {
|
||||
|
||||
|
|
Loading…
Reference in New Issue