Gianpaolo Coro 2016-10-26 10:09:17 +00:00
parent def1b34335
commit 3d03f95946
3 changed files with 26 additions and 9 deletions

View File

@ -16,7 +16,10 @@ public abstract class StandardLocalInfraAlgorithm extends StandardLocalExternalA
String serviceAddress = InfraRetrieval.findEmailingSystemAddress(config.getGcubeScope());
String requestForMessage = serviceAddress + "/messages/writeMessageToUsers" + "?gcube-token=" + config.getGcubeToken();
if (!serviceAddress.endsWith("/"))
serviceAddress = serviceAddress+"/";
String requestForMessage = serviceAddress + "messages/writeMessageToUsers" + "?gcube-token=" + config.getGcubeToken();
requestForMessage = requestForMessage.replace("http://", "https://").replace(":80", ""); // remove the port (or set it to 443) otherwise you get an SSL error
AnalysisLogger.getLogger().debug("Emailing System->Request url is going to be " + requestForMessage);

View File

@ -19,7 +19,8 @@ public class TestEmailingSystem {
config.setParam("DatabaseURL", "jdbc:postgresql://statistical-manager.d.d4science.research-infrastructures.eu/testdb");
config.setPersistencePath("./");
//config.setGcubeScope("/gcube/devNext/NextNext");
config.setGcubeScope("/gcube/devNext/NextNext");
// config.setGcubeScope("/gcube/devNext/NextNext");
config.setGcubeScope("/gcube");
config.setParam("ServiceUserName", "gianpaolo.coro");
config.setParam("DatabaseDriver", "org.postgresql.Driver");
config.setGcubeUserName("gianpaolo.coro");

View File

@ -57,10 +57,16 @@ public class InfraRetrieval {
public static String findEmailingSystemAddress(String scope) throws Exception {
String serviceName = "SocialNetworking";
String serviceClass = "Portal";
List<String> endpoints = retrieveServiceAddress(serviceClass, serviceName,scope,"test");
/* new code - deprecated
String resource = "jersey-servlet";
String serviceName = "SocialNetworking";
String serviceClass = "Portal";
SimpleQuery query = ICFactory.queryFor(GCoreEndpoint.class);
query.addCondition(String.format("$resource/Profile/ServiceClass/text() eq '%s'",serviceClass));
query.addCondition("$resource/Profile/DeploymentData/Status/text() eq 'ready'");
@ -69,13 +75,20 @@ public class InfraRetrieval {
DiscoveryClient<String> client = ICFactory.client();
List<String> endpoints = client.submit(query);
if (endpoints == null || endpoints.isEmpty()) throw new Exception("Cannot retrieve the GCoreEndpoint serviceName: "+serviceName +", serviceClass: " +serviceClass +", in scope: "+scope);
String resourceEntyName = endpoints.get(0);
if(resourceEntyName==null)
throw new Exception("Endpoint:"+resource+", is null for serviceName: "+serviceName +", serviceClass: " +serviceClass +", in scope: "+scope);
*/
String resourceEntyName = endpoints.get(0);
if (endpoints == null || endpoints.isEmpty()) throw new Exception("Cannot retrieve the GCoreEndpoint serviceName: "+serviceName +", serviceClass: " +serviceClass +", in scope: "+scope);
if(resourceEntyName==null)
throw new Exception("Endpoint:"+serviceName+", is null for serviceName: "+serviceName +", serviceClass: " +serviceClass +", in scope: "+scope);
return resourceEntyName;
}