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 java.util.Properties;
|
||||||
|
|
||||||
import org.gcube.common.authorization.utils.manager.SecretManager;
|
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.GCubeSecret;
|
||||||
import org.gcube.common.authorization.utils.secret.Secret;
|
import org.gcube.common.authorization.utils.secret.Secret;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
|
@ -68,10 +69,12 @@ public class ContextTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void set(Secret secret) throws Exception {
|
public static void set(Secret secret) throws Exception {
|
||||||
SecretManager.instance.get().reset();
|
SecretManagerProvider.instance.reset();
|
||||||
secret.set();
|
SecretManager secretManager = SecretManagerProvider.instance.get();
|
||||||
String username = secret.getUsername();
|
secretManager.addSecret(secret);
|
||||||
String context = secret.getContext();
|
secretManager.set();
|
||||||
|
String username = secretManager.getUser().getUsername();
|
||||||
|
String context = secretManager.getContext();
|
||||||
logger.debug("Set authorization for user {} in context {}", username, context);
|
logger.debug("Set authorization for user {} in context {}", username, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +105,7 @@ public class ContextTest {
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
public static void afterClass() throws Exception {
|
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.JavaType;
|
||||||
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
|
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
|
||||||
import org.gcube.com.fasterxml.jackson.databind.ObjectMapper;
|
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.gcube.gcat.api.GCatConstants;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
|
@ -54,7 +54,7 @@ public class ItemTest extends ContextTest {
|
||||||
public void testCount() throws MalformedURLException {
|
public void testCount() throws MalformedURLException {
|
||||||
Item item = new Item();
|
Item item = new Item();
|
||||||
int count = item.count();
|
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 {
|
public String createItem(ObjectMapper mapper, String licenseID) throws Exception {
|
||||||
|
|
Loading…
Reference in New Issue