diff --git a/src/main/java/org/gcube/gcat/moderation/thread/MessageModerationThread.java b/src/main/java/org/gcube/gcat/moderation/thread/social/SocialMessageModerationThread.java similarity index 85% rename from src/main/java/org/gcube/gcat/moderation/thread/MessageModerationThread.java rename to src/main/java/org/gcube/gcat/moderation/thread/social/SocialMessageModerationThread.java index 971037c..a00c809 100644 --- a/src/main/java/org/gcube/gcat/moderation/thread/MessageModerationThread.java +++ b/src/main/java/org/gcube/gcat/moderation/thread/social/SocialMessageModerationThread.java @@ -1,4 +1,4 @@ -package org.gcube.gcat.moderation.thread; +package org.gcube.gcat.moderation.thread.social; import java.io.StringWriter; import java.util.Set; @@ -6,6 +6,7 @@ import java.util.Set; import org.gcube.common.authorization.utils.manager.SecretManagerProvider; import org.gcube.gcat.api.moderation.CMItemStatus; import org.gcube.gcat.api.moderation.Moderated; +import org.gcube.gcat.moderation.thread.ModerationThread; import org.gcube.gcat.social.Message; import org.gcube.gcat.social.SocialUsers; import org.slf4j.Logger; @@ -14,9 +15,9 @@ import org.slf4j.LoggerFactory; /** * @author Luca Frosini (ISTI - CNR) */ -public class MessageModerationThread extends ModerationThread { +public class SocialMessageModerationThread extends ModerationThread { - private static final Logger logger = LoggerFactory.getLogger(MessageModerationThread.class); + private static final Logger logger = LoggerFactory.getLogger(SocialMessageModerationThread.class); protected String getSubject(CMItemStatus cmItemStatus) { StringWriter stringWriter = new StringWriter(); @@ -42,8 +43,6 @@ public class MessageModerationThread extends ModerationThread { @Override protected void postMessage(CMItemStatus cmItemStatus, String message) throws Exception { - - } @Override diff --git a/src/main/java/org/gcube/gcat/utils/Constants.java b/src/main/java/org/gcube/gcat/utils/Constants.java index ea05ef1..9540ff8 100644 --- a/src/main/java/org/gcube/gcat/utils/Constants.java +++ b/src/main/java/org/gcube/gcat/utils/Constants.java @@ -28,7 +28,8 @@ public class Constants { Properties properties = new Properties(); InputStream input = Constants.class.getClassLoader().getResourceAsStream(CLIENT_SECRET_FILENAME); properties.load(input); - String root = context.substring(0, context.indexOf('/', 1)); + int index = context.indexOf('/', 1); + String root = context.substring(0, index == -1 ? context.length() : index); clientSecret = properties.getProperty(root); } return clientSecret; diff --git a/src/test/java/org/gcube/gcat/ContextTest.java b/src/test/java/org/gcube/gcat/ContextTest.java index 0a6b2f9..108a400 100644 --- a/src/test/java/org/gcube/gcat/ContextTest.java +++ b/src/test/java/org/gcube/gcat/ContextTest.java @@ -37,14 +37,14 @@ public class ContextTest { throw new RuntimeException(e); } - //DEFAULT_TEST_SCOPE_NAME = "/pred4s/preprod/preVRE"; + // DEFAULT_TEST_SCOPE_NAME = "/pred4s/preprod/preVRE"; // DEFAULT_TEST_SCOPE_NAME = "/gcube/devsec/devVRE"; ROOT = "/gcube"; -// VO = ROOT + "/devsec"; -// VRE = VO + "/devVRE"; - VO = ROOT + "/devNext"; - VRE = VO + "/NextNext"; + VO = ROOT + "/devsec"; + VRE = VO + "/devVRE"; + // VO = ROOT + "/devNext"; + // VRE = VO + "/NextNext"; } diff --git a/src/test/java/org/gcube/gcat/utils/ConstantsTest.java b/src/test/java/org/gcube/gcat/utils/ConstantsTest.java index 9ede444..a42470e 100644 --- a/src/test/java/org/gcube/gcat/utils/ConstantsTest.java +++ b/src/test/java/org/gcube/gcat/utils/ConstantsTest.java @@ -1,12 +1,17 @@ package org.gcube.gcat.utils; import org.gcube.common.authorization.utils.manager.SecretManagerProvider; +import org.gcube.common.authorization.utils.secret.Secret; import org.gcube.common.encryption.encrypter.StringEncrypter; +import org.gcube.common.keycloak.model.TokenResponse; import org.gcube.gcat.ContextTest; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +/** + * @author Luca Frosini (ISTI - CNR) + */ public class ConstantsTest extends ContextTest { private static final Logger logger = LoggerFactory.getLogger(ConstantsTest.class); @@ -17,12 +22,17 @@ public class ConstantsTest extends ContextTest { Constants.getCatalogueSecret().getToken()); } - @Test public void decrypt() throws Exception { StringEncrypter stringEncrypter = StringEncrypter.getEncrypter(); String decrypted = stringEncrypter.decrypt("w0KVc+78b2yUQsndDh/cXyyRquuwyILTygmoF0Y5Dls="); logger.debug("{}", decrypted); - } + + @Test + public void getToken() throws Exception { + Secret secret = Constants.getCatalogueSecret(); + logger.debug(secret.getToken()); + } + }