diff options
author | Venkata Harish K Kajur <vk250x@att.com> | 2017-05-25 10:34:57 -0400 |
---|---|---|
committer | Venkata Harish K Kajur <vk250x@att.com> | 2017-05-25 10:38:05 -0400 |
commit | 379bb1213239e8f272f3ced0a8c2a2937a594dc0 (patch) | |
tree | d6bb695500b6aed82320ba61b43c84506ea0155b /aai-resources/src/test | |
parent | 16ea5afacc6140573ff431bf5622a6c8cc07925b (diff) |
Remove the unnecessary files that are duplicated
Change-Id: I52fbaceb47d609003b2decf9f0467fcf6e6ac755
Signed-off-by: Venkata Harish K Kajur <vk250x@att.com>
Diffstat (limited to 'aai-resources/src/test')
3 files changed, 0 insertions, 293 deletions
diff --git a/aai-resources/src/test/java/org/openecomp/aai/util/CNNameTest.java b/aai-resources/src/test/java/org/openecomp/aai/util/CNNameTest.java deleted file mode 100644 index 8f3cfa5..0000000 --- a/aai-resources/src/test/java/org/openecomp/aai/util/CNNameTest.java +++ /dev/null @@ -1,138 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * org.openecomp.aai - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.aai.util; - -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.when; - -import java.security.cert.X509Certificate; - -import javax.security.auth.x500.X500Principal; -import javax.servlet.http.HttpServletRequest; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.mockito.Mockito; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.agent.PowerMockAgent; -import org.powermock.modules.junit4.rule.PowerMockRule; - -import ch.qos.logback.access.spi.IAccessEvent; - -@PowerMockIgnore("javax.security.auth.x500.X500Principal") -@PrepareForTest({IAccessEvent.class, HttpServletRequest.class, X509Certificate.class}) -public class CNNameTest { - - @Rule - public PowerMockRule rule = new PowerMockRule(); - - static { - PowerMockAgent.initializeIfNeeded(); - } - - - IAccessEvent mockAccEvent; - HttpServletRequest mockHttpServletRequest; - org.openecomp.aai.logging.CNName cnname; - X509Certificate cert; - - /** - * Initialize. - */ - @Before - public void initialize(){ - mockAccEvent = Mockito.mock(IAccessEvent.class); - mockHttpServletRequest = Mockito.mock(HttpServletRequest.class); - cert = Mockito.mock(X509Certificate.class); - } - - - /** - * Test 'convert' when there is no AccessConverter. - */ - @Test - public void testConvert_withoutAccessConverter(){ - cnname = getTestObj(false); - assertTrue("Conversion failed with no AccessConverter", "INACTIVE_HEADER_CONV".equals(cnname.convert(mockAccEvent))); - } - - /** - * Test 'convert' with no CipherSuite. - */ - @Test - public void testConvert_withNullCipherSuite(){ - setupForCipherSuite(null); - assertTrue("Conversion failed for a null CipherSuite", "-".equals(cnname.convert(mockAccEvent))); - } - - - /** - * Test 'convert' with a non-null CipherSuite. - */ - @Test - public void testConvert_withNotNullCipherSuite(){ - - setupForCipherSuite("StrRepOfAValidSuite"); - - final X500Principal principal = new X500Principal("CN=AnAI, OU=DOX, O=BWS, C=CA"); - - Mockito.when(cert.getSubjectX500Principal()).thenReturn(principal); - - final X509Certificate[] certChain = {cert}; - - when(mockHttpServletRequest.getAttribute("javax.servlet.request.X509Certificate")).thenReturn(certChain); - - assertTrue("Conversion failed for a valid CipherSuite", principal.toString().equals(cnname.convert(mockAccEvent))); - } - - - /** - * Helper method to mock IAccessEvent and HttpServletRequest. - * - * @param suite CipherSuite to be used in current test - */ - private void setupForCipherSuite(String suite){ - cnname = getTestObj(true); - when(mockAccEvent.getRequest()).thenReturn(mockHttpServletRequest); - when(mockHttpServletRequest.getAttribute("javax.servlet.request.cipher_suite")).thenReturn(suite); - } - - - /** - * Helper method to create a CNName object with overridden 'start status' . - * - * @param instanceStarted Start status to be used - * @return CNName object to test - */ - private org.openecomp.aai.logging.CNName getTestObj(final boolean instanceStarted){ - return new org.openecomp.aai.logging.CNName(){ - @Override - public boolean isStarted(){ - return instanceStarted; - } - }; - } -} - - - diff --git a/aai-resources/src/test/java/org/openecomp/aai/util/CustomLogPatternLayoutTest.java b/aai-resources/src/test/java/org/openecomp/aai/util/CustomLogPatternLayoutTest.java deleted file mode 100644 index e087108..0000000 --- a/aai-resources/src/test/java/org/openecomp/aai/util/CustomLogPatternLayoutTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * org.openecomp.aai - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.aai.util; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import org.openecomp.aai.logging.CNName; -import org.openecomp.aai.logging.CustomLogPatternLayout; -import org.junit.Test; - -public class CustomLogPatternLayoutTest { - - /** - * Test null when defaultConverterMap doesn't have corresponding entry. - */ - @Test - public void testNull(){ - String s = CustomLogPatternLayout.defaultConverterMap.get("z"); - assertFalse("Entry not found for key 'z'", CNName.class.getName().equals(s)); - } - - /** - * Test defaultConverterMap when valid entry exists. - */ - @Test - public void testEntryFor_Z(){ - CustomLogPatternLayout layout = new CustomLogPatternLayout(); - String s = CustomLogPatternLayout.defaultConverterMap.get("z"); - assertTrue("Entry not found for key 'z'", org.openecomp.aai.logging.CNName.class.getName().equals(s)); - } - -} diff --git a/aai-resources/src/test/java/org/openecomp/aai/workarounds/LegacyURITransformerTest.java b/aai-resources/src/test/java/org/openecomp/aai/workarounds/LegacyURITransformerTest.java deleted file mode 100644 index 25dc648..0000000 --- a/aai-resources/src/test/java/org/openecomp/aai/workarounds/LegacyURITransformerTest.java +++ /dev/null @@ -1,104 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * org.openecomp.aai - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.aai.workarounds; - -import static org.junit.Assert.assertEquals; - -import java.io.File; -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; - -import org.junit.BeforeClass; -import org.junit.Test; - -import org.openecomp.aai.introspection.Version; - - -public class LegacyURITransformerTest { - - private LegacyURITransformer uriTransformer = LegacyURITransformer.getInstance(); - private String fromSuccess = "http://myhostname.com:8443/aai/{version}/cloud-infrastructure/tenants/tenant/key1/vservers/vserver/key2"; - private String toSuccess = "http://myhostname.com:8443/aai/servers/{version}/key1/vservers/key2"; - - /** - * Configure. - */ - @BeforeClass - public static void configure() { - System.setProperty("AJSC_HOME", "."); - System.setProperty("BUNDLECONFIG_DIR", "bundleconfig-local"); - } - - - /** - * Test spec. - * - * @param version the version - * @param toExpected the to expected - * @param fromExpected the from expected - * @throws URISyntaxException - * @throws MalformedURLException the malformed URL exception - */ - public void testSpec(Version version, String toExpected, String fromExpected) throws URISyntaxException { - - URI toExpectedUri = new URI(toExpected.replace("{version}",version.toString())); - URI fromExpectedUri = new URI(fromExpected.replace("{version}",version.toString())); - - URI result = toLegacyURISpec(version, fromExpectedUri); - - assertEquals("to", toExpectedUri, result); - - result = fromLegacyURISpec(version, toExpectedUri); - - assertEquals("from", fromExpectedUri, result); - } - - - /** - * To legacy URL spec. - * - * @param version the version - * @param url the url - * @return the url - * @throws URISyntaxException - * @throws MalformedURLException the malformed URL exception - */ - public URI toLegacyURISpec(Version version, URI uri) throws URISyntaxException { - return uri; - } - - /** - * From legacy URL spec. - * - * @param version the version - * @param url the url - * @return the url - * @throws URISyntaxException - * @throws MalformedURLException the malformed URL exception - */ - public URI fromLegacyURISpec(Version version, URI uri) throws URISyntaxException { - return uri; - } - - -} |