From 87e4643333446e8a9fec71be044ae71386716b93 Mon Sep 17 00:00:00 2001 From: "lucio.lelii" Date: Thu, 3 Dec 2020 14:24:34 +0100 Subject: [PATCH] first import --- .classpath | 36 +++ .project | 37 +++ .settings/.jsdtscope | 13 + .settings/org.eclipse.core.resources.prefs | 6 + .settings/org.eclipse.jdt.core.prefs | 11 + .settings/org.eclipse.m2e.core.prefs | 4 + .settings/org.eclipse.wst.common.component | 37 +++ ....eclipse.wst.common.project.facet.core.xml | 7 + ...rg.eclipse.wst.jsdt.ui.superType.container | 1 + .../org.eclipse.wst.jsdt.ui.superType.name | 1 + .settings/org.eclipse.wst.validation.prefs | 2 + DevelopmentNote | 2 + distro/gcube-app.xml | 7 + pom.xml | 278 ++++++++++++++++++ .../contextmanager/ContextAppManager.java | 58 ++++ .../ContextManagerApplication.java | 22 ++ .../contextmanager/MultiKeysMap.java | 260 ++++++++++++++++ .../contextmanager/ProfileDate.java | 56 ++++ .../contextmanager/ResourceBinder.java | 38 +++ .../contextmanager/ResourceManager.java | 105 +++++++ .../contextmanager/ScopeDescriptor.java | 47 +++ .../contextmanager/ScopedResource.java | 47 +++ .../handlers/ContextHandler.java | 34 +++ .../handlers/ResourceHandler.java | 23 ++ .../handlers/impl/DynamicResourceHandler.java | 48 +++ .../handlers/impl/StaticResourceHandler.java | 51 ++++ .../services/ContextService.java | 126 ++++++++ src/main/resources/META-INF/beans.xml | 6 + src/main/webapp/WEB-INF/gcube-app.xml | 7 + .../BackendConnectorTester.java | 48 +++ .../ContextServiceIntegrationTest.java | 48 +++ .../contextmanager/ResourceTest.java | 45 +++ src/test/resources/META-INF/beans.xml | 6 + src/test/resources/logback-test.xml | 12 + target/classes/META-INF/beans.xml | 6 + .../contextmanager/ContextAppManager.class | Bin 0 -> 4340 bytes .../ContextManagerApplication.class | Bin 0 -> 781 bytes .../MultiKeysMap$WrappedValue.class | Bin 0 -> 1676 bytes .../contextmanager/MultiKeysMap.class | Bin 0 -> 6115 bytes .../contextmanager/ProfileDate.class | Bin 0 -> 1832 bytes .../contextmanager/ResourceBinder.class | Bin 0 -> 1784 bytes .../contextmanager/ResourceManager.class | Bin 0 -> 3587 bytes .../contextmanager/ScopeDescriptor.class | Bin 0 -> 1800 bytes .../contextmanager/ScopedResource.class | Bin 0 -> 1562 bytes .../handlers/ContextHandler.class | Bin 0 -> 3299 bytes .../handlers/ResourceHandler.class | Bin 0 -> 618 bytes .../impl/DynamicResourceHandler.class | Bin 0 -> 1746 bytes .../handlers/impl/StaticResourceHandler.class | Bin 0 -> 3226 bytes .../services/ContextService.class | Bin 0 -> 5073 bytes .../web-resources/META-INF/MANIFEST.MF | 13 + .../VREManager/pom.properties | 7 + .../VREManager/pom.xml | 278 ++++++++++++++++++ target/test-classes/META-INF/beans.xml | 6 + target/test-classes/logback-test.xml | 12 + .../BackendConnectorTester.class | Bin 0 -> 1726 bytes .../ContextServiceIntegrationTest.class | Bin 0 -> 3166 bytes .../contextmanager/ResourceTest.class | Bin 0 -> 3214 bytes 57 files changed, 1851 insertions(+) create mode 100644 .classpath create mode 100644 .project create mode 100644 .settings/.jsdtscope create mode 100644 .settings/org.eclipse.core.resources.prefs create mode 100644 .settings/org.eclipse.jdt.core.prefs create mode 100644 .settings/org.eclipse.m2e.core.prefs create mode 100644 .settings/org.eclipse.wst.common.component create mode 100644 .settings/org.eclipse.wst.common.project.facet.core.xml create mode 100644 .settings/org.eclipse.wst.jsdt.ui.superType.container create mode 100644 .settings/org.eclipse.wst.jsdt.ui.superType.name create mode 100644 .settings/org.eclipse.wst.validation.prefs create mode 100644 DevelopmentNote create mode 100644 distro/gcube-app.xml create mode 100644 pom.xml create mode 100644 src/main/java/org/gcube/vremanagement/contextmanager/ContextAppManager.java create mode 100644 src/main/java/org/gcube/vremanagement/contextmanager/ContextManagerApplication.java create mode 100644 src/main/java/org/gcube/vremanagement/contextmanager/MultiKeysMap.java create mode 100644 src/main/java/org/gcube/vremanagement/contextmanager/ProfileDate.java create mode 100644 src/main/java/org/gcube/vremanagement/contextmanager/ResourceBinder.java create mode 100644 src/main/java/org/gcube/vremanagement/contextmanager/ResourceManager.java create mode 100644 src/main/java/org/gcube/vremanagement/contextmanager/ScopeDescriptor.java create mode 100644 src/main/java/org/gcube/vremanagement/contextmanager/ScopedResource.java create mode 100644 src/main/java/org/gcube/vremanagement/contextmanager/handlers/ContextHandler.java create mode 100644 src/main/java/org/gcube/vremanagement/contextmanager/handlers/ResourceHandler.java create mode 100644 src/main/java/org/gcube/vremanagement/contextmanager/handlers/impl/DynamicResourceHandler.java create mode 100644 src/main/java/org/gcube/vremanagement/contextmanager/handlers/impl/StaticResourceHandler.java create mode 100644 src/main/java/org/gcube/vremanagement/contextmanager/services/ContextService.java create mode 100644 src/main/resources/META-INF/beans.xml create mode 100644 src/main/webapp/WEB-INF/gcube-app.xml create mode 100644 src/test/java/org/gcube/vremanagement/contextmanager/BackendConnectorTester.java create mode 100644 src/test/java/org/gcube/vremanagement/contextmanager/ContextServiceIntegrationTest.java create mode 100644 src/test/java/org/gcube/vremanagement/contextmanager/ResourceTest.java create mode 100644 src/test/resources/META-INF/beans.xml create mode 100644 src/test/resources/logback-test.xml create mode 100644 target/classes/META-INF/beans.xml create mode 100644 target/classes/org/gcube/vremanagement/contextmanager/ContextAppManager.class create mode 100644 target/classes/org/gcube/vremanagement/contextmanager/ContextManagerApplication.class create mode 100644 target/classes/org/gcube/vremanagement/contextmanager/MultiKeysMap$WrappedValue.class create mode 100644 target/classes/org/gcube/vremanagement/contextmanager/MultiKeysMap.class create mode 100644 target/classes/org/gcube/vremanagement/contextmanager/ProfileDate.class create mode 100644 target/classes/org/gcube/vremanagement/contextmanager/ResourceBinder.class create mode 100644 target/classes/org/gcube/vremanagement/contextmanager/ResourceManager.class create mode 100644 target/classes/org/gcube/vremanagement/contextmanager/ScopeDescriptor.class create mode 100644 target/classes/org/gcube/vremanagement/contextmanager/ScopedResource.class create mode 100644 target/classes/org/gcube/vremanagement/contextmanager/handlers/ContextHandler.class create mode 100644 target/classes/org/gcube/vremanagement/contextmanager/handlers/ResourceHandler.class create mode 100644 target/classes/org/gcube/vremanagement/contextmanager/handlers/impl/DynamicResourceHandler.class create mode 100644 target/classes/org/gcube/vremanagement/contextmanager/handlers/impl/StaticResourceHandler.class create mode 100644 target/classes/org/gcube/vremanagement/contextmanager/services/ContextService.class create mode 100644 target/m2e-wtp/web-resources/META-INF/MANIFEST.MF create mode 100644 target/m2e-wtp/web-resources/META-INF/maven/org.gcube.vremanagement/VREManager/pom.properties create mode 100644 target/m2e-wtp/web-resources/META-INF/maven/org.gcube.vremanagement/VREManager/pom.xml create mode 100644 target/test-classes/META-INF/beans.xml create mode 100644 target/test-classes/logback-test.xml create mode 100644 target/test-classes/org/gcube/vremanagement/contextmanager/BackendConnectorTester.class create mode 100644 target/test-classes/org/gcube/vremanagement/contextmanager/ContextServiceIntegrationTest.class create mode 100644 target/test-classes/org/gcube/vremanagement/contextmanager/ResourceTest.class diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..51d0e20 --- /dev/null +++ b/.classpath @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..65ff719 --- /dev/null +++ b/.project @@ -0,0 +1,37 @@ + + + VREManager + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.wst.jsdt.core.jsNature + + diff --git a/.settings/.jsdtscope b/.settings/.jsdtscope new file mode 100644 index 0000000..f179e11 --- /dev/null +++ b/.settings/.jsdtscope @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..29abf99 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/test/java=UTF-8 +encoding//src/test/resources=UTF-8 +encoding/=UTF-8 diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..cac0df4 --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component new file mode 100644 index 0000000..206c60d --- /dev/null +++ b/.settings/org.eclipse.wst.common.component @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + uses + + + + + + + + + + + + + + + + + diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..225e769 --- /dev/null +++ b/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/.settings/org.eclipse.wst.jsdt.ui.superType.container b/.settings/org.eclipse.wst.jsdt.ui.superType.container new file mode 100644 index 0000000..3bd5d0a --- /dev/null +++ b/.settings/org.eclipse.wst.jsdt.ui.superType.container @@ -0,0 +1 @@ +org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/.settings/org.eclipse.wst.jsdt.ui.superType.name b/.settings/org.eclipse.wst.jsdt.ui.superType.name new file mode 100644 index 0000000..05bd71b --- /dev/null +++ b/.settings/org.eclipse.wst.jsdt.ui.superType.name @@ -0,0 +1 @@ +Window \ No newline at end of file diff --git a/.settings/org.eclipse.wst.validation.prefs b/.settings/org.eclipse.wst.validation.prefs new file mode 100644 index 0000000..04cad8c --- /dev/null +++ b/.settings/org.eclipse.wst.validation.prefs @@ -0,0 +1,2 @@ +disabled=06target +eclipse.preferences.version=1 diff --git a/DevelopmentNote b/DevelopmentNote new file mode 100644 index 0000000..f77beda --- /dev/null +++ b/DevelopmentNote @@ -0,0 +1,2 @@ +New Context Manager +- deve essere un coda per scope perchè uno solo lo deve prendere quel update se ci sono pù contextManager nello stesso scope \ No newline at end of file diff --git a/distro/gcube-app.xml b/distro/gcube-app.xml new file mode 100644 index 0000000..ded6254 --- /dev/null +++ b/distro/gcube-app.xml @@ -0,0 +1,7 @@ + + ContextManager + VREManagement + ${version} + ContextManager webapp + + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..7362456 --- /dev/null +++ b/pom.xml @@ -0,0 +1,278 @@ + + 4.0.0 + org.gcube.vremanagement + VREManager + 1.0.0-SNAPSHOT + VREManager + war + + maven-parent + org.gcube.tools + 1.1.0 + + + + ${project.basedir}/src/main/webapp/WEB-INF + ${project.basedir}/distro + + + + + + org.gcube.distribution + maven-smartgears-bom + 2.0.0-SNAPSHOT + pom + import + + + + + + + org.gcube.vremanagement + context-manager-model + [1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT) + + + + org.gcube.resources + common-gcore-resources + + + org.gcube.resources.discovery + discovery-client + + + + org.gcube.core + common-smartgears-app + + + + org.gcube.core + common-smartgears + + + + + xstream + xstream + 1.2.2 + + + + org.gcube.resourcemanagement + whn-manager-client + [2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT) + + + + org.gcube.resources.discovery + ic-client + + + org.gcube.common + authorization-control-library + [1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT) + + + javax.ws.rs + javax.ws.rs-api + 2.0 + + + + + com.rabbitmq + amqp-client + 5.10.0 + + + + + org.glassfish.jersey.containers + jersey-container-servlet + 2.32 + + + org.glassfish.jersey.containers + jersey-container-servlet-core + 2.32 + + + + org.glassfish.jersey.core + jersey-server + 2.32 + + + org.glassfish.jersey.ext.cdi + jersey-cdi1x + 2.32 + + + + + + + org.jboss.weld.servlet + weld-servlet-core + 2.2.10.Final + + + + org.jboss + jandex + 1.2.2.Final + + + + com.fasterxml.jackson.jaxrs + jackson-jaxrs-json-provider + 2.3.0 + + + + org.glassfish.jersey.media + jersey-media-json-jackson + 2.32 + + + + + javax.enterprise + cdi-api + 1.2 + + + + + org.glassfish.jersey.core + jersey-common + 2.32 + + + + + org.glassfish.jersey.inject + jersey-hk2 + 2.32 + + + + + + javax.servlet + javax.servlet-api + 3.0.1 + + + + + + + org.slf4j + slf4j-api + + + + + + org.glassfish.jersey.test-framework + jersey-test-framework-core + 2.32 + test + + + + org.glassfish.jersey.test-framework.providers + jersey-test-framework-provider-jetty + 2.32 + test + + + + org.glassfish.jersey.ext.cdi + jersey-weld2-se + 2.30.1 + test + + + + ch.qos.logback + logback-classic + 1.2.3 + test + + + + junit + junit + 4.11 + test + + + + + + ${artifactId} + + + org.apache.maven.plugins + maven-war-plugin + + false + + + + org.apache.maven.plugins + maven-resources-plugin + 2.6 + + + copy-profile + + copy-resources + + process-resources + + ${webappDirectory} + + + ${distroDirectory} + true + + + + + + + + org.apache.maven.plugins + maven-assembly-plugin + + + descriptor.xml + + + + + servicearchive + install + + single + + + + + + + + \ No newline at end of file diff --git a/src/main/java/org/gcube/vremanagement/contextmanager/ContextAppManager.java b/src/main/java/org/gcube/vremanagement/contextmanager/ContextAppManager.java new file mode 100644 index 0000000..b9a8827 --- /dev/null +++ b/src/main/java/org/gcube/vremanagement/contextmanager/ContextAppManager.java @@ -0,0 +1,58 @@ +package org.gcube.vremanagement.contextmanager; + + +import static org.gcube.resources.discovery.icclient.ICFactory.clientFor; +import static org.gcube.resources.discovery.icclient.ICFactory.queryFor; + +import java.util.List; + +import javax.xml.bind.JAXBException; + +import org.gcube.common.resources.gcore.GenericResource; +import org.gcube.common.scope.api.ScopeProvider; +import org.gcube.resources.discovery.client.api.DiscoveryClient; +import org.gcube.resources.discovery.client.queries.api.SimpleQuery; +import org.gcube.smartgears.ApplicationManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ContextAppManager implements ApplicationManager { + + private static Logger logger = LoggerFactory.getLogger(ContextAppManager.class); + + + MultiKeysMap scopeDescriptorMap = new MultiKeysMap(); + + @Override + public void onInit() { + String currentContext = ScopeProvider.instance.get(); + logger.info("resource initialization started in {} ",currentContext); + + SimpleQuery query = queryFor(GenericResource.class); + query.addCondition("$resource/Profile/SecondaryType/text eq 'VRE' or $resource/Profile/SecondaryType/text eq 'VO'"); + + DiscoveryClient client = clientFor(GenericResource.class); + List resources = client.submit(query); + for (GenericResource resource : resources) { + try { + String body = resource.profile().bodyAsString(); + ScopeDescriptor scopeDescr = ResourceBinder.get().bind(body); + scopeDescriptorMap.put(scopeDescr.context, resource.id(), scopeDescr); + } catch (JAXBException e) { + logger.error("cannot unmarshal resource",e); + } + } + + } + + @Override + public void onShutdown() { + } + + public MultiKeysMap getScopeDescriptorMap() { + return scopeDescriptorMap; + } + + + +} diff --git a/src/main/java/org/gcube/vremanagement/contextmanager/ContextManagerApplication.java b/src/main/java/org/gcube/vremanagement/contextmanager/ContextManagerApplication.java new file mode 100644 index 0000000..7f43f9b --- /dev/null +++ b/src/main/java/org/gcube/vremanagement/contextmanager/ContextManagerApplication.java @@ -0,0 +1,22 @@ +package org.gcube.vremanagement.contextmanager; + +import java.util.HashSet; +import java.util.Set; + +import javax.ws.rs.Path; +import javax.ws.rs.core.Application; + +@Path("") +public class ContextManagerApplication extends Application { + + @Override + public Set> getClasses() { + final Set> classes = new HashSet>(); + // register resources and features + //classes.add(XMLQueryAccess.class); + //classes.add(XMLResources.class); + return classes; + } + + +} diff --git a/src/main/java/org/gcube/vremanagement/contextmanager/MultiKeysMap.java b/src/main/java/org/gcube/vremanagement/contextmanager/MultiKeysMap.java new file mode 100644 index 0000000..1581e62 --- /dev/null +++ b/src/main/java/org/gcube/vremanagement/contextmanager/MultiKeysMap.java @@ -0,0 +1,260 @@ +package org.gcube.vremanagement.contextmanager; + +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; + + +/** + * + * A thread-safe Map with multiple keys allowing multiple values per key + * + * @author Manuele Simi (ISTI-CNR) + * + */ +public class MultiKeysMap implements Iterable { + + private List values = Collections.synchronizedList(new LinkedList()); + + private List wrappedValues = Collections.synchronizedList(new LinkedList()); + + private Map> k1values = Collections.synchronizedMap(new HashMap>()); + + private Map> k2values = Collections.synchronizedMap(new HashMap>()); + + + /** + * {@inheritDoc} + */ + public Iterator iterator() { + return values.iterator(); + } + + /** + * Associates the specified value with the two keys + * + * @param key1 the value's primary key + * @param key2 the value's secondary key + * @param value the value + */ + public void put(K1 key1, K2 key2, V value) { + WrappedValue wrappedValue = this.new WrappedValue(value); + wrappedValue.addKey1(key1); + wrappedValue.addKey2(key2); + if (wrappedValues.contains(wrappedValue)) + wrappedValues.remove(wrappedValue); + wrappedValues.add(wrappedValue); + if (values.contains(value)) + values.remove(value); + values.add(value); + //add the value index to k1values + if (!k1values.containsKey(key1)) + k1values.put(key1, new HashSet()); + k1values.get(key1).add(value); + //add the value index to k2values + if (!k2values.containsKey(key2)) + k2values.put(key2, new HashSet()); + k2values.get(key2).add(value); + } + + /** + * removes the given values and its keys from the map + * @param value + */ + public void removeValue(V value) { + values.remove(value); + WrappedValue wvalue = wrappedValues.get(this.wrappedIndexOf(value)); + + k1values.get(wvalue.key1).remove(value); + if (k1values.get(wvalue.key1).isEmpty()) + k1values.remove(wvalue.key1); + + k2values.get(wvalue.key2).remove(value); + if (k2values.get(wvalue.key2).isEmpty()) + k2values.remove(wvalue.key2); + + wrappedValues.remove(wvalue); + + } + + /** + * Removes all the values associated to the primary key + * + * @param key the key of type K1 + */ + public void removeValuesByPrimaryKey(K1 key) { + Set valuesToRemove = k1values.get(key); + if (valuesToRemove == null) + return; + Iterator iterator = valuesToRemove.iterator(); + while (iterator.hasNext()) { + V value = iterator.next(); + values.remove(value); + if (value == null) { + continue; + } + WrappedValue wvalue = wrappedValues.get(this.wrappedIndexOf(value)); + k2values.get(wvalue.key2).remove(value); + if (k2values.get(wvalue.key2).isEmpty()) + k2values.remove(wvalue.key2); + wrappedValues.remove(wvalue); + } + + k1values.remove(key); + } + + + /** + * Removes all the values associated to the secondary key + * + * @param key the key of type K2 + */ + public void removeValuesBySecondaryKey(K2 key) { + Set valuesToRemove = k2values.get(key); + if (valuesToRemove == null) + return; + Iterator iterator = valuesToRemove.iterator(); + while (iterator.hasNext()) { + V value = iterator.next(); + values.remove(value); + if (value == null) { + return; + } + WrappedValue wvalue = wrappedValues.get(this.wrappedIndexOf(value)); + k1values.get(wvalue.key1).remove(value); + if (k1values.get(wvalue.key1).isEmpty()) + k1values.remove(wvalue.key1); + wrappedValues.remove(wvalue); + } + + k2values.remove(key); + } + + + + private int wrappedIndexOf(V value) { + int index = 0; + if (value==null) + return -1; + for (WrappedValue wvalue : wrappedValues) { + if (wvalue.equals(value)) + return index; + index++; + } + return -1; + } + + + /** + * Returns the values to which this map maps the specified primary key + * + * @param key key whose associated values are to be returned + * @return the values to which this map maps the specified primary key + */ + @SuppressWarnings("unchecked") + public Set getValuesByPrimaryKey(K1 key) { + return k1values.get(key) == null? (Set)Collections.emptySet(): k1values.get(key); + } + + /** + * Returns the values to which this map maps the specified primary key + * @param key key whose associated values are to be returned + * @return @return the values to which this map maps the specified secondary key + */ + @SuppressWarnings("unchecked") + public Set getValuesBySecondaryKey(K2 key) { + return k2values.get(key) == null? (Set)Collections.emptySet(): k2values.get(key); + } + + /** + * Returns a set view of the primary keys contained in this map + * + * @return a set view of the primary keys contained in this map + */ + @SuppressWarnings("unchecked") + public Set primaryKeySet() { + return k1values.keySet() == null? (Set)Collections.emptySet(): k1values.keySet(); + } + + /** + * Returns a set view of the secondary keys contained in this map + * + * @return a set view of the secondary keys contained in this map + */ + @SuppressWarnings("unchecked") + public Set secondaryKeySet() { + return k2values.keySet() == null? (Set)Collections.emptySet(): k2values.keySet(); + } + + /** + * Returns a collection view of the values contained in this map + * + * @return a collection view of the values contained in this map + */ + public Collection values() { + return Collections.unmodifiableCollection(values); + } + + /** + * Removes all mapping from this maps + */ + public void clean () { + values.clear(); + wrappedValues.clear(); + k1values.clear(); + k2values.clear(); + } + + /** + * + * Internal Map object + * + * It maps a value V to both its primary and secondary key + * + * @author Manuele Simi (ISTI-CNR) + * + */ + class WrappedValue { + + V value; + K1 key1; + K2 key2; + WrappedValue(V value) { this.value = value;} + void addKey1(K1 key) {this.key1=key;} + void addKey2(K2 key) {this.key2=key;} + + @Override + public int hashCode() { + return ((value == null) ? 0 : value.hashCode()); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() == obj.getClass()) { + @SuppressWarnings("unchecked") + WrappedValue other = (WrappedValue) obj; + if ((this.value == null) && (other.value == null)) { + return true; + } else if (this.value.equals(other.value)) { + return true; + } + } else { //check if obj is the wrapped object + if (this.value.equals(obj)) { + return true; + } + } + return false; + } + } + +} diff --git a/src/main/java/org/gcube/vremanagement/contextmanager/ProfileDate.java b/src/main/java/org/gcube/vremanagement/contextmanager/ProfileDate.java new file mode 100644 index 0000000..9009962 --- /dev/null +++ b/src/main/java/org/gcube/vremanagement/contextmanager/ProfileDate.java @@ -0,0 +1,56 @@ +package org.gcube.vremanagement.contextmanager; + +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.regex.Pattern; + +/** + * Transforms from {@link Date} to a valid string representation for the xs:dateAndTime XML Schema data type and vice versa. + * It can be used to write/read a {@link Date} object to/from a profile. + * + * @author Manuele Simi (ISTI-CNR) + * + */ +public final class ProfileDate { + + static final DateFormat dateAndTime = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); + + /** + * Transforms the input {@link Date} in a valid string representation for the xs:dateAndTime XML Schema data type + * @param date the {@link Date} object to tranform + * @return the {@link String} object + */ + public static synchronized String toXMLDateAndTime(Date date) { + String formatted = dateAndTime.format(date); + StringBuilder toXS = new StringBuilder(); + toXS.append(formatted.substring(0, formatted.length()-2)); + toXS.append(":"); + toXS.append(formatted.substring(formatted.length()-2, formatted.length())); + return toXS.toString(); + + } + + /** + * Transforms the input xs:dateAndTime representation in a {@link Date} object + * @param date the string representation of xs:dateAndTime (e.g. " 2009-05-12T16:46:03+02:00 ") + * @return the {@link Date} object + * @throws ParseException if the input date is not in an valid format + */ + public static synchronized Date fromXMLDateAndTime(String date) throws ParseException { + + //the test is for backward compatibility, to read the old profiles that have no time zone in the dateAndTime fields + Pattern p = Pattern.compile("^.*T\\d{2}:\\d{2}:\\d{2}$"); //ends with 'T'HH:mm:ss + if (p.matcher(date).matches()) { + return new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").parse(date); + } else { + StringBuilder toDate = new StringBuilder(); + toDate.append(date.substring(0, date.length()-3)); + toDate.append(date.substring(date.length()-2, date.length())); + return dateAndTime.parse(toDate.toString()); + } + + } + +} diff --git a/src/main/java/org/gcube/vremanagement/contextmanager/ResourceBinder.java b/src/main/java/org/gcube/vremanagement/contextmanager/ResourceBinder.java new file mode 100644 index 0000000..f2739e4 --- /dev/null +++ b/src/main/java/org/gcube/vremanagement/contextmanager/ResourceBinder.java @@ -0,0 +1,38 @@ +package org.gcube.vremanagement.contextmanager; + +import java.io.StringReader; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Unmarshaller; + +public class ResourceBinder { + + private JAXBContext jaxbContext; + + private static ResourceBinder binder = null; + + + public static synchronized ResourceBinder get() { + if (binder==null) { + try { + JAXBContext context = JAXBContext.newInstance(ScopeDescriptor.class); + binder= new ResourceBinder(context); + } catch (JAXBException e) { + throw new RuntimeException("cannot create jaxbContext",e); + } + } + return binder; + } + + private ResourceBinder(JAXBContext context) { + this.jaxbContext = context; + } + + public ScopeDescriptor bind(String xml) throws JAXBException{ + Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); + ScopeDescriptor scopedRes = (ScopeDescriptor)unmarshaller.unmarshal(new StringReader(xml)); + return scopedRes; + } + +} diff --git a/src/main/java/org/gcube/vremanagement/contextmanager/ResourceManager.java b/src/main/java/org/gcube/vremanagement/contextmanager/ResourceManager.java new file mode 100644 index 0000000..6d56187 --- /dev/null +++ b/src/main/java/org/gcube/vremanagement/contextmanager/ResourceManager.java @@ -0,0 +1,105 @@ +package org.gcube.vremanagement.contextmanager; + +import java.util.Iterator; + +import javax.enterprise.inject.Any; +import javax.enterprise.inject.Default; +import javax.enterprise.inject.Instance; +import javax.inject.Inject; +import javax.inject.Singleton; + +import org.gcube.common.resources.gcore.Resource; +import org.gcube.common.resources.gcore.Resource.Type; +import org.gcube.vremanagement.contextmanager.handlers.ResourceHandler; +import org.gcube.vremanagement.contextmanager.model.collectors.BackendConnector; + + +@Singleton +public class ResourceManager { + + @Inject + @Any + Instance resourcesHandlers; + + @Inject + @Default + BackendConnector defaultCollector; + + public ScopedResource addResourceToContext(String context, Resource resource) { + ResourceHandler handler = retrieveHandler(resource.type()); + handler.addResource(context, resource); + return getScopedResource(resource); + } + + public ScopedResource removeResourceFromContext(String context, String id ) { + Resource res = retrieveResource(id); + ResourceHandler handler = retrieveHandler(res.type()); + handler.removeResource(context, res); + return getScopedResource(res); + } + + private Resource retrieveResource(String id) { + return defaultCollector.find(id); + /* + XQuery query = ICFactory.queryFor(Resource.class); + query.addCondition(String.format("$resource/ID/text() eq '%s'",id)); + query.setResult("{$resource/Type}{$resource}"); + DiscoveryClient client = ICFactory.clientWith(new ResourceParser()); + List resources = client.submit(query); + //TODO check return size + return resources.get(0); + + public static class ResourceParser implements ResultParser{ + + private enum ResourceType { + GenericResource(GenericResource.class), + RuntimeResource(ServiceEndpoint.class), + RunningInstance(GCoreEndpoint.class), + Service(Software.class), + GHN(HostingNode.class); + + private Class managerClass; + + ResourceType(Class managerClass) { + this.managerClass = managerClass; + } + + public Class getManagerClass(){ + return this.managerClass; + } + } + + @Override + public Resource parse(String res) throws Exception { + String type = res.replaceAll("\\s*([^<]*).*", "$1"); + String resource = res.replaceAll(".*(.*).*", "$1"); + Class classForUnmrshalling= ResourceType.valueOf(type).getManagerClass(); + return Resources.unmarshal(classForUnmrshalling, new StringReader(resource)); + } + + + } + + + */ + } + + private ResourceHandler retrieveHandler(Type type) { + Iterator it = resourcesHandlers.iterator(); + while (it.hasNext()) { + ResourceHandler rh = it.next(); + if (rh.getManagedResources().contains(type)) + return rh; + } + + //TODO return handler not found + return null; + + } + + private ScopedResource getScopedResource(Resource res) { + return new ScopedResource(res.id(), res.type().name(), Long.toString(System.currentTimeMillis())); + } + + +} diff --git a/src/main/java/org/gcube/vremanagement/contextmanager/ScopeDescriptor.java b/src/main/java/org/gcube/vremanagement/contextmanager/ScopeDescriptor.java new file mode 100644 index 0000000..a5f3add --- /dev/null +++ b/src/main/java/org/gcube/vremanagement/contextmanager/ScopeDescriptor.java @@ -0,0 +1,47 @@ +package org.gcube.vremanagement.contextmanager; + +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement(name = "Body") +@XmlAccessorType (XmlAccessType.FIELD) +public class ScopeDescriptor { + + @XmlElement(name = "Scope") + String context; + + + @XmlElement(name = "Service") + String service; + + @XmlElement(name = "Manager") + String manager; + + @XmlElement(name = "Designer") + String designer; + + @XmlElement(name = "StartTime") + String startTime; + + @XmlElement(name = "SecurityEnabled") + boolean secure = false; + + + @XmlElementWrapper(name="ScopedRescources") + @XmlElement(name="ScopedRescource") + List scopedResources = null; + + + @Override + public String toString() { + return "ScopeDescriptor [context=" + context + ", manager=" + manager + ", designer=" + designer + + ", startTime=" + startTime + ", secure=" + secure + ", scopedResources=" + scopedResources + "]"; + } + + +} diff --git a/src/main/java/org/gcube/vremanagement/contextmanager/ScopedResource.java b/src/main/java/org/gcube/vremanagement/contextmanager/ScopedResource.java new file mode 100644 index 0000000..0f327ad --- /dev/null +++ b/src/main/java/org/gcube/vremanagement/contextmanager/ScopedResource.java @@ -0,0 +1,47 @@ +package org.gcube.vremanagement.contextmanager; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement +@XmlAccessorType (XmlAccessType.FIELD) +public class ScopedResource { + + @XmlElement(name = "ResourceID") + String id; + + @XmlElement(name = "ResourceType") + String type; + + @XmlElement(name = "JointTime") + String jointTime; + + @XmlElement(name = "HostedOn") + String hostedOn; + + + + public ScopedResource(String id, String type, String jointTime) { + super(); + this.id = id; + this.type = type; + this.jointTime = jointTime; + } + + public ScopedResource(String id, String type, String jointTime, String hostedOn) { + super(); + this.id = id; + this.type = type; + this.jointTime = jointTime; + this.hostedOn = hostedOn; + } + + @Override + public String toString() { + return "ScopedResource [id=" + id + ", type=" + type + ", jointTime=" + jointTime + ", hostedOn=" + hostedOn + + "]"; + } + +} diff --git a/src/main/java/org/gcube/vremanagement/contextmanager/handlers/ContextHandler.java b/src/main/java/org/gcube/vremanagement/contextmanager/handlers/ContextHandler.java new file mode 100644 index 0000000..f31f359 --- /dev/null +++ b/src/main/java/org/gcube/vremanagement/contextmanager/handlers/ContextHandler.java @@ -0,0 +1,34 @@ +package org.gcube.vremanagement.contextmanager.handlers; + +import java.util.List; + +import javax.enterprise.inject.Any; +import javax.enterprise.inject.Instance; +import javax.inject.Inject; +import javax.inject.Singleton; + +import org.gcube.common.authorization.library.provider.SecurityTokenProvider; +import org.gcube.vremanagement.contextmanager.ContextAppManager; +import org.gcube.vremanagement.contextmanager.model.operators.context.CustomContextOperator; +import org.gcube.vremanagement.contextmanager.model.operators.context.MandatoryContextOperator; + + +@Singleton +public class ContextHandler { + + @Inject + @Any + Instance mandatoryContextOperators; + + @Inject + @Any + Instance customContextOperators; + + public void createContext(String contextName, List resourcesId, ContextAppManager appContext) { + mandatoryContextOperators.forEach(co -> co.onCreateContext(SecurityTokenProvider.instance.get(), contextName, null)); + } + + public void removeContext(String contextName, ContextAppManager appContext) { + mandatoryContextOperators.forEach(co -> co.onDisposeContext(SecurityTokenProvider.instance.get(), contextName, null)); + } +} diff --git a/src/main/java/org/gcube/vremanagement/contextmanager/handlers/ResourceHandler.java b/src/main/java/org/gcube/vremanagement/contextmanager/handlers/ResourceHandler.java new file mode 100644 index 0000000..cf09b9d --- /dev/null +++ b/src/main/java/org/gcube/vremanagement/contextmanager/handlers/ResourceHandler.java @@ -0,0 +1,23 @@ +package org.gcube.vremanagement.contextmanager.handlers; + + +import java.util.List; + +import org.gcube.common.resources.gcore.Resource; +import org.gcube.common.resources.gcore.Resource.Type; + +public interface ResourceHandler { + + public List getManagedResources(); + + public void addResource(String contextName, Resource resource); + + public void removeResource(String contextName, Resource resource); + + //in case of resource created directly by the publisher + public void createResourceNotified(String contextName, Resource resource); + + //in case of resource deleted directly by the publisher + public void removeResourceNotified(String contextName, Resource resource); + +} diff --git a/src/main/java/org/gcube/vremanagement/contextmanager/handlers/impl/DynamicResourceHandler.java b/src/main/java/org/gcube/vremanagement/contextmanager/handlers/impl/DynamicResourceHandler.java new file mode 100644 index 0000000..7997bae --- /dev/null +++ b/src/main/java/org/gcube/vremanagement/contextmanager/handlers/impl/DynamicResourceHandler.java @@ -0,0 +1,48 @@ +package org.gcube.vremanagement.contextmanager.handlers.impl; + +import java.util.Arrays; +import java.util.List; + +import javax.enterprise.inject.Default; +import javax.inject.Inject; + +import org.gcube.common.resources.gcore.Resource; +import org.gcube.common.resources.gcore.Resource.Type; +import org.gcube.vremanagement.contextmanager.handlers.ResourceHandler; +import org.gcube.vremanagement.contextmanager.model.collectors.BackendConnector; + +public class DynamicResourceHandler implements ResourceHandler { + + @Inject + @Default + BackendConnector defaultCollector; + + @Override + public List getManagedResources() { + return Arrays.asList(Type.GCOREENDPOINT, Type.NODE); + } + + @Override + public void addResource(String contextName, Resource resource) { + // TODO Auto-generated method stub + } + + @Override + public void removeResource(String contextName, Resource resource) { + // TODO Auto-generated method stub + + } + + @Override + public void createResourceNotified(String contextName, Resource resource) { + // TODO Auto-generated method stub + + } + + @Override + public void removeResourceNotified(String contextName, Resource resource) { + // TODO Auto-generated method stub + + } + +} diff --git a/src/main/java/org/gcube/vremanagement/contextmanager/handlers/impl/StaticResourceHandler.java b/src/main/java/org/gcube/vremanagement/contextmanager/handlers/impl/StaticResourceHandler.java new file mode 100644 index 0000000..736c1c7 --- /dev/null +++ b/src/main/java/org/gcube/vremanagement/contextmanager/handlers/impl/StaticResourceHandler.java @@ -0,0 +1,51 @@ +package org.gcube.vremanagement.contextmanager.handlers.impl; + +import java.util.Arrays; +import java.util.List; + +import javax.enterprise.inject.Any; +import javax.enterprise.inject.Instance; +import javax.inject.Inject; + +import org.gcube.common.resources.gcore.Resource; +import org.gcube.common.resources.gcore.Resource.Type; +import org.gcube.vremanagement.contextmanager.handlers.ResourceHandler; +import org.gcube.vremanagement.contextmanager.model.collectors.BackendConnector; + +public class StaticResourceHandler implements ResourceHandler { + + @Inject + @Any + Instance collectors; + + @Override + public List getManagedResources() { + return Arrays.asList(Type.GENERIC, Type.ENDPOINT); + } + + @Override + public void addResource(String contextName, Resource resource) { + collectors.forEach(c-> c.addResourceToContext(contextName, resource)); + //ADD resource operator execution onAdd + } + + @Override + public void removeResource(String contextName, Resource resource) { + collectors.forEach(c-> c.removeResourceFromContext(contextName, resource)); + //ADD resource operator execution onREmove + } + + @Override + public void createResourceNotified(String contextName, Resource resource) { + // TODO Auto-generated method stub + + } + + @Override + public void removeResourceNotified(String contextName, Resource resource) { + // TODO Auto-generated method stub + + } + + +} diff --git a/src/main/java/org/gcube/vremanagement/contextmanager/services/ContextService.java b/src/main/java/org/gcube/vremanagement/contextmanager/services/ContextService.java new file mode 100644 index 0000000..e264490 --- /dev/null +++ b/src/main/java/org/gcube/vremanagement/contextmanager/services/ContextService.java @@ -0,0 +1,126 @@ +package org.gcube.vremanagement.contextmanager.services; + +import java.util.Arrays; +import java.util.List; + +import javax.enterprise.context.RequestScoped; +import javax.inject.Inject; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +import org.gcube.common.resources.gcore.Resource; +import org.gcube.common.scope.api.ScopeProvider; +import org.gcube.smartgears.ApplicationManagerProvider; +import org.gcube.smartgears.ContextProvider; +import org.gcube.smartgears.annotations.ManagedBy; +import org.gcube.smartgears.context.application.ApplicationContext; +import org.gcube.vremanagement.contextmanager.ResourceManager; +import org.gcube.vremanagement.contextmanager.ContextAppManager; +import org.gcube.vremanagement.contextmanager.handlers.ContextHandler; +import org.gcube.vremanagement.contextmanager.model.types.ContextList; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@Path("contexts") +@ManagedBy(ContextAppManager.class) +public class ContextService { + + private static Logger log = LoggerFactory.getLogger(ContextService.class); + + ApplicationContext appContext = ContextProvider.get(); + + @Inject + ContextHandler contextHandler; + + @Inject + ResourceManager resourceHandler; + + @RequestScoped + @PathParam("vre") + String vre; + + @RequestScoped + @PathParam("resourceId") + String resourceId; + + @RequestScoped + @PathParam("infra") + String infra; + + @RequestScoped + @PathParam("vo") + String vo; + + @GET + @Produces(MediaType.APPLICATION_JSON) + @Path("") + public ContextList getContexts() { + return new ContextList(Arrays.asList("/gcube","/gcube/devsec")); + } + + @PUT + @Path("/{infra}/{vo}/{vre}") + public String createVREContext(List resourceIds) { + try { + String fullContext = String.format("/%s/%s/%s", infra,vo,vre); + validateCall(fullContext); + contextHandler.createContext(fullContext, resourceIds, (ContextAppManager)ApplicationManagerProvider.get()); + }catch (Exception e) { + // TODO: handle exception + } + return null; + } + + @DELETE + @Path("/{infra}/{vo}/{vre}") + public String disposeVREContext() { + try { + String fullContext = String.format("/%s/%s/%s", infra,vo,vre); + validateCall(fullContext); + contextHandler.removeContext(fullContext, (ContextAppManager)ApplicationManagerProvider.get()); + }catch (Exception e) { + // TODO: handle exception + } + return null; + } + + @DELETE + @Path("/{context:(.*(?=/resources))}/resources/{resourceId}") + public String removeResourceFromContext(@PathParam("context") String context) { + log.info("remove resource {} from context {}", resourceId, context); + try { + validateCall(context); + resourceHandler.removeResourceFromContext(context, resourceId); + }catch (Exception e) { + // TODO: handle exception + } + return null; + } + + @PUT + @Path("/{context:(.*(?=/resources))}/resources") + public String addResourceToContext(@PathParam("context") String context, Resource resource) { + log.info("adding resource {} to context {}", resource.id(), context); + try { + validateCall(context); + resourceHandler.addResourceToContext(context, resource); + }catch (Exception e) { + // TODO: handle exception + } + return null; + } + + private void validateCall(String fullContext) throws Exception { + String currentContext = ScopeProvider.instance.get(); + if (!fullContext.startsWith(currentContext)) + throw new Exception("invalid call"); + } + + + +} diff --git a/src/main/resources/META-INF/beans.xml b/src/main/resources/META-INF/beans.xml new file mode 100644 index 0000000..f64554d --- /dev/null +++ b/src/main/resources/META-INF/beans.xml @@ -0,0 +1,6 @@ + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/gcube-app.xml b/src/main/webapp/WEB-INF/gcube-app.xml new file mode 100644 index 0000000..e454d56 --- /dev/null +++ b/src/main/webapp/WEB-INF/gcube-app.xml @@ -0,0 +1,7 @@ + + ContextManager + VREManagement + 1.0.0-SNAPSHOT + ContextManager webapp + + \ No newline at end of file diff --git a/src/test/java/org/gcube/vremanagement/contextmanager/BackendConnectorTester.java b/src/test/java/org/gcube/vremanagement/contextmanager/BackendConnectorTester.java new file mode 100644 index 0000000..cf0d9bb --- /dev/null +++ b/src/test/java/org/gcube/vremanagement/contextmanager/BackendConnectorTester.java @@ -0,0 +1,48 @@ +package org.gcube.vremanagement.contextmanager; + +import java.util.List; + +import javax.enterprise.inject.Default; + +import org.gcube.common.resources.gcore.Resource; +import org.gcube.vremanagement.contextmanager.model.collectors.BackendConnector; + +@Default +public class BackendConnectorTester implements BackendConnector { + + @Override + public Resource find(String resourceId) { + return null; + } + + @Override + public String createContext(String contextName, String parentContextId, List resourceIds) { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean removeContext(String contextId) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean addResourceToContext(String contextId, Resource resource) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean removeResourceFromContext(String contextId, Resource resource) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean updateResource(Resource resource) { + // TODO Auto-generated method stub + return false; + } + +} diff --git a/src/test/java/org/gcube/vremanagement/contextmanager/ContextServiceIntegrationTest.java b/src/test/java/org/gcube/vremanagement/contextmanager/ContextServiceIntegrationTest.java new file mode 100644 index 0000000..90a08e1 --- /dev/null +++ b/src/test/java/org/gcube/vremanagement/contextmanager/ContextServiceIntegrationTest.java @@ -0,0 +1,48 @@ +package org.gcube.vremanagement.contextmanager; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import javax.ws.rs.core.Application; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; + +import org.gcube.vremanagement.contextmanager.model.types.ContextList; +import org.gcube.vremanagement.contextmanager.services.ContextService; +import org.glassfish.jersey.server.ResourceConfig; +import org.glassfish.jersey.test.JerseyTest; +import org.jboss.weld.environment.se.Weld; +import org.junit.Test; + +public class ContextServiceIntegrationTest extends JerseyTest { + + @Override + protected Application configure() { + /*Class[] extScopes = ServiceFinder.find(ExternalRequestScope.class, true).toClassArray(); + for (Class ers : extScopes) { + System.out.println("ESR "+ers.getName()); + }*/ + + final Weld weld = new Weld(); + weld.initialize(); + Runtime.getRuntime().addShutdownHook(new Thread(() -> weld.shutdown())); + + return new ResourceConfig(ContextService.class); + } + + @Test + public void getContexts_whenCorrectRequest_thenResponseIsOk() { + + + Response response = target("/contexts").request() + .get(); + + assertEquals("Http Response should be 200: ", Status.OK.getStatusCode(), response.getStatus()); + assertEquals("Http Content-Type should be: ", MediaType.APPLICATION_JSON, response.getHeaderString(HttpHeaders.CONTENT_TYPE)); + + assertTrue(((ContextList)response.getEntity()).getContexts().size()>0); + } + +} diff --git a/src/test/java/org/gcube/vremanagement/contextmanager/ResourceTest.java b/src/test/java/org/gcube/vremanagement/contextmanager/ResourceTest.java new file mode 100644 index 0000000..ef312ae --- /dev/null +++ b/src/test/java/org/gcube/vremanagement/contextmanager/ResourceTest.java @@ -0,0 +1,45 @@ +package org.gcube.vremanagement.contextmanager; + +import static org.gcube.resources.discovery.icclient.ICFactory.clientFor; +import static org.gcube.resources.discovery.icclient.ICFactory.queryFor; + +import java.util.List; + +import org.gcube.common.resources.gcore.GenericResource; +import org.gcube.common.scope.api.ScopeProvider; +import org.gcube.resources.discovery.client.api.DiscoveryClient; +import org.gcube.resources.discovery.client.queries.api.SimpleQuery; +import org.junit.Before; +import org.junit.Test; + +public class ResourceTest { + + @Before + public void init() { + ScopeProvider.instance.set("/gcube/devsec"); + } + + @Test + public void bindResource() throws Exception{ + + SimpleQuery query = queryFor(GenericResource.class); + query.addCondition("$resource/Profile/SecondaryType/text() eq 'VO'"); + + DiscoveryClient client = clientFor(GenericResource.class); + List resources = client.submit(query); + + System.out.println(resources.get(0).profile().bodyAsString()); + + System.out.println(ResourceBinder.get().bind(""+resources.get(0).profile().bodyAsString()+"")); + + } + + + @Test + public void regExpr() { + String regexpr = ".*(?=/resources)"; + String val = "/gcube/devsec/devVRE/resources"; + System.out.println(val.replaceFirst(regexpr, "ciao")); + + } +} diff --git a/src/test/resources/META-INF/beans.xml b/src/test/resources/META-INF/beans.xml new file mode 100644 index 0000000..f64554d --- /dev/null +++ b/src/test/resources/META-INF/beans.xml @@ -0,0 +1,6 @@ + + \ No newline at end of file diff --git a/src/test/resources/logback-test.xml b/src/test/resources/logback-test.xml new file mode 100644 index 0000000..c5fbacc --- /dev/null +++ b/src/test/resources/logback-test.xml @@ -0,0 +1,12 @@ + + + + + + %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n + + + + + + diff --git a/target/classes/META-INF/beans.xml b/target/classes/META-INF/beans.xml new file mode 100644 index 0000000..f64554d --- /dev/null +++ b/target/classes/META-INF/beans.xml @@ -0,0 +1,6 @@ + + \ No newline at end of file diff --git a/target/classes/org/gcube/vremanagement/contextmanager/ContextAppManager.class b/target/classes/org/gcube/vremanagement/contextmanager/ContextAppManager.class new file mode 100644 index 0000000000000000000000000000000000000000..7072c91c4b03e899133c4b25081370a0145d1cb4 GIT binary patch literal 4340 zcmcIn`F9)D8NJWjNXp;@hqzUnfPfHN&N4J4II-Q(*jZ|0Ctw>B%F>QTFY*LwMwuBo zHk3ly_qB9k?{W^mvW6JW;qWtmRMY!rM%Gw1t`ZJDN0#Qj_ucm`_gm)s|9<@~fCKoC zhBkpiu2(WjR;?h71y5E?$1KT;bOOV2oj@)I(TZn`MUO|T)v54|r=de&%Q=e zQyN}prD6Jp?wna|+3*o+m>RLlwqplJ1ls%aa{?V>Zc%1%Ew*at5%^iNi%yspy|Sd^ zI&7nXB^gAn6S$>6q1ss4^!?%dS`Vi|P#qdl0-GmoN1m!x3euZ33uQWqA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ager/ContextManagerApplication.class b/target/classes/org/gcube/vremanagement/contextmanager/ContextManagerApplication.class new file mode 100644 index 0000000000000000000000000000000000000000..da16a2e55d71cc8c2a78e0de1ddc411cca3dca7b GIT binary patch literal 781 zcmbtR%TC)s6g}f4I5CevpimyA>Z0N$F`MoZMWvBY7jA_Jiqz%AjGU>QaWozW_$#_X zY9&6PA64~^P1Higs*AbLGv~g3{`!6o;2mE3@EG2wCgyRJ4<(-(ITl*PaxAswQL3%H zwq?ZdUg>@+0On*eNmL}PO0|zF!_HSR71#VK<0hk@M)JQ9409c&mF+TA_74UO)n0lj z160shKn-&Y%}{CiIUf(Dxe&udGPJ@p63IXq<@|?W)s9rg@FD!)p4$vTENw3lStf~b zW&a>_6Y$)sg!iQ-K%=i>Eo^S6o4u#`P6rKR*mIAWs3HDqIGJE zYtk}WMa9`M&x9S(HfmFmYTWd`6Amxvfyqja|&l{mwn-eCM3+%(I`59s@Xx(+)xkXUcvdUC38+ zCOz+)S?%e9nKfRJ&X>Kw+zM(IKRsS81;sJ5P#M>Az1Ms_H)p1@x>Pj|A`0y@dS0hX z+AE~59aUtwKj;_1&;S>qN2O>7eS=eb#a8z<)RIn*j%D7 zD>s{6L=jVH%M?9xxjLIO{-n;8?0m|3UCL^|D7bEnNXH6io2m8>b=Z7Y<`05}x!)v? zo|>YfochMZzdLjiB1f%*JuX_MgD{0ssK-(x@foW7BwVZ!pO$G|nUi<+hs9r6u6k}jHyMgM+dD} zi6w7aGW7tR$%ojO?0Oj(yuenzyXY)QwqZNJa*|R)*uk@F{lwB@y?R*k zZ>n9EDnl&sF`?SMn&D*wLu{ELhF)923WHeUmTPYV!@j>6_OE7m^&bq8mn z;yo=N(2bAO?-Nq^j05C246((oR_2QQJV?aVt7v4|7kOS{_M8 zqP1<2;ben>f{sXE%u0?VsJAd{xv{gWp@}+=ok&g>Xa2zYRMc}k?wCCTs>zfnQy$SyYq-C|PU`R_f&78Gl(Fes>l(gjYhGg{ z7D+Z4@RwI~83=5T_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;F+pNoq~yb_>5%m-2f;jqu#NQ#P#@Xe6Hq;F9c3R=~C_QnqyIkr>m+ORuWk~W?rz> zSkh6gC*jn2P$?03NsBI4r^qblhobadhxO1L<*4M16s>Yu(zUqi!Pw2q+r*hS#)mhU zZ$qy(pq1|g*9pFpe4t7RPe=FLxZA=#j!yjD!d04Y!FO|N8SOvuPYfO5A)p=G_}>f; zpcC7Nu)W9R`SjMi&!Ty02>}x`5U>T_g{1m8b)0lS>OE(33wAxf4 z8mgrd9Movkze9M9lC5aNVGL1LaK=9x8okGLGd1@p8^2&z>ffCdzHnP~zNWn+Tzt;YuYUnR2Q@Km|^m-F_hQo?F|k$GxXzDB=AEuFhfkr zEI}mDhaB>Rv7JehI`FrtS>-?YR^Yce?zAHICpH?mw1XQQZbARbk*<#F;_JIlD1;_N>f;c^J}iZ;iJYXmsRN7v#tLC>6hgC literal 0 HcmV?d00001 diff --git a/target/classes/org/gcube/vremanagement/contextmanager/ScopeDescriptor.class b/target/classes/org/gcube/vremanagement/contextmanager/ScopeDescriptor.class new file mode 100644 index 0000000000000000000000000000000000000000..68943147ac84d362459d028eb795f8d48ccb95f5 GIT binary patch literal 1800 zcmb7E?Q+{h6g}&F*iO|Xn6#x(z%6ZY9H-)=l!B9%q;VkNwlq%MHXVM*@{ZY#EqSDM zCV2v02WDtG12a4T55;hHrNm&D4E>?i*?ae1oqO+D{rT5#e*n0NXIW$fZiP|D?f8S1 zboV3K^8&9Udos|j9|l?;=)@Aa4L|J54H^59>gzDdVp3rKxwr4RT`%ak4_nWruLZJc zm_VUE^fq*)f=*T7;`SiWswbN&R;{jF3xZI4T7^L@aNPzRxCgzi+fqT>^-jF*lU}#h zwY->QGVpp*V9HYBCu14yE1#BZ;{>I&X}fPriUe|P8LLhp4P+rH%*Wb`^bR=*@5eM<2D;++8a;{%dZL=%af9+=J2J!Or@AAbk!tZac~yXIk5X@ zD#c@+TGv+&=8S7yz^N2Z#AcNFO0)f;!5qk}gQ8N5Z5!9~k%f#_`>CcAfz zXrX|8iEV3O-uu0`Z=4YR}_(&8|I;a|cc z-<%$n(v&~3QO39XJ1S2LH(uhS@~`;x2%iJjRNhr~yC^fMD@V2I7yd6Y?D36J>sA*tPzR0a)uddGI-JmYprjNNGBF~Jjwr`Y=& DgcQ2{ literal 0 HcmV?d00001 diff --git a/target/classes/org/gcube/vremanagement/contextmanager/ScopedResource.class b/target/classes/org/gcube/vremanagement/contextmanager/ScopedResource.class new file mode 100644 index 0000000000000000000000000000000000000000..f273447ed6b8bd96b353f48c10ad60634b0c2e4f GIT binary patch literal 1562 zcmbVMYfsZq7=F$eyHUA}0dAm9E@SHk^#UToP!NddA_fBpXc6TlL-g77gcTXsdMXpItAPHkRQO|`ur(fppJDh!JyjJ$H7m+~>4a+zgHJCrL<^n7p=0Z2 zWsM_@QJ0H&Jh7JgkN{;(6Lo_czNGs2)$~Xfpy)~oehT7bT{|^ ziDZgIS5%gh9!U)D0`qG(V7!0>1^dlgwgoFXlnv!q}0fwQ1Zt}N{YKhxND$PYq z&(c(*sM@;lTS32btka-Y3OBkfn%tWk9<2ND-kD}33<>@r$MUY2A(qZ`R|hfAFmY86 zTMgYPb323#!|312N`BDG`3O?TiYew8#(FT%6h+0N1O*Qm0&1W# z#N~x1CcjeNhdZ>66E9$rDyI;p$RO@g_dQwx+3P1SNgfbuok3XiebElW5-dGraaw`= znKEM6L=R*+?r&ncgP)*oV49F-2!EFF=V*@<;+S_iEO|S%IV9Q~5^WBN76(FfN8=|R zq?;BS%Vh`Te<1Zfn!bQ6f5XH%7NQSnAv-SY$DTbY>}AiM7WN7)=UDwhB)x$Rx)++I kAA1g~$hssYf+BzxNgvkS>UHv9xD6#ja1S+W_-5+D*K7%*rq$`J3cF%p&l(aptd45BFZ&UQ8fv)xlYv#EqC zA4<#8f*(GBQ4Y4VIzwS!>rOZyXG`1!rs!N z&Lyvjx{#smC>e_FFy7JjCYM!D=)f+<`w!!F7TpZ_XMBs>9+x$Hx$;anA;U27Re7lN zPC~!z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&)~}_lqND?(Yi#>5bc)9ns4wezKj08$B%f5pXkgK K2ZsZJ;eP?o3C%tL literal 0 HcmV?d00001 diff --git a/target/classes/org/gcube/vremanagement/contextmanager/handlers/ResourceHandler.class b/target/classes/org/gcube/vremanagement/contextmanager/handlers/ResourceHandler.class new file mode 100644 index 0000000000000000000000000000000000000000..554fcf1414fada4403e3eb569bcd238674e0a564 GIT binary patch literal 618 zcmb7C%T59@6g@>?^wSyfg{DME5mG|Za$iYHZ+02c{6)whCT;iw z8I@|Eu9pE1Wrp@#ECi2*4EgjiM;#5G z7+OvnwV>513_V|yuVqpv! z4;_Z#|F-wgWf*MT!%)sNt1>X`xL*NO+&L?#I^T0%3A@g(p^og#jlwnyyO&v4)5_m{ Pw4JTH&I26cXk7aNN>sQw literal 0 HcmV?d00001 diff --git a/target/classes/org/gcube/vremanagement/contextmanager/handlers/impl/DynamicResourceHandler.class b/target/classes/org/gcube/vremanagement/contextmanager/handlers/impl/DynamicResourceHandler.class new file mode 100644 index 0000000000000000000000000000000000000000..6d4c49e0aacdcc9882d32fefe2778a0ae943934e GIT binary patch literal 1746 zcmb7FTT>G;7(IbPp%g(t6hQ?9EuaMN4`sO6qN1gBD8mfnQ`m+Q+|4rCl!1Sxyy!Ti zKfoX5`0cg@L}pkXz9yTToSg5L{{Hjh7l7w@l|&1}2j5hA)v0Yueqf|0w5Uo?YRes8 zTX|^fD~9h1U2&xexbpU0oNV%6iMJwmM9sB1-*t)AHw^C!Ft1%t=F_wp4?P{ z+IHo#*1i>1`8r^@Q3#znZ)ikCF|Mg_77$=AgarhQ&%WfvG)GgF%k zi5zK3p%uMpq|wdLQ&3tKYu>gr8-gxo=qvb+a5sff;df&(VRscNS&Qp(oP3eG{;ITV zQPL~Th|?{7nW@M#UbD*O1r=C=c9vCD3tKZJG5;T6{){lk_dH*7)2NPs>dQBhH!qmj zINF!lg=`YH8D>vY80T0ghA@)G9o%K;ew!<;udEdFA4{vn4Tia^N(jkD(-;fM62($} zC58K#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~ zVvMva>m@5R3y-SOJsWP;4RdOq3r*|k33EYR+n0BO1us~aWu5eE4QreZosw9sNRN$W z$0o;yg=e1Cv4T&NH|H9!V#io7*R$%o4FOt_6GJ4S+Q~2YUMZILU>#|7^*CXySkY{C zs`q$*@7Xg()dfLc-)e1PtW@da`Be=Mte;k7kGDA-tQ%WWigOyD#qx!}E*bbv2jqhvdCN9p2>pUBJ3BP9WL;NU(S2XnP z7?+M8W07;AlNav!sg9TNGYyshSJ#^S|IPO4s{L5#6SeQZ8JE*;T-|~e{2ISa;WwP8 zYcLdtK+Mnl@Nf+2_F8Xw6~E(P?6^T_x)$3^|7Pi1+#TLcd4CY|=Avk`f70=1yhcFe z|IG2YLEoK2MO^aRXX_591N>9^fMq z|?|KKPrW@N&=cb$5M{;X;^e!&k;_W2nvk8d@Vu|DUC?$PNp3O?h!sHWN zD`}UcwAbiM;nkDvmz&=~<8)*Hn|OlK_{im^ckywJVy{p158lNMu5Jzvtik*TX76C` zRWwa#x1^>IldDS$2upU6C2)b3xF}|DYCBHVvJz!?But^CSS;WfayU%y`}AT10^W_R zC-y?_l}X|MIVvei;Ie{6WlEvY5;xZ=^b(~vkT|rxLfQTSrBJNTGWE$SeIBA$Tw<;1 zlOx7S>T`{roTA8SsZUoVOX+hM9a4)Jb6H_t#b?M&xPJrY=kPpX~%qBn|i=A)` zFUSN^hUVZd4gE5{lK`EFobO7|ts*C4(2%fSB*a(}np9svCq@nln ze+@@AU@j7~OUxek7U+N=5jZ_D<{pKavhZ{Kf^JagO^Loie72DIOM+=4PFKPUsgJPg zq1*V?J^Wt7!~pU9@fGZO8}4-bU+&`dzl*$%{N65AS>*T35=+%GGxym9ltVF;L(1nZ o^!^(%h6R)~w144XioK!%Z*tv$w`2fx@=XQo9o!|f4hw7l0f_`y$^ZZW literal 0 HcmV?d00001 diff --git a/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF b/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF new file mode 100644 index 0000000..4ec51cf --- /dev/null +++ b/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF @@ -0,0 +1,13 @@ +Manifest-Version: 1.0 +Build-Jdk-Spec: 14 +Specification-Title: VREManager +Specification-Version: 1.0 +Implementation-Title: VREManager +Implementation-Version: 1.0.0-SNAPSHOT +Build-Time: 20201203-131437 +Created-By: Maven Integration for Eclipse +SCM-Branch: +SCM-Revision: +SCM-Revision-URL: https://code-repo.d4science.org/gCubeSystem/maven-pare + nt/VREManager/commit/${buildNumber} + diff --git a/target/m2e-wtp/web-resources/META-INF/maven/org.gcube.vremanagement/VREManager/pom.properties b/target/m2e-wtp/web-resources/META-INF/maven/org.gcube.vremanagement/VREManager/pom.properties new file mode 100644 index 0000000..d4c444c --- /dev/null +++ b/target/m2e-wtp/web-resources/META-INF/maven/org.gcube.vremanagement/VREManager/pom.properties @@ -0,0 +1,7 @@ +#Generated by Maven Integration for Eclipse +#Thu Dec 03 14:14:48 CET 2020 +m2e.projectLocation=C\:\\Users\\tilli\\eclipse-workspace\\ContextManager +m2e.projectName=ContextManager +groupId=org.gcube.vremanagement +artifactId=VREManager +version=1.0.0-SNAPSHOT diff --git a/target/m2e-wtp/web-resources/META-INF/maven/org.gcube.vremanagement/VREManager/pom.xml b/target/m2e-wtp/web-resources/META-INF/maven/org.gcube.vremanagement/VREManager/pom.xml new file mode 100644 index 0000000..7362456 --- /dev/null +++ b/target/m2e-wtp/web-resources/META-INF/maven/org.gcube.vremanagement/VREManager/pom.xml @@ -0,0 +1,278 @@ + + 4.0.0 + org.gcube.vremanagement + VREManager + 1.0.0-SNAPSHOT + VREManager + war + + maven-parent + org.gcube.tools + 1.1.0 + + + + ${project.basedir}/src/main/webapp/WEB-INF + ${project.basedir}/distro + + + + + + org.gcube.distribution + maven-smartgears-bom + 2.0.0-SNAPSHOT + pom + import + + + + + + + org.gcube.vremanagement + context-manager-model + [1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT) + + + + org.gcube.resources + common-gcore-resources + + + org.gcube.resources.discovery + discovery-client + + + + org.gcube.core + common-smartgears-app + + + + org.gcube.core + common-smartgears + + + + + xstream + xstream + 1.2.2 + + + + org.gcube.resourcemanagement + whn-manager-client + [2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT) + + + + org.gcube.resources.discovery + ic-client + + + org.gcube.common + authorization-control-library + [1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT) + + + javax.ws.rs + javax.ws.rs-api + 2.0 + + + + + com.rabbitmq + amqp-client + 5.10.0 + + + + + org.glassfish.jersey.containers + jersey-container-servlet + 2.32 + + + org.glassfish.jersey.containers + jersey-container-servlet-core + 2.32 + + + + org.glassfish.jersey.core + jersey-server + 2.32 + + + org.glassfish.jersey.ext.cdi + jersey-cdi1x + 2.32 + + + + + + + org.jboss.weld.servlet + weld-servlet-core + 2.2.10.Final + + + + org.jboss + jandex + 1.2.2.Final + + + + com.fasterxml.jackson.jaxrs + jackson-jaxrs-json-provider + 2.3.0 + + + + org.glassfish.jersey.media + jersey-media-json-jackson + 2.32 + + + + + javax.enterprise + cdi-api + 1.2 + + + + + org.glassfish.jersey.core + jersey-common + 2.32 + + + + + org.glassfish.jersey.inject + jersey-hk2 + 2.32 + + + + + + javax.servlet + javax.servlet-api + 3.0.1 + + + + + + + org.slf4j + slf4j-api + + + + + + org.glassfish.jersey.test-framework + jersey-test-framework-core + 2.32 + test + + + + org.glassfish.jersey.test-framework.providers + jersey-test-framework-provider-jetty + 2.32 + test + + + + org.glassfish.jersey.ext.cdi + jersey-weld2-se + 2.30.1 + test + + + + ch.qos.logback + logback-classic + 1.2.3 + test + + + + junit + junit + 4.11 + test + + + + + + ${artifactId} + + + org.apache.maven.plugins + maven-war-plugin + + false + + + + org.apache.maven.plugins + maven-resources-plugin + 2.6 + + + copy-profile + + copy-resources + + process-resources + + ${webappDirectory} + + + ${distroDirectory} + true + + + + + + + + org.apache.maven.plugins + maven-assembly-plugin + + + descriptor.xml + + + + + servicearchive + install + + single + + + + + + + + \ No newline at end of file diff --git a/target/test-classes/META-INF/beans.xml b/target/test-classes/META-INF/beans.xml new file mode 100644 index 0000000..f64554d --- /dev/null +++ b/target/test-classes/META-INF/beans.xml @@ -0,0 +1,6 @@ + + \ No newline at end of file diff --git a/target/test-classes/logback-test.xml b/target/test-classes/logback-test.xml new file mode 100644 index 0000000..c5fbacc --- /dev/null +++ b/target/test-classes/logback-test.xml @@ -0,0 +1,12 @@ + + + + + + %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n + + + + + + diff --git a/target/test-classes/org/gcube/vremanagement/contextmanager/BackendConnectorTester.class b/target/test-classes/org/gcube/vremanagement/contextmanager/BackendConnectorTester.class new file mode 100644 index 0000000000000000000000000000000000000000..24f7ded1f4ba17643e9dea6eea167c95045275e2 GIT binary patch literal 1726 zcmbVMPfrs;6o1ne3N27XsbW>AqO_pQ#drY`#Sl#zOn`7OT&CNh4(`r0v$G9;Cl7iu z@!$vWLmA)9ZcCv{EFN~=%zN{G@Av-9{{Hjx7XUnmr+LT_c&T)ow!NsyX;<@rN!I28 zmxg*u8h&PCjizsy_nFJqj*^mlM(INy8m{w@BQSf)x{Ufvw&{oFDO&R|PT<{$z=3LU zAEWuc!wrWb5g6YTQkX3Q*;@UGKyC+J3Xp~36y#xoK&c@l-;07K*N3d>a{_Y>GXQKeCci~CoCh5w(6dj zaXuyA`bVruLe!GF#agXiuMSne1KTOC*J!$pGSN$yz}huj2`t2E^jPg`74&({M4c8+ zO3y}My><<3ORI3;=5$xs7gR}~{&hP@NMt{fMg;swgaRMfYbljsMktBxtGbq)QEV~S z9W6pmg|xo~`j(%t$Tu5M1$@i+jp2_dj}l)ou9JA8C<)53)gMs!j++cj;X3Y=MVQ9@ zRD1zupoAwJ7r23|b$)>|gEB+D*>%9P z4q(kYtku{$fOW@VS=0sGIUaBqDwya!#EDsFP;=j<{s0y+!UfjZua{U?u3){Cu&%R2ek4HdT85!*fto$>-XIJEB8QD(OTs`WriqcNN G8o*y|wVU|> literal 0 HcmV?d00001 diff --git a/target/test-classes/org/gcube/vremanagement/contextmanager/ContextServiceIntegrationTest.class b/target/test-classes/org/gcube/vremanagement/contextmanager/ContextServiceIntegrationTest.class new file mode 100644 index 0000000000000000000000000000000000000000..4961fcca4ce66712b4fe9a488c147cd792725cd8 GIT binary patch literal 3166 zcmb_eS$7mg7`>GY>B-PY7#C!VV+>{!8gPX{1Ok}E1eA%1al@XOV$w;cd*~%0xG%Wx z`-;nhzN!xi$kF4o$Dic!c&odU%mmOpc;=k0>FTO)x!?V6)gOQV@*9BL@STPRfkUoW zF)F37D2-`PPMMBbkyFwMjFRgF@^lc-ct&shT9DqfRg(SuR`JZha-Cu62O3fW?U5zh z^!<~TKW+BkwFsIGa#*A-x zKB4fWaiChYtx}Y7Uc)+pHsyJu==#1fBki&wooUN+od`T%8l#-cpasq9agB~^ah*U$ z$=T?FBoe`AF zR&Rl;t2CyBN}=Hx-UyJpS+Zwaa{Ut=#?Zv zV=*;sqw%Fwdlfk~7y|oN$QosqboZChKZ9=UR0-}X2zw{>w2Cn1;^#7kZp4!;1rXqx{fdV{bPh^LsI7v%eM&n0mpHJh@I?;me^@X zvKgxD@@ecQ#TR&cmYLXa-YDKz96XP7UpvPxEtE#Tv6tB?bxv=*Nh##7vR%E1o6dUQqz65T*BIjbk zNMcfn*(!x8f!&wcQqzFPiW6*`{G~HWaz^3msNz%%+F>eZFe`9PolYhOG!UPa%ET1w zW*Y$^T2zWb%MUW}5bBu5jKFH7k~68!hn480y+k7fHeH#7Jnq(zaHYv1vzi>IY1^DCmd*AZ z0v#(8e!|&;S9H9p4(+s`$T!0(L<)SwQb%`Nl5*j)*M{vXQL^Zu>jr+{nbjc~jJsvZ z(_45)!`s{+K@lBv7R6yw8iP@sTxgy&OM&an>UbCL5#On$DSPdSjj91^m#_R|?DF6D)}Et@Y~XO85-_IaX`aqrXxSf93rF9ljJ!L|+|o(wTY8os6&sKv|9f&N9grnV=7 z&0VpS@hU+j_itHGE6qDy-#< z+I))Z8aVE}h?cQ=-VA%@aP{bUtiOmYV?Dp%24EgH&Ee*Y=pIY`id)7Sv)c>v*zqGb z#g4Kx2y8~0my|VVMUFq^^t#w^;xvse+{#O`iuLx$=^b37g1nQX3gvs|q(T|!&fYbL zJr}?$?FAeX7|ag*jKMh^Kg-}o&Ys63SuQE R$MZRS)1(f{QGC09!#|6=gf##F literal 0 HcmV?d00001 diff --git a/target/test-classes/org/gcube/vremanagement/contextmanager/ResourceTest.class b/target/test-classes/org/gcube/vremanagement/contextmanager/ResourceTest.class new file mode 100644 index 0000000000000000000000000000000000000000..f452f0d1593acfdc7fbc2799680438fc44d35e13 GIT binary patch literal 3214 zcmbtWX?GJ<7=CVAI&C@#gaU#rWl_?F4vHv{3epXWDTSsMP(&w_OPHF>gqcZg-1mL? zE%G5yJ;&o`e}%uq<8x=Smgs5mzXNz4KWm5yoN~Rqk+;fO zX{>m%XgX$I7Nrvymg@v^HHcO`V?p|E*|X%L^aBmu0^66(71Jn~PTrW$E=wyA=oz;i zJ2)@Ul^j|U=$>?QGLA0v>DYoEfo*Bqkypyatn?PmY(WYn(ynC|mQ2r9-?hc=;I8cp zoK8Q6X(_5zMhNU(C_8~&luNd66Z@j$xPckiu0v?5rPs@49yBK89oLhoJ|r-pVW&W{ zsn&9fMb|NW%PmR6EZIgzy zXG|+_y^4+`hDg}GGWTa(PhhUq!O4Q@`>CN84m-itKoy29eZwx63dW6V3Xzv~ z40Y=`iDwxYGnbpBE?WgdV4>B$di*x$-#R@hMgJ+C<$GG7FS6->GO097)uT2UhAh>O z7jag@8G$n!VxDsM%rfL_TeR5(7;C1(u6V< zKafQoFXJN1$1SV!i3DwznP58s10c;JeVfFzhADw3!a8Z->X^YL%I2feo2}_>X>nx# z2xfI$#;XEaDM~M9PO>#=YlYv;p^jyAtd^XFoWs0^D{WM74nxOPTvJ`a%~dY?QJx75 z(5hx5sAXRq8N8-pvEC%wxzVwtnh!lAT?HqO8+cvAP4?nu7HnurOt3$x204Q_1kSe6 zvk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