84 lines
2.6 KiB
Java
84 lines
2.6 KiB
Java
/**
|
|
*
|
|
*/
|
|
package org.gcube.vremanagement.executor;
|
|
/*
|
|
import java.io.StringWriter;
|
|
import java.net.URI;
|
|
import java.util.Calendar;
|
|
import java.util.Map;
|
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
|
*/
|
|
import org.gcube.testutility.ScopedTest;
|
|
|
|
/**
|
|
* @author Luca Frosini (ISTI - CNR)
|
|
*
|
|
*/
|
|
public class GCoreEndPointCreationTest extends ScopedTest {
|
|
|
|
//private static Logger logger = LoggerFactory.getLogger(GCoreEndPointCreationTest.class);
|
|
|
|
/* protected static GCoreEndpoint createGCoreEndpoint(){
|
|
logger.debug("Getting Available Plugins and their own supported capabilities");
|
|
PluginManager pluginManager = PluginManager.getInstance();
|
|
|
|
//ContextProvider.get().application();
|
|
GCoreEndpoint gCoreEndpoint = new GCoreEndpoint();
|
|
|
|
Profile profile = gCoreEndpoint.profile();
|
|
profile.serviceId("serviceid");
|
|
profile.ghnId("nodeid");
|
|
profile.serviceClass("serviceClass");
|
|
profile.serviceName("serviceName");
|
|
profile.version("version");
|
|
profile.description("description");
|
|
profile.endpoints().add().nameAndAddress("name",URI.create("http://acme.org"));
|
|
|
|
|
|
profile.serviceClass(ContextProvider.get().configuration().serviceClass());
|
|
profile.serviceName(ContextProvider.get().configuration().name());
|
|
profile.version(ContextProvider.get().configuration().version());
|
|
profile.description(ContextProvider.get().configuration().description());
|
|
|
|
|
|
DeploymentData deploymentData = profile.newDeploymentData();
|
|
deploymentData.activationTime(Calendar.getInstance());
|
|
|
|
Map<String, PluginDeclaration> availablePlugins = pluginManager.getAvailablePlugins();
|
|
for(String pluginName : availablePlugins.keySet()){
|
|
PluginDeclaration pluginDeclaration = availablePlugins.get(pluginName);
|
|
|
|
deploymentData.plugins().add().service("",pluginName, pluginDeclaration.getVersion()).pluginPackage("").version(pluginDeclaration.getVersion());
|
|
|
|
|
|
Map<String, String> pluginCapabilities = pluginDeclaration.getSupportedCapabilities();
|
|
for(String capabilityName : pluginCapabilities.keySet()){
|
|
Parameter parameter = new Parameter();
|
|
parameter.nameAndValues(capabilityName, pluginCapabilities.get(capabilityName));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return gCoreEndpoint;
|
|
}
|
|
|
|
|
|
@Test
|
|
public void logCreatedGCoreEndpoint() throws Exception {
|
|
GCoreEndpoint gCoreEndpoint = createGCoreEndpoint();
|
|
|
|
StringWriter stringWriter = new StringWriter();
|
|
Resources.marshal(gCoreEndpoint, stringWriter);
|
|
|
|
logger.debug("Created {} for scope {}:\n{}",
|
|
GCoreEndpoint.class.getSimpleName(),
|
|
TestUtility.getScopeFromToken(), stringWriter);
|
|
}*/
|
|
|
|
}
|