Merging from branch 1.x
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/vre-management/ResourceManager@46749 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
1fee0573bb
commit
27eb24d406
|
@ -11,6 +11,6 @@
|
|||
<classpathentry kind="lib" path="/Dependencies/XStream/xstream-1.3.1.jar"/>
|
||||
<classpathentry kind="lib" path="/Dependencies/ResourceBroker/org.gcube.vremanagement.resourcebroker.stubs.jar"/>
|
||||
<classpathentry kind="lib" path="/Dependencies/ResourceBroker/org.gcube.vremanagement.resourcebroker.serialization.jar"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/GCF.1.2.0"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/GCF.1.3.0"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
|
2
README
2
README
|
@ -13,7 +13,7 @@ Authors
|
|||
Version and Release Date
|
||||
------------------------
|
||||
|
||||
v. 1.0.3, 30/08/2010
|
||||
v. 1.0.9, 01/08/2011
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
|
47
build.xml
47
build.xml
|
@ -59,7 +59,8 @@ full.stubs: (optional) Set to 'false', it excludes auxiliary stub code plac
|
|||
<property name="etc.dir.name" value="etc" />
|
||||
<property name="etc.dir" value="${service.dir}/${etc.dir.name}" />
|
||||
<property name="source.dir" value="${service.dir}/src" />
|
||||
|
||||
<property name="testsuite.dir" value="${service.dir}/test" />
|
||||
|
||||
|
||||
<!-- load input properties -->
|
||||
<property file="${etc.dir}/build.properties" />
|
||||
|
@ -73,6 +74,7 @@ full.stubs: (optional) Set to 'false', it excludes auxiliary stub code plac
|
|||
<property name="garfile" value="${garname}.gar"/>
|
||||
<property name="jarfile" value="${package}.jar" />
|
||||
<property name="jarfile.stubs" value="${package}.stubs.jar" />
|
||||
<property name="jarfile.testsuite" value="${package}.testsuite.jar" />
|
||||
|
||||
<if name="etics.build" value="true">
|
||||
<property name="build.location" location="${service.dir}" />
|
||||
|
@ -101,6 +103,9 @@ full.stubs: (optional) Set to 'false', it excludes auxiliary stub code plac
|
|||
<property name="build.stubs.dir" location="${build.dir}/stubs-${package}" />
|
||||
<property name="build.stubs.src.dir" location="${build.stubs.dir}/src" />
|
||||
<property name="build.stubs.class.dir" location="${build.stubs.dir}/classes" />
|
||||
<property name="build.testsuite.dir" location="${build.dir}/testsuite-${package}" />
|
||||
<property name="build.testsuite.src.dir" location="${build.testsuite.dir}/test" />
|
||||
<property name="build.testsuite.class.dir" location="${build.testsuite.dir}/classes" />
|
||||
|
||||
<!-- misc defaults -->
|
||||
<property name="java.debug" value="on" />
|
||||
|
@ -144,6 +149,9 @@ full.stubs: (optional) Set to 'false', it excludes auxiliary stub code plac
|
|||
<mkdir dir="${build.stubs.dir}" />
|
||||
<mkdir dir="${build.stubs.src.dir}" />
|
||||
<mkdir dir="${build.stubs.class.dir}"/>
|
||||
<mkdir dir="${build.testsuite.dir}" />
|
||||
<mkdir dir="${build.testsuite.src.dir}" />
|
||||
<mkdir dir="${build.testsuite.class.dir}"/>
|
||||
|
||||
<!-- Populates schema folder -->
|
||||
<copy toDir="${build.schema.dir}">
|
||||
|
@ -475,6 +483,43 @@ full.stubs: (optional) Set to 'false', it excludes auxiliary stub code plac
|
|||
|
||||
<target name="stubs" depends="deployStubs" description="generates, builds, jars and deploy stubs"/>
|
||||
|
||||
<target name="buildTestsuite" depends="init" description="testsuite">
|
||||
<copy toDir="${build.testsuite.src.dir}/" overwrite="true">
|
||||
<fileset dir="${testsuite.dir}" casesensitive="yes">
|
||||
<exclude name="**/*.class" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<javac srcdir="${build.testsuite.src.dir}" destdir="${build.testsuite.class.dir}" debug="${java.debug}" deprecation="${java.deprecation}" description="compile testsuite classes">
|
||||
<include name="org/gcube/vremanagement/resourcemanager/testsuite/**/*.java" />
|
||||
<classpath>
|
||||
<fileset dir="${container.dir}/lib">
|
||||
<include name="*.jar" />
|
||||
<exclude name="${jarfile.testsuite}" />
|
||||
<exclude name="${jarfile}" />
|
||||
</fileset>
|
||||
<fileset dir="${lib.location}">
|
||||
<include name="**/*.jar" />
|
||||
<exclude name="**/${jarfile.testsuite}" />
|
||||
<exclude name="**/${jarfile}" />
|
||||
</fileset>
|
||||
</classpath>
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
<target name="jarTestSuite" depends="buildTestsuite" description="jar testsuite classes">
|
||||
<jar destfile="${build.lib.dir}/${jarfile.testsuite}" basedir="${build.testsuite.class.dir}" />
|
||||
</target>
|
||||
|
||||
<target name="deployTestsuite" depends="jarTestSuite" description="generates and jars testsuite">
|
||||
<copy file="${build.lib.dir}/${jarfile.testsuite}" toDir="${lib.location}"/>
|
||||
<if name="etics.build" value="false">
|
||||
<copy file="${build.lib.dir}/${jarfile.testsuite}" toDir="${container.dir}/lib"/>
|
||||
</if>
|
||||
</target>
|
||||
|
||||
<target name="testsuite" depends="deployTestsuite" description="generates and jars testsuite"/>
|
||||
|
||||
|
||||
<!-- undeployement tasks -->
|
||||
<target name="undeployStubs" description="deploy stub jar">
|
||||
<delete file="${container.dir}/lib/${jarfile.stubs}"/>
|
||||
|
|
|
@ -1,6 +1,29 @@
|
|||
<ReleaseNotes>
|
||||
<Changeset component="org.gcube.vre-management.resourcemanager.1-0-9" date="2011-08-01">
|
||||
<Change>Removing an old security manager from the JNDI</Change>
|
||||
<Change>Adopting the new security in the test-suite</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.vre-management.resourcemanager.1-0-8" date="2011-06-30">
|
||||
<Change>Changing the gHNManager endpoint's lookup</Change>
|
||||
<Change>Additional fault tolerance when looking for RI's source service</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.vre-management.resourcemanager.1-0-7" date="2011-05-13">
|
||||
<Change>Fixing a misbehavior when a service has missing dependencies, all the following attempts of the same deployment were always failing</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.vre-management.resourcemanager.1-0-6" date="2011-02-07">
|
||||
<Change>Fixing a misbehavior when a service has missing dependencies</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.vre-management.resourcemanager.1-0-5" date="2010-11-26">
|
||||
<Change>Rollback of deployment operation</Change>
|
||||
<Change>Fixings on gHN lookups</Change>
|
||||
<Change>RI with no source service are no longer blocking</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.vre-management.resourcemanager.1-0-4" date="2010-11-9">
|
||||
<Change>Instance state synchronized asynchronously</Change>
|
||||
<Change>Fixing REMOVEREQUESTED and ADDREQUESTED issues in the state transitions</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.vre-management.resourcemanager.1-0-3" date="2010-08-30">
|
||||
<Change>Fixing undeployment of the same RI from different scopes</Change>
|
||||
<Change>Fixing undeployment of the same RI from different scopes</Change>
|
||||
<Change>Integration of the Serialization Library of the Broker Service</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.vre-management.resourcemanager.1-0-2" date="2010-07-21">
|
||||
|
|
|
@ -7,12 +7,6 @@
|
|||
value="@config.dir@"
|
||||
type="java.lang.String"
|
||||
override="false" />
|
||||
|
||||
<environment
|
||||
name="securityManagerClass"
|
||||
value="org.gcube.common.core.security.GCUBESimpleServiceSecurityManager"
|
||||
type="java.lang.String"
|
||||
override="false" />
|
||||
|
||||
<environment
|
||||
name="resourceBrokerClass"
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
<Main deployable="true">
|
||||
<Description>ResourceManager creates and manages Scopes within a gCube infrastructure</Description>
|
||||
<Name>ResourceManager-service</Name>
|
||||
<Version>1.0.5</Version>
|
||||
<Version>1.0.9</Version>
|
||||
<Mandatory level="VRE"/>
|
||||
<Shareable level="NONE"/>
|
||||
<GHNRequirements>
|
||||
|
@ -42,7 +42,7 @@
|
|||
<Version>1.00.00</Version>
|
||||
</Service>
|
||||
<Package>ResourceManager-stubs</Package>
|
||||
<Version>1.0.5</Version>
|
||||
<Version>1.0.9</Version>
|
||||
<Scope level="GHN"/>
|
||||
<Optional>false</Optional>
|
||||
</Dependency>
|
||||
|
@ -79,7 +79,7 @@
|
|||
<Software>
|
||||
<Description>Stubs for ResourceManager: provide facilities to interact with a ResourceManager instance</Description>
|
||||
<Name>ResourceManager-stubs</Name>
|
||||
<Version>1.0.5</Version>
|
||||
<Version>1.0.9</Version>
|
||||
<MultiVersion value="true"/>
|
||||
<Mandatory level="GHN"/>
|
||||
<Shareable level="VO"/>
|
||||
|
@ -91,7 +91,7 @@
|
|||
<Software>
|
||||
<Description>Test-suite for ResourceManager: provide sample usages of interaction with a ResourceManager instance</Description>
|
||||
<Name>ResourceManager-test-suite</Name>
|
||||
<Version>1.0.5</Version>
|
||||
<Version>1.0.9</Version>
|
||||
<MultiVersion value="true"/>
|
||||
<Shareable level="VO"/>
|
||||
<Type>application</Type>
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
package org.gcube.vremanagement.resourcemanager.impl.deployment;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.apache.axis.message.addressing.Address;
|
||||
import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||
import org.gcube.common.core.contexts.GCUBERemotePortTypeContext;
|
||||
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.queries.GCUBEGHNQuery;
|
||||
import org.gcube.common.core.informationsystem.client.queries.GCUBERIQuery;
|
||||
import org.gcube.common.core.resources.GCUBERunningInstance;
|
||||
import org.gcube.common.core.scope.GCUBEScope;
|
||||
import org.gcube.common.core.utils.logging.GCUBELog;
|
||||
import org.gcube.common.vremanagement.deployer.stubs.common.PackageInfo;
|
||||
|
@ -20,7 +22,7 @@ import org.gcube.vremanagement.resourcemanager.impl.contexts.ServiceContext;
|
|||
import org.gcube.vremanagement.resourcemanager.impl.contexts.StatefulPortTypeContext;
|
||||
|
||||
/**
|
||||
* Models a node and the related deployed packages
|
||||
* A target node for deployment and undeployment operations
|
||||
*
|
||||
* @author Manuele Simi (ISTI-CNR)
|
||||
*
|
||||
|
@ -34,9 +36,7 @@ public class VirtualNode {
|
|||
private String callbackID;
|
||||
|
||||
private String ghnID = "";
|
||||
|
||||
private String name = "";
|
||||
|
||||
|
||||
private GCUBEScope scope = null;
|
||||
|
||||
private boolean isWorking = false;
|
||||
|
@ -47,22 +47,22 @@ public class VirtualNode {
|
|||
|
||||
private long lastActivity;
|
||||
|
||||
private static final String DEPLOYER_PT_NAME = "/wsrf/services/gcube/common/vremanagement/Deployer";
|
||||
|
||||
//here only for backward compatibility (deserialization will fail)
|
||||
private String name = "";
|
||||
|
||||
//if we do not receive a deployment session from the node after one hour, we assume that the node is not working anymore
|
||||
private static final long MAX_ACTIVITY = 3600 * 1000; //1h in milliseconds
|
||||
|
||||
protected VirtualNode(String ID, GCUBEScope scope, String ... name) throws NoGHNFoundException {
|
||||
protected VirtualNode(String ID, GCUBEScope scope) throws NoGHNFoundException {
|
||||
this.ghnID = ID;
|
||||
this.scope = scope;
|
||||
this.name = (name != null && name.length > 0)? name[0] : this.detectName();
|
||||
}
|
||||
|
||||
public void setCallbackID(String id) {
|
||||
this.callbackID = id;
|
||||
}
|
||||
|
||||
private String detectName() throws NoGHNFoundException {
|
||||
public String detectName() throws NoGHNFoundException {
|
||||
logger.debug("Detecting name for " + this.ghnID);
|
||||
if (GHNContext.getContext().getGHNID().compareToIgnoreCase(this.ghnID) == 0)
|
||||
throw new NoGHNFoundException ("cannot deploy on the same GHN (ghnID=" + this.ghnID + ") where the Resource Manager is deployed");
|
||||
|
@ -151,15 +151,13 @@ public class VirtualNode {
|
|||
return;
|
||||
}
|
||||
|
||||
EndpointReferenceType callbackEPR = new EndpointReferenceType();
|
||||
callbackEPR.setAddress(new Address("http://"+ GHNContext.getContext().getHostnameAndPort() +"/wsrf/services/" + StatefulPortTypeContext.getContext().getJNDIName()));
|
||||
EndpointReferenceType callbackEPR = ServiceContext.getContext().getInstance().getAccessPoint().getEndpoint(StatefulPortTypeContext.getContext().getJNDIName());
|
||||
DeployParameters param = new DeployParameters();
|
||||
param.set_package(this.packagesToAdd.toArray(new PackageInfo[0]));
|
||||
param.setTargetScope(new String[] {scope.toString()});
|
||||
param.setCallbackID(callbackID);
|
||||
param.setEndpointReference(callbackEPR);
|
||||
EndpointReferenceType nodeEPR = new EndpointReferenceType();
|
||||
nodeEPR.setAddress(new Address("http://" + this.name + DEPLOYER_PT_NAME));
|
||||
EndpointReferenceType nodeEPR = this.loadDeployer(this.ghnID);
|
||||
logger.trace("Deploying on " + nodeEPR.toString());
|
||||
DeployerPortType pt = GCUBERemotePortTypeContext.getProxy(new DeployerServiceAddressingLocator().getDeployerPortTypePort(nodeEPR),
|
||||
scope, ServiceContext.getContext());
|
||||
|
@ -184,15 +182,13 @@ public class VirtualNode {
|
|||
return;
|
||||
}
|
||||
|
||||
EndpointReferenceType callbackEPR = new EndpointReferenceType();
|
||||
callbackEPR.setAddress(new Address("http://"+ GHNContext.getContext().getHostnameAndPort() +"/wsrf/services/" + StatefulPortTypeContext.getContext().getJNDIName()));
|
||||
EndpointReferenceType callbackEPR = ServiceContext.getContext().getInstance().getAccessPoint().getEndpoint(StatefulPortTypeContext.getContext().getJNDIName());
|
||||
UndeployParameters params = new UndeployParameters();
|
||||
params.set_package(this.packagesToRemove.toArray(new PackageInfo[0]));
|
||||
params.setTargetScope(new String[] {scope.toString()});
|
||||
params.setCallbackID(callbackID);
|
||||
params.setEndpointReference(callbackEPR);
|
||||
EndpointReferenceType nodeEPR = new EndpointReferenceType();
|
||||
nodeEPR.setAddress(new Address("http://" + this.name + DEPLOYER_PT_NAME));
|
||||
EndpointReferenceType nodeEPR = this.loadDeployer(this.ghnID);
|
||||
logger.trace("Undeploying from " + nodeEPR.toString() + " in scope " + scope);
|
||||
DeployerPortType pt = GCUBERemotePortTypeContext.getProxy(new DeployerServiceAddressingLocator().getDeployerPortTypePort(nodeEPR),
|
||||
scope, ServiceContext.getContext());
|
||||
|
@ -224,16 +220,13 @@ public class VirtualNode {
|
|||
this.packagesToRemove.addAll(packages);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VirtualNode [ghnID=" + ghnID + ", name=" + name + ", scope="+ scope + "]";
|
||||
return "VirtualNode [ghnID=" + ghnID + ", scope="+ scope + "]";
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -291,4 +284,20 @@ public class VirtualNode {
|
|||
return this.scope;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Looks for the Deployer's endpoint to contact
|
||||
* @param id the identifier of the gHN
|
||||
* @return the endpoint reference of Deployer's portType to contact
|
||||
* @throws Exception if the search fails
|
||||
*/
|
||||
private EndpointReferenceType loadDeployer(String id) throws Exception {
|
||||
ISClient client = GHNContext.getImplementation(ISClient.class);
|
||||
GCUBERIQuery riquery = client.getQuery(GCUBERIQuery.class);
|
||||
riquery.addAtomicConditions(new AtomicCondition("//GHN/@UniqueID", id),
|
||||
new AtomicCondition("//ServiceClass", "VREManagement"),
|
||||
new AtomicCondition("//ServiceName", "Deployer"));
|
||||
List<GCUBERunningInstance> results = client.execute(riquery,ServiceContext.getContext().getScope());
|
||||
return results.get(0).getAccessPoint().getEndpoint("gcube/common/vremanagement/Deployer");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,14 +32,13 @@ public class VirtualNodeManager {
|
|||
* Gets or builds the VirtualNode
|
||||
* @param ID the node identifier
|
||||
* @param scope the deployment scope
|
||||
* @param name the node name (format has to be <i>host:port</i>)
|
||||
* @return the Virtual Node
|
||||
* @throws NoGHNFoundException if the node does not exist
|
||||
*/
|
||||
public static VirtualNode getNode(String ID, GCUBEScope scope, String ... name) throws NoGHNFoundException {
|
||||
public static VirtualNode getNode(String ID, GCUBEScope scope) throws NoGHNFoundException {
|
||||
checkNodes();
|
||||
if (!nodes.containsKey(ID)) {
|
||||
nodes.put(ID,new VirtualNode(ID, scope, name));
|
||||
nodes.put(ID,new VirtualNode(ID, scope));
|
||||
}
|
||||
return nodes.get(ID);
|
||||
}
|
||||
|
|
|
@ -353,8 +353,8 @@ public final class ScopedDeployedService extends ScopedResource {
|
|||
* Gets the ID of the target gHN
|
||||
* @return the ID of the target gHN
|
||||
*/
|
||||
public String getTargetGHNName() {
|
||||
return this.virtualNodes.size() > 0 ? this.virtualNodes.get(0).getName() : "";
|
||||
public String getTargetGHN() {
|
||||
return this.virtualNodes.size() > 0 ? this.virtualNodes.get(0).getID() : "";
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ public final class ScopedGHN extends ScopedResource {
|
|||
|
||||
@Override
|
||||
protected void addToScope() throws ResourceNotFound, Exception {
|
||||
if (this.nodename.compareToIgnoreCase("") == 0)
|
||||
if (this.ghnEpr == null)
|
||||
this.findResource();
|
||||
//contact the GHNManager to add the GHN to the given scope
|
||||
EndpointReferenceType endpoint = new EndpointReferenceType();
|
||||
|
@ -75,14 +75,14 @@ public final class ScopedGHN extends ScopedResource {
|
|||
List<GCUBEHostingNode> hostingNodes = client.execute(query, ServiceContext.getContext().getScope());
|
||||
this.nodename = hostingNodes.get(0).getNodeDescription().getName();
|
||||
this.hostedOn = nodename;
|
||||
this.ghnEpr = this.loadGHNmanager(hostingNodes.get(0).getID(), client);
|
||||
this.ghnEpr = this.loadGHNmanager(hostingNodes.get(0).getID(), client, ServiceContext.getContext().getScope());
|
||||
} catch (Exception e) {
|
||||
//try in the enclosing scope
|
||||
try {
|
||||
List<GCUBEHostingNode> hostingNodes = client.execute(query, ServiceContext.getContext().getScope().getEnclosingScope());
|
||||
this.nodename = hostingNodes.get(0).getNodeDescription().getName();
|
||||
this.hostedOn = nodename;
|
||||
this.ghnEpr = this.loadGHNmanager(hostingNodes.get(0).getID(), client);
|
||||
this.ghnEpr = this.loadGHNmanager(hostingNodes.get(0).getID(), client,ServiceContext.getContext().getScope().getEnclosingScope());
|
||||
} catch (Exception ei) {
|
||||
throw new Exception("unable to find the target GHN (ID=" + this.id + ")", e);
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ public final class ScopedGHN extends ScopedResource {
|
|||
|
||||
@Override
|
||||
protected void removeFromScope() throws ResourceNotFound, Exception {
|
||||
if (this.nodename.compareToIgnoreCase("") == 0)
|
||||
if (this.ghnEpr == null)
|
||||
this.findResource();
|
||||
//EndpointReferenceType endpoint = new EndpointReferenceType();
|
||||
try {
|
||||
|
@ -111,16 +111,17 @@ public final class ScopedGHN extends ScopedResource {
|
|||
* Looks for the GHN manager's endpoint to contact
|
||||
* @param id the identifier of the gHN
|
||||
* @param client the ISClient instance to use
|
||||
* @param scope
|
||||
* @return the endpoint reference of gHNManager's portType to contact
|
||||
* @throws Exception if the search fails
|
||||
*/
|
||||
private EndpointReferenceType loadGHNmanager(String id, ISClient client) throws Exception {
|
||||
private EndpointReferenceType loadGHNmanager(String id, ISClient client, GCUBEScope scope) throws Exception {
|
||||
//looks for the GHN manager's endpoint to contact
|
||||
GCUBERIQuery riquery = client.getQuery(GCUBERIQuery.class);
|
||||
riquery.addAtomicConditions(new AtomicCondition("//GHN/@UniqueID", id),
|
||||
new AtomicCondition("//ServiceClass", "VREManagement"),
|
||||
new AtomicCondition("//ServiceName", "GHNManager"));
|
||||
List<GCUBERunningInstance> results = client.execute(riquery,ServiceContext.getContext().getScope());
|
||||
List<GCUBERunningInstance> results = client.execute(riquery,scope);
|
||||
return results.get(0).getAccessPoint().getEndpoint("gcube/common/vremanagement/GHNManager");
|
||||
}
|
||||
|
||||
|
|
|
@ -61,17 +61,20 @@ public class ScopedResourceFactory {
|
|||
*/
|
||||
public static ScopedDeployedService getRelatedService(
|
||||
ScopedRunningInstance scopedRunningInstance) throws ServiceNotFoundException {
|
||||
try {
|
||||
for (ScopedResource resource : scopeState.getResourcesByType(ScopedDeployedService.TYPE)) {
|
||||
ScopedDeployedService service = (ScopedDeployedService)resource;
|
||||
if ((service.getSourceService().getClazz().compareToIgnoreCase(scopedRunningInstance.getSourceServiceClass())==0)
|
||||
&& (service.getSourceService().getName().compareToIgnoreCase(scopedRunningInstance.getSourceServiceName())==0))
|
||||
return service;
|
||||
if (resource == null) continue;
|
||||
try {
|
||||
ScopedDeployedService service = (ScopedDeployedService)resource;
|
||||
if ((service.getSourceService().getClazz().compareToIgnoreCase(scopedRunningInstance.getSourceServiceClass())==0)
|
||||
&& (service.getSourceService().getName().compareToIgnoreCase(scopedRunningInstance.getSourceServiceName())==0)) {
|
||||
logger.debug("Source service found for RI " + scopedRunningInstance);
|
||||
return service;
|
||||
}
|
||||
}catch (Exception e ) {
|
||||
logger.warn("An error occurred when looking for the source service for RI "+ scopedRunningInstance + ", error message: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}catch (Exception e ) {
|
||||
logger.error("Unable to find the source service for RI "+ scopedRunningInstance, e);
|
||||
throw new ServiceNotFoundException();
|
||||
}
|
||||
logger.error("Unable to find a source service for " + scopedRunningInstance);
|
||||
throw new ServiceNotFoundException();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,52 +0,0 @@
|
|||
package org.gcube.vremanagement.resourcemanager.stubs.testsuite;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
|
||||
import org.apache.axis.message.addressing.Address;
|
||||
import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||
import org.gcube.common.core.contexts.GCUBERemotePortTypeContext;
|
||||
import org.gcube.common.core.scope.GCUBEScope;
|
||||
import org.gcube.common.core.security.GCUBESecurityManagerImpl;
|
||||
import org.gcube.vremanagement.resourcemanager.stubs.resourcemanager.ResourceManagerPortType;
|
||||
import org.gcube.vremanagement.resourcemanager.stubs.resourcemanager.service.ResourceManagerServiceAddressingLocator;
|
||||
|
||||
public class GetReportTest {
|
||||
|
||||
/**
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
|
||||
EndpointReferenceType endpoint = new EndpointReferenceType();
|
||||
|
||||
try {
|
||||
endpoint.setAddress(new Address("http://"+ args[0]+":"+ args[1] +"/wsrf/services/gcube/vremanagement/ResourceManager"));
|
||||
ResourceManagerPortType pt;
|
||||
|
||||
GCUBESecurityManagerImpl managerSec = new GCUBESecurityManagerImpl() {
|
||||
public boolean isSecurityEnabled() {return false;}};
|
||||
pt = GCUBERemotePortTypeContext.getProxy(new ResourceManagerServiceAddressingLocator().getResourceManagerPortTypePort(endpoint),
|
||||
GCUBEScope.getScope(args[2]), 90000, managerSec);
|
||||
System.out.println(Calendar.getInstance().getTime().toString());
|
||||
String report = pt.getReport(args[3]);
|
||||
System.out.println(Calendar.getInstance().getTime().toString());
|
||||
System.out.println ("REPORT");
|
||||
System.out.println ("************");
|
||||
System.out.println (report);
|
||||
System.out.println ("************");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void printUsage() {
|
||||
System.out.println("GetReportTest <ResourceManager host> <ResourceManager port> <caller scope> <reportID>");
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1 +1 @@
|
|||
java -cp .:./lib/org.gcube.vremanagement.resourcemanager.testsuite.jar:$CLASSPATH org/gcube/vremanagement/resourcemanager/stubs/testsuite/AddResourceTest $1 $2 $3
|
||||
java -cp .:./lib/org.gcube.vremanagement.resourcemanager.testsuite.jar:$CLASSPATH org/gcube/vremanagement/resourcemanager/testsuite/AddResourceTest $1 $2 $3
|
||||
|
|
|
@ -1 +1 @@
|
|||
java -cp .:./lib/org.gcube.vremanagement.resourcemanager.testsuite.jar:$CLASSPATH org/gcube/vremanagement/resourcemanager/stubs/testsuite/CreateScopeTest $1 $2 $3
|
||||
java -cp .:./lib/org.gcube.vremanagement.resourcemanager.testsuite.jar:$CLASSPATH org/gcube/vremanagement/resourcemanager/testsuite/CreateScopeTest $1 $2 $3
|
||||
|
|
|
@ -1 +1 @@
|
|||
java -cp .:./lib/org.gcube.vremanagement.resourcemanager.testsuite.jar:$CLASSPATH org/gcube/vremanagement/resourcemanager/stubs/testsuite/DisposeScopeTest $1 $2 $3
|
||||
java -cp .:./lib/org.gcube.vremanagement.resourcemanager.testsuite.jar:$CLASSPATH org/gcube/vremanagement/resourcemanager/testsuite/DisposeScopeTest $1 $2 $3
|
||||
|
|
|
@ -1 +1 @@
|
|||
java -cp .:./lib/org.gcube.vremanagement.resourcemanager.testsuite.jar:$CLASSPATH org/gcube/vremanagement/resourcemanager/stubs/testsuite/GetReportTest $1 $2 $3 $4
|
||||
java -cp .:./lib/org.gcube.vremanagement.resourcemanager.testsuite.jar:$CLASSPATH org/gcube/vremanagement/resourcemanager/testsuite/GetReportTest $1 $2 $3 $4
|
||||
|
|
|
@ -1 +1 @@
|
|||
java -cp .:./lib/org.gcube.vremanagement.resourcemanager.testsuite.jar:$CLASSPATH org/gcube/vremanagement/resourcemanager/stubs/testsuite/RemoveResourceTest $1 $2 $3
|
||||
java -cp .:./lib/org.gcube.vremanagement.resourcemanager.testsuite.jar:$CLASSPATH org/gcube/vremanagement/resourcemanager/testsuite/RemoveResourceTest $1 $2 $3
|
||||
|
|
|
@ -1 +1 @@
|
|||
java -cp .:./lib/org.gcube.resourcemanagement.manager.testsuite.jar:$CLASSPATH org/gcube/vremanagement/resourcemanager/stubs/testsuite/SetScopeOptionsTest $1 $2 $3
|
||||
java -cp .:./lib/org.gcube.resourcemanagement.manager.testsuite.jar:$CLASSPATH org/gcube/vremanagement/resourcemanager/testsuite/SetScopeOptionsTest $1 $2 $3
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.gcube.vremanagement.resourcemanager.stubs.testsuite;
|
||||
package org.gcube.vremanagement.resourcemanager.testsuite;
|
||||
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
|
@ -9,7 +8,7 @@ import org.apache.axis.message.addressing.Address;
|
|||
import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||
import org.gcube.common.core.contexts.GCUBERemotePortTypeContext;
|
||||
import org.gcube.common.core.scope.GCUBEScope;
|
||||
import org.gcube.common.core.security.GCUBESecurityManagerImpl;
|
||||
import org.gcube.common.core.security.GCUBESecurityManager;
|
||||
import org.gcube.vremanagement.resourcemanager.stubs.resourcemanager.AddResourcesParameters;
|
||||
import org.gcube.vremanagement.resourcemanager.stubs.resourcemanager.ResourceItem;
|
||||
import org.gcube.vremanagement.resourcemanager.stubs.resourcemanager.ResourceList;
|
||||
|
@ -32,11 +31,11 @@ public class AddResourceTest {
|
|||
*/
|
||||
public static void main(String[] args) {
|
||||
|
||||
if (args.length < 3)
|
||||
if ((args.length < 2) || (args.length > 3))
|
||||
AddResourceTest.printUsage();
|
||||
|
||||
try {
|
||||
resources.load(new FileInputStream(args[2]));
|
||||
resources.load(AddResourceTest.class.getResourceAsStream("/" + args[1]));
|
||||
} catch (IOException e1) {
|
||||
e1.printStackTrace();
|
||||
Runtime.getRuntime().exit(1);
|
||||
|
@ -45,14 +44,18 @@ public class AddResourceTest {
|
|||
EndpointReferenceType endpoint = new EndpointReferenceType();
|
||||
|
||||
try {
|
||||
endpoint.setAddress(new Address("http://"+ args[0]+":"+ args[1] +"/wsrf/services/gcube/vremanagement/ResourceManager"));
|
||||
ResourceManagerPortType pt;
|
||||
|
||||
GCUBESecurityManagerImpl managerSec = new GCUBESecurityManagerImpl() {
|
||||
public boolean isSecurityEnabled() {return false;}};
|
||||
pt = GCUBERemotePortTypeContext.getProxy(new ResourceManagerServiceAddressingLocator().getResourceManagerPortTypePort(endpoint),
|
||||
GCUBEScope.getScope(resources.getProperty("callerScope").trim() ),managerSec);
|
||||
|
||||
endpoint.setAddress(new Address(args[0]));
|
||||
ResourceManagerPortType pt = new ResourceManagerServiceAddressingLocator().getResourceManagerPortTypePort(endpoint);
|
||||
if (args.length == 3) {
|
||||
GCUBESecurityManager securityManager = org.gcube.vremanagement.resourcemanager.testsuite.security.Utils.generateAndConfigureDefaultSecurityManager(args[2], true);
|
||||
securityManager.setSecurity(pt, GCUBESecurityManager.AuthMode.PRIVACY, GCUBESecurityManager.DelegationMode.FULL);
|
||||
pt = GCUBERemotePortTypeContext.getProxy(pt,
|
||||
GCUBEScope.getScope(resources.getProperty("callerScope").trim()), securityManager);
|
||||
|
||||
} else {
|
||||
pt = GCUBERemotePortTypeContext.getProxy(pt,
|
||||
GCUBEScope.getScope(resources.getProperty("callerScope").trim()));
|
||||
}
|
||||
AddResourcesParameters add = new AddResourcesParameters();
|
||||
|
||||
if (new Integer(resources.getProperty("numOfServicesToAdd")) > 0) {
|
||||
|
@ -99,7 +102,9 @@ public class AddResourceTest {
|
|||
}
|
||||
|
||||
static void printUsage() {
|
||||
System.out.println("AddResourceTest <ResourceManager host> <ResourceManager port> <properties file>");
|
||||
System.out.println("AddResourceTest http://host:port/wsrf/services/gcube/vremanagement/ResourceManager <properties file>");
|
||||
System.out.println("or");
|
||||
System.out.println("AddResourceTest https://host:port/wsrf/services/gcube/vremanagement/ResourceManager <properties file> <identity>");
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package org.gcube.vremanagement.resourcemanager.stubs.testsuite;
|
||||
package org.gcube.vremanagement.resourcemanager.testsuite;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
@ -7,7 +7,7 @@ import org.apache.axis.message.addressing.Address;
|
|||
import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||
import org.gcube.common.core.contexts.GCUBERemotePortTypeContext;
|
||||
import org.gcube.common.core.scope.GCUBEScope;
|
||||
import org.gcube.common.core.security.GCUBESecurityManagerImpl;
|
||||
import org.gcube.common.core.security.GCUBESecurityManager;
|
||||
import org.gcube.common.core.utils.logging.GCUBEClientLog;
|
||||
import org.gcube.vremanagement.resourcemanager.stubs.resourcemanager.AddResourcesParameters;
|
||||
import org.gcube.vremanagement.resourcemanager.stubs.resourcemanager.CreateScopeParameters;
|
||||
|
@ -33,11 +33,11 @@ public class CreateScopeTest {
|
|||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
if (args.length < 3)
|
||||
if ((args.length < 2) || (args.length > 3))
|
||||
CreateScopeTest.printUsage();
|
||||
|
||||
try {
|
||||
resources.load(CreateScopeTest.class.getResourceAsStream("/" + args[2]));
|
||||
resources.load(CreateScopeTest.class.getResourceAsStream("/" + args[1]));
|
||||
} catch (IOException e1) {
|
||||
logger.error("Unable to load the properties file",e1);
|
||||
Runtime.getRuntime().exit(1);
|
||||
|
@ -46,14 +46,17 @@ public class CreateScopeTest {
|
|||
EndpointReferenceType endpoint = new EndpointReferenceType();
|
||||
|
||||
try {
|
||||
endpoint.setAddress(new Address("http://"+ args[0]+":"+ args[1] +"/wsrf/services/gcube/vremanagement/ResourceManager"));
|
||||
ResourceManagerPortType pt;
|
||||
endpoint.setAddress(new Address(args[0]));
|
||||
ResourceManagerPortType pt = new ResourceManagerServiceAddressingLocator().getResourceManagerPortTypePort(endpoint);
|
||||
|
||||
GCUBESecurityManagerImpl managerSec = new GCUBESecurityManagerImpl() {
|
||||
public boolean isSecurityEnabled() {return false;}};
|
||||
pt = GCUBERemotePortTypeContext.getProxy(new ResourceManagerServiceAddressingLocator().getResourceManagerPortTypePort(endpoint),
|
||||
GCUBEScope.getScope(resources.getProperty("callerScope").trim() ),managerSec);
|
||||
|
||||
if (args.length == 3) {
|
||||
GCUBESecurityManager securityManager = org.gcube.vremanagement.resourcemanager.testsuite.security.Utils.generateAndConfigureDefaultSecurityManager(args[2], true);
|
||||
securityManager.setSecurity(pt, GCUBESecurityManager.AuthMode.PRIVACY, GCUBESecurityManager.DelegationMode.FULL);
|
||||
pt = GCUBERemotePortTypeContext.getProxy(pt,
|
||||
GCUBEScope.getScope(resources.getProperty("callerScope").trim()), securityManager);
|
||||
} else {
|
||||
pt = GCUBERemotePortTypeContext.getProxy(pt, GCUBEScope.getScope(resources.getProperty("callerScope").trim()), 90000);
|
||||
}
|
||||
logger.info("Setting the Scope parameters...");
|
||||
OptionsParameters options = new OptionsParameters();
|
||||
ScopeOption[] scopeOptionList = new ScopeOption[optionNames.length];
|
||||
|
@ -117,7 +120,10 @@ public class CreateScopeTest {
|
|||
}
|
||||
|
||||
static void printUsage() {
|
||||
System.out.println("CreateScopeTest <ResourceManager host> <ResourceManager port> <properties file>");
|
||||
System.out.println("CreateScopeTest http://host:port/wsrf/services/gcube/vremanagement/ResourceManager <properties file>");
|
||||
System.out.println("or");
|
||||
System.out.println("CreateScopeTest https://host:port/wsrf/services/gcube/vremanagement/ResourceManager <properties file> <identity>");
|
||||
|
||||
System.exit(1);
|
||||
}
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
package org.gcube.vremanagement.resourcemanager.stubs.testsuite;
|
||||
package org.gcube.vremanagement.resourcemanager.testsuite;
|
||||
|
||||
import org.apache.axis.message.addressing.Address;
|
||||
import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||
import org.gcube.common.core.contexts.GCUBERemotePortTypeContext;
|
||||
import org.gcube.common.core.scope.GCUBEScope;
|
||||
import org.gcube.common.core.security.GCUBESecurityManagerImpl;
|
||||
import org.gcube.common.core.security.GCUBESecurityManager;
|
||||
import org.gcube.common.core.utils.logging.GCUBEClientLog;
|
||||
import org.gcube.vremanagement.resourcemanager.stubs.resourcemanager.DisposeScopeParameters;
|
||||
import org.gcube.vremanagement.resourcemanager.stubs.resourcemanager.ResourceManagerPortType;
|
||||
|
@ -19,21 +19,26 @@ public class DisposeScopeTest {
|
|||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
if (args.length < 3)
|
||||
|
||||
if ((args.length < 2) || (args.length > 3))
|
||||
DisposeScopeTest.printUsage();
|
||||
|
||||
EndpointReferenceType endpoint = new EndpointReferenceType();
|
||||
|
||||
try {
|
||||
endpoint.setAddress(new Address("http://"+ args[0]+":"+ args[1] +"/wsrf/services/gcube/vremanagement/ResourceManager"));
|
||||
ResourceManagerPortType pt;
|
||||
endpoint.setAddress(new Address(args[0]));
|
||||
ResourceManagerPortType pt = new ResourceManagerServiceAddressingLocator().getResourceManagerPortTypePort(endpoint);
|
||||
|
||||
GCUBESecurityManagerImpl managerSec = new GCUBESecurityManagerImpl() {
|
||||
public boolean isSecurityEnabled() {return false;}};
|
||||
pt = GCUBERemotePortTypeContext.getProxy(new ResourceManagerServiceAddressingLocator().getResourceManagerPortTypePort(endpoint),
|
||||
GCUBEScope.getScope(args[2].trim() ),managerSec);
|
||||
if (args.length == 3) {
|
||||
GCUBESecurityManager securityManager = org.gcube.vremanagement.resourcemanager.testsuite.security.Utils.generateAndConfigureDefaultSecurityManager(args[2], true);
|
||||
securityManager.setSecurity(pt, GCUBESecurityManager.AuthMode.PRIVACY, GCUBESecurityManager.DelegationMode.FULL);
|
||||
pt = GCUBERemotePortTypeContext.getProxy(pt,
|
||||
GCUBEScope.getScope(args[1].trim()), securityManager);
|
||||
} else {
|
||||
pt = GCUBERemotePortTypeContext.getProxy(pt, GCUBEScope.getScope(args[1].trim()));
|
||||
}
|
||||
logger.info("Sending the destroy request....");
|
||||
String reportID = pt.disposeScope(new DisposeScopeParameters(args[2]));
|
||||
String reportID = pt.disposeScope(new DisposeScopeParameters(args[1]));
|
||||
logger.info("Returned report ID: " + reportID);
|
||||
} catch (Exception e) {
|
||||
logger.fatal("Failed to dispose the VRE",e);
|
||||
|
@ -42,7 +47,10 @@ public class DisposeScopeTest {
|
|||
}
|
||||
|
||||
static void printUsage() {
|
||||
System.out.println("DisposeScopeTest <ResourceManager host> <ResourceManager port> <scope>");
|
||||
System.out.println("DisposeScopeTest http://host:port/wsrf/services/gcube/vremanagement/ResourceManager <scope>");
|
||||
System.out.println("or");
|
||||
System.out.println("DisposeScopeTest https://host:port/wsrf/services/gcube/vremanagement/ResourceManager <scope> <identity>");
|
||||
|
||||
System.exit(1);
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
package org.gcube.vremanagement.resourcemanager.testsuite;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
|
||||
import org.apache.axis.message.addressing.Address;
|
||||
import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||
import org.gcube.common.core.contexts.GCUBERemotePortTypeContext;
|
||||
import org.gcube.common.core.scope.GCUBEScope;
|
||||
import org.gcube.common.core.security.GCUBESecurityManager;
|
||||
import org.gcube.vremanagement.resourcemanager.stubs.resourcemanager.ResourceManagerPortType;
|
||||
import org.gcube.vremanagement.resourcemanager.stubs.resourcemanager.service.ResourceManagerServiceAddressingLocator;
|
||||
|
||||
public class GetReportTest {
|
||||
|
||||
/**
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
|
||||
if ((args.length < 3) || (args.length > 4))
|
||||
GetReportTest.printUsage();
|
||||
|
||||
EndpointReferenceType endpoint = new EndpointReferenceType();
|
||||
|
||||
try {
|
||||
endpoint.setAddress(new Address(args[0]));
|
||||
ResourceManagerPortType pt = new ResourceManagerServiceAddressingLocator().getResourceManagerPortTypePort(endpoint);
|
||||
if (args.length == 4) {
|
||||
GCUBESecurityManager securityManager = org.gcube.vremanagement.resourcemanager.testsuite.security.Utils.generateAndConfigureDefaultSecurityManager(args[3], true);
|
||||
securityManager.setSecurity(pt, GCUBESecurityManager.AuthMode.PRIVACY, GCUBESecurityManager.DelegationMode.FULL);
|
||||
pt = GCUBERemotePortTypeContext.getProxy(pt, GCUBEScope.getScope(args[1]), securityManager);
|
||||
} else {
|
||||
pt = GCUBERemotePortTypeContext.getProxy(pt,
|
||||
GCUBEScope.getScope(args[1]), 90000);
|
||||
}
|
||||
System.out.println(Calendar.getInstance().getTime().toString());
|
||||
String report = pt.getReport(args[2]);
|
||||
System.out.println(Calendar.getInstance().getTime().toString());
|
||||
System.out.println ("REPORT");
|
||||
System.out.println ("************");
|
||||
System.out.println (report);
|
||||
System.out.println ("************");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void printUsage() {
|
||||
System.out.println("GetReportTest http://host:port/wsrf/services/gcube/vremanagement/ResourceManager <scope> <session>");
|
||||
System.out.println("or");
|
||||
System.out.println("GetReportTest https://host:port/wsrf/services/gcube/vremanagement/ResourceManager <scope> <session> <identity>");
|
||||
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
package org.gcube.vremanagement.resourcemanager.stubs.testsuite;
|
||||
package org.gcube.vremanagement.resourcemanager.testsuite;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
|
@ -8,7 +7,7 @@ import org.apache.axis.message.addressing.Address;
|
|||
import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||
import org.gcube.common.core.contexts.GCUBERemotePortTypeContext;
|
||||
import org.gcube.common.core.scope.GCUBEScope;
|
||||
import org.gcube.common.core.security.GCUBESecurityManagerImpl;
|
||||
import org.gcube.common.core.security.GCUBESecurityManager;
|
||||
import org.gcube.vremanagement.resourcemanager.stubs.resourcemanager.RemoveResourcesParameters;
|
||||
import org.gcube.vremanagement.resourcemanager.stubs.resourcemanager.ResourceItem;
|
||||
import org.gcube.vremanagement.resourcemanager.stubs.resourcemanager.ResourceList;
|
||||
|
@ -26,28 +25,30 @@ public class RemoveResourceTest {
|
|||
*/
|
||||
public static void main(String[] args) {
|
||||
|
||||
if (args.length < 3)
|
||||
AddResourceTest.printUsage();
|
||||
if ((args.length < 2) || (args.length > 3))
|
||||
RemoveResourceTest.printUsage();
|
||||
|
||||
try {
|
||||
resources.load(new FileInputStream(args[2]));
|
||||
resources.load(RemoveResourceTest.class.getResourceAsStream("/" + args[1]));
|
||||
} catch (IOException e1) {
|
||||
e1.printStackTrace();
|
||||
Runtime.getRuntime().exit(1);
|
||||
|
||||
Runtime.getRuntime().exit(1);
|
||||
}
|
||||
|
||||
|
||||
EndpointReferenceType endpoint = new EndpointReferenceType();
|
||||
|
||||
try {
|
||||
endpoint.setAddress(new Address("http://"+ args[0]+":"+ args[1] +"/wsrf/services/gcube/vremanagement/ResourceManager"));
|
||||
ResourceManagerPortType pt;
|
||||
|
||||
GCUBESecurityManagerImpl managerSec = new GCUBESecurityManagerImpl() {
|
||||
public boolean isSecurityEnabled() {return false;}};
|
||||
pt = GCUBERemotePortTypeContext.getProxy(new ResourceManagerServiceAddressingLocator().getResourceManagerPortTypePort(endpoint),
|
||||
GCUBEScope.getScope(resources.getProperty("callerScope").trim() ),managerSec);
|
||||
endpoint.setAddress(new Address(args[0]));
|
||||
ResourceManagerPortType pt = new ResourceManagerServiceAddressingLocator().getResourceManagerPortTypePort(endpoint);
|
||||
if (args.length == 3) {
|
||||
GCUBESecurityManager securityManager = org.gcube.vremanagement.resourcemanager.testsuite.security.Utils.generateAndConfigureDefaultSecurityManager(args[2], true);
|
||||
securityManager.setSecurity(pt, GCUBESecurityManager.AuthMode.PRIVACY, GCUBESecurityManager.DelegationMode.FULL);
|
||||
pt = GCUBERemotePortTypeContext.getProxy(pt,
|
||||
GCUBEScope.getScope(resources.getProperty("callerScope").trim()), securityManager);
|
||||
|
||||
} else {
|
||||
pt = GCUBERemotePortTypeContext.getProxy(pt,
|
||||
GCUBEScope.getScope(resources.getProperty("callerScope").trim() ));
|
||||
}
|
||||
RemoveResourcesParameters params = new RemoveResourcesParameters();
|
||||
if (new Integer(resources.getProperty("numOfResourcesToRemove")) > 0) {
|
||||
ResourceItem[] resourcelist = new ResourceItem[new Integer(resources.getProperty("numOfResourcesToRemove"))];
|
||||
|
@ -88,7 +89,9 @@ public class RemoveResourceTest {
|
|||
}
|
||||
|
||||
static void printUsage() {
|
||||
System.out.println("RemoveResourceTest <ResourceManager host> <ResourceManager port> <properties file>");
|
||||
System.out.println("RemoveResourceTest http://host:port/wsrf/services/gcube/vremanagement/ResourceManager <properties file>");
|
||||
System.out.println("or");
|
||||
System.out.println("RemoveResourceTest https://host:port/wsrf/services/gcube/vremanagement/ResourceManager <properties file> <identity>");
|
||||
System.exit(1);
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package org.gcube.vremanagement.resourcemanager.stubs.testsuite;
|
||||
package org.gcube.vremanagement.resourcemanager.testsuite;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
@ -7,6 +7,7 @@ import org.apache.axis.message.addressing.Address;
|
|||
import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||
import org.gcube.common.core.contexts.GCUBERemotePortTypeContext;
|
||||
import org.gcube.common.core.scope.GCUBEScope;
|
||||
import org.gcube.common.core.security.GCUBESecurityManager;
|
||||
import org.gcube.common.core.security.GCUBESecurityManagerImpl;
|
||||
import org.gcube.vremanagement.resourcemanager.stubs.resourcemanager.OptionsParameters;
|
||||
import org.gcube.vremanagement.resourcemanager.stubs.resourcemanager.ScopeOption;
|
||||
|
@ -32,11 +33,11 @@ public class SetScopeOptionsTest {
|
|||
*/
|
||||
public static void main(String[] args) {
|
||||
|
||||
if (args.length < 3)
|
||||
if ((args.length < 2) || (args.length > 3))
|
||||
SetScopeOptionsTest.printUsage();
|
||||
|
||||
try {
|
||||
resources.load(SetScopeOptionsTest.class.getResourceAsStream("/" + args[2]));
|
||||
resources.load(SetScopeOptionsTest.class.getResourceAsStream("/" + args[1]));
|
||||
} catch (IOException e1) {
|
||||
e1.printStackTrace();
|
||||
Runtime.getRuntime().exit(1);
|
||||
|
@ -45,14 +46,17 @@ public class SetScopeOptionsTest {
|
|||
EndpointReferenceType endpoint = new EndpointReferenceType();
|
||||
|
||||
try {
|
||||
endpoint.setAddress(new Address("http://"+ args[0]+":"+ args[1] +"/wsrf/services/gcube/vremanagement/ResourceManager"));
|
||||
ResourceManagerPortType pt;
|
||||
|
||||
GCUBESecurityManagerImpl managerSec = new GCUBESecurityManagerImpl() {
|
||||
public boolean isSecurityEnabled() {return false;}};
|
||||
pt = GCUBERemotePortTypeContext.getProxy(new ResourceManagerServiceAddressingLocator().getResourceManagerPortTypePort(endpoint),
|
||||
GCUBEScope.getScope(resources.getProperty("callerScope")),managerSec);
|
||||
endpoint.setAddress(new Address(args[0]));
|
||||
ResourceManagerPortType pt = new ResourceManagerServiceAddressingLocator().getResourceManagerPortTypePort(endpoint);
|
||||
|
||||
if (args.length == 3) {
|
||||
GCUBESecurityManager securityManager = org.gcube.vremanagement.resourcemanager.testsuite.security.Utils.generateAndConfigureDefaultSecurityManager(args[2], true);
|
||||
securityManager.setSecurity(pt, GCUBESecurityManager.AuthMode.PRIVACY, GCUBESecurityManager.DelegationMode.FULL);
|
||||
pt = GCUBERemotePortTypeContext.getProxy(pt,
|
||||
GCUBEScope.getScope(resources.getProperty("callerScope").trim()), securityManager);
|
||||
} else {
|
||||
pt = GCUBERemotePortTypeContext.getProxy(pt, GCUBEScope.getScope(resources.getProperty("callerScope").trim()), 90000);
|
||||
}
|
||||
OptionsParameters options = new OptionsParameters();
|
||||
ScopeOption[] scopeOptionList = new ScopeOption[optionNames.length];
|
||||
for (int i=0; i < optionNames.length; i++)
|
||||
|
@ -68,7 +72,10 @@ public class SetScopeOptionsTest {
|
|||
}
|
||||
|
||||
static void printUsage() {
|
||||
System.out.println("SetScopeOptionsTest <ResourceManager host> <ResourceManager port> <properties file>");
|
||||
System.out.println("SetScopeOptionsTest http://host:port/wsrf/services/gcube/vremanagement/ResourceManager <properties file>");
|
||||
System.out.println("or");
|
||||
System.out.println("SetScopeOptionsTest https://host:port/wsrf/services/gcube/vremanagement/ResourceManager <properties file> <identity>");
|
||||
|
||||
System.exit(1);
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package org.gcube.vremanagement.resourcemanager.stubs.testsuite;
|
||||
package org.gcube.vremanagement.resourcemanager.testsuite;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
@ -7,7 +7,7 @@ import org.apache.axis.message.addressing.Address;
|
|||
import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||
import org.gcube.common.core.contexts.GCUBERemotePortTypeContext;
|
||||
import org.gcube.common.core.scope.GCUBEScope;
|
||||
import org.gcube.common.core.security.GCUBESecurityManagerImpl;
|
||||
import org.gcube.common.core.security.GCUBESecurityManager;
|
||||
import org.gcube.common.core.utils.logging.GCUBEClientLog;
|
||||
import org.gcube.vremanagement.resourcemanager.stubs.resourcemanager.RemoveResourcesParameters;
|
||||
import org.gcube.vremanagement.resourcemanager.stubs.resourcemanager.ResourceManagerPortType;
|
||||
|
@ -27,11 +27,11 @@ public class UndeployServiceTest {
|
|||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
if (args.length < 3)
|
||||
if ((args.length < 2) || (args.length > 3))
|
||||
AddResourceTest.printUsage();
|
||||
|
||||
try {
|
||||
resources.load(RemoveResourceTest.class.getResourceAsStream("/" + args[2]));
|
||||
resources.load(RemoveResourceTest.class.getResourceAsStream("/" + args[1]));
|
||||
} catch (IOException e1) {
|
||||
e1.printStackTrace();
|
||||
Runtime.getRuntime().exit(1);
|
||||
|
@ -41,13 +41,19 @@ public class UndeployServiceTest {
|
|||
EndpointReferenceType endpoint = new EndpointReferenceType();
|
||||
|
||||
try {
|
||||
endpoint.setAddress(new Address("http://"+ args[0]+":"+ args[1] +"/wsrf/services/gcube/vremanagement/ResourceManager"));
|
||||
ResourceManagerPortType pt;
|
||||
|
||||
GCUBESecurityManagerImpl managerSec = new GCUBESecurityManagerImpl() {
|
||||
public boolean isSecurityEnabled() {return false;}};
|
||||
pt = GCUBERemotePortTypeContext.getProxy(new ResourceManagerServiceAddressingLocator().getResourceManagerPortTypePort(endpoint),
|
||||
GCUBEScope.getScope(resources.getProperty("callerScope").trim() ),managerSec);
|
||||
endpoint.setAddress(new Address(args[0]));
|
||||
ResourceManagerPortType pt = new ResourceManagerServiceAddressingLocator().getResourceManagerPortTypePort(endpoint);
|
||||
|
||||
if (args.length == 3) {
|
||||
GCUBESecurityManager securityManager = org.gcube.vremanagement.resourcemanager.testsuite.security.Utils.generateAndConfigureDefaultSecurityManager(args[2], true);
|
||||
securityManager.setSecurity(pt, GCUBESecurityManager.AuthMode.PRIVACY, GCUBESecurityManager.DelegationMode.FULL);
|
||||
pt = GCUBERemotePortTypeContext.getProxy(pt,
|
||||
GCUBEScope.getScope(resources.getProperty("callerScope").trim()), securityManager);
|
||||
} else {
|
||||
pt = GCUBERemotePortTypeContext.getProxy(pt, GCUBEScope.getScope(resources.getProperty("callerScope").trim()), 90000);
|
||||
}
|
||||
|
||||
RemoveResourcesParameters params = new RemoveResourcesParameters();
|
||||
|
||||
if (new Integer(resources.getProperty("numOfServicesToRemove")) > 0) {
|
|
@ -0,0 +1,41 @@
|
|||
package org.gcube.vremanagement.resourcemanager.testsuite.security;
|
||||
|
||||
import org.gcube.common.core.security.GCUBEClientSecurityManager;
|
||||
import org.gcube.common.core.security.GCUBESecurityManager;
|
||||
import org.gcube.common.core.security.GCUBESecurityManagerImpl;
|
||||
import org.gcube.common.core.security.context.SecurityContextFactory;
|
||||
import org.gcube.common.core.utils.logging.GCUBEClientLog;
|
||||
|
||||
public class Utils {
|
||||
public static GCUBESecurityManager generateAndConfigureDefaultSecurityManager (String identity, final boolean isSecurityEnabled)
|
||||
{
|
||||
GCUBEClientLog logger = new GCUBEClientLog(Utils.class);
|
||||
|
||||
GCUBESecurityManager securityManager = null;
|
||||
|
||||
if (isSecurityEnabled)
|
||||
{
|
||||
try {
|
||||
securityManager = SecurityContextFactory.getInstance().getSecurityContext().getDefaultSecurityManager();
|
||||
logger.debug("Identity = "+identity);
|
||||
((GCUBEClientSecurityManager) securityManager).setDefaultIdentityParameter(identity);
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("Unable to generate default security manager: trying without security...",e);
|
||||
securityManager = new GCUBESecurityManagerImpl() {
|
||||
public boolean isSecurityEnabled() {return isSecurityEnabled;}
|
||||
};
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
securityManager = new GCUBESecurityManagerImpl() {
|
||||
public boolean isSecurityEnabled() {return isSecurityEnabled;}
|
||||
};
|
||||
}
|
||||
|
||||
return securityManager;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue