@Before
public void setUp() throws Exception {
/*
* Create database
*/
JCRRegistry jcrRegistry = new JCRRegistry(null,
"org.apache.jackrabbit.core.RepositoryFactoryImpl", "admin",
"admin", null);
/*
* Host
*/
URL url = this.getClass().getClassLoader().getResource(GRAM_PROPERTIES);
Properties properties = new Properties();
properties.load(url.openStream());
HostDescription host = new HostDescription();
host.getType().changeType(GlobusHostType.type);
host.getType().setHostName(properties.getProperty("gram.name"));
host.getType().setHostAddress(properties.getProperty("gram.host"));
((GlobusHostType) host.getType()).setGridFTPEndPointArray(new String[]{properties.getProperty("gridftp.endpoint")});
((GlobusHostType) host.getType()).setGlobusGateKeeperEndPointArray(new String[]{properties.getProperty("globus.endpoints")});
/*
* App
*/
ApplicationDeploymentDescription appDesc = new ApplicationDeploymentDescription(GramApplicationDeploymentType.type);
GramApplicationDeploymentType app = (GramApplicationDeploymentType) appDesc.getType();
app.setCpuCount(1);
app.setNodeCount(1);
ApplicationDeploymentDescriptionType.ApplicationName name = appDesc.getType().addNewApplicationName();
name.setStringValue("EchoLocal");
app.setExecutableLocation("/bin/echo");
app.setScratchWorkingDirectory(properties.getProperty("scratch.directory"));
app.setCpuCount(1);
ProjectAccountType projectAccountType = ((GramApplicationDeploymentType) appDesc.getType()).addNewProjectAccount();
projectAccountType.setProjectAccountNumber(properties.getProperty("project.name"));
/*
* Service
*/
ServiceDescription serv = new ServiceDescription();
serv.getType().setName("SimpleEcho");
InputParameterType input = InputParameterType.Factory.newInstance();
ParameterType parameterType = input.addNewParameterType();
parameterType.setName("echo_input");
List<InputParameterType> inputList = new ArrayList<InputParameterType>();
inputList.add(input);
InputParameterType[] inputParamList = inputList.toArray(new InputParameterType[inputList
.size()]);
OutputParameterType output = OutputParameterType.Factory.newInstance();
ParameterType parameterType1 = output.addNewParameterType();
parameterType1.setName("echo_output");
List<OutputParameterType> outputList = new ArrayList<OutputParameterType>();
outputList.add(output);
OutputParameterType[] outputParamList = outputList
.toArray(new OutputParameterType[outputList.size()]);
serv.getType().setInputParametersArray(inputParamList);
serv.getType().setOutputParametersArray(outputParamList);
/*
* Save to registry
*/
jcrRegistry.saveHostDescription(host);
jcrRegistry.saveDeploymentDescription(serv.getType().getName(), host.getType().getHostName(), appDesc);
jcrRegistry.saveServiceDescription(serv);
jcrRegistry.deployServiceOnHost(serv.getType().getName(), host.getType().getHostName());
}