moved to new gcube-security
This commit is contained in:
parent
f9f535d252
commit
fba448a7f2
|
@ -47,7 +47,7 @@ public class ScopedServiceMap implements ServiceMap {
|
|||
//helper
|
||||
public ServiceMap currentMap() {
|
||||
|
||||
String currentScope = SecretManagerProvider.instance.get().getContext();
|
||||
String currentScope = SecretManagerProvider.get().getContext();
|
||||
|
||||
if (currentScope==null)
|
||||
throw new IllegalStateException("current scope is undefined");
|
||||
|
|
|
@ -45,11 +45,9 @@ class ServiceMapScanner {
|
|||
|
||||
try {
|
||||
|
||||
Collection<URL> urls = ClasspathHelper.forClassLoader();
|
||||
urls.removeIf(url -> url.toString().endsWith(".so") || url.toString().endsWith(".zip") );
|
||||
Collection<URL> urls = ClasspathHelper.forJavaClassPath();
|
||||
|
||||
|
||||
ConfigurationBuilder reflectionConf = new ConfigurationBuilder().addUrls(urls).setScanners(new ResourcesScanner());
|
||||
ConfigurationBuilder reflectionConf = new ConfigurationBuilder().addUrls(ClasspathHelper.forJavaClassPath()).addUrls(ClasspathHelper.forClassLoader()).setScanners(new ResourcesScanner());
|
||||
|
||||
Reflections reflection = new Reflections(reflectionConf);
|
||||
|
||||
|
|
|
@ -21,12 +21,12 @@ public class BindingTest {
|
|||
|
||||
final String callScope = "somescope";
|
||||
|
||||
SecretManagerProvider.instance.set(new TestSecret(callScope));
|
||||
SecretManagerProvider.set(new TestSecret(callScope));
|
||||
|
||||
Callable<Void> unbound = new Callable<Void>() {
|
||||
@Override
|
||||
public Void call() throws Exception {
|
||||
assertEquals("task thread is not bound to call scope, but to "+SecretManagerProvider.instance.get().getContext(),callScope,SecretManagerProvider.instance.get().getContext());
|
||||
assertEquals("task thread is not bound to call scope, but to "+SecretManagerProvider.get().getContext(),callScope,SecretManagerProvider.get().getContext());
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
@ -36,21 +36,21 @@ public class BindingTest {
|
|||
String newScope = "newscope";
|
||||
|
||||
//scope in current thread changes
|
||||
SecretManagerProvider.instance.set(new TestSecret(newScope));
|
||||
SecretManagerProvider.set(new TestSecret(newScope));
|
||||
|
||||
//task is submittted
|
||||
executor.submit(bound).get();
|
||||
|
||||
//resetting task
|
||||
assertEquals("call thread does not retain its latest scope",newScope,SecretManagerProvider.instance.get().getContext());
|
||||
assertEquals("call thread does not retain its latest scope",newScope,SecretManagerProvider.get().getContext());
|
||||
|
||||
//reset call scope
|
||||
SecretManagerProvider.instance.reset();
|
||||
SecretManagerProvider.reset();
|
||||
|
||||
Callable<Void> cleanupTest = new Callable<Void>() {
|
||||
@Override
|
||||
public Void call() throws Exception {
|
||||
assertNull(SecretManagerProvider.instance.get());
|
||||
assertNull(SecretManagerProvider.get());
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -54,7 +54,7 @@ public class ServiceMapTest {
|
|||
@Test
|
||||
public void serviceMapsDiscoveredCorrectly() throws Exception {
|
||||
|
||||
SecretManagerProvider.instance.set(new TestSecret("/infra/vo"));
|
||||
SecretManagerProvider.set(new TestSecret("/infra/vo"));
|
||||
|
||||
assertNotNull(ServiceMap.instance.endpoint("service1"));
|
||||
|
||||
|
@ -65,7 +65,7 @@ public class ServiceMapTest {
|
|||
@Test
|
||||
public void serviceMapsCanBeLookedupInVREScope() throws Exception {
|
||||
|
||||
SecretManagerProvider.instance.set(new TestSecret("/infra/vo/vre"));
|
||||
SecretManagerProvider.set(new TestSecret("/infra/vo/vre"));
|
||||
|
||||
assertNotNull(ServiceMap.instance.endpoint("service1"));
|
||||
|
||||
|
@ -73,7 +73,7 @@ public class ServiceMapTest {
|
|||
|
||||
@After
|
||||
public void cleanup() {
|
||||
SecretManagerProvider.instance.reset();
|
||||
SecretManagerProvider.reset();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue