Fixings on the ISRegistry testsuite
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/information-system/gCubeIS/Registry@14371 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
c004c1d298
commit
8d7c4115f6
|
@ -1,55 +0,0 @@
|
|||
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;
|
||||
import org.gcube.common.core.resources.GCUBEService;
|
||||
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.UpdateResourceMessage;
|
||||
import org.gcube.informationsystem.registry.stubs.service.RegistryFactoryServiceAddressingLocator;
|
||||
|
||||
public class RegistryUpdateTest {
|
||||
|
||||
public static void main (String[]args ) throws Exception {
|
||||
|
||||
RegistryFactoryServiceAddressingLocator registryLocator = new RegistryFactoryServiceAddressingLocator();
|
||||
|
||||
GCUBESecurityManagerImpl managerSec = new GCUBESecurityManagerImpl() { public boolean isSecurityEnabled() {return true;}};
|
||||
FileReader fis = new FileReader (args[1]);
|
||||
GCUBEService resource =GHNContext.getImplementation(GCUBEService.class);
|
||||
EndpointReferenceType factoryEPR = new EndpointReferenceType();
|
||||
resource.load(fis);
|
||||
|
||||
RegistryFactoryPortType registryFactoryPortType= null;
|
||||
try {
|
||||
factoryEPR.setAddress(new Address(args[0]));
|
||||
registryFactoryPortType = registryLocator.getRegistryFactoryPortTypePort(factoryEPR);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
UpdateResourceMessage message = new UpdateResourceMessage();
|
||||
|
||||
|
||||
|
||||
registryFactoryPortType =GCUBERemotePortTypeContext.getProxy(registryFactoryPortType,GCUBEScope.getScope(args[3]),managerSec);
|
||||
try {
|
||||
StringWriter writer =new StringWriter();
|
||||
resource.store(writer);
|
||||
message.setXmlProfile(writer.toString());
|
||||
message.setUniqueID(resource.getID());
|
||||
message.setType(GCUBEService.TYPE);
|
||||
|
||||
registryFactoryPortType.updateResource(message);
|
||||
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println("Profile has been updated");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue