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 | |
parent | 16ea5afacc6140573ff431bf5622a6c8cc07925b (diff) |
Remove the unnecessary files that are duplicated
Change-Id: I52fbaceb47d609003b2decf9f0467fcf6e6ac755
Signed-off-by: Venkata Harish K Kajur <vk250x@att.com>
7 files changed, 0 insertions, 807 deletions
diff --git a/aai-resources/bundleconfig-local/etc/appprops/dupeTool-logback.xml b/aai-resources/bundleconfig-local/etc/appprops/dupeTool-logback.xml deleted file mode 100644 index aa5bd2e..0000000 --- a/aai-resources/bundleconfig-local/etc/appprops/dupeTool-logback.xml +++ /dev/null @@ -1,62 +0,0 @@ -<configuration> - <property name="logDirectory" value="${AJSC_HOME}/logs" /> - - <appender name="dupeToollog" class="ch.qos.logback.classic.sift.SiftingAppender"> - <filter class="ch.qos.logback.classic.filter.LevelFilter"> - <level>INFO</level> - <onMatch>ACCEPT</onMatch> - <onMismatch>DENY</onMismatch> - </filter> - <!-- This is MDC value --> - <!-- We will assign a value to 'logFilenameAppender' via Java code --> - <discriminator> - <key>logFilenameAppender</key> - <defaultValue>undefined</defaultValue> - </discriminator> - <sift> - <!-- A standard RollingFileAppender, the log file is based on 'logFileName' - at runtime --> - <appender name="FILE-${logFilenameAppender}" - class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${logDirectory}/dupeTool/${logFilenameAppender}.log</file> - <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <fileNamePattern>${logDirectory}/dupeTool/${logFilenameAppender}.log.%d{yyyy-MM-dd} - </fileNamePattern> - </rollingPolicy> - <encoder> - <pattern>%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%m%n</pattern> - </encoder> - </appender> - </sift> - </appender> - - <logger name="org.reflections" level="ERROR" additivity="false"> - <appender-ref ref="dupeToollog" /> - </logger> - <logger name="org.apache.zookeeper" level="ERROR" additivity="false"> - <appender-ref ref="dupeToollog" /> - </logger> - <logger name="org.apache.hadoop" level="ERROR" additivity="false"> - <appender-ref ref="dupeToollog" /> - </logger> - <logger name="com.thinkaurelius" level="ERROR" additivity="false"> - <appender-ref ref="dupeToollog" /> - </logger> - <logger name="ch.qos.logback.classic" level="ERROR" additivity="false"> - <appender-ref ref="dupeToollog" /> - </logger> - <logger name="ch.qos.logback.core" level="ERROR" additivity="false"> - <appender-ref ref="dupeToollog" /> - </logger> - <logger name="com.att.eelf" level="ERROR" additivity="false"> - <appender-ref ref="dupeToollog" /> - </logger> - <logger name="org.openecomp.aai" level="ERROR" additivity="false"> - <appender-ref ref="dupeToollog" /> - </logger> - - - <root level="INFO"> - <appender-ref ref="dupeToollog" /> - </root> -</configuration>
\ No newline at end of file diff --git a/aai-resources/bundleconfig-local/etc/appprops/notifysdnctool-logback.xml b/aai-resources/bundleconfig-local/etc/appprops/notifysdnctool-logback.xml deleted file mode 100644 index 4559557..0000000 --- a/aai-resources/bundleconfig-local/etc/appprops/notifysdnctool-logback.xml +++ /dev/null @@ -1,93 +0,0 @@ -<configuration> - <property name="logDirectory" value="${AJSC_HOME}/logs" /> - - <appender name="notifySDNCTool" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> - <level>WARN</level> - </filter> - <File>${logDirectory}/notifySDNCTool/error.log</File> - <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <fileNamePattern>${logDirectory}/notifySDNCTool/error.log.%d{yyyy-MM-dd}</fileNamePattern> - </rollingPolicy> - <encoder> - <pattern>%m%n</pattern> - </encoder> - </appender> - - <appender name="notifySDNCTooldebug" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <filter class="ch.qos.logback.classic.filter.LevelFilter"> - <level>DEBUG</level> - <onMatch>ACCEPT</onMatch> - <onMismatch>DENY</onMismatch> - </filter> - <File>${logDirectory}/notifySDNCTool/debug.log</File> - <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <fileNamePattern>${logDirectory}/notifySDNCTool/debug.log.%d{yyyy-MM-dd}</fileNamePattern> - </rollingPolicy> - <encoder> - <pattern>%m%n</pattern> - </encoder> - </appender> - - <appender name="notifySDNCToolmetric" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <filter class="ch.qos.logback.classic.filter.LevelFilter"> - <level>INFO</level> - <onMatch>ACCEPT</onMatch> - <onMismatch>DENY</onMismatch> - </filter> - <File>${logDirectory}/notifySDNCTool/metrics.log</File> - <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <fileNamePattern>${logDirectory}/notifySDNCTool/metrics.log.%d{yyyy-MM-dd}</fileNamePattern> - </rollingPolicy> - <encoder> - <pattern>%m%n</pattern> - </encoder> - </appender> - - <logger name="org.reflections" level="WARN" additivity="false"> - <appender-ref ref="notifySDNCTool"/> - <appender-ref ref="notifySDNCTooldebug"/> - <appender-ref ref="notifySDNCToolmetric"/> - </logger> - <logger name="org.apache.zookeeper" level="WARN" additivity="false"> - <appender-ref ref="notifySDNCTool"/> - <appender-ref ref="notifySDNCTooldebug"/> - <appender-ref ref="notifySDNCToolmetric"/> - </logger> - <logger name="org.apache.hadoop" level="WARN" additivity="false"> - <appender-ref ref="notifySDNCTool"/> - <appender-ref ref="notifySDNCTooldebug"/> - <appender-ref ref="notifySDNCToolmetric"/> - </logger> - <logger name="com.thinkaurelius" level="WARN" additivity="false"> - <appender-ref ref="notifySDNCTool"/> - <appender-ref ref="notifySDNCTooldebug"/> - <appender-ref ref="notifySDNCToolmetric"/> - </logger> - <logger name="ch.qos.logback.classic" level="WARN" additivity="false"> - <appender-ref ref="notifySDNCTool"/> - <appender-ref ref="notifySDNCTooldebug"/> - <appender-ref ref="notifySDNCToolmetric"/> - </logger> - <logger name="ch.qos.logback.core" level="WARN" additivity="false"> - <appender-ref ref="notifySDNCTool"/> - <appender-ref ref="notifySDNCTooldebug"/> - <appender-ref ref="notifySDNCToolmetric"/> - </logger> - <logger name="com.att.eelf" level="WARN" additivity="false"> - <appender-ref ref="notifySDNCTool"/> - <appender-ref ref="notifySDNCTooldebug"/> - <appender-ref ref="notifySDNCToolmetric"/> - </logger> - <logger name="org.openecomp.aai" level="INFO" additivity="false"> - <appender-ref ref="notifySDNCTool"/> - <appender-ref ref="notifySDNCTooldebug"/> - <appender-ref ref="notifySDNCToolmetric"/> - </logger> - - <root level="INFO"> - <appender-ref ref="notifySDNCTool"/> - <appender-ref ref="notifySDNCTooldebug"/> - <appender-ref ref="notifySDNCToolmetric"/> - </root> -</configuration> diff --git a/aai-resources/src/main/java/org/openecomp/aai/db/schema/ScriptDriver.java b/aai-resources/src/main/java/org/openecomp/aai/db/schema/ScriptDriver.java deleted file mode 100644 index 458c4c9..0000000 --- a/aai-resources/src/main/java/org/openecomp/aai/db/schema/ScriptDriver.java +++ /dev/null @@ -1,95 +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.db.schema; - -import java.io.IOException; - -import org.codehaus.jackson.JsonGenerationException; -import org.codehaus.jackson.map.JsonMappingException; -import org.codehaus.jackson.map.ObjectMapper; - -import org.openecomp.aai.exceptions.AAIException; -import org.openecomp.aai.introspection.Version; -import org.openecomp.aai.util.AAIConfig; -import com.beust.jcommander.JCommander; -import com.beust.jcommander.Parameter; -import com.thinkaurelius.titan.core.TitanFactory; -import com.thinkaurelius.titan.core.TitanGraph; - -public class ScriptDriver { - - - /** - * The main method. - * - * @param args the arguments - * @throws AAIException the AAI exception - * @throws JsonGenerationException the json generation exception - * @throws JsonMappingException the json mapping exception - * @throws IOException Signals that an I/O exception has occurred. - */ - public static void main (String[] args) throws AAIException, JsonGenerationException, JsonMappingException, IOException { - CommandLineArgs cArgs = new CommandLineArgs(); - - new JCommander(cArgs, args); - - if (cArgs.help) { - System.out.println("-c [path to graph configuration] -type [what you want to audit - oxm or graph]"); - } - String config = cArgs.config; - AAIConfig.init(); - TitanGraph graph = TitanFactory.open(config); - if (!(cArgs.type.equals("oxm") || cArgs.type.equals("graph"))) { - System.out.println("type: " + cArgs.type + " not recognized."); - System.exit(1); - } - - Auditor a = null; - if (cArgs.type.equals("oxm")) { - a = AuditorFactory.getOXMAuditor(Version.v8); - } else if (cArgs.type.equals("graph")) { - a = AuditorFactory.getGraphAuditor(graph); - } - - AuditDoc doc = a.getAuditDoc(); - - ObjectMapper mapper = new ObjectMapper(); - - String json = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(doc); - System.out.println(json); - - } - -} - -class CommandLineArgs { - - @Parameter(names = "--help", description = "Help") - public boolean help = false; - - @Parameter(names = "-c", description = "Configuration", required=true) - public String config; - - @Parameter(names = "-type", description = "Type", required=true) - public String type = "graph"; - - -} diff --git a/aai-resources/src/main/java/org/openecomp/aai/util/UniquePropertyCheck.java b/aai-resources/src/main/java/org/openecomp/aai/util/UniquePropertyCheck.java deleted file mode 100644 index b5c5cbc..0000000 --- a/aai-resources/src/main/java/org/openecomp/aai/util/UniquePropertyCheck.java +++ /dev/null @@ -1,264 +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 java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Properties; -import java.util.UUID; - -import org.apache.tinkerpop.gremlin.structure.Direction; -import org.apache.tinkerpop.gremlin.structure.Edge; -import org.apache.tinkerpop.gremlin.structure.VertexProperty; -import org.slf4j.MDC; - -import org.openecomp.aai.exceptions.AAIException; -import com.att.eelf.configuration.Configuration; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; -import com.thinkaurelius.titan.core.TitanEdge; -import com.thinkaurelius.titan.core.TitanFactory; -import com.thinkaurelius.titan.core.TitanGraph; -import com.thinkaurelius.titan.core.TitanTransaction; -import com.thinkaurelius.titan.core.TitanVertex; - - - -public class UniquePropertyCheck { - - - private static final String FROMAPPID = "AAI-UTILS"; - private static final String TRANSID = UUID.randomUUID().toString(); - private static final String COMPONENT = "UniquePropertyCheck"; - - /** - * The main method. - * - * @param args the arguments - */ - public static void main(String[] args) { - - - Properties props = System.getProperties(); - props.setProperty(Configuration.PROPERTY_LOGGING_FILE_NAME, "uniquePropertyCheck-logback.xml"); - props.setProperty(Configuration.PROPERTY_LOGGING_FILE_PATH, AAIConstants.AAI_HOME_ETC_APP_PROPERTIES); - EELFLogger logger = EELFManager.getInstance().getLogger(UniquePropertyCheck.class.getSimpleName()); - MDC.put("logFilenameAppender", UniquePropertyCheck.class.getSimpleName()); - - if( args == null || args.length != 1 ){ - String msg = "usage: UniquePropertyCheck propertyName \n"; - System.out.println(msg); - logAndPrint(logger, msg ); - System.exit(1); - } - String propertyName = args[0]; - TitanTransaction graph = null; - - try { - AAIConfig.init(); - System.out.println(" ---- NOTE --- about to open graph (takes a little while)--------\n"); - TitanGraph tGraph = TitanFactory.open(AAIConstants.REALTIME_DB_CONFIG); - - if( tGraph == null ) { - logAndPrint(logger, " Error: Could not get TitanGraph "); - System.exit(1); - } - - graph = tGraph.newTransaction(); - if( graph == null ){ - logAndPrint(logger, "could not get graph object in UniquePropertyCheck() \n"); - System.exit(0); - } - } - catch (AAIException e1) { - String msg = "Threw Exception: [" + e1.toString() + "]"; - logAndPrint(logger, msg); - System.exit(0); - } - catch (Exception e2) { - String msg = "Threw Exception: [" + e2.toString() + "]"; - logAndPrint(logger, msg); - System.exit(0); - } - - runTheCheckForUniqueness( TRANSID, FROMAPPID, graph, propertyName, logger ); - System.exit(0); - - }// End main() - - - /** - * Run the check for uniqueness. - * - * @param transId the trans id - * @param fromAppId the from app id - * @param graph the graph - * @param propertyName the property name - * @param logger the logger - * @return the boolean - */ - public static Boolean runTheCheckForUniqueness( String transId, String fromAppId, TitanTransaction graph, - String propertyName, EELFLogger logger ){ - - // Note - property can be found in more than one nodetype - // our uniqueness constraints are always across the entire db - so this - // tool looks across all nodeTypes that the property is found in. - Boolean foundDupesFlag = false; - - HashMap <String,String> valuesAndVidHash = new HashMap <String, String> (); - HashMap <String,String> dupeHash = new HashMap <String, String> (); - - int propCount = 0; - int dupeCount = 0; - Iterable <?> vertItr = graph.query().has(propertyName).vertices(); - Iterator <?> vertItor = vertItr.iterator(); - while( vertItor.hasNext() ){ - propCount++; - TitanVertex v = (TitanVertex)vertItor.next(); - String thisVid = v.id().toString(); - Object val = (v.<Object>property(propertyName)).orElse(null); - if( valuesAndVidHash.containsKey(val) ){ - // We've seen this one before- track it in our dupe hash - dupeCount++; - if( dupeHash.containsKey(val) ){ - // This is not the first one being added to the dupe hash for this value - String updatedDupeList = dupeHash.get(val) + "|" + thisVid; - dupeHash.put(val.toString(), updatedDupeList); - } - else { - // This is the first time we see this value repeating - String firstTwoVids = valuesAndVidHash.get(val) + "|" + thisVid; - dupeHash.put(val.toString(), firstTwoVids); - } - } - else { - valuesAndVidHash.put(val.toString(), thisVid); - } - } - - - String info = "\n Found this property [" + propertyName + "] " + propCount + " times in our db."; - logAndPrint(logger, info); - info = " Found " + dupeCount + " cases of duplicate values for this property.\n\n"; - logAndPrint(logger, info); - - try { - if( ! dupeHash.isEmpty() ){ - Iterator <?> dupeItr = dupeHash.entrySet().iterator(); - while( dupeItr.hasNext() ){ - Map.Entry pair = (Map.Entry) dupeItr.next(); - String dupeValue = pair.getKey().toString();; - String vidsStr = pair.getValue().toString(); - String[] vidArr = vidsStr.split("\\|"); - logAndPrint(logger, "\n\n -------------- Found " + vidArr.length - + " nodes with " + propertyName + " of this value: [" + dupeValue + "]. Node details: "); - - for( int i = 0; i < vidArr.length; i++ ){ - String vidString = vidArr[i]; - Long idLong = Long.valueOf(vidString); - TitanVertex tvx = (TitanVertex)graph.getVertex(idLong); - showPropertiesAndEdges( TRANSID, FROMAPPID, tvx, logger ); - } - } - } - } - catch( Exception e2 ){ - logAndPrint(logger, "Threw Exception: [" + e2.toString() + "]"); - } - finally { - if( graph != null ){ - graph.rollback(); - } - } - - return foundDupesFlag; - - }// end of runTheCheckForUniqueness() - - - /** - * Show properties and edges. - * - * @param transId the trans id - * @param fromAppId the from app id - * @param tVert the t vert - * @param logger the logger - */ - private static void showPropertiesAndEdges( String transId, String fromAppId, TitanVertex tVert, - EELFLogger logger ){ - - if( tVert == null ){ - logAndPrint(logger, "Null node passed to showPropertiesAndEdges."); - } - else { - String nodeType = ""; - Object ob = tVert.<String>property("aai-node-type").orElse(null); - if( ob == null ){ - nodeType = "null"; - } - else{ - nodeType = ob.toString(); - } - - logAndPrint(logger, " AAINodeType/VtxID for this Node = [" + nodeType + "/" + tVert.id() + "]"); - logAndPrint(logger, " Property Detail: "); - Iterator<VertexProperty<Object>> pI = tVert.properties(); - while( pI.hasNext() ){ - VertexProperty<Object> tp = pI.next(); - Object val = tp.value(); - logAndPrint(logger, "Prop: [" + tp.key() + "], val = [" + val + "] "); - } - - Iterator <Edge> eI = tVert.edges(Direction.BOTH); - if( ! eI.hasNext() ){ - logAndPrint(logger, "No edges were found for this vertex. "); - } - while( eI.hasNext() ){ - TitanEdge ed = (TitanEdge) eI.next(); - String lab = ed.label(); - TitanVertex vtx = (TitanVertex) ed.otherVertex(tVert); - if( vtx == null ){ - logAndPrint(logger, " >>> COULD NOT FIND VERTEX on the other side of this edge edgeId = " + ed.id() + " <<< "); - } - else { - String nType = vtx.<String>property("aai-node-type").orElse(null); - String vid = vtx.id().toString(); - logAndPrint(logger, "Found an edge (" + lab + ") from this vertex to a [" + nType + "] node with VtxId = " + vid); - } - } - } - } // End of showPropertiesAndEdges() - - - /** - * Log and print. - * - * @param logger the logger - * @param msg the msg - */ - protected static void logAndPrint(EELFLogger logger, String msg) { - System.out.println(msg); - logger.info(msg); - } - -} - - 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; - } - - -} |