diff options
author | Instrumental <jonathan.gathman@att.com> | 2019-02-07 18:53:11 -0600 |
---|---|---|
committer | Instrumental <jonathan.gathman@att.com> | 2019-02-07 18:53:18 -0600 |
commit | 39596f5b6d2c67d8c2b357243ecfb2dd6d746796 (patch) | |
tree | dca4f08d6ad0a65cfb378f2f097bbcff165315b6 /auth/auth-core | |
parent | 27afb0201ce717c25d8ffcc50f8b4972fc98f5c5 (diff) |
Minor fixes starting from Scratch
Issue-ID: AAF-698
Change-Id: Ie279c11f9f385e9cb179cbe3e16de35cbfa33ecf
Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'auth/auth-core')
5 files changed, 12 insertions, 46 deletions
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationFactory.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationFactory.java index 40c8c2d3..f4e6d14e 100644 --- a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationFactory.java +++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationFactory.java @@ -71,7 +71,7 @@ public class OrganizationFactory { String realm = env.getProperty(Config.AAF_DEFAULT_REALM,"people.osaaf.org"); defaultOrg = cnst.newInstance(env,realm); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | NoSuchMethodException | SecurityException | IllegalArgumentException | InvocationTargetException e) { - throw new OrganizationException("At least one Organization must be defined",e); + env.warn().log("Not Organization Moduled linked in",e); } } if (defaultOrg == null) { diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsServiceStarter.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsServiceStarter.java index 1bc367e6..fe610e57 100644 --- a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsServiceStarter.java +++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsServiceStarter.java @@ -23,7 +23,6 @@ import java.io.IOException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; import org.onap.aaf.auth.org.OrganizationException; import org.onap.aaf.auth.org.OrganizationFactory; @@ -41,15 +40,13 @@ public abstract class AbsServiceStarter<ENV extends RosettaEnv, TRANS extends Tr protected AbsService<ENV,TRANS> service; - public AbsServiceStarter(final AbsService<ENV,TRANS> service, boolean noexit) { + public AbsServiceStarter(final AbsService<ENV,TRANS> service) { this.service = service; try { OrganizationFactory.init(service.env); } catch (OrganizationException e) { service.access.log(e, "Missing defined Organization Plugins"); - if(!noexit) { - System.exit(3); - } + System.exit(3); } // do_register - this is used for specialty Debug Situations. Developer can create an Instance for a remote system // for Debugging purposes without fear that real clients will start to call your debug instance diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/JettyServiceStarter.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/JettyServiceStarter.java index 98503d11..413b7919 100644 --- a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/JettyServiceStarter.java +++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/JettyServiceStarter.java @@ -59,7 +59,7 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex private boolean secure; public JettyServiceStarter(final AbsService<ENV,TRANS> service) throws OrganizationException { - super(service,false); + super(service); secure = true; } diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/org/test/JU_OrganizationFactory.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/org/test/JU_OrganizationFactory.java index 36d071fd..20b47331 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/org/test/JU_OrganizationFactory.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/org/test/JU_OrganizationFactory.java @@ -55,13 +55,8 @@ public class JU_OrganizationFactory { @SuppressWarnings("static-access") @Test - public void testInit() { - try { - organizationFactory.init(bEnv); - Assert.fail("Expect an exception"); - } catch (OrganizationException e) { - Assert.assertEquals("At least one Organization must be defined", e.getMessage()); - } + public void testInit() throws OrganizationException { + Assert.assertEquals(null, organizationFactory.init(bEnv)); } @SuppressWarnings("static-access") //TODO:Fix this once real input is available AAF-111 diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsServiceStarter.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsServiceStarter.java index 04d58d6b..9b49216d 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsServiceStarter.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsServiceStarter.java @@ -21,51 +21,25 @@ package org.onap.aaf.auth.server.test; -import static org.junit.Assert.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; + +import javax.servlet.Filter; import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.onap.aaf.auth.env.AuthzTrans; -import org.onap.aaf.auth.env.AuthzTransFilter; -import org.onap.aaf.auth.local.AbsData; -import org.onap.aaf.auth.local.DataFile; -import org.onap.aaf.auth.local.TextIndex; import org.onap.aaf.auth.rserv.RServlet; import org.onap.aaf.auth.server.AbsService; import org.onap.aaf.auth.server.AbsServiceStarter; -import org.onap.aaf.auth.server.test.JU_AbsService; import org.onap.aaf.cadi.Access; +import org.onap.aaf.cadi.Access.Level; import org.onap.aaf.cadi.CadiException; import org.onap.aaf.cadi.LocatorException; import org.onap.aaf.cadi.PropAccess; -import org.onap.aaf.cadi.Access.Level; import org.onap.aaf.cadi.config.Config; import org.onap.aaf.cadi.register.Registrant; import org.onap.aaf.misc.env.impl.BasicEnv; -import org.onap.aaf.auth.local.AbsData.Iter; -import org.onap.aaf.auth.local.AbsData.Reuse; - -import junit.framework.Assert; - -import static org.junit.Assert.*; -import static org.mockito.Matchers.*; -import static org.mockito.Mockito.*; - -import java.io.BufferedWriter; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.PrintStream; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.security.Principal; - -import javax.servlet.Filter; public class JU_AbsServiceStarter { @@ -76,7 +50,7 @@ public class JU_AbsServiceStarter { private class AbsServiceStarterStub extends AbsServiceStarter { public AbsServiceStarterStub(AbsService service) { - super(service, true); + super(service); // TODO Auto-generated constructor stub } |