Refactoring code due to changes in authorization-utils
This commit is contained in:
parent
2269b20f8d
commit
a64cef5113
|
@ -6,6 +6,7 @@ import java.net.MalformedURLException;
|
|||
import java.util.Properties;
|
||||
|
||||
import org.gcube.common.authorization.utils.manager.SecretManager;
|
||||
import org.gcube.common.authorization.utils.manager.SecretManagerProvider;
|
||||
import org.gcube.common.authorization.utils.secret.GCubeSecret;
|
||||
import org.gcube.common.authorization.utils.secret.Secret;
|
||||
import org.junit.AfterClass;
|
||||
|
@ -68,10 +69,12 @@ public class ContextTest {
|
|||
}
|
||||
|
||||
public static void set(Secret secret) throws Exception {
|
||||
SecretManager.instance.get().reset();
|
||||
secret.set();
|
||||
String username = secret.getUsername();
|
||||
String context = secret.getContext();
|
||||
SecretManagerProvider.instance.reset();
|
||||
SecretManager secretManager = SecretManagerProvider.instance.get();
|
||||
secretManager.addSecret(secret);
|
||||
secretManager.set();
|
||||
String username = secretManager.getUser().getUsername();
|
||||
String context = secretManager.getContext();
|
||||
logger.debug("Set authorization for user {} in context {}", username, context);
|
||||
}
|
||||
|
||||
|
@ -102,7 +105,7 @@ public class ContextTest {
|
|||
|
||||
@AfterClass
|
||||
public static void afterClass() throws Exception {
|
||||
SecretManager.instance.get().reset();
|
||||
SecretManagerProvider.instance.reset();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import java.util.concurrent.TimeUnit;
|
|||
import org.gcube.com.fasterxml.jackson.databind.JavaType;
|
||||
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
|
||||
import org.gcube.com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.gcube.common.authorization.utils.manager.SecretManager;
|
||||
import org.gcube.common.authorization.utils.manager.SecretManagerProvider;
|
||||
import org.gcube.gcat.api.GCatConstants;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
|
@ -54,7 +54,7 @@ public class ItemTest extends ContextTest {
|
|||
public void testCount() throws MalformedURLException {
|
||||
Item item = new Item();
|
||||
int count = item.count();
|
||||
logger.debug("The items published in the organization corresponding to the VRE {} are {}", SecretManager.instance.get().getContext(), count);
|
||||
logger.debug("The items published in the organization corresponding to the VRE {} are {}", SecretManagerProvider.instance.get().getContext(), count);
|
||||
}
|
||||
|
||||
public String createItem(ObjectMapper mapper, String licenseID) throws Exception {
|
||||
|
|
Loading…
Reference in New Issue