diff --git a/.classpath b/.classpath index caae616..a31545e 100644 --- a/.classpath +++ b/.classpath @@ -6,5 +6,6 @@ + diff --git a/build.xml b/build.xml index 63da752..af30eb4 100755 --- a/build.xml +++ b/build.xml @@ -3,7 +3,7 @@ Version 0.5 -REQUIRED INPUT PROPERTIES +INPUT PROPERTIES This buildfile assumes that the following properties have or may have been defined in a "build.properties" file in the configuration directory of the service (or else using the -D flag on the command line). @@ -24,7 +24,10 @@ package.: (optional) The package name of the stubs generated from WSDL and/ etics.build: (optional) Set to 'true', it indicates that build structures and procedures should be optimised for remote builds in ETICS. If it is omitted, this buildfile will optimise build structures and procedures for local builds. - +full.stubs: (optional) Set to 'false', it excludes auxiliary stub code placed under ${package}/stubs when building the stub distribution. + It is intended to simplify realignment of auxiliary and standard stub in IDE environments in case the latter change in non backwards-compatible ways. + After re-alignment, the property is typically left to its default of 'true' to restore a joint build of all stub code. + --> @@ -83,9 +86,10 @@ etics.build: (optional) Set to 'true', it indicates that build structures a + - + @@ -391,7 +395,8 @@ etics.build: (optional) Set to 'true', it indicates that build structures a - + @@ -429,12 +434,14 @@ etics.build: (optional) Set to 'true', it indicates that build structures a - - - - - - + + + + + + + + diff --git a/src/org/gcube/informationsystem/registry/test/RegistryRegistrationTest.java b/src/org/gcube/informationsystem/registry/stubs/testsuite/RegistryRegistrationTest.java similarity index 57% rename from src/org/gcube/informationsystem/registry/test/RegistryRegistrationTest.java rename to src/org/gcube/informationsystem/registry/stubs/testsuite/RegistryRegistrationTest.java index 18ef5c5..55a8ea5 100644 --- a/src/org/gcube/informationsystem/registry/test/RegistryRegistrationTest.java +++ b/src/org/gcube/informationsystem/registry/stubs/testsuite/RegistryRegistrationTest.java @@ -1,8 +1,9 @@ -package org.gcube.informationsystem.registry.test; +package org.gcube.informationsystem.registry.stubs.testsuite; import java.io.FileReader; import java.io.StringWriter; +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; @@ -12,40 +13,51 @@ import org.gcube.common.core.resources.GCUBEResource; import org.gcube.common.core.resources.GCUBERunningInstance; import org.gcube.common.core.resources.GCUBEService; import org.gcube.common.core.scope.GCUBEScope; -import org.gcube.common.core.scope.ServiceMap.ServiceType; import org.gcube.common.core.security.GCUBESecurityManagerImpl; import org.gcube.informationsystem.registry.stubs.CreateResourceMessage; import org.gcube.informationsystem.registry.stubs.RegistryFactoryPortType; import org.gcube.informationsystem.registry.stubs.service.RegistryFactoryServiceAddressingLocator; /** - * GCUBE resource registration tester + * {@link GCUBEResource} registration tester * * @author Manuele Simi (CNR-ISTI) - * + * */ public class RegistryRegistrationTest { /** * - * @param args parameters: - *
    - *
  • resource file - *
  • resource type - *
  • caller scope + * @param args + * parameters: + *
      + *
    • factory URI + *
    • resource file + *
    • resource type + *
    • caller scope * - * @throws Exception if the registration fails + * @throws Exception + * if the registration fails */ - + public static void main(String[] args) throws Exception { - if (args.length != 3) { + if (args.length != 4) { printUsage(); } + for (String param : args) System.out.println("param "+ param); + // get the scope and the factory URI GCUBEScope scope = GCUBEScope.getScope(args[2]); - EndpointReferenceType factoryEPR = scope.getServiceMap().getEndpoints(ServiceType.ISICAllRegistrationPT).iterator().next(); + + EndpointReferenceType factoryEPR = new EndpointReferenceType(); + try { + factoryEPR.setAddress(new Address(args[0])); + } catch (Exception e) { + e.printStackTrace(); + Runtime.getRuntime().exit(1); + } RegistryFactoryServiceAddressingLocator registryLocator = new RegistryFactoryServiceAddressingLocator(); @@ -55,18 +67,16 @@ public class RegistryRegistrationTest { } }; - // ExtendedGSSCredential cred = org.diligentproject.dvos.authentication.util.ProxyUtil.loadProxyCredentials(args[2]); - // managerSec.useCredentials(cred); - // load the resource - GCUBEResource resource = getResource(args[1], new FileReader(args[0])); + GCUBEResource resource = getResource(args[3], new FileReader(args[1])); RegistryFactoryPortType registryFactoryPortType = null; try { - registryFactoryPortType = registryLocator.getRegistryFactoryPortTypePort(factoryEPR); + registryFactoryPortType = registryLocator + .getRegistryFactoryPortTypePort(factoryEPR); } catch (Exception e) { e.printStackTrace(); - System.exit(1); + Runtime.getRuntime().exit(1); } CreateResourceMessage message = new CreateResourceMessage(); @@ -81,38 +91,47 @@ public class RegistryRegistrationTest { } catch (Exception e) { e.printStackTrace(); + Runtime.getRuntime().exit(1); } } /** * Loads the specific GCUBEResource class - * @param type the resource type - * @param file the file representation of the profile + * + * @param type + * the resource type + * @param file + * the file representation of the profile * @return the resource class - * @throws Exception if the loading fails + * @throws Exception + * if the loading fails */ - static GCUBEResource getResource(String type, FileReader file) throws Exception { + static GCUBEResource getResource(String type, FileReader file) + throws Exception { if (type.compareTo("Service") == 0) { - GCUBEService service = GHNContext.getImplementation(GCUBEService.class); + GCUBEService service = GHNContext + .getImplementation(GCUBEService.class); service.load(file); return (GCUBEResource) service; - } - else if (type.compareTo("RunningInstance") == 0) { - GCUBERunningInstance instance = GHNContext.getImplementation(GCUBERunningInstance.class); + } else if (type.compareTo("RunningInstance") == 0) { + GCUBERunningInstance instance = GHNContext + .getImplementation(GCUBERunningInstance.class); instance.load(file); return (GCUBEResource) instance; } else if (type.compareTo("GHN") == 0) { - GCUBEHostingNode node = GHNContext.getImplementation(GCUBEHostingNode.class); + GCUBEHostingNode node = GHNContext + .getImplementation(GCUBEHostingNode.class); node.load(file); return (GCUBEResource) node; } else if (type.compareTo("GenericResource") == 0) { - GCUBEGenericResource generic = GHNContext.getImplementation(GCUBEGenericResource.class); + GCUBEGenericResource generic = GHNContext + .getImplementation(GCUBEGenericResource.class); generic.load(file); return (GCUBEResource) generic; } - - throw new Exception( type + " is an invalid resource type"); + + throw new Exception(type + " is an invalid resource type"); } @@ -120,8 +139,10 @@ public class RegistryRegistrationTest { * Prints tester usage syntax */ static void printUsage() { - System.out.println("RegistryRegistrationTest "); - System.out.println("allowed types are: RunningInstance/Service/GHN/GenericResource"); + System.out + .println("RegistryRegistrationTest "); + System.out + .println("allowed types are: RunningInstance/Service/GHN/GenericResource"); System.exit(1); } } diff --git a/src/org/gcube/informationsystem/registry/stubs/testsuite/RegistryRemoveTest.java b/src/org/gcube/informationsystem/registry/stubs/testsuite/RegistryRemoveTest.java new file mode 100644 index 0000000..7d8c7ae --- /dev/null +++ b/src/org/gcube/informationsystem/registry/stubs/testsuite/RegistryRemoveTest.java @@ -0,0 +1,52 @@ +package org.gcube.informationsystem.registry.stubs.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.informationsystem.registry.stubs.RegistryFactoryPortType; +import org.gcube.informationsystem.registry.stubs.RemoveResourceMessage; +import org.gcube.informationsystem.registry.stubs.service.RegistryFactoryServiceAddressingLocator; + +public class RegistryRemoveTest { + + public static void main(String[] args) throws Exception { + + RegistryFactoryServiceAddressingLocator registryLocator = new RegistryFactoryServiceAddressingLocator(); + + GCUBESecurityManagerImpl managerSec = new GCUBESecurityManagerImpl() { + public boolean isSecurityEnabled() { + return true; + } + }; + + EndpointReferenceType factoryEPR = new EndpointReferenceType(); + + RegistryFactoryPortType registryFactoryPortType = null; + try { + factoryEPR.setAddress(new Address(args[0])); + registryFactoryPortType = registryLocator + .getRegistryFactoryPortTypePort(factoryEPR); + } catch (Exception e) { + e.printStackTrace(); + } + RemoveResourceMessage message = new RemoveResourceMessage(); + + // managerSec.useCredentials(cred); + registryFactoryPortType = GCUBERemotePortTypeContext.getProxy( + registryFactoryPortType, GCUBEScope.getScope(args[2]), + managerSec); + try { + message.setType(args[3]); + message.setUniqueID(args[1]); + registryFactoryPortType.removeResource(message); + + } catch (Exception e) { + e.printStackTrace(); + } + System.out.println("Profile with ID " + args[1] + + "has been succesfully removed"); + } + +} diff --git a/src/org/gcube/informationsystem/registry/test/RegistryUpdateTest.java b/src/org/gcube/informationsystem/registry/stubs/testsuite/RegistryUpdateTest.java similarity index 97% rename from src/org/gcube/informationsystem/registry/test/RegistryUpdateTest.java rename to src/org/gcube/informationsystem/registry/stubs/testsuite/RegistryUpdateTest.java index 841456f..606107c 100644 --- a/src/org/gcube/informationsystem/registry/test/RegistryUpdateTest.java +++ b/src/org/gcube/informationsystem/registry/stubs/testsuite/RegistryUpdateTest.java @@ -1,4 +1,4 @@ -package org.gcube.informationsystem.registry.test; +package org.gcube.informationsystem.registry.stubs.testsuite; import java.io.FileReader; import java.io.StringWriter; diff --git a/src/org/gcube/informationsystem/registry/test/RegistryRemoveTest$1.class b/src/org/gcube/informationsystem/registry/test/RegistryRemoveTest$1.class deleted file mode 100644 index 25c9c1c..0000000 Binary files a/src/org/gcube/informationsystem/registry/test/RegistryRemoveTest$1.class and /dev/null differ diff --git a/src/org/gcube/informationsystem/registry/test/RegistryRemoveTest.class b/src/org/gcube/informationsystem/registry/test/RegistryRemoveTest.class deleted file mode 100644 index d9aadf8..0000000 Binary files a/src/org/gcube/informationsystem/registry/test/RegistryRemoveTest.class and /dev/null differ diff --git a/src/org/gcube/informationsystem/registry/test/RegistryRemoveTest.java b/src/org/gcube/informationsystem/registry/test/RegistryRemoveTest.java deleted file mode 100644 index c09a378..0000000 --- a/src/org/gcube/informationsystem/registry/test/RegistryRemoveTest.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.gcube.informationsystem.registry.test; - -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.informationsystem.registry.stubs.RegistryFactoryPortType; -import org.gcube.informationsystem.registry.stubs.RemoveResourceMessage; -import org.gcube.informationsystem.registry.stubs.service.RegistryFactoryServiceAddressingLocator; - - -public class RegistryRemoveTest { - - public static void main (String[]args ) throws Exception { - - RegistryFactoryServiceAddressingLocator registryLocator = new RegistryFactoryServiceAddressingLocator(); - - GCUBESecurityManagerImpl managerSec = new GCUBESecurityManagerImpl() { public boolean isSecurityEnabled() {return true;}}; - - - EndpointReferenceType factoryEPR = new EndpointReferenceType(); - - RegistryFactoryPortType registryFactoryPortType= null; - try { - factoryEPR.setAddress(new Address(args[0])); - registryFactoryPortType = registryLocator.getRegistryFactoryPortTypePort(factoryEPR); - }catch(Exception e){ - e.printStackTrace(); - } - RemoveResourceMessage message = new RemoveResourceMessage(); - - //managerSec.useCredentials(cred); - registryFactoryPortType =GCUBERemotePortTypeContext.getProxy(registryFactoryPortType,GCUBEScope.getScope(args[2]),managerSec); - try { - message.setType(args[3]); - message.setUniqueID(args[1]); - registryFactoryPortType.removeResource(message); - - } catch(Exception e) { - e.printStackTrace(); - } - System.out.println("Profile with ID "+ args[1]+ "has been succesfully removed"); - } - -}