From 1296352d8eafee57f982a4342ad79ada4aa56d28 Mon Sep 17 00:00:00 2001 From: Instrumental Date: Tue, 15 Oct 2019 08:19:50 -0500 Subject: Sonar Fixes, Formatting Issue-ID: AAF-1019 Change-Id: Ica49d9e7323aad9622ff9d95cc21b87430c22c54 Signed-off-by: Instrumental --- .../org/onap/aaf/auth/common/test/JU_Define.java | 4 +- .../org/onap/aaf/auth/env/test/JU_AuthzEnv.java | 2 +- .../aaf/auth/env/test/JU_AuthzTransFilter.java | 12 +- .../onap/aaf/auth/env/test/JU_AuthzTransImpl.java | 38 ++-- .../org/onap/aaf/auth/env/test/JU_NullTrans.java | 74 +++---- .../org/onap/aaf/auth/local/test/JU_AbsData.java | 20 +- .../org/onap/aaf/auth/local/test/JU_DataFile.java | 8 +- .../org/onap/aaf/auth/local/test/JU_TextIndex.java | 32 +-- .../auth/log4j/test/JU_Log4jAccessAppender.java | 26 +-- .../onap/aaf/auth/org/test/JU_Organization.java | 12 +- .../onap/aaf/auth/request/test/CredCompare.java | 8 +- .../aaf/auth/request/test/JU_RequestCheck.java | 6 +- .../onap/aaf/auth/request/test/MultiCompare.java | 14 +- .../aaf/auth/request/test/NSAttribCompare.java | 10 +- .../org/onap/aaf/auth/request/test/NSCompare.java | 8 +- .../onap/aaf/auth/request/test/PermCompare.java | 8 +- .../onap/aaf/auth/request/test/RoleCompare.java | 8 +- .../aaf/auth/request/test/RolePermCompare.java | 8 +- .../onap/aaf/auth/request/test/RosettaCompare.java | 20 +- .../aaf/auth/request/test/UserRoleCompare.java | 8 +- .../onap/aaf/auth/rserv/test/JU_BetterMatch.java | 32 +-- .../onap/aaf/auth/rserv/test/JU_BetterMatch1.java | 32 +-- .../onap/aaf/auth/rserv/test/JU_BetterRoute.java | 6 +- .../org/onap/aaf/auth/rserv/test/JU_Content.java | 226 ++++++++++----------- .../org/onap/aaf/auth/rserv/test/JU_Content1.java | 18 +- .../java/org/onap/aaf/auth/rserv/test/JU_Pair.java | 6 +- .../org/onap/aaf/auth/rserv/test/JU_Route.java | 12 +- .../onap/aaf/auth/rserv/test/JU_RouteReport.java | 4 +- .../org/onap/aaf/auth/rserv/test/JU_Routes.java | 20 +- .../org/onap/aaf/auth/rserv/test/JU_TypedCode.java | 26 +-- .../org/onap/aaf/auth/rserv/test/JU_Version.java | 16 +- .../onap/aaf/auth/server/test/JU_AbsService.java | 20 +- .../aaf/auth/server/test/JU_AbsServiceStarter.java | 32 +-- .../auth/server/test/JU_JettyServiceStarter.java | 10 +- .../java/org/onap/aaf/auth/util/test/JU_Mask.java | 12 +- .../java/org/onap/aaf/auth/util/test/TestKill.java | 6 +- 36 files changed, 402 insertions(+), 402 deletions(-) (limited to 'auth/auth-core/src/test/java/org/onap') diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/common/test/JU_Define.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/common/test/JU_Define.java index a94d82da..f572af35 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/common/test/JU_Define.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/common/test/JU_Define.java @@ -50,7 +50,7 @@ public class JU_Define { public void setUp() throws CadiException{ acc = mock(Access.class); } - + @Test public void testSet() throws CadiException { PropAccess prop = new PropAccess(); @@ -60,7 +60,7 @@ public class JU_Define { Define.set(prop); Define.ROOT_NS(); Define.ROOT_COMPANY(); - + PropAccess prop1 = new PropAccess(); prop1.setProperty(AAF_NS_DOT, AAF_NS_DOT); prop1.setProperty(Config.AAF_ROOT_NS, ".ns_Test"); diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_AuthzEnv.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_AuthzEnv.java index 817ec984..80d85fce 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_AuthzEnv.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_AuthzEnv.java @@ -146,7 +146,7 @@ public class JU_AuthzEnv { @Test public void testLog1() { - + Exception e = new Exception(); Object msgs = null; authzEnv.log(e, msgs); diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_AuthzTransFilter.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_AuthzTransFilter.java index ddb2d8c1..7ed2ba69 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_AuthzTransFilter.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_AuthzTransFilter.java @@ -7,9 +7,9 @@ * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at - * * + * * * * http://www.apache.org/licenses/LICENSE-2.0 - * * + * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -55,7 +55,7 @@ public class JU_AuthzTransFilter { @Mock private TrustChecker tcMock; @Mock private AuthzTrans authzTransMock; @Mock private Object additionalTafLurs; - + private PropAccess access; @Before @@ -66,7 +66,7 @@ public class JU_AuthzTransFilter { when(envMock.access()).thenReturn(access); } - + // TODO: These tests only work on the AT&T network. Fix them - Ian @Test public void testAuthenticated() throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException, CadiException { @@ -80,7 +80,7 @@ public class JU_AuthzTransFilter { // authenticatedMethod.setAccessible(true); // authenticatedMethod.invoke(aTF, authzTransMock, null); } - + @Test public void testTallyHo() throws CadiException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { // Slot specialLogSlot = authzEnvMock.slot("SPECIAL_LOG_SLOT"); @@ -107,5 +107,5 @@ public class JU_AuthzTransFilter { // when(authzTransMock.getUserPrincipal()).thenReturn(tPrin); // tallyHoMethod.invoke(aTF, authzTransMock); } - + } diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_AuthzTransImpl.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_AuthzTransImpl.java index af92e372..0c697bea 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_AuthzTransImpl.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_AuthzTransImpl.java @@ -7,9 +7,9 @@ * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at - * * + * * * * http://www.apache.org/licenses/LICENSE-2.0 - * * + * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -55,13 +55,13 @@ public class JU_AuthzTransImpl { @Mock AuthzEnv authzEnvMock; AuthzTransImpl trans1; - + private Organization org=null; private AuthzTransImpl mockAuthzTransImpl; private static HttpServletRequest req; private static HttpServletResponse res; private Lur lur1 = mock(Lur.class); - + @Before public void setUp(){ authzTransImpl = new AuthzTransImpl(authzEnvMock); @@ -71,9 +71,9 @@ public class JU_AuthzTransImpl { when(req.getParameter("request")).thenReturn("NotNull"); authzTransImpl.set(req,res); when(req.getParameter("request")).thenReturn(""); - authzTransImpl.set(req,res); + authzTransImpl.set(req,res); } - + @Test public void testOrg() { Organization result=null; @@ -82,15 +82,15 @@ public class JU_AuthzTransImpl { //result = OrganizationFactory.obtain(authzTransImpl.env(), authzTransImpl.user()); authzTransImpl.org(); //when(test).thenReturn(null); - //assertTrue(true); + //assertTrue(true); } - + @Mock LogTarget logTargetMock; - + @Test public void testLogAuditTrail(){ - + when(logTargetMock.isLoggable()).thenReturn(false); authzTransImpl.logAuditTrail(logTargetMock); when(logTargetMock.isLoggable()).thenReturn(true); @@ -98,7 +98,7 @@ public class JU_AuthzTransImpl { //when(logTargetMock.isLoggable()).thenReturn(true);//TODO: Figure this out //authzTransImpl.logAuditTrail(logTargetMock); } - + // @Test //TODO:Fix this AAF-111 // public void testSetUser() { // Principal user = mock(Principal.class); @@ -107,7 +107,7 @@ public class JU_AuthzTransImpl { // String username = user1.getName(); // Assert.assertNotNull(user1); // } - + // @Test //TODO:Fix this AAF-111 // public void testUser() { // Assert.assertEquals("n/a", authzTransImpl.user()); @@ -117,7 +117,7 @@ public class JU_AuthzTransImpl { // authzTransImpl.setUser(user); // Assert.assertEquals("name", authzTransImpl.user()); // } -// +// @Test public void testRequested() { REQD_TYPE user = REQD_TYPE.move; @@ -134,10 +134,10 @@ public class JU_AuthzTransImpl { when(req.getParameter(user1.name())).thenReturn("test"); authzTransImpl.requested(user,false); */ - - + + } - + @Test public void testFish() { mockAuthzTransImpl = mock(AuthzTransImpl.class); @@ -149,7 +149,7 @@ public class JU_AuthzTransImpl { authzTransImpl.setLur(lur1); authzTransImpl.fish(p); } - + @Test public void testSetVariables() { //TODO: refactor this better Assert.assertNull(authzTransImpl.agent()); @@ -160,12 +160,12 @@ public class JU_AuthzTransImpl { Assert.assertNull(authzTransImpl.getUserPrincipal()); Assert.assertNotNull(authzTransImpl.user()); } - + @Test public void testNow() { Date date = authzTransImpl.now(); Assert.assertEquals(date,authzTransImpl.now()); when(authzTransImpl.now()).thenReturn(null); } - + } diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_NullTrans.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_NullTrans.java index 9c7212c2..142317d1 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_NullTrans.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_NullTrans.java @@ -7,9 +7,9 @@ * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at - * * + * * * * http://www.apache.org/licenses/LICENSE-2.0 - * * + * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -48,65 +48,65 @@ import org.onap.aaf.misc.env.TimeTaken; @RunWith(MockitoJUnitRunner.class) public class JU_NullTrans { NullTrans nullTrans; - + @Before public void setUp(){ nullTrans = new NullTrans(); } - + @Test public void testAuditTrail() { Assert.assertNull(nullTrans.auditTrail(0, null, 0)); } - + @Test public void testSingleton() { AuthzTrans single = nullTrans.singleton(); Assert.assertTrue(single instanceof AuthzTrans); } - + @Test public void testCheckpoints() { nullTrans.checkpoint("Test"); nullTrans.checkpoint(null, 0); } - + @Test public void testFatal() { LogTarget log = nullTrans.fatal(); Assert.assertEquals(LogTarget.NULL, log); } - + @Test public void testError() { LogTarget log = nullTrans.error(); Assert.assertEquals(LogTarget.NULL, log); } - + @Test public void testAudit() { LogTarget log = nullTrans.audit(); Assert.assertEquals(LogTarget.NULL, log); } - + @Test public void testInit() { LogTarget log = nullTrans.init(); Assert.assertEquals(LogTarget.NULL, log); } - + @Test public void testWarn() { LogTarget log = nullTrans.warn(); Assert.assertEquals(LogTarget.NULL, log); } - + @Test public void testInfo() { LogTarget log = nullTrans.info(); Assert.assertEquals(LogTarget.NULL, log); } - + @Test public void testDebug() { LogTarget log = nullTrans.debug(); @@ -118,7 +118,7 @@ public class JU_NullTrans { LogTarget log = nullTrans.trace(); Assert.assertEquals(LogTarget.NULL, log); } - + @Test public void testStart() { TimeTaken test = nullTrans.start("test", 1); @@ -131,7 +131,7 @@ public class JU_NullTrans { s1 = s1.trim(); Assert.assertEquals(s,s1); } - + @Test public void testSetProperty() { String tag = "tag"; @@ -142,19 +142,19 @@ public class JU_NullTrans { String expectedTag = nullTrans.getProperty(tag); Assert.assertEquals(expectedTag, tag); } - + @Test public void testDecryptor() { Decryptor decry = nullTrans.decryptor(); Assert.assertNull(decry); } - + @Test public void testEncryptor() { Encryptor encry = nullTrans.encryptor(); Assert.assertNull(encry); } - + @Test public void testSet() { HttpServletRequest req = mock(HttpServletRequest.class); @@ -162,96 +162,96 @@ public class JU_NullTrans { AuthzTrans set = nullTrans.set(req,res); Assert.assertNull(set); } - + @Test public void testUser() { String user = nullTrans.user(); Assert.assertNull(user); } - + @Test public void testGetUserPrincipal() { Principal principal = nullTrans.getUserPrincipal(); Assert.assertNull(principal); } - + @Test public void testIp() { String ip = nullTrans.ip(); Assert.assertNull(ip); } - + @Test public void testMeth() { String meth = nullTrans.meth(); Assert.assertNull(meth); } - + @Test public void testPort() { int port = nullTrans.port(); Assert.assertEquals(port,0); } - + @Test public void testPath() { String path = nullTrans.path(); Assert.assertNull(path); } - + @Test public void testPut() { nullTrans.put(null, nullTrans); } - + @Test public void testSetUser() { Principal principal = mock(Principal.class); //nullTrans.setUser(principal); } - + @Test public void testSlot() { Slot slot = nullTrans.slot(null); Assert.assertNull(slot); } - + @Test public void testEnv() { AuthzEnv env = nullTrans.env(); Assert.assertNull(env); } - + @Test public void testAgent() { String agent = nullTrans.agent(); Assert.assertNull(agent); } - + @Test public void testSetLur() { nullTrans.setLur(null); } - + @Test public void testFish() { Permission perm = mock(Permission.class); Boolean fish = nullTrans.fish(perm); Assert.assertFalse(fish); } - + @Test public void testOrg() { Organization org = nullTrans.org(); Assert.assertEquals(Organization.NULL, org); } - + @Test public void testLogAuditTrail() { LogTarget lt = mock(LogTarget.class); nullTrans.logAuditTrail(lt); } - + @Test public void testRequested() { Boolean reqd = nullTrans.requested(null); @@ -266,7 +266,7 @@ public class JU_NullTrans { // Assert.assertEquals(date,nullTrans.now()); // //when(nullTrans.now()).thenReturn(null); // } - - - + + + } diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_AbsData.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_AbsData.java index 2bc7dfa0..86cb04bd 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_AbsData.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_AbsData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -54,16 +54,16 @@ public class JU_AbsData { String filePath = "test/output_.key"; File keyfile = new File(filePath); AuthzTrans trans = mock(AuthzTrans.class); - + private class AbsDataStub extends AbsData { - + public AbsDataStub(File dataf, char sepChar, int maxLineSize, int fieldOffset) { super(dataf, sepChar, maxLineSize, fieldOffset); // TODO Auto-generated constructor stub - + } - + } @Test @@ -81,18 +81,18 @@ public class JU_AbsData { AbsDataStub ads = new AbsDataStub(keyfile, character, 0, 0); ads.skipLines(0); ads.name(); - + long lng = 1823286886660L; //ads.open(trans, lng); keyfile.delete(); } - + @Test public void testClose() throws IOException { AbsDataStub ads = new AbsDataStub(keyfile, character, 0, 0); ads.close(trans); } - + @Test public void testReuse() throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { char character = 'x'; @@ -105,7 +105,7 @@ public class JU_AbsData { //reuse.pos(10); keyfile.delete(); } - + @Test public void testIter() throws IOException { AbsDataStub ads = new AbsDataStub(keyfile, character, 0, 0); diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_DataFile.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_DataFile.java index b0af89ce..8f0ff022 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_DataFile.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_DataFile.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -41,7 +41,7 @@ public class JU_DataFile { // public void netYetTested() { // fail("Tests not yet implemented"); // } - + // @Test // public void test() throws Exception { // File file = new File("../authz-batch/data/v1.dat"); @@ -52,7 +52,7 @@ public class JU_DataFile { // df.open(); // Token tok = df.new Token(1024000); // Field fld = tok.new Field('|'); -// +// // while (tok.nextLine()) { // ++count; // fld.reset(); diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_TextIndex.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_TextIndex.java index d4330296..30149cf4 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_TextIndex.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_TextIndex.java @@ -7,9 +7,9 @@ * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at - * * + * * * * http://www.apache.org/licenses/LICENSE-2.0 - * * + * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -63,20 +63,20 @@ public class JU_TextIndex { DataFile datafile; @Mock File file; - + private class AbsDataStub extends AbsData { - + public AbsDataStub(File dataf, char sepChar, int maxLineSize, int fieldOffset) { super(dataf, sepChar, maxLineSize, fieldOffset); // TODO Auto-generated constructor stub - + } - + } - + @Before - public void setUp() throws IOException{ + public void setUp() throws IOException{ char character = 'x'; String filePath = "test/output_key"; File keyfile = new File(filePath); @@ -87,31 +87,31 @@ public class JU_TextIndex { w.write("a\nsdfasdfxasdf" + i + "\n"); } w.close(); - + datafile = new DataFile(keyfile, "r"); datafile.open(); datafile = new DataFile(keyfile, "rws");// "S" for synchronized datafile.open(); - + trans = mock(Trans.class); TimeTaken ttMock = mock(TimeTaken.class); TimeTaken ttMock1 = mock(TimeTaken.class); when(trans.start("Open Files", Env.SUB)).thenReturn(ttMock); when(trans.start("Read", Env.SUB)).thenReturn(ttMock); - textIndex = new TextIndex(keyfile); + textIndex = new TextIndex(keyfile); textIndex.close(); textIndex.open(); //textIndex.create(trans, datafile, 4, character, 2, 0); //TODO: AAF-111 once actual input is aquired keyfile.delete(); - + iter = textIndex.new Iter(); } - + @Test public void testClose() throws IOException { textIndex.close(); } - + @Test public void testFind() throws IOException { char character = 'x'; @@ -121,13 +121,13 @@ public class JU_TextIndex { Reuse reuse = ads.reuse(); textIndex.find("a", reuse , 0); } - + @Test public void testIterNext() { iter.next(); iter.hasNext(); } - + @Test public void testIdx() throws ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { TextIndex outerObject = new TextIndex(file); diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/log4j/test/JU_Log4jAccessAppender.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/log4j/test/JU_Log4jAccessAppender.java index 8123a82d..551ff0df 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/log4j/test/JU_Log4jAccessAppender.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/log4j/test/JU_Log4jAccessAppender.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -40,26 +40,26 @@ public class JU_Log4jAccessAppender { @Mock Access access; - + @Before public void setUp() { initMocks(this); } - + @Test public void testRequiresLayout() { Log4JAccessAppender log4jObj = new Log4JAccessAppender(access); boolean retObj = log4jObj.requiresLayout(); assertFalse(retObj); } - + @Test public void testClose() { Log4JAccessAppender log4jObj = new Log4JAccessAppender(access); log4jObj.close(); - + } - + @Test public void testAppend() { Log4jAccessAppenderImpl log4jObj = new Log4jAccessAppenderImpl(access); @@ -71,7 +71,7 @@ public class JU_Log4jAccessAppender { event=new LoggingEvent("com.chililog.server.engine",Logger.getLogger(Log4JAccessAppender.class),(new Date()).getTime(),Level.ALL,"test",Thread.currentThread().getName(),null,null,null,null); log4jObj.append(event); } - + @Test public void testAppendWARN() { Log4jAccessAppenderImpl log4jObj = new Log4jAccessAppenderImpl(access); @@ -79,7 +79,7 @@ public class JU_Log4jAccessAppender { LoggingEvent event=new LoggingEvent("com.chililog.server.engine",Logger.getLogger(Log4JAccessAppender.class),(new Date()).getTime(),Level.WARN,"test",Thread.currentThread().getName(),null,null,null,null); log4jObj.append(event); } - + @Test public void testAppendINFO() { Log4jAccessAppenderImpl log4jObj = new Log4jAccessAppenderImpl(access); @@ -87,7 +87,7 @@ public class JU_Log4jAccessAppender { LoggingEvent event=new LoggingEvent("com.chililog.server.engine",Logger.getLogger(Log4JAccessAppender.class),(new Date()).getTime(),Level.INFO,"test",Thread.currentThread().getName(),null,null,null,null); log4jObj.append(event); } - + @Test public void testAppendWTrace() { Log4jAccessAppenderImpl log4jObj = new Log4jAccessAppenderImpl(access); @@ -95,18 +95,18 @@ public class JU_Log4jAccessAppender { LoggingEvent event=new LoggingEvent("com.chililog.server.engine",Logger.getLogger(Log4JAccessAppender.class),(new Date()).getTime(),Level.TRACE,"test",Thread.currentThread().getName(),null,null,null,null); log4jObj.append(event); } - + class Log4jAccessAppenderImpl extends Log4JAccessAppender{ public Log4jAccessAppenderImpl(Access access) { super(access); // TODO Auto-generated constructor stub } - + @Override protected void append(LoggingEvent event) { super.append(event); } - + } } diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/org/test/JU_Organization.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/org/test/JU_Organization.java index 3d2153e6..8302cad7 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/org/test/JU_Organization.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/org/test/JU_Organization.java @@ -7,9 +7,9 @@ * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at - * * + * * * * http://www.apache.org/licenses/LICENSE-2.0 - * * + * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -51,9 +51,9 @@ public class JU_Organization { gc = new GregorianCalendar(1900, 1, 1); trans = mock(AuthzTrans.class); } - + @Test - public void test() throws OrganizationException { + public void test() throws OrganizationException { //tests for Org null Assert.assertEquals("n/a",Organization.NULL.getName()); Assert.assertEquals("n/a",Organization.NULL.getDomain()); @@ -74,9 +74,9 @@ public class JU_Organization { Assert.assertEquals("Null Organization rejects all Policies",Organization.NULL.validate(trans, Policy.CHANGE_JOB, null, null)); Assert.assertFalse(Organization.NULL.isTestEnv()); Organization.NULL.setTestMode(true); - + //tests for org emailWarnings - Assert.assertTrue(Organization.NULL.emailWarningPolicy() instanceof EmailWarnings); + Assert.assertTrue(Organization.NULL.emailWarningPolicy() instanceof EmailWarnings); Assert.assertEquals(604800000L, Organization.NULL.emailWarningPolicy().credEmailInterval()); Assert.assertEquals(604800000L, Organization.NULL.emailWarningPolicy().roleEmailInterval()); Assert.assertEquals(259200000L, Organization.NULL.emailWarningPolicy().apprEmailInterval()); diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/CredCompare.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/CredCompare.java index 87a86d7c..ad11ae69 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/CredCompare.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/CredCompare.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -33,7 +33,7 @@ public class CredCompare extends RosettaCompare { public CredCompare() { super(CredRequest.class); } - + public static CredRequest create() { CredRequest rr = new CredRequest(); String in = instance(); @@ -46,7 +46,7 @@ public class CredCompare extends RosettaCompare { rr.setEnd(Chrono.timeStamp(gc)); return rr; } - + @Override public void compare(CredRequest t1, CredRequest t2) { assertEquals(t1.getId(),t2.getId()); diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/JU_RequestCheck.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/JU_RequestCheck.java index 832f5188..02263a9d 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/JU_RequestCheck.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/JU_RequestCheck.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -26,7 +26,7 @@ import org.onap.aaf.misc.env.APIException; import org.onap.aaf.misc.rosetta.env.RosettaEnv; public class JU_RequestCheck { - + @Test public void testNSRequest() throws APIException { RosettaEnv env = new RosettaEnv(); diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/MultiCompare.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/MultiCompare.java index 024a5237..803fff44 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/MultiCompare.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/MultiCompare.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -33,7 +33,7 @@ public class MultiCompare extends RosettaCompare { public MultiCompare() { super(MultiRequest.class); } - + @Override public MultiRequest newOne() { MultiRequest multi = new MultiRequest(); @@ -50,19 +50,19 @@ public class MultiCompare extends RosettaCompare { multi.getUserRoleRequest().add(UserRoleCompare.create()); multi.getRolePermRequest().add(RolePermCompare.create()); multi.getRolePermRequest().add(RolePermCompare.create()); - - + + GregorianCalendar gc = new GregorianCalendar(); multi.setStart(Chrono.timeStamp(gc)); gc.add(GregorianCalendar.MONTH, 1); multi.setEnd(Chrono.timeStamp(gc)); return multi; } - + public void compare(MultiRequest t1, MultiRequest t2) { new NSCompare().compare(t1.getNsRequest(), t2.getNsRequest()); // Will have to find by key for others. - + assertEquals(t1.getStart(),t2.getStart()); assertEquals(t1.getEnd(),t2.getEnd()); } diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/NSAttribCompare.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/NSAttribCompare.java index 0786c134..7f7b09ce 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/NSAttribCompare.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/NSAttribCompare.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -35,11 +35,11 @@ public class NSAttribCompare extends RosettaCompare { public NSAttribCompare() { super(NsAttribRequest.class); } - + public static NsAttribRequest create() { NsAttribRequest nar = new NsAttribRequest(); String in = instance(); - + nar.setNs("org.osaaf.ns"+in); Attrib attrib = new Attrib(); attrib.setKey("swm"); @@ -55,7 +55,7 @@ public class NSAttribCompare extends RosettaCompare { nar.setEnd(Chrono.timeStamp(gc)); return nar; } - + @Override public void compare(NsAttribRequest t1, NsAttribRequest t2) { assertEquals(t1.getNs(),t2.getNs()); diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/NSCompare.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/NSCompare.java index c3504216..a6a3e428 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/NSCompare.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/NSCompare.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -34,7 +34,7 @@ public class NSCompare extends RosettaCompare { public NSCompare() { super(NsRequest.class); } - + public static NsRequest create() { NsRequest nsr = new NsRequest(); String in = instance(); @@ -51,7 +51,7 @@ public class NSCompare extends RosettaCompare { nsr.setEnd(Chrono.timeStamp(gc)); return nsr; } - + @Override public void compare(NsRequest t1, NsRequest t2) { assertEquals(t1.getName(),t2.getName()); diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/PermCompare.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/PermCompare.java index 92e07655..f10c9013 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/PermCompare.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/PermCompare.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -33,7 +33,7 @@ public class PermCompare extends RosettaCompare { public PermCompare() { super(PermRequest.class); } - + public static PermRequest create() { PermRequest pr = new PermRequest(); String in = instance(); @@ -47,7 +47,7 @@ public class PermCompare extends RosettaCompare { pr.setEnd(Chrono.timeStamp(gc)); return pr; } - + @Override public void compare(PermRequest t1, PermRequest t2) { assertEquals(t1.getType(),t2.getType()); diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/RoleCompare.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/RoleCompare.java index 0a3a164c..b0c30e1c 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/RoleCompare.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/RoleCompare.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -33,7 +33,7 @@ public class RoleCompare extends RosettaCompare { public RoleCompare() { super(RoleRequest.class); } - + public static RoleRequest create() { RoleRequest rr = new RoleRequest(); String in = instance(); @@ -45,7 +45,7 @@ public class RoleCompare extends RosettaCompare { rr.setEnd(Chrono.timeStamp(gc)); return rr; } - + @Override public void compare(RoleRequest t1, RoleRequest t2) { assertEquals(t1.getName(),t2.getName()); diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/RolePermCompare.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/RolePermCompare.java index 24a84b53..73348d1b 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/RolePermCompare.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/RolePermCompare.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -34,7 +34,7 @@ public class RolePermCompare extends RosettaCompare { public RolePermCompare() { super(RolePermRequest.class); } - + public static RolePermRequest create() { RolePermRequest urr = new RolePermRequest(); String in = instance(); @@ -50,7 +50,7 @@ public class RolePermCompare extends RosettaCompare { urr.setEnd(Chrono.timeStamp(gc)); return urr; } - + @Override public void compare(RolePermRequest t1, RolePermRequest t2) { assertEquals(t1.getRole(),t2.getRole()); diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/RosettaCompare.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/RosettaCompare.java index 43703d29..c09ded28 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/RosettaCompare.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/RosettaCompare.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -31,36 +31,36 @@ import org.onap.aaf.misc.rosetta.env.RosettaEnv; public abstract class RosettaCompare { protected Class cls; private static int count = 0; - + public RosettaCompare(Class cls) { this.cls = cls; } - + public void run(RosettaEnv env) throws APIException { RosettaDF nsrDF = env.newDataFactory(cls); compare(nsrDF.newData().option(Data.PRETTY),newOne(),this); } - + private void compare(RosettaData rdt, T t, RosettaCompare comp) throws APIException { //System.out.println("########### Testing " + cls.getName() + " ##############"); String s = rdt.load(t).out(TYPE.JSON).asString(); //System.out.println(s); T t2 = rdt.in(TYPE.JSON).load(s).asObject(); comp.compare(t, t2); - + //System.out.println(); - + s = rdt.load(t).out(TYPE.XML).asString(); //System.out.println(s); t2 = rdt.in(TYPE.XML).load(s).asObject(); comp.compare(t, t2); } - + public synchronized static String instance() { return "_"+ ++count; } - + public abstract void compare(T t1, T t2); public abstract T newOne(); - + } \ No newline at end of file diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/UserRoleCompare.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/UserRoleCompare.java index af61e639..258c6568 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/UserRoleCompare.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/UserRoleCompare.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -33,7 +33,7 @@ public class UserRoleCompare extends RosettaCompare { public UserRoleCompare() { super(UserRoleRequest.class); } - + public static UserRoleRequest create() { UserRoleRequest urr = new UserRoleRequest(); String in = instance(); @@ -45,7 +45,7 @@ public class UserRoleCompare extends RosettaCompare { urr.setEnd(Chrono.timeStamp(gc)); return urr; } - + @Override public void compare(UserRoleRequest t1, UserRoleRequest t2) { assertEquals(t1.getUser(),t2.getUser()); diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_BetterMatch.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_BetterMatch.java index 031da2fa..98a213de 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_BetterMatch.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_BetterMatch.java @@ -7,9 +7,9 @@ * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at - * * + * * * * http://www.apache.org/licenses/LICENSE-2.0 - * * + * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -51,7 +51,7 @@ public class JU_BetterMatch { assertFalse(bm.match("/req/1.0.0/wilma/bambam")); assertFalse(bm.match("/not/valid/234")); assertFalse(bm.match("")); - + TimeTaken tt = trans.start("A", Env.SUB); TimeTaken tt2; int i = 0; @@ -66,8 +66,8 @@ public class JU_BetterMatch { } finally { tt.done(); } - - + + tt = trans.start("B", Env.SUB); i = 0; try { @@ -88,9 +88,9 @@ public class JU_BetterMatch { assertFalse(bm.match("/req/1.0.0/urn:fsdb,1.0,req,newreq/0x12345/xyx")); } finally { tt2.done(); - tt.done(); + tt.done(); } - + tt = trans.start("C", Env.SUB); i = 0; try { @@ -98,12 +98,12 @@ public class JU_BetterMatch { bm = new Match(url+":urn*"); tt2 = trans.start(Integer.toString(++i), Env.SUB); String value = "urn:fsdb,1.0,req,newreq/0x12345"; - + assertTrue(bm.match(url+value)); assertEquals("urn:fsdb,1.0,req,newreq/0x12345",bm.param(url+value, ":urn")); } finally { tt2.done(); - tt.done(); + tt.done(); } tt = trans.start("D", Env.SUB); @@ -117,7 +117,7 @@ public class JU_BetterMatch { assertFalse(bm.match("/req/1.0.0/urn:fsdb,1.0,req,newreq/")); } finally { tt2.done(); - tt.done(); + tt.done(); } tt = trans.start("E", Env.SUB); @@ -134,7 +134,7 @@ public class JU_BetterMatch { assertTrue(bm.match("this/1.0.0/urn:fsdb,1.0,req,newreq/0x12345/")); } finally { tt2.done(); - tt.done(); + tt.done(); } tt = trans.start("F", Env.SUB); @@ -145,20 +145,20 @@ public class JU_BetterMatch { assertTrue(bm.match("/this")); } finally { tt2.done(); - tt.done(); + tt.done(); } - + StringBuilder sb = new StringBuilder(); trans.auditTrail(0, sb); //System.out.println(sb); - + } - + @Test public void specialTest() { Match match = new Match("/sample"); assertTrue(match.match("/sample")); - + match = new Match("/lpeer//lpeer/:key/:item*"); assertTrue(match.match("/lpeer//lpeer/x/y")); assertFalse(match.match("/lpeer/x/lpeer/x/y")); diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_BetterMatch1.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_BetterMatch1.java index 2287889b..e95d626b 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_BetterMatch1.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_BetterMatch1.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -47,7 +47,7 @@ public class JU_BetterMatch1 { assertFalse(bm.match("/req/1.0.0/wilma/bambam")); assertFalse(bm.match("/not/valid/234")); assertFalse(bm.match("")); - + TimeTaken tt = trans.start("A", Env.SUB); TimeTaken tt2; int i = 0; @@ -62,8 +62,8 @@ public class JU_BetterMatch1 { } finally { tt.done(); } - - + + tt = trans.start("B", Env.SUB); i = 0; try { @@ -84,9 +84,9 @@ public class JU_BetterMatch1 { assertFalse(bm.match("/req/1.0.0/urn:fsdb,1.0,req,newreq/0x12345/xyx")); } finally { tt2.done(); - tt.done(); + tt.done(); } - + tt = trans.start("C", Env.SUB); i = 0; try { @@ -94,12 +94,12 @@ public class JU_BetterMatch1 { bm = new Match(url+":urn*"); tt2 = trans.start(Integer.toString(++i), Env.SUB); String value = "urn:fsdb,1.0,req,newreq/0x12345"; - + assertTrue(bm.match(url+value)); assertEquals("urn:fsdb,1.0,req,newreq/0x12345",bm.param(url+value, ":urn")); } finally { tt2.done(); - tt.done(); + tt.done(); } tt = trans.start("D", Env.SUB); @@ -113,7 +113,7 @@ public class JU_BetterMatch1 { assertFalse(bm.match("/req/1.0.0/urn:fsdb,1.0,req,newreq/")); } finally { tt2.done(); - tt.done(); + tt.done(); } tt = trans.start("E", Env.SUB); @@ -130,7 +130,7 @@ public class JU_BetterMatch1 { assertTrue(bm.match("this/1.0.0/urn:fsdb,1.0,req,newreq/0x12345/")); } finally { tt2.done(); - tt.done(); + tt.done(); } tt = trans.start("F", Env.SUB); @@ -141,20 +141,20 @@ public class JU_BetterMatch1 { assertTrue(bm.match("whatever/this")); } finally { tt2.done(); - tt.done(); + tt.done(); } - + StringBuilder sb = new StringBuilder(); trans.auditTrail(0, sb); //System.out.println(sb); - + } - + @Test public void specialTest() { Match match = new Match("/sample"); assertTrue(match.match("/sample")); - + match = new Match("/lpeer//lpeer/:key/:item*"); assertTrue(match.match("/lpeer//lpeer/x/y")); assertFalse(match.match("/lpeer/x/lpeer/x/y")); diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_BetterRoute.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_BetterRoute.java index 2fa6b5f8..04ddca2a 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_BetterRoute.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_BetterRoute.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -27,7 +27,7 @@ public class JU_BetterRoute { @Test public void test() { - + } } diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Content.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Content.java index 65cf9bc9..23c0ae80 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Content.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Content.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -41,7 +41,7 @@ import org.onap.aaf.misc.env.impl.EnvFactory; * Test the functioning of the "Content" class, which holds, and routes to the right code based on Accept values */ public class JU_Content { - + @Test public void test() throws Exception { @@ -78,7 +78,7 @@ public class JU_Content { //BogusReq req = new BogusReq(); //expected = (expected); //HttpServletResponse resp = new BogusResp(); - + assertNotNull("Same Content String and Accept String",ct.prep(trans,expected)); //expects Null (not run) @@ -103,35 +103,35 @@ public class JU_Content { expected = "application/java.lang.Boolean+xml;charset=UTF8;version=1.0"; assertNotNull("Minor Charset in Caps acceptable",ct.prep(trans,expected)); - // expects no run + // expects no run expected="application/java.lang.Boolean+xml;charset=MyType;version=1.0"; assertNull("Unknown Minor Charset",ct.prep(trans,expected)); expected=""; assertNotNull("Blank Acceptance",ct.prep(trans,expected)); - + expected=null; - assertNotNull("Null Acceptance",ct.prep(trans,expected)); + assertNotNull("Null Acceptance",ct.prep(trans,expected)); expected = ("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); assertNotNull("Matches application/xml, and other content not known",ct.prep(trans,expected)); - + // No SemiColon expected = ("i/am/bogus,application/xml"); assertNotNull("Match second entry, with no Semis",ct.prep(trans,expected)); - } finally { + } finally { StringBuilder sb = new StringBuilder(); trans.auditTrail(0, sb); //System.out.println(sb); } } -// +// // Original API used HTTPServletRequest and HTTPServletResponse. Due to the fact that sometimes we use Accept, and others Content-TYpe // I changed it to simply accept a string -// +// // Jonathan 3/8/2013 -// +// // @SuppressWarnings("rawtypes") // class BogusReq implements HttpServletRequest { // private String accept; @@ -159,175 +159,175 @@ public class JU_Content { // @Override // public void setCharacterEncoding(String env) // throws UnsupportedEncodingException { -// +// // // } // // @Override // public int getContentLength() { -// +// // return 0; // } // // @Override // public String getContentType() { -// +// // return null; // } // // @Override // public ServletInputStream getInputStream() throws IOException { -// +// // return null; // } // // @Override // public String getParameter(String name) { -// +// // return null; // } // // @Override // public Enumeration getParameterNames() { -// +// // return null; // } // // @Override // public String[] getParameterValues(String name) { -// +// // return null; // } // // @Override // public Map getParameterMap() { -// +// // return null; // } // // @Override // public String getProtocol() { -// +// // return null; // } // // @Override // public String getScheme() { -// +// // return null; // } // // @Override // public String getServerName() { -// +// // return null; // } // // @Override // public int getServerPort() { -// +// // return 0; // } // // @Override // public BufferedReader getReader() throws IOException { -// +// // return null; // } // // @Override // public String getRemoteAddr() { -// +// // return null; // } // // @Override // public String getRemoteHost() { -// +// // return null; // } // // @Override // public void setAttribute(String name, Object o) { -// +// // // } // // @Override // public void removeAttribute(String name) { -// +// // // } // // @Override // public Locale getLocale() { -// +// // return null; // } // // @Override // public Enumeration getLocales() { -// +// // return null; // } // // @Override // public boolean isSecure() { -// +// // return false; // } // // @Override // public RequestDispatcher getRequestDispatcher(String path) { -// +// // return null; // } // // @Override // public String getRealPath(String path) { -// +// // return null; // } // // @Override // public int getRemotePort() { -// +// // return 0; // } // // @Override // public String getLocalName() { -// +// // return null; // } // // @Override // public String getLocalAddr() { -// +// // return null; // } // // @Override // public int getLocalPort() { -// +// // return 0; // } // // @Override // public String getAuthType() { -// +// // return null; // } // // @Override // public Cookie[] getCookies() { -// +// // return null; // } // // @Override // public long getDateHeader(String name) { -// +// // return 0; // } // @@ -338,137 +338,137 @@ public class JU_Content { // // @Override // public Enumeration getHeaders(String name) { -// +// // return null; // } // // @Override // public Enumeration getHeaderNames() { -// +// // return null; // } // // @Override // public int getIntHeader(String name) { -// +// // return 0; // } // // @Override // public String getMethod() { -// +// // return null; // } // // @Override // public String getPathInfo() { -// +// // return null; // } // // @Override // public String getPathTranslated() { -// +// // return null; // } // // @Override // public String getContextPath() { -// +// // return null; // } // // @Override // public String getQueryString() { -// +// // return null; // } // // @Override // public String getRemoteUser() { -// +// // return null; // } // // @Override // public boolean isUserInRole(String role) { -// +// // return false; // } // // @Override // public Principal getUserPrincipal() { -// +// // return null; // } // // @Override // public String getRequestedSessionId() { -// +// // return null; // } // // @Override // public String getRequestURI() { -// +// // return null; // } // // @Override // public StringBuffer getRequestURL() { -// +// // return null; // } // // @Override // public String getServletPath() { -// +// // return null; // } // // @Override // public HttpSession getSession(boolean create) { -// +// // return null; // } // // @Override // public HttpSession getSession() { -// +// // return null; // } // // @Override // public boolean isRequestedSessionIdValid() { -// +// // return false; // } // // @Override // public boolean isRequestedSessionIdFromCookie() { -// +// // return false; // } // // @Override // public boolean isRequestedSessionIdFromURL() { -// +// // return false; // } // // @Override // public boolean isRequestedSessionIdFromUrl() { -// +// // return false; // } // } -// +// // public class BogusResp implements HttpServletResponse { // public String contentType; // // @Override // public String getCharacterEncoding() { -// +// // return null; // } // @@ -479,26 +479,26 @@ public class JU_Content { // // @Override // public ServletOutputStream getOutputStream() throws IOException { -// +// // return null; // } // // @Override // public PrintWriter getWriter() throws IOException { -// +// // return null; // } // // @Override // public void setCharacterEncoding(String charset) { -// -// +// +// // } // // @Override // public void setContentLength(int len) { -// -// +// +// // } // // @Override @@ -508,154 +508,154 @@ public class JU_Content { // // @Override // public void setBufferSize(int size) { -// -// +// +// // } // // @Override // public int getBufferSize() { -// +// // return 0; // } // // @Override // public void flushBuffer() throws IOException { -// -// +// +// // } // // @Override // public void resetBuffer() { -// -// +// +// // } // // @Override // public boolean isCommitted() { -// +// // return false; // } // // @Override // public void reset() { -// -// +// +// // } // // @Override // public void setLocale(Locale loc) { -// -// +// +// // } // // @Override // public Locale getLocale() { -// +// // return null; // } // // @Override // public void addCookie(Cookie cookie) { -// -// +// +// // } // // @Override // public boolean containsHeader(String name) { -// +// // return false; // } // // @Override // public String encodeURL(String url) { -// +// // return null; // } // // @Override // public String encodeRedirectURL(String url) { -// +// // return null; // } // // @Override // public String encodeUrl(String url) { -// +// // return null; // } // // @Override // public String encodeRedirectUrl(String url) { -// +// // return null; // } // // @Override // public void sendError(int sc, String msg) throws IOException { -// -// +// +// // } // // @Override // public void sendError(int sc) throws IOException { -// -// +// +// // } // // @Override // public void sendRedirect(String location) throws IOException { -// -// +// +// // } // // @Override // public void setDateHeader(String name, long date) { -// -// +// +// // } // // @Override // public void addDateHeader(String name, long date) { -// -// +// +// // } // // @Override // public void setHeader(String name, String value) { -// -// +// +// // } // // @Override // public void addHeader(String name, String value) { -// -// +// +// // } // // @Override // public void setIntHeader(String name, int value) { -// -// +// +// // } // // @Override // public void addIntHeader(String name, int value) { -// -// +// +// // } // // @Override // public void setStatus(int sc) { -// -// +// +// // } // // @Override // public void setStatus(int sc, String sm) { -// -// +// +// // } -// +// // } // } diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Content1.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Content1.java index eb2fe359..b6f220c9 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Content1.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Content1.java @@ -7,9 +7,9 @@ * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at - * * + * * * * http://www.apache.org/licenses/LICENSE-2.0 - * * + * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -42,7 +42,7 @@ import org.onap.aaf.misc.env.impl.EnvFactory; * Test the functioning of the "Content" class, which holds, and routes to the right code based on Accept values */ public class JU_Content1 { - + @Test public void test() throws Exception { @@ -79,7 +79,7 @@ public class JU_Content1 { //BogusReq req = new BogusReq(); //expected = (expected); //HttpServletResponse resp = new BogusResp(); - + assertNotNull("Same Content String and Accept String",ct.prep(trans,expected)); //expects Null (not run) @@ -104,24 +104,24 @@ public class JU_Content1 { expected = "application/java.lang.Boolean+xml;charset=UTF8;version=1.0"; assertNotNull("Minor Charset in Caps acceptable",ct.prep(trans,expected)); - // expects no run + // expects no run expected="application/java.lang.Boolean+xml;charset=MyType;version=1.0"; assertNull("Unknown Minor Charset",ct.prep(trans,expected)); expected=""; assertNotNull("Blank Acceptance",ct.prep(trans,expected)); - + expected=null; - assertNotNull("Null Acceptance",ct.prep(trans,expected)); + assertNotNull("Null Acceptance",ct.prep(trans,expected)); expected = ("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); assertNotNull("Matches application/xml, and other content not known",ct.prep(trans,expected)); - + // No SemiColon expected = ("i/am/bogus,application/xml"); assertNotNull("Match second entry, with no Semis",ct.prep(trans,expected)); - } finally { + } finally { StringBuilder sb = new StringBuilder(); trans.auditTrail(0, sb); //System.out.println(sb); diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Pair.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Pair.java index b81966db..84383ce5 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Pair.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Pair.java @@ -7,9 +7,9 @@ * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at - * * + * * * * http://www.apache.org/licenses/LICENSE-2.0 - * * + * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -34,7 +34,7 @@ public class JU_Pair { Pair pair; Integer x; Integer y; - + @Before public void setUp(){ pair = new Pair(1, 2); diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Route.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Route.java index 26ec6abf..b8fd01c2 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Route.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Route.java @@ -7,9 +7,9 @@ * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at - * * + * * * * http://www.apache.org/licenses/LICENSE-2.0 - * * + * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -37,20 +37,20 @@ public class JU_Route { HttpCode httpCode; HttpMethods httpMethod; Trans trans; - + @Before public void setUp() { //TODO: AAF-111 complete when actual input is provided //httpMethod = Matchers.any(HttpMethods.class); //when(httpMethod.name()).thenReturn("test"); // route = new Route(null,"path/to/place"); } - - + + @Test public void testAdd() { // route.add(httpCode, "path/to/place"); } - + @Test public void testStart() { // trans = mock(Trans.class); diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_RouteReport.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_RouteReport.java index fffd3944..12b00858 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_RouteReport.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_RouteReport.java @@ -7,9 +7,9 @@ * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at - * * + * * * * http://www.apache.org/licenses/LICENSE-2.0 - * * + * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Routes.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Routes.java index 9606d472..b5538b99 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Routes.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Routes.java @@ -7,9 +7,9 @@ * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at - * * + * * * * http://www.apache.org/licenses/LICENSE-2.0 - * * + * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -49,25 +49,25 @@ public class JU_Routes { //TODO: Gabe [JUnit] Not visible to junit //CodeSetter codeSetterMock; Route routeObj; - + @Before public void setUp(){ routes = new Routes(); } - + @Test public void testRouteReport(){ - List listVal = routes.routeReport(); + List listVal = routes.routeReport(); assertNotNull(listVal); } - + @Test public void testDerive() throws IOException, ServletException{ routeObj = routes.derive(reqMock, null); - + } - - - + + + } diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_TypedCode.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_TypedCode.java index 76948ac6..60727b6a 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_TypedCode.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_TypedCode.java @@ -7,9 +7,9 @@ * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at - * * + * * * * http://www.apache.org/licenses/LICENSE-2.0 - * * + * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -50,31 +50,31 @@ public class JU_TypedCode { TypedCode typedCode; @Mock RouteReport routeReportMock; - + @Before public void setUp(){ typedCode = new TypedCode(); } - + @Test public void testFirst(){ String returnVal = typedCode.first(); assertNull(returnVal); } - + @Test public void testAdd() { HttpCode code = mock(HttpCode.class); typedCode.add(code , "test", "test1", "test2"); } - + @Test public void testPrep() throws IOException, ServletException, ClassNotFoundException { Trans trans = mock(Trans.class); TimeTaken time = new TimeTaken("yell", 2) { @Override public void output(StringBuilder sb) { - // TODO Auto-generated method stub + // TODO Auto-generated method stub } }; when(trans.start(";na=me;,prop", 8)).thenReturn(time); @@ -83,20 +83,20 @@ public class JU_TypedCode { code.isAuthorized(null); //Testing httpcode, currently not working code.no_cache(); code.toString(); - + typedCode.add(code , ""); typedCode.prep(null , "q"); - + typedCode.add(code , "t"); typedCode.prep(trans , null); - + typedCode.add(code , "t"); typedCode.prep(trans , ""); - + typedCode.add(code, "POST /authn/validate application/CredRequest+json;charset=utf-8;version=2.0,application/json;version=2.0,*/*"); - //typedCode.prep(trans , "POST /authn/validate application/CredRequest+json;charset=utf-8;version=2.0,application/json;version=2.0,*/*"); + //typedCode.prep(trans , "POST /authn/validate application/CredRequest+json;charset=utf-8;version=2.0,application/json;version=2.0,*/*"); } - + @Test public void testRelatedTo() { HttpCode code = mock(HttpCode.class); diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Version.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Version.java index 47be1acb..a1bbef5a 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Version.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Version.java @@ -7,9 +7,9 @@ * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at - * * + * * * * http://www.apache.org/licenses/LICENSE-2.0 - * * + * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -38,7 +38,7 @@ public class JU_Version { Version version; Version versionTest; - + @Before public void setUp(){ version = new Version("first\\.123"); @@ -46,7 +46,7 @@ public class JU_Version { } @Test - public void testEquals(){ + public void testEquals(){ version.equals(versionTest); versionTest.equals(version); versionTest = new Version("fail\\.124"); @@ -54,16 +54,16 @@ public class JU_Version { version.equals("This is not an object of version"); versionTest = new Version("NoVersion\\.number"); version.equals(versionTest); - - + + } - + @Test public void testToString(){ String strVal = version.toString(); assertNotNull(strVal); } - + @Test public void testHashCode() { Assert.assertNotNull(version.hashCode()); diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsService.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsService.java index b89e2e5d..c80c8187 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsService.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsService.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -63,9 +63,9 @@ import java.security.Principal; import javax.servlet.Filter; public class JU_AbsService { - + ByteArrayOutputStream outStream; - + private class AbsServiceStub extends AbsService { public AbsServiceStub(Access access, BasicEnv env) throws CadiException { @@ -84,31 +84,31 @@ public class JU_AbsService { // TODO Auto-generated method stub return null; } - + } - + @Before public void setUp() { outStream = new ByteArrayOutputStream(); System.setOut(new PrintStream(outStream)); } - + @After public void tearDown() { System.setOut(System.out); } - + @Test public void testStub() throws CadiException { BasicEnv bEnv = new BasicEnv(); PropAccess prop = new PropAccess(); - + prop.setProperty(Config.AAF_LOCATOR_ENTRIES, "te.st"); prop.setProperty(Config.AAF_LOCATOR_VERSION, "te.st"); prop.setLogLevel(Level.DEBUG); AbsServiceStub absServiceStub = new AbsServiceStub(prop, bEnv); //Testing other branches requires "fails" due to exception handling, will leave that off for now. } - + } 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 4972b572..9e0cd9af 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 @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -42,11 +42,11 @@ import org.onap.aaf.cadi.register.Registrant; import org.onap.aaf.misc.env.impl.BasicEnv; public class JU_AbsServiceStarter { - + ByteArrayOutputStream outStream; AbsServiceStub absServiceStub; AbsServiceStarterStub absServiceStarterStub; - + private class AbsServiceStarterStub extends AbsServiceStarter { public AbsServiceStarterStub(AbsService service, boolean secure) { @@ -57,16 +57,16 @@ public class JU_AbsServiceStarter { @Override public void _start(RServlet rserv) throws Exception { // TODO Auto-generated method stub - + } @Override public void _propertyAdjustment() { // TODO Auto-generated method stub - + } } - + private class AbsServiceStub extends AbsService { public AbsServiceStub(Access access, BasicEnv env) throws CadiException { @@ -85,40 +85,40 @@ public class JU_AbsServiceStarter { // TODO Auto-generated method stub return null; } - + } - + @Before public void setUp() { outStream = new ByteArrayOutputStream(); System.setOut(new PrintStream(outStream)); } - + @After public void tearDown() { System.setOut(System.out); } - - + + @Test public void testStub() throws CadiException { BasicEnv bEnv = new BasicEnv(); PropAccess prop = new PropAccess(); - + prop.setProperty(Config.AAF_LOCATOR_ENTRIES, "te.st"); prop.setProperty(Config.AAF_LOCATOR_VERSION, "te.st"); prop.setLogLevel(Level.DEBUG); absServiceStub = new AbsServiceStub(prop, bEnv); - + absServiceStarterStub = new AbsServiceStarterStub(absServiceStub,true); } - + // @Test // public void testStart() throws Exception { // absServiceStarterStub.env(); // absServiceStarterStub.start(); // } - + } diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_JettyServiceStarter.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_JettyServiceStarter.java index ae76de0f..68077c7c 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_JettyServiceStarter.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_JettyServiceStarter.java @@ -7,9 +7,9 @@ * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at - * * + * * * * http://www.apache.org/licenses/LICENSE-2.0 - * * + * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -76,18 +76,18 @@ public class JU_JettyServiceStarter { @Before public void setUp() throws OrganizationException, CadiException { Access access = mock(Access.class); - + BasicEnv bEnv = mock(BasicEnv.class); Trans trans = mock(Trans.class); //TODO: Fix this once Gabe has services running to see correct output without mock //TestService testService = new TestService(access, bEnv); //jss = new JettyServiceStarter(testService); } - + // @Test // public void netYetTested() { // fail("Tests not yet implemented"); // } - + @Test public void testPropertyAdjustment() { //jss._propertyAdjustment(); diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/util/test/JU_Mask.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/util/test/JU_Mask.java index 5bc1b68d..f887ca40 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/util/test/JU_Mask.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/util/test/JU_Mask.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -40,12 +40,12 @@ public class JU_Mask { InetAddress ia = InetAddress.getByName("192.168.0.0"); NetMask mask = new NetMask(ia.getAddress()); assertTrue(mask.isInNet(ia.getAddress())); - + mask = new NetMask("192.168.1/24"); assertTrue(mask.isInNet("192.168.1.20")); assertTrue(mask.isInNet("192.168.1.255")); assertFalse(mask.isInNet("192.168.2.20")); - + mask = new NetMask("192.168.1/31"); assertFalse(mask.isInNet("192.168.2.20")); assertFalse(mask.isInNet("192.168.1.20")); @@ -56,10 +56,10 @@ public class JU_Mask { assertTrue(mask.isInNet("192.168.1.1")); assertTrue(mask.isInNet("192.1.1.1")); assertFalse(mask.isInNet("193.168.1.1")); - + mask = new NetMask("/0"); assertTrue(mask.isInNet("193.168.1.1")); - + String msg = "Should throw " + MaskFormatException.class.getSimpleName(); try { mask = new NetMask("256.256.256.256"); diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/util/test/TestKill.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/util/test/TestKill.java index 40e1886e..754d476f 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/util/test/TestKill.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/util/test/TestKill.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -52,7 +52,7 @@ public class TestKill implements Runnable { @Override public void run() { } - + private void longProcess() { System.out.println("Starting long cleanup process"); try { -- cgit 1.2.3-korg