-/*-
- * ============LICENSE_START=======================================================
- * org.openecomp.aai
- * ================================================================================
- * Copyright © 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=========================================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
- */
+============LICENSE_START=======================================================
+org.onap.aai
+================================================================================
+Copyright © 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=========================================================
+
+ECOMP is a trademark and service mark of AT&T Intellectual Property.
+<!--
+
+ ============LICENSE_START=======================================================
+ org.onap.aai
+ ================================================================================
+ Copyright © 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=========================================================
+
+ ECOMP is a trademark and service mark of AT&T Intellectual Property.
+
+-->
<configuration scan="true" scanPeriod="3 seconds" debug="true">
<property name="logDirectory" value="${AJSC_HOME}/log" />
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+<!--
+
+ ============LICENSE_START=======================================================
+ org.onap.aai
+ ================================================================================
+ Copyright © 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=========================================================
+
+ ECOMP is a trademark and service mark of AT&T Intellectual Property.
+
+-->
<configuration>
<appender name="ACCESS"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<fileNamePattern>${AJSC_HOME}/logs/ajsc-jetty/localhost_access.log.%d{yyyy-MM-dd}
</fileNamePattern>
</rollingPolicy>
- <encoder class="org.openecomp.aai.logging.CustomLogPatternLayoutEncoder">
+ <encoder class="org.onap.aai.logging.CustomLogPatternLayoutEncoder">
<Pattern>%a %u %z [%t] "%m %U" %s %b %y %i{X-TransactionId} %i{X-FromAppId} %i{X-Forwarded-For} %i{X-AAI-SSL-Client-CN} %i{X-AAI-SSL-Client-OU} %i{X-AAI-SSL-Client-O} %i{X-AAI-SSL-Client-L} %i{X-AAI-SSL-Client-ST} %i{X-AAI-SSL-Client-C} %i{X-AAI-SSL-Client-NotBefore} %i{X-AAI-SSL-Client-NotAfter} %i{X-AAI-SSL-Client-DN} %D</Pattern>
</encoder>
</appender>
+<!--
+
+ ============LICENSE_START=======================================================
+ org.onap.aai
+ ================================================================================
+ Copyright © 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=========================================================
+
+ ECOMP is a trademark and service mark of AT&T Intellectual Property.
+
+-->
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<contextName>${module.ajsc.namespace.name}</contextName>
<jmxConfigurator />
<fileNamePattern>${logDirectory}/rest/metrics.log.%d{yyyy-MM-dd}
</fileNamePattern>
</rollingPolicy>
- <encoder class="org.openecomp.aai.logging.EcompEncoder">
+ <encoder class="org.onap.aai.logging.EcompEncoder">
<pattern>${eelfMetricLogPattern}</pattern>
</encoder>
</appender>
<fileNamePattern>${logDirectory}/rest/debug.log.%d{yyyy-MM-dd}
</fileNamePattern>
</rollingPolicy>
- <encoder class="org.openecomp.aai.logging.EcompEncoder">
+ <encoder class="org.onap.aai.logging.EcompEncoder">
<pattern>${eelfLogPattern}</pattern>
</encoder>
</appender>
<fileNamePattern>${logDirectory}/rest/error.log.%d{yyyy-MM-dd}
</fileNamePattern>
</rollingPolicy>
- <encoder class="org.openecomp.aai.logging.EcompEncoder">
+ <encoder class="org.onap.aai.logging.EcompEncoder">
<pattern>${eelfLogPattern}</pattern>
</encoder>
</appender>
<fileNamePattern>${logDirectory}/rest/audit.log.%d{yyyy-MM-dd}
</fileNamePattern>
</rollingPolicy>
- <encoder class="org.openecomp.aai.logging.EcompEncoder">
+ <encoder class="org.onap.aai.logging.EcompEncoder">
<pattern>${eelfAuditLogPattern}</pattern>
</encoder>
</appender>
<fileNamePattern>${logDirectory}/rest/translog.log.%d{yyyy-MM-dd}
</fileNamePattern>
</rollingPolicy>
- <encoder class="org.openecomp.aai.logging.EcompEncoder">
+ <encoder class="org.onap.aai.logging.EcompEncoder">
<pattern>${eelfLogPattern}</pattern>
</encoder>
</appender>
<fileNamePattern>${logDirectory}/dmaapAAIEventConsumer/error.log.%d{yyyy-MM-dd}
</fileNamePattern>
</rollingPolicy>
- <encoder class="org.openecomp.aai.logging.EcompEncoder">
+ <encoder class="org.onap.aai.logging.EcompEncoder">
<pattern>${eelfLogPattern}</pattern>
</encoder>
</appender>
<fileNamePattern>${logDirectory}/dmaapAAIEventConsumer/debug.log.%d{yyyy-MM-dd}
</fileNamePattern>
</rollingPolicy>
- <encoder class="org.openecomp.aai.logging.EcompEncoder">
+ <encoder class="org.onap.aai.logging.EcompEncoder">
<pattern>${eelfLogPattern}</pattern>
</encoder>
</appender>
<fileNamePattern>${logDirectory}/dmaapAAIEventConsumer/metrics.log.%d{yyyy-MM-dd}
</fileNamePattern>
</rollingPolicy>
- <encoder class="org.openecomp.aai.logging.EcompEncoder">
+ <encoder class="org.onap.aai.logging.EcompEncoder">
<pattern>${eelfLogPattern}</pattern>
</encoder>
</appender>
</logger>
<!-- logback jms appenders & loggers definition ends here -->
- <logger name="org.openecomp.aai.interceptors" level="DEBUG"
+ <logger name="org.onap.aai.interceptors" level="DEBUG"
additivity="false">
<appender-ref ref="asynctranslog" />
</logger>
- <logger name="org.openecomp.aai.interceptors.PreAaiAjscInterceptor" level="DEBUG">
+ <logger name="org.onap.aai.interceptors.PreAaiAjscInterceptor" level="DEBUG">
<appender-ref ref="asyncAUDIT"/>
</logger>
- <logger name="org.openecomp.aai.interceptors.PostAaiAjscInterceptor" level="DEBUG">
+ <logger name="org.onap.aai.interceptors.PostAaiAjscInterceptor" level="DEBUG">
<appender-ref ref="asyncAUDIT"/>
</logger>
- <logger name="org.openecomp.aai.dmaap" level="DEBUG" additivity="false">
+ <logger name="org.onap.aai.dmaap" level="DEBUG" additivity="false">
<appender-ref ref="dmaapAAIEventConsumer" />
<appender-ref ref="dmaapAAIEventConsumerDebug" />
<appender-ref ref="dmaapAAIEventConsumerMetric" />
#This properties file is for defining any PostProcessorInterceptors that have been created for your AJSC service.
-/**=org.openecomp.aai.interceptors.PostAaiAjscInterceptor
+/**=org.onap.aai.interceptors.PostAaiAjscInterceptor
#This properties file is for defining any PreProcessorInterceptors that have been created for your AJSC service.
-/**=com.att.ajsc.csi.restmethodmap.RestMethodMapInterceptor,org.openecomp.aai.interceptors.PreAaiAjscInterceptor
+/**=com.att.ajsc.csi.restmethodmap.RestMethodMapInterceptor,org.onap.aai.interceptors.PreAaiAjscInterceptor
+#
+# ============LICENSE_START=======================================================
+# org.onap.aai
+# ================================================================================
+# Copyright © 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=========================================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
####################################################################
# REMEMBER TO THINK ABOUT ENVIRONMENTAL DIFFERENCES AND CHANGE THE
# TEMPLATE AND *ALL* DATAFILES
+<!--
+
+ ============LICENSE_START=======================================================
+ org.onap.aai
+ ================================================================================
+ Copyright © 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=========================================================
+
+ ECOMP is a trademark and service mark of AT&T Intellectual Property.
+
+-->
<configuration debug="false">
<property name="defaultPattern" value="%d{MM/dd-HH:mm:ss.SSS}|%logger|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}|%X{Timer}|%msg%n" />
+#
+# ============LICENSE_START=======================================================
+# org.onap.aai
+# ================================================================================
+# Copyright © 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=========================================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
hosts: [localhost]
port: 8182
serializer: { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0 }
\ No newline at end of file
+#
+# ============LICENSE_START=======================================================
+# org.onap.aai
+# ================================================================================
+# Copyright © 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=========================================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
query.fast-property=true
# the following parameters are not reloaded automatically and require a manual bounce
+#storage.backend=inmemory
storage.backend=inmemory
storage.hostname=localhost
#schema.default=none
storage.lock.wait-time=300
storage.hbase.table=aaigraph-dev02
-storage.hbase.ext.zookeeper.znode.parent=/hbase
+storage.hbase.ext.zookeeper.znode.parent=/hbase-unsecure
#caching on
cache.db-cache = true
cache.db-cache-clean-wait = 20
+#
+# ============LICENSE_START=======================================================
+# org.onap.aai
+# ================================================================================
+# Copyright © 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=========================================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
query.fast-property=true
# the following parameters are not reloaded automatically and require a manual bounce
+#storage.backend=inmemory
storage.backend=inmemory
storage.hostname=localhost
#schema.default=none
storage.lock.wait-time=300
storage.hbase.table=aaigraph-dev02
-storage.hbase.ext.zookeeper.znode.parent=/hbase
+storage.hbase.ext.zookeeper.znode.parent=/hbase-unsecure
# Setting db-cache to false ensure the fastest propagation of changes across servers
cache.db-cache = false
<!--<bean-->
<!--class="org.springframework.context.annotation.CommonAnnotationBeanPostProcessor" />-->
<!---->
- <!--<bean id="ServicePropertiesListener" class="org.openecomp.aai.ajsc_aai.filemonitor.ServicePropertiesListener" />-->
+ <!--<bean id="ServicePropertiesListener" class="org.onap.aai.ajsc_aai.filemonitor.ServicePropertiesListener" />-->
<!---->
- <!--<bean id="ServicePropertiesMap" class="org.openecomp.aai.ajsc_aai.filemonitor.ServicePropertiesMap" />-->
+ <!--<bean id="ServicePropertiesMap" class="org.onap.aai.ajsc_aai.filemonitor.ServicePropertiesMap" />-->
- <!--<bean id="ServicePropertyService" class="org.openecomp.aai.ajsc_aai.filemonitor.ServicePropertyService">-->
+ <!--<bean id="ServicePropertyService" class="org.onap.aai.ajsc_aai.filemonitor.ServicePropertyService">-->
<!--<property name="loadOnStartup" value="false" />-->
<!--<property name="fileChangedListener" ref="ServicePropertiesListener" />-->
<!--<property name="filePropertiesMap" ref="ServicePropertiesMap" />-->
xmlns jaxrs: "http://cxf.apache.org/jaxrs"
xmlns util: "http://www.springframework.org/schema/util"
- SearchProvider(org.openecomp.aai.rest.search.SearchProvider)
- ModelAndNamedQueryRestProvider(org.openecomp.aai.rest.search.ModelAndNamedQueryRestProvider)
- QueryConsumer(org.openecomp.aai.rest.QueryConsumer)
+ SearchProvider(org.onap.aai.rest.search.SearchProvider)
+ ModelAndNamedQueryRestProvider(org.onap.aai.rest.search.ModelAndNamedQueryRestProvider)
+ QueryConsumer(org.onap.aai.rest.QueryConsumer)
- V3ThroughV7Retired(org.openecomp.aai.rest.retired.V3ThroughV7Consumer)
+ V3ThroughV7Retired(org.onap.aai.rest.retired.V3ThroughV7Consumer)
- EchoResponse(org.openecomp.aai.rest.util.EchoResponse)
+ EchoResponse(org.onap.aai.rest.util.EchoResponse)
util.list(id: 'jaxrsServices') {
<!-- <bean id="processRestletHeaders" name="processRestletHeaders" class="ajsc.restlet.ProcessRestletHeaders"
/> -->
<bean id="servicePropsBean" name="servicePropsBean"
- class="org.openecomp.aai.ajsc_aai.util.ServicePropertiesMapBean" />
- <bean id="jsonProvider" class="org.openecomp.aai.restcore.CustomJacksonJaxBJsonProvider" />
+ class="org.onap.aai.ajsc_aai.util.ServicePropertiesMapBean" />
+ <bean id="jsonProvider" class="org.onap.aai.restcore.CustomJacksonJaxBJsonProvider" />
- <bean id="inInterceptor" class="org.openecomp.aai.interceptors.AAILogJAXRSInInterceptor" />
- <bean id="outInterceptor" class="org.openecomp.aai.interceptors.AAILogJAXRSOutInterceptor" />
+ <bean id="inInterceptor" class="org.onap.aai.interceptors.AAILogJAXRSInInterceptor" />
+ <bean id="outInterceptor" class="org.onap.aai.interceptors.AAILogJAXRSOutInterceptor" />
<cxf:bus bus="cxfBus">
<cxf:inInterceptors>
<ref bean="inInterceptor" />
<ref bean="outInterceptor" />
</cxf:outInterceptors>
</cxf:bus>
- <context:component-scan base-package="org.openecomp.aai.tasks" />
- <context:component-scan base-package="org.openecomp.aai.config" />
+ <context:component-scan base-package="org.onap.aai.tasks" />
+ <context:component-scan base-package="org.onap.aai.config" />
<task:scheduler id="taskScheduler" pool-size="10" />
<task:executor id="taskExecutor" pool-size="10"
</bean>
<!-- Message Producer -->
- <bean id="messageProducer" class="org.openecomp.aai.dmaap.AAIDmaapEventJMSProducer" />
+ <bean id="messageProducer" class="org.onap.aai.dmaap.AAIDmaapEventJMSProducer" />
<!-- Message Consumer from Default Destination -->
- <bean id="messageDefaultConsumer" class="org.openecomp.aai.dmaap.AAIDmaapEventJMSConsumer" />
+ <bean id="messageDefaultConsumer" class="org.onap.aai.dmaap.AAIDmaapEventJMSConsumer" />
<!-- Message Consumer Container for Default Destination -->
<bean
<listener>
<listener-class>
- org.openecomp.aai.util.AAIAppServletContextListener
+ org.onap.aai.util.AAIAppServletContextListener
</listener-class>
</listener>
<security-constraint>
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.ajsc_aai;
+package org.onap.aai.ajsc_aai;
//import java.util.HashMap;
//import java.util.Map;
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.ajsc_aai;
+package org.onap.aai.ajsc_aai;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.ajsc_aai.filemonitor;
+package org.onap.aai.ajsc_aai.filemonitor;
import java.io.File;
import java.io.FileInputStream;
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
+package org.onap.aai.ajsc_aai.util;
-package org.openecomp.aai.ajsc_aai.util;
-
-import org.openecomp.aai.ajsc_aai.filemonitor.ServicePropertiesMap;
+import org.onap.aai.ajsc_aai.filemonitor.ServicePropertiesMap;
public class ServicePropertiesMapBean {
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.config;
+package org.onap.aai.config;
import org.apache.activemq.broker.BrokerService;
import org.springframework.context.annotation.Bean;
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.dbgraphgen;
+package org.onap.aai.dbgraphgen;
import java.util.ArrayList;
import java.util.Collection;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.structure.VertexProperty;
-import org.openecomp.aai.db.DbMethHelper;
-import org.openecomp.aai.db.props.AAIProperties;
-import org.openecomp.aai.dbgen.PropertyLimitDesc;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.introspection.Introspector;
-import org.openecomp.aai.introspection.Loader;
-import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException;
-import org.openecomp.aai.query.builder.QueryBuilder;
-import org.openecomp.aai.schema.enums.PropertyMetadata;
-import org.openecomp.aai.serialization.db.DBSerializer;
-import org.openecomp.aai.serialization.db.EdgeRules;
-import org.openecomp.aai.serialization.db.EdgeType;
-import org.openecomp.aai.serialization.engines.TransactionalGraphEngine;
-import org.openecomp.aai.util.AAIConfig;
+import org.onap.aai.db.DbMethHelper;
+import org.onap.aai.db.props.AAIProperties;
+import org.onap.aai.dbgen.PropertyLimitDesc;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.introspection.Introspector;
+import org.onap.aai.introspection.Loader;
+import org.onap.aai.introspection.exceptions.AAIUnknownObjectException;
+import org.onap.aai.query.builder.QueryBuilder;
+import org.onap.aai.schema.enums.PropertyMetadata;
+import org.onap.aai.serialization.db.DBSerializer;
+import org.onap.aai.serialization.db.EdgeRules;
+import org.onap.aai.serialization.db.EdgeType;
+import org.onap.aai.serialization.engines.TransactionalGraphEngine;
+import org.onap.aai.util.AAIConfig;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.dbgraphgen;
+package org.onap.aai.dbgraphgen;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.openecomp.aai.dbgen.PropertyLimitDesc;
+import org.onap.aai.dbgen.PropertyLimitDesc;
public class ResultSet {
private Vertex vert;
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.dbgraphmap;
+package org.onap.aai.dbgraphmap;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import org.eclipse.persistence.dynamic.DynamicType;
import org.eclipse.persistence.exceptions.DynamicException;
import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext;
-import org.openecomp.aai.db.DbMethHelper;
-import org.openecomp.aai.db.props.AAIProperties;
-import org.openecomp.aai.dbgen.PropertyLimitDesc;
-import org.openecomp.aai.dbgraphgen.ModelBasedProcessing;
-import org.openecomp.aai.dbgraphgen.ResultSet;
-import org.openecomp.aai.dbmap.DBConnectionType;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.extensions.AAIExtensionMap;
-import org.openecomp.aai.introspection.Introspector;
-import org.openecomp.aai.introspection.Loader;
-import org.openecomp.aai.introspection.LoaderFactory;
-import org.openecomp.aai.introspection.ModelType;
-import org.openecomp.aai.introspection.MoxyLoader;
-import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException;
-import org.openecomp.aai.parsers.relationship.RelationshipToURI;
-import org.openecomp.aai.query.builder.QueryBuilder;
-import org.openecomp.aai.schema.enums.ObjectMetadata;
-import org.openecomp.aai.schema.enums.PropertyMetadata;
-import org.openecomp.aai.serialization.db.DBSerializer;
-import org.openecomp.aai.serialization.db.EdgeRule;
-import org.openecomp.aai.serialization.db.EdgeRules;
-import org.openecomp.aai.serialization.engines.QueryStyle;
-import org.openecomp.aai.serialization.engines.TitanDBEngine;
-import org.openecomp.aai.serialization.engines.TransactionalGraphEngine;
-import org.openecomp.aai.serialization.queryformats.exceptions.AAIFormatVertexException;
-import org.openecomp.aai.serialization.queryformats.utils.UrlBuilder;
-import org.openecomp.aai.util.StoreNotificationEvent;
+import org.onap.aai.db.DbMethHelper;
+import org.onap.aai.db.props.AAIProperties;
+import org.onap.aai.dbgen.PropertyLimitDesc;
+import org.onap.aai.dbgraphgen.ModelBasedProcessing;
+import org.onap.aai.dbgraphgen.ResultSet;
+import org.onap.aai.dbmap.DBConnectionType;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.extensions.AAIExtensionMap;
+import org.onap.aai.introspection.Introspector;
+import org.onap.aai.introspection.Loader;
+import org.onap.aai.introspection.LoaderFactory;
+import org.onap.aai.introspection.ModelType;
+import org.onap.aai.introspection.MoxyLoader;
+import org.onap.aai.introspection.exceptions.AAIUnknownObjectException;
+import org.onap.aai.parsers.relationship.RelationshipToURI;
+import org.onap.aai.query.builder.QueryBuilder;
+import org.onap.aai.schema.enums.ObjectMetadata;
+import org.onap.aai.schema.enums.PropertyMetadata;
+import org.onap.aai.serialization.db.DBSerializer;
+import org.onap.aai.serialization.db.EdgeRule;
+import org.onap.aai.serialization.db.EdgeRules;
+import org.onap.aai.serialization.engines.QueryStyle;
+import org.onap.aai.serialization.engines.TitanDBEngine;
+import org.onap.aai.serialization.engines.TransactionalGraphEngine;
+import org.onap.aai.serialization.queryformats.exceptions.AAIFormatVertexException;
+import org.onap.aai.serialization.queryformats.utils.UrlBuilder;
+import org.onap.aai.util.StoreNotificationEvent;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
Introspector searchResults = createSearchResults(loader, urlBuilder, queryResults);
String outputMediaType = getMediaType(headers.getAcceptableMediaTypes());
- org.openecomp.aai.introspection.MarshallerProperties properties = new org.openecomp.aai.introspection.MarshallerProperties.Builder(
- org.openecomp.aai.restcore.MediaType.getEnum(outputMediaType)).build();
+ org.onap.aai.introspection.MarshallerProperties properties = new org.onap.aai.introspection.MarshallerProperties.Builder(
+ org.onap.aai.restcore.MediaType.getEnum(outputMediaType)).build();
result = searchResults.marshal(properties);
response = Response.ok().entity(result).build();
Introspector searchResults = createSearchResults(loader, urlBuilder, results);
String outputMediaType = getMediaType(headers.getAcceptableMediaTypes());
- org.openecomp.aai.introspection.MarshallerProperties properties = new org.openecomp.aai.introspection.MarshallerProperties.Builder(
- org.openecomp.aai.restcore.MediaType.getEnum(outputMediaType)).build();
+ org.onap.aai.introspection.MarshallerProperties properties = new org.onap.aai.introspection.MarshallerProperties.Builder(
+ org.onap.aai.restcore.MediaType.getEnum(outputMediaType)).build();
result = searchResults.marshal(properties);
response = Response.ok().entity(result).build();
ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);
dbEngine.startTransaction();
- org.openecomp.aai.restcore.MediaType mediaType = org.openecomp.aai.restcore.MediaType.APPLICATION_JSON_TYPE;
+ org.onap.aai.restcore.MediaType mediaType = org.onap.aai.restcore.MediaType.APPLICATION_JSON_TYPE;
String contentType = aaiExtMap.getHttpServletRequest().getContentType();
if (contentType != null && contentType.contains("application/xml")) {
- mediaType = org.openecomp.aai.restcore.MediaType.APPLICATION_XML_TYPE;
+ mediaType = org.onap.aai.restcore.MediaType.APPLICATION_XML_TYPE;
}
if (queryParameters.length() == 0) {
dbEngine.startTransaction();
- org.openecomp.aai.restcore.MediaType mediaType = org.openecomp.aai.restcore.MediaType.APPLICATION_JSON_TYPE;
+ org.onap.aai.restcore.MediaType mediaType = org.onap.aai.restcore.MediaType.APPLICATION_JSON_TYPE;
String contentType = aaiExtMap.getHttpServletRequest().getContentType();
if (contentType != null && contentType.contains("application/xml")) {
- mediaType = org.openecomp.aai.restcore.MediaType.APPLICATION_XML_TYPE;
+ mediaType = org.onap.aai.restcore.MediaType.APPLICATION_XML_TYPE;
}
if (queryParameters.length() == 0) {
break;
}
}
- org.openecomp.aai.introspection.MarshallerProperties properties;
+ org.onap.aai.introspection.MarshallerProperties properties;
if (isJson) {
properties =
- new org.openecomp.aai.introspection.MarshallerProperties.Builder(org.openecomp.aai.restcore.MediaType.APPLICATION_JSON_TYPE).build();
+ new org.onap.aai.introspection.MarshallerProperties.Builder(org.onap.aai.restcore.MediaType.APPLICATION_JSON_TYPE).build();
} else {
properties =
- new org.openecomp.aai.introspection.MarshallerProperties.Builder(org.openecomp.aai.restcore.MediaType.APPLICATION_XML_TYPE).build();
+ new org.onap.aai.introspection.MarshallerProperties.Builder(org.onap.aai.restcore.MediaType.APPLICATION_XML_TYPE).build();
}
String marshalledObj = obj.marshal(properties);
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.interceptors;
+package org.onap.aai.interceptors;
public class AAIHeaderProperties {
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.interceptors;
+package org.onap.aai.interceptors;
import java.io.InputStream;
import java.util.ArrayList;
import org.apache.cxf.interceptor.LoggingMessage;
import org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor;
import org.apache.cxf.message.Message;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.logging.ErrorLogHelper;
-import org.openecomp.aai.rest.util.EchoResponse;
-import org.openecomp.aai.util.AAIConfig;
-import org.openecomp.aai.util.AAIConstants;
-import org.openecomp.aai.util.FormatDate;
-import org.openecomp.aai.util.HbaseSaltPrefixer;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.logging.ErrorLogHelper;
+import org.onap.aai.rest.util.EchoResponse;
+import org.onap.aai.util.AAIConfig;
+import org.onap.aai.util.AAIConstants;
+import org.onap.aai.util.FormatDate;
+import org.onap.aai.util.HbaseSaltPrefixer;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.interceptors;
+package org.onap.aai.interceptors;
import java.io.OutputStream;
import java.util.Collections;
import org.apache.cxf.io.CachedOutputStreamCallback;
import org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor;
import org.apache.cxf.message.Message;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.logging.ErrorLogHelper;
-import org.openecomp.aai.util.AAIConfig;
-import org.openecomp.aai.util.AAIConstants;
-import org.openecomp.aai.util.FormatDate;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.logging.ErrorLogHelper;
+import org.onap.aai.util.AAIConfig;
+import org.onap.aai.util.AAIConstants;
+import org.onap.aai.util.FormatDate;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.interceptors;
+package org.onap.aai.interceptors;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.openecomp.aai.logging.LoggingContext;
-import org.openecomp.aai.logging.LoggingContext.StatusCode;
+import org.onap.aai.logging.LoggingContext;
+import org.onap.aai.logging.LoggingContext.StatusCode;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.interceptors;
+package org.onap.aai.interceptors;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.openecomp.aai.logging.LoggingContext;
+import org.onap.aai.logging.LoggingContext;
import ajsc.beans.interceptors.AjscInterceptor;
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest;
+package org.onap.aai.rest;
import java.util.ArrayList;
import java.util.List;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.logging.ErrorLogHelper;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.logging.ErrorLogHelper;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.sun.istack.SAXParseException2;
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest;
+package org.onap.aai.rest;
import java.net.URI;
import java.util.ArrayList;
import javax.ws.rs.core.UriInfo;
import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.openecomp.aai.dbmap.DBConnectionType;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.introspection.ModelType;
-import org.openecomp.aai.introspection.Version;
-import org.openecomp.aai.parsers.query.QueryParser;
-import org.openecomp.aai.rest.db.HttpEntry;
-import org.openecomp.aai.rest.search.GenericQueryProcessor;
-import org.openecomp.aai.rest.search.QueryProcessorType;
-import org.openecomp.aai.restcore.HttpMethod;
-import org.openecomp.aai.restcore.RESTAPI;
-import org.openecomp.aai.restcore.util.URITools;
-import org.openecomp.aai.serialization.db.DBSerializer;
-import org.openecomp.aai.serialization.engines.QueryStyle;
-import org.openecomp.aai.serialization.engines.TransactionalGraphEngine;
-import org.openecomp.aai.serialization.queryformats.Format;
-import org.openecomp.aai.serialization.queryformats.FormatFactory;
-import org.openecomp.aai.serialization.queryformats.Formatter;
-import org.openecomp.aai.serialization.queryformats.SubGraphStyle;
+import org.onap.aai.dbmap.DBConnectionType;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.introspection.ModelType;
+import org.onap.aai.introspection.Version;
+import org.onap.aai.parsers.query.QueryParser;
+import org.onap.aai.rest.db.HttpEntry;
+import org.onap.aai.rest.search.GenericQueryProcessor;
+import org.onap.aai.rest.search.QueryProcessorType;
+import org.onap.aai.restcore.HttpMethod;
+import org.onap.aai.restcore.RESTAPI;
+import org.onap.aai.restcore.util.URITools;
+import org.onap.aai.serialization.db.DBSerializer;
+import org.onap.aai.serialization.engines.QueryStyle;
+import org.onap.aai.serialization.engines.TransactionalGraphEngine;
+import org.onap.aai.serialization.queryformats.Format;
+import org.onap.aai.serialization.queryformats.FormatFactory;
+import org.onap.aai.serialization.queryformats.Formatter;
+import org.onap.aai.serialization.queryformats.SubGraphStyle;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.retired;
+package org.onap.aai.rest.retired;
import java.util.ArrayList;
import org.apache.cxf.jaxrs.ext.PATCH;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.logging.ErrorLogHelper;
-import org.openecomp.aai.restcore.RESTAPI;
-import org.openecomp.aai.util.AAIConfig;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.logging.ErrorLogHelper;
+import org.onap.aai.restcore.RESTAPI;
+import org.onap.aai.util.AAIConfig;
/**
* The Class RetiredConsumer.
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.retired;
+package org.onap.aai.rest.retired;
import javax.ws.rs.Path;
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.retired;
+package org.onap.aai.rest.retired;
import javax.ws.rs.Path;
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
import java.io.FileNotFoundException;
import java.net.URI;
import org.apache.tinkerpop.gremlin.structure.Graph;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.javatuples.Pair;
-import org.openecomp.aai.restcore.util.URITools;
-import org.openecomp.aai.serialization.engines.TransactionalGraphEngine;
-import org.openecomp.aai.serialization.queryformats.SubGraphStyle;
+import org.onap.aai.restcore.util.URITools;
+import org.onap.aai.serialization.engines.TransactionalGraphEngine;
+import org.onap.aai.serialization.queryformats.SubGraphStyle;
import jersey.repackaged.com.google.common.base.Joiner;
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
import java.util.HashMap;
import java.util.Map;
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
import java.util.List;
import java.util.Map;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
-import org.openecomp.aai.util.AAIConfig;
+import org.onap.aai.util.AAIConfig;
public class GremlinServerImpl extends GenericQueryProcessor {
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
+package org.onap.aai.rest.search;
-package org.openecomp.aai.rest.search;
-
-import org.openecomp.aai.util.AAIConstants;
-import org.openecomp.aai.util.FileWatcher;
+import org.onap.aai.util.AAIConstants;
+import org.onap.aai.util.FileWatcher;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import org.apache.tinkerpop.gremlin.driver.Cluster;
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
import java.util.HashMap;
import java.util.Map;
import org.codehaus.groovy.control.CompilerConfiguration;
import org.codehaus.groovy.control.customizers.ASTTransformationCustomizer;
import org.codehaus.groovy.control.customizers.ImportCustomizer;
-import org.openecomp.aai.query.builder.QueryBuilder;
-import org.openecomp.aai.serialization.engines.QueryStyle;
-import org.openecomp.aai.serialization.engines.TransactionalGraphEngine;
+import org.onap.aai.query.builder.QueryBuilder;
+import org.onap.aai.serialization.engines.QueryStyle;
+import org.onap.aai.serialization.engines.TransactionalGraphEngine;
import groovy.lang.Binding;
import groovy.lang.GroovyShell;
"org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__",
"org.apache.tinkerpop.gremlin.structure.T",
"org.apache.tinkerpop.gremlin.process.traversal.P",
- "org.openecomp.aai.serialization.db.EdgeType");
+ "org.onap.aai.serialization.db.EdgeType");
CompilerConfiguration config = new CompilerConfiguration();
config.addCompilationCustomizers(custom, imports);
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
import java.util.Map;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
-import org.openecomp.aai.restcore.search.GremlinGroovyShellSingleton;
+import org.onap.aai.restcore.search.GremlinGroovyShellSingleton;
public class GroovyShellImpl extends GenericQueryProcessor {
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
import java.util.ArrayList;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
-import org.openecomp.aai.dbgraphmap.SearchGraph;
-import org.openecomp.aai.dbmap.DBConnectionType;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.extensions.AAIExtensionMap;
-import org.openecomp.aai.logging.ErrorLogHelper;
-import org.openecomp.aai.restcore.RESTAPI;
-import org.openecomp.aai.util.AAIApiVersion;
+import org.onap.aai.dbgraphmap.SearchGraph;
+import org.onap.aai.dbmap.DBConnectionType;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.extensions.AAIExtensionMap;
+import org.onap.aai.logging.ErrorLogHelper;
+import org.onap.aai.restcore.RESTAPI;
+import org.onap.aai.util.AAIApiVersion;
/**
* Implements the search subdomain in the REST API. All API calls must include
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
public enum QueryProcessorType {
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
import java.util.ArrayList;
import java.util.List;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
-import org.openecomp.aai.db.props.AAIProperties;
-import org.openecomp.aai.dbgraphmap.SearchGraph;
-import org.openecomp.aai.dbmap.DBConnectionType;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.introspection.Loader;
-import org.openecomp.aai.introspection.LoaderFactory;
-import org.openecomp.aai.introspection.ModelType;
-import org.openecomp.aai.introspection.Version;
-import org.openecomp.aai.logging.ErrorLogHelper;
-import org.openecomp.aai.restcore.RESTAPI;
-import org.openecomp.aai.serialization.db.DBSerializer;
-import org.openecomp.aai.serialization.engines.QueryStyle;
-import org.openecomp.aai.serialization.engines.TitanDBEngine;
-import org.openecomp.aai.serialization.engines.TransactionalGraphEngine;
-import org.openecomp.aai.serialization.queryformats.utils.UrlBuilder;
+import org.onap.aai.db.props.AAIProperties;
+import org.onap.aai.dbgraphmap.SearchGraph;
+import org.onap.aai.dbmap.DBConnectionType;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.introspection.Loader;
+import org.onap.aai.introspection.LoaderFactory;
+import org.onap.aai.introspection.ModelType;
+import org.onap.aai.introspection.Version;
+import org.onap.aai.logging.ErrorLogHelper;
+import org.onap.aai.restcore.RESTAPI;
+import org.onap.aai.serialization.db.DBSerializer;
+import org.onap.aai.serialization.engines.QueryStyle;
+import org.onap.aai.serialization.engines.TitanDBEngine;
+import org.onap.aai.serialization.engines.TransactionalGraphEngine;
+import org.onap.aai.serialization.queryformats.utils.UrlBuilder;
/**
* Implements the search subdomain in the REST API. All API calls must include
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.util;
+package org.onap.aai.rest.util;
import java.util.ArrayList;
import java.util.HashMap;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.logging.ErrorLogHelper;
-import org.openecomp.aai.restcore.RESTAPI;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.logging.ErrorLogHelper;
+import org.onap.aai.restcore.RESTAPI;
/**
* The Class EchoResponse.
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.util;
+package org.onap.aai.rest.util;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.util;
+package org.onap.aai.rest.util;
import java.io.UnsupportedEncodingException;
import java.net.URI;
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.transforms;
+package org.onap.aai.transforms;
public interface Converter {
String convert(String input);
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.transforms;
+package org.onap.aai.transforms;
import com.google.common.base.CaseFormat;
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.transforms;
+package org.onap.aai.transforms;
/**
* <b>LowerHyphenToLowerCamelConverter</b> is the converter to use
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.transforms;
+package org.onap.aai.transforms;
import joptsimple.internal.Objects;
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.util;
+package org.onap.aai.util;
import java.io.IOException;
//import org.apache.activemq.broker.BrokerService;
-import org.openecomp.aai.dbmap.AAIGraph;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.introspection.ModelInjestor;
-import org.openecomp.aai.logging.ErrorLogHelper;
+import org.onap.aai.dbmap.AAIGraph;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.introspection.ModelInjestor;
+import org.onap.aai.logging.ErrorLogHelper;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
* @param arg0 the ServletContextEvent
*/
public void contextInitialized(ServletContextEvent arg0) {
- System.setProperty("org.openecomp.aai.serverStarted", "false");
+ System.setProperty("org.onap.aai.serverStarted", "false");
LOGGER.info("***AAI Server initialization started...");
try {
//broker.start();
LOGGER.info("AAI Server initialization succcessful.");
- System.setProperty("org.openecomp.aai.serverStarted", "true");
+ System.setProperty("org.onap.aai.serverStarted", "true");
} catch (AAIException e) {
ErrorLogHelper.logException(e);
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.util;
+package org.onap.aai.util;
import java.io.File;
import java.util.ArrayList;
import org.apache.commons.io.FileUtils;
-import org.openecomp.aai.introspection.Introspector;
-import org.openecomp.aai.introspection.Loader;
-import org.openecomp.aai.introspection.LoaderFactory;
-import org.openecomp.aai.introspection.ModelType;
-import org.openecomp.aai.introspection.Version;
-import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException;
-import org.openecomp.aai.util.AAIConfig;
-import org.openecomp.aai.util.AAIConstants;
+import org.onap.aai.introspection.Introspector;
+import org.onap.aai.introspection.Loader;
+import org.onap.aai.introspection.LoaderFactory;
+import org.onap.aai.introspection.ModelType;
+import org.onap.aai.introspection.Version;
+import org.onap.aai.introspection.exceptions.AAIUnknownObjectException;
+import org.onap.aai.util.AAIConfig;
+import org.onap.aai.util.AAIConstants;
public class MakeNamedQuery {
-###
+#
# ============LICENSE_START=======================================================
-# org.openecomp.aai
+# org.onap.aai
# ================================================================================
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 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
-#
+#
+# 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=========================================================
-###
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
PROJECT_HOME=/opt/app/aai-traversal
export PROJECT_HOME
-###
+#
# ============LICENSE_START=======================================================
-# org.openecomp.aai
+# org.onap.aai
# ================================================================================
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 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
-#
+#
+# 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=========================================================
-###
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
# Set the current path to be the application home and common libs home
export APP_HOME=$(pwd);
chown -R aaiadmin:aaiadmin /opt/app /var/chef /opt/aai/logroot
-gosu aaiadmin ./init-chef.sh
+gosu aaiadmin ./init-chef.sh || {
+ echo "Unable to run init chef script, please check logs";
+ exit 1;
+}
httpPort=8086;
httpsPort=8446;
#!/bin/bash
-
-###
+#
# ============LICENSE_START=======================================================
-# org.openecomp.aai
+# org.onap.aai
# ================================================================================
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 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
-#
+#
+# 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=========================================================
-###
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
##############################################################################
# Script to initialize the chef-repo branch and.chef
exit;
}
+fi
+
+if [ -d "aai-config/cookbooks/aai-traversal" ]; then
+
(cd aai-config/cookbooks/aai-traversal/ && \
for f in $(ls); do mv $f ../; done && \
cd ../ && rmdir aai-traversal);
-fi
+
+fi;
if [ ! -d "aai-data" ]; then
exit;
}
- chef-solo \
- -c /var/chef/aai-data/chef-config/dev/.knife/solo.rb \
- -j /var/chef/aai-config/cookbooks/runlist-aai-traversal.json \
- -E ${AAI_CHEF_ENV};
-
fi
+
+chef-solo \
+ -c /var/chef/aai-data/chef-config/dev/.knife/solo.rb \
+ -j /var/chef/aai-config/cookbooks/runlist-aai-traversal.json \
+ -E ${AAI_CHEF_ENV};
+
+<!--
+
+ ============LICENSE_START=======================================================
+ org.onap.aai
+ ================================================================================
+ Copyright © 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=========================================================
+
+ ECOMP is a trademark and service mark of AT&T Intellectual Property.
+
+-->
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="UebEventLogEntry">
<xs:sequence>
#!/bin/ksh
-
-###
+#
# ============LICENSE_START=======================================================
-# org.openecomp.aai
+# org.onap.aai
# ================================================================================
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 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
-#
+#
+# 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=========================================================
-###
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
#
# This script deletes the named query in bundleconfig/etc/scriptdata/named-query-json directory
#!/bin/ksh
-
-###
+#
# ============LICENSE_START=======================================================
-# org.openecomp.aai
+# org.onap.aai
# ================================================================================
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 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
-#
+#
+# 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=========================================================
-###
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
#
# The script is called with a resource to be deleted.
#!/bin/ksh
-
-###
+#
# ============LICENSE_START=======================================================
-# org.openecomp.aai
+# org.onap.aai
# ================================================================================
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 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
-#
+#
+# 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=========================================================
-###
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
#
# The script is called with a resource.
#!/bin/ksh
-
-###
+#
# ============LICENSE_START=======================================================
-# org.openecomp.aai
+# org.onap.aai
# ================================================================================
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 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
-#
+#
+# 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=========================================================
-###
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
ECHO=${ECHO:-echo}
#!/bin/ksh
-
-###
+#
# ============LICENSE_START=======================================================
-# org.openecomp.aai
+# org.onap.aai
# ================================================================================
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 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
-#
+#
+# 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=========================================================
-###
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
PROGNAME=$(basename $0)
PROJECT_HOME=/opt/app/aai-traversal
#!/bin/ksh
-
-###
+#
# ============LICENSE_START=======================================================
-# org.openecomp.aai
+# org.onap.aai
# ================================================================================
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 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
+#
+# 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=========================================================
-###
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
#
# The script is called with a resource, filepath and an optional argument to
-/*-\r
- * ============LICENSE_START=======================================================\r
- * org.openecomp.aai\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package org.openecomp.aai.dbgraphgen;\r
-\r
-import static org.junit.Assert.*;\r
-import static org.mockito.Matchers.any;\r
-import static org.mockito.Matchers.anyMap;\r
-import static org.mockito.Matchers.anyMapOf;\r
-import static org.mockito.Mockito.*;\r
-\r
-import com.bazaarvoice.jolt.modifier.DataType;\r
-import com.google.common.collect.ArrayListMultimap;\r
-import com.google.common.collect.LinkedListMultimap;\r
-import com.google.common.collect.Multimap;\r
-import com.thinkaurelius.titan.graphdb.olap.computer.VertexMapJob;\r
-import com.thinkaurelius.titan.graphdb.types.VertexLabelVertex;\r
-import com.thinkaurelius.titan.graphdb.types.system.BaseVertexLabel;\r
-import com.thinkaurelius.titan.graphdb.types.system.EmptyVertex;\r
-import com.thinkaurelius.titan.graphdb.types.vertices.EdgeLabelVertex;\r
-import com.thinkaurelius.titan.graphdb.types.vertices.PropertyKeyVertex;\r
-import org.apache.commons.lang.ObjectUtils;\r
-import org.apache.openjpa.kernel.exps.Exp;\r
-import org.apache.tinkerpop.gremlin.structure.Graph;\r
-import org.apache.tinkerpop.gremlin.structure.T;\r
-import org.apache.tinkerpop.gremlin.structure.Vertex;\r
-import org.apache.tinkerpop.gremlin.structure.VertexProperty;\r
-import org.junit.Before;\r
-import org.junit.BeforeClass;\r
-import org.junit.Test;\r
-import org.junit.runner.RunWith;\r
-import org.mockito.*;\r
-import org.mockito.runners.MockitoJUnitRunner;\r
-import org.openecomp.aai.db.DbMethHelper;\r
-import org.openecomp.aai.db.props.AAIProperties;\r
-import org.openecomp.aai.exceptions.AAIException;\r
-import org.openecomp.aai.introspection.Loader;\r
-import org.openecomp.aai.introspection.LoaderFactory;\r
-import org.openecomp.aai.introspection.ModelType;\r
-import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException;\r
-import org.openecomp.aai.serialization.db.DBSerializer;\r
-import org.openecomp.aai.serialization.engines.TransactionalGraphEngine;\r
-\r
-import javax.inject.Inject;\r
-import java.util.*;\r
-@RunWith(MockitoJUnitRunner.class)\r
-public class ModelBasedProcessingInvalidDataTest {\r
-\r
- @Mock\r
- private static TransactionalGraphEngine dbEngine;\r
- private static Loader loader;\r
- @Mock\r
- private static DBSerializer serializer;\r
- ModelBasedProcessing processor;\r
-\r
- @Mock\r
- private ModelBasedProcessing mockProcessor;\r
-\r
-\r
- @Mock\r
- private DbMethHelper dbMethHelper;\r
-\r
- @BeforeClass\r
- public static void configure() throws Exception {\r
- System.setProperty("AJSC_HOME", ".");\r
- System.setProperty("BUNDLECONFIG_DIR", "bundleconfig-local");\r
- loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, AAIProperties.LATEST);\r
-\r
-\r
- }\r
-\r
- @Before\r
- public void init() {\r
- MockitoAnnotations.initMocks(this);\r
- processor = new ModelBasedProcessing(loader, dbEngine, serializer);\r
-\r
- dbMethHelper = new DbMethHelper(loader, dbEngine);\r
-\r
- }\r
-\r
- @Test\r
- public void getStartNodesAndModVersionIdsTest() throws AAIException {\r
-\r
-\r
- List<Map<String, Object>> startNodeFilterArrayOfHashes = new ArrayList<Map<String, Object>>();\r
- Map<String, Object> map = new HashMap<String, Object>();\r
- map.put("test", new Object());\r
- startNodeFilterArrayOfHashes.add(map);\r
- Map<String, String> result=new HashMap<>();\r
-\r
- Map<String, String> result1 = mockProcessor.getStartNodesAndModVersionIds("test", "test",\r
- "test", "test", "test",\r
- "test", startNodeFilterArrayOfHashes,\r
- "test");\r
- assertNotNull(result);\r
-\r
- }\r
-\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void getStartNodesAndModVersionIdsTest2() throws AAIException {\r
- List<Map<String, Object>> startNodeFilterArrayOfHashes = new ArrayList<Map<String, Object>>();\r
- Map<String, Object> map = new HashMap<String, Object>();\r
- map.put("test", new Object());\r
- startNodeFilterArrayOfHashes.add(map);\r
- Map<String, String> result1 = processor.getStartNodesAndModVersionIds("test", "test",\r
- "", "test", "test",\r
- "test", startNodeFilterArrayOfHashes,\r
- "test");\r
- assertNotNull(result1);\r
- }\r
-\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void getStartNodesAndModVersionIdsTest3() throws AAIException {\r
- List<Map<String, Object>> startNodeFilterArrayOfHashes = new ArrayList<Map<String, Object>>();\r
- Map<String, Object> map = new HashMap<String, Object>();\r
- map.put("test", new Object());\r
- startNodeFilterArrayOfHashes.add(map);\r
- Map<String, String> result1 = processor.getStartNodesAndModVersionIds("test", "test",\r
- "", "", "test",\r
- "test", startNodeFilterArrayOfHashes,\r
- "test");\r
- assertNotNull(result1);\r
- }\r
-\r
-\r
- @Test(expected = AAIException.class)\r
- public void getStartNodesAndModVersionIdsTest4() throws AAIException {\r
- List<Map<String, Object>> startNodeFilterArrayOfHashes = new ArrayList<Map<String, Object>>();\r
- Map<String, Object> map = new HashMap<String, Object>();\r
- map.put("test", new Object());\r
- startNodeFilterArrayOfHashes.add(map);\r
- Map<String, String> result1 = processor.getStartNodesAndModVersionIds("test", "test",\r
- "", "", "",\r
- "test", startNodeFilterArrayOfHashes,\r
- "test");\r
- assertNotNull(result1);\r
- }\r
-\r
-\r
- @Test(expected = AAIException.class)\r
- public void getStartNodesAndModVersionIdsTest5() throws AAIException {\r
- List<Map<String, Object>> startNodeFilterArrayOfHashes = new ArrayList<Map<String, Object>>();\r
- Map<String, Object> map = new HashMap<String, Object>();\r
- map.put("test", new Object());\r
- startNodeFilterArrayOfHashes.add(map);\r
- Map<String, String> result1 = processor.getStartNodesAndModVersionIds("test", "test",\r
- "", "", "",\r
- "", startNodeFilterArrayOfHashes,\r
- "test");\r
- assertNotNull(result1);\r
- }\r
-\r
-\r
- @Test(expected = AAIException.class)\r
- public void getStartNodesAndModVersionIdsNullTest() throws AAIException {\r
- List<Map<String, Object>> startNodeFilterArrayOfHashes = new ArrayList<Map<String, Object>>();\r
-\r
- Map<String, String> result = null;\r
- result = processor.getStartNodesAndModVersionIds("test", "test",\r
- "", "", "",\r
- "", startNodeFilterArrayOfHashes,\r
- "test");\r
-\r
- assertNotNull(result);\r
- }\r
-\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void getStartNodesAndModVersionIdsNullTest1() throws AAIException {\r
- List<Map<String, Object>> startNodeFilterArrayOfHashes = new ArrayList<Map<String, Object>>();\r
-\r
- Map<String, String> result = null;\r
- result = processor.getStartNodesAndModVersionIds("test", "test",\r
- "Test", "", "",\r
- "", startNodeFilterArrayOfHashes,\r
- "test");\r
-\r
- assertNotNull(result);\r
- }\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void getStartNodesAndModVersionIdsNullTest2() throws AAIException {\r
- List<Map<String, Object>> startNodeFilterArrayOfHashes = new ArrayList<Map<String, Object>>();\r
-\r
- Map<String, String> result = null;\r
- result = processor.getStartNodesAndModVersionIds("test", "test",\r
- "", "test", "",\r
- "", startNodeFilterArrayOfHashes,\r
- "test");\r
- assertNotNull(result);\r
- }\r
-\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void getStartNodesAndModVersionIdsNullTest3() throws AAIException {\r
- List<Map<String, Object>> startNodeFilterArrayOfHashes = new ArrayList<Map<String, Object>>();\r
-\r
- Map<String, String> result = null;\r
- result = processor.getStartNodesAndModVersionIds("test", "test",\r
- "", "", "test",\r
- "", startNodeFilterArrayOfHashes,\r
- "test");\r
- assertNotNull(result);\r
- }\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void getModelVerTopWidgetTypeTest() throws AAIException {\r
- Vertex vertex = new EmptyVertex();\r
- //Mockito.when(mockProcessor.getModelVerTopWidgetType(Mockito.any(Vertex.class), Mockito.any(String.class))).thenReturn("Sucess");\r
- String result = processor.getModelVerTopWidgetType(vertex, "test");\r
- assertEquals("result has -local tacked on the end as it should", "Sucess", result\r
- );\r
-\r
- }\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void getModelVerTopWidgetType() throws AAIException {\r
- /*Mockito.when(mockProcessor.getModelVerTopWidgetType(Mockito.any(String.class),\r
- Mockito.any(String.class), Mockito.any(String.class),\r
- Mockito.any(String.class), Mockito.any(String.class))\r
- ).thenReturn("Sucess");*/\r
- String result = processor.getModelVerTopWidgetType("test", "test", "test", "Test", "test");\r
- assertEquals("result has -local tacked on the end as it should", "Sucess", result\r
- );\r
-\r
- }\r
-\r
- @Test(expected = AAIException.class)\r
- public void queryByModel() throws AAIException {\r
- /*Mockito.when(mockProcessor.getModelVerTopWidgetType(Mockito.any(String.class),\r
- Mockito.any(String.class), Mockito.any(String.class),\r
- Mockito.any(String.class), Mockito.any(String.class))\r
- ).thenReturn("Sucess");*/\r
- List<ResultSet> result = processor.queryByModel("test", "test",\r
- "test", "test", "test",\r
- "generic-vnf", null,\r
- "test");\r
- assertEquals("result has -local tacked on the end as it should", 0, result.size());\r
-\r
-\r
- }\r
-\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void queryByModel_Timed() throws AAIException {\r
- List<Map<String, Object>> startNodeFilterArrayOfHashes = new ArrayList<Map<String, Object>>();\r
- Map<String, Object> map = new HashMap<String, Object>();\r
- map.put("test", new Object());\r
- startNodeFilterArrayOfHashes.add(map);\r
- List<ResultSet> result = processor.queryByModel_Timed("test", "test",\r
- "test", "test", "test",\r
- "test", startNodeFilterArrayOfHashes,\r
- "test");\r
- assertEquals("result has -local tacked on the end as it should", 0, result.size());\r
-\r
-\r
- }\r
-\r
- @Mock\r
- Map<String, Object> startNodeFilterHash;\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void runDeleteByModel() throws AAIException {\r
- Map<String, String> resultMock = new HashMap<String, String>();\r
-\r
- // when(mockProcessor.getNodeUsingUniqueId(any(String.class),any(String.class),any(String.class),any(String.class),any(String.class))).thenReturn(vertex);\r
- when(mockProcessor.runDeleteByModel(any(String.class),\r
- any(String.class), any(String.class),\r
- any(String.class), anyMapOf(String.class, Object.class), any(String.class), any(String.class))\r
- ).thenReturn(resultMock);\r
- Map<String, String> result = processor.runDeleteByModel("test", "test",\r
- "test", "test", startNodeFilterHash,\r
- "test",\r
- "test");\r
- assertEquals("result has -local tacked on the end as it should", result.size(), resultMock.size());\r
-\r
-\r
- }\r
-\r
- Optional<Vertex> vertext = Optional.empty();\r
-\r
- @Test(expected = AAIException.class)\r
- public void runDeleteByModelWithNullParams() throws AAIException {\r
- Map<String, String> resultMock = new HashMap<String, String>();\r
-\r
-\r
- Map<String, String> result = processor.runDeleteByModel("test", "test",\r
- null, null, null,\r
- "test",\r
- "test");\r
-\r
- assertNotNull(result);\r
-\r
- }\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void runDeleteByModelWithNullParams1() throws AAIException {\r
-\r
- Map<String, String> result1 = processor.runDeleteByModel("test", "test",\r
- null, "unknown", null,\r
- "test",\r
- "test");\r
- assertNotNull(result1);\r
-\r
- }\r
-\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void runDeleteByModelWithNullParams2() throws AAIException {\r
-\r
- Map<String, String> result1 = processor.runDeleteByModel("test", "test",\r
- null, "unknown", null,\r
- "test",\r
- "test");\r
- assertNotNull(result1);\r
-\r
- }\r
-\r
- @Test(expected = AAIException.class)\r
- public void queryByNamedQuery() throws AAIException{\r
- String transId="test";\r
- String fromAppId="test";\r
- String namedQueryUuid="test";\r
- ArrayList <Map<String,Object>> startNodeFilterArrayOfHashes=new ArrayList<Map<String,Object>>();\r
- String apiVer="test";\r
- List<ResultSet> result=processor.queryByNamedQuery(transId,fromAppId,namedQueryUuid,startNodeFilterArrayOfHashes,apiVer);\r
- assertNotNull(result);\r
- }\r
-\r
- @Test(expected = AAIException.class)\r
- public void queryByNamedQuery1() throws AAIException{\r
- String transId="teet";\r
- String fromAppId="test";\r
- String namedQueryUuid="test";\r
- String secondaryFilterCutPoint="test";\r
- List <Map<String,Object>> startNodeFilterArrayOfHashes=new ArrayList<Map<String,Object>>();\r
- String apiVer="test";\r
- Map<String,Object> secondaryFilterHash=new HashMap<String,Object>();\r
- List<ResultSet> result=processor.queryByNamedQuery(transId,fromAppId,namedQueryUuid,startNodeFilterArrayOfHashes,apiVer,secondaryFilterCutPoint,secondaryFilterHash);\r
- assertNotNull(result);\r
- }\r
-\r
- @Test\r
- public void deleteAsNeededFromResultSet() throws AAIException {\r
- Vertex vert = new BaseVertexLabel("Test");\r
- Map<String, String> resultMock = new HashMap<String, String>();\r
- ResultSet resultSet = new ResultSet();\r
- resultSet.setVert(null);\r
-\r
- Map<String, String> result = processor.deleteAsNeededFromResultSet("test", "test",\r
- resultSet, "test", "test",\r
- "test",\r
- resultMock);\r
-\r
- assertEquals(result.size(), 0);\r
-\r
- resultSet.setVert(vert);\r
-\r
- Map<String, String> result1 = processor.deleteAsNeededFromResultSet("test", "test",\r
- resultSet, "test", "test",\r
- "test",\r
- resultMock);\r
-\r
- assertEquals(result.size(), 0);\r
-\r
-\r
- }\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void pruneResultSetTest() throws AAIException {\r
- ResultSet rs = new ResultSet();\r
- Vertex v = new BaseVertexLabel(AAIProperties.NODE_TYPE);\r
- rs.setVert(v);\r
- List<ResultSet> rsList = new ArrayList<ResultSet>();\r
- ResultSet rs1 = new ResultSet();\r
- rsList.add(rs1);\r
- rs.setSubResultSet(rsList);\r
- Map<String, Object> map = new HashMap<String, Object>();\r
- map.put("test", new Object());\r
- ResultSet resultSet = processor.pruneResultSet(rs, "testr", map);\r
- assertNotNull(resultSet);\r
-\r
- }\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void satisfiesFiltersTest() throws AAIException {\r
- ResultSet rs = new ResultSet();\r
- Vertex v = new BaseVertexLabel(AAIProperties.NODE_TYPE);\r
- rs.setVert(v);\r
- rs.getVert().property(AAIProperties.NODE_TYPE);\r
- List<ResultSet> rsList = new ArrayList<ResultSet>();\r
- ResultSet rs1 = new ResultSet();\r
- rsList.add(rs1);\r
- rs.setSubResultSet(rsList);\r
- Map<String, Object> map = new HashMap<String, Object>();\r
-\r
- map.put("modern.vertex-id", new Object());\r
-\r
- boolean result = processor.satisfiesFilters(rs, map);\r
- assertEquals(result, true);\r
- }\r
-\r
- @Test\r
- public void satisfiesFiltersTest1() throws AAIException {\r
- ResultSet rs = new ResultSet();\r
- Vertex v = new BaseVertexLabel(AAIProperties.NODE_TYPE);\r
- rs.setVert(v);\r
- List<ResultSet> rsList = new ArrayList<ResultSet>();\r
- ResultSet rs1 = new ResultSet();\r
- rsList.add(rs1);\r
- rs.setSubResultSet(rsList);\r
- Map<String, Object> map = new HashMap<String, Object>();\r
- //map.put("test.filter",new Object());\r
-\r
- boolean result = processor.satisfiesFilters(rs, map);\r
- assertEquals(result, false);\r
- }\r
-\r
- @Test(expected = AAIException.class)\r
- public void satisfiesFiltersTest2() throws AAIException {\r
- ResultSet rs = new ResultSet();\r
- Vertex v = new BaseVertexLabel(AAIProperties.NODE_TYPE);\r
- rs.setVert(v);\r
- List<ResultSet> rsList = new ArrayList<ResultSet>();\r
- ResultSet rs1 = new ResultSet();\r
- rsList.add(rs1);\r
- rs.setSubResultSet(rsList);\r
- Map<String, Object> map = new HashMap<String, Object>();\r
- map.put("testfilter", new Object());\r
-\r
- boolean result = processor.satisfiesFilters(rs, map);\r
- assertEquals(result, false);\r
- }\r
-\r
- @Test\r
- public void collapseForDoNotOutputTest() throws AAIException {\r
- ResultSet rs = new ResultSet();\r
- rs.setDoNotOutputFlag("true");\r
- List<ResultSet> rsList = new ArrayList<ResultSet>();\r
- ResultSet rs1 = new ResultSet();\r
- rsList.add(rs1);\r
- rs.setSubResultSet(rsList);\r
- List<ResultSet> result = processor.collapseForDoNotOutput(rs);\r
- assertEquals(result.size(), 1);\r
- }\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void collectInstanceDataTest() throws AAIException {\r
-\r
- BaseVertexLabel bs = new BaseVertexLabel("test");\r
- //bs.setId(80);\r
- EmptyVertex ev = new EmptyVertex();\r
- //ev.setId(50l);\r
- Vertex thisLevelElemVtx = ev;\r
-\r
-\r
- Multimap<String, String> thisMap = ArrayListMultimap.create();\r
- List<String> vidsTraversed = new ArrayList<String>();\r
- // only applies when collecting data using the default model for delete\r
- Multimap<String, String> validNextStepMap = ArrayListMultimap.create();\r
- Map<String, String> namedQueryElementHash = new HashMap<String, String>();\r
- namedQueryElementHash.put("test", "test");\r
- Map<String, String> delKeyHash = new HashMap<String, String>();\r
-\r
- ResultSet rs = processor.collectInstanceData("test", "test", thisLevelElemVtx, "test", validNextStepMap, vidsTraversed, 1, delKeyHash, namedQueryElementHash, "test");\r
- }\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void genTopoMap4ModelVerTest() throws\r
- AAIException {\r
- Vertex vertext = new EmptyVertex();\r
- Multimap<String, String> map = processor.genTopoMap4ModelVer("test", "test", vertext, "test");\r
- assertNotEquals(map, null);\r
- }\r
-\r
- @Test(expected = AAIException.class)\r
- public void genTopoMap4ModelVerTestNull() throws\r
- AAIException {\r
- Vertex vertext = null;\r
- Multimap<String, String> map = processor.genTopoMap4ModelVer("test", "test", vertext, "test");\r
- assertNotEquals(map, null);\r
- }\r
-\r
- @Test\r
- public void makeSureItsAnArrayListTest() {\r
- String input = "model-versionId,modelTestID,modelTestid2;";\r
- List<String> result = processor.makeSureItsAnArrayList(input);\r
- assertTrue(result.size() > 0);\r
- }\r
-\r
- @Test(expected = AAIException.class)\r
- public void getModConstraintHashTest() throws AAIException {\r
- Vertex modelElementVtx = new EmptyVertex();\r
- //modelElementVtx.property(AAIProperties.NODE_TYPE,"Model");\r
- Vertex modelElementVtx1 = new EmptyVertex();\r
- Map<String, Vertex> currentHash = new HashMap<String, Vertex>();\r
- currentHash.put("constraint", modelElementVtx1);\r
- Map<String, Vertex> result = processor.getModConstraintHash(modelElementVtx, currentHash);\r
- assertTrue(result.size() > 0);\r
- }\r
-\r
- @Test(expected = AAIException.class)\r
- public void getModConstraintHashTestNull() throws AAIException {\r
- Vertex modelElementVtx = null;\r
- //modelElementVtx.property(AAIProperties.NODE_TYPE,"Model");\r
- Vertex modelElementVtx1 =null;\r
- Map<String, Vertex> currentHash = new HashMap<String, Vertex>();\r
- currentHash.put("constraint", modelElementVtx1);\r
- Map<String, Vertex> result = processor.getModConstraintHash(modelElementVtx, currentHash);\r
- assertTrue(result.size() > 0);\r
- }\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void getTopElementForSvcOrResModelVerTest() throws AAIException {\r
- Vertex modelElementVtx = new EmptyVertex();\r
- //modelElementVtx.property(AAIProperties.NODE_TYPE,"Model");\r
- Vertex modelElementVtx1 = new EmptyVertex();\r
- Map<String, Vertex> currentHash = new HashMap<String, Vertex>();\r
- currentHash.put("constraint", modelElementVtx1);\r
- Vertex result = processor.getTopElementForSvcOrResModelVer(modelElementVtx, "test");\r
- assertNotEquals(result, null);\r
- }\r
-\r
- @Test\r
- public void getNamedQueryPropOverRideTest() throws AAIException {\r
- String transId = "test";\r
- String fromAppId = "test";\r
- Vertex namedQueryElementVertex = new EmptyVertex();\r
- Vertex instanceVertex = new EmptyVertex();\r
- String apiVer = "test";\r
-\r
- namedQueryElementVertex.properties("property-collect-list", "");\r
-\r
- Map<String, Object> result = processor.getNamedQueryPropOverRide(transId, fromAppId, namedQueryElementVertex, instanceVertex, apiVer);\r
- assertNotEquals(result, null);\r
- }\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void getNamedQueryPropOverRideTestNull() throws AAIException {\r
- String transId = "test";\r
- String fromAppId = "test";\r
- Vertex namedQueryElementVertex = null;\r
- Vertex instanceVertex = new EmptyVertex();\r
- String apiVer = "test";\r
-\r
- namedQueryElementVertex.properties("property-collect-list", "");\r
-\r
- Map<String, Object> result = processor.getNamedQueryPropOverRide(transId, fromAppId, namedQueryElementVertex, instanceVertex, apiVer);\r
- assertNotEquals(result, null);\r
- }\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void namedQueryConstraintSaysStopTest() throws AAIException {\r
- String transId = "test";\r
- String fromAppId = "test";\r
- Vertex namedQueryElementVertex = new EmptyVertex();\r
- Vertex instanceVertex = new EmptyVertex();\r
- String apiVer = "test";\r
-\r
- namedQueryElementVertex.properties("property-collect-list", "");\r
-\r
- boolean result = processor.namedQueryConstraintSaysStop(transId, fromAppId, namedQueryElementVertex, instanceVertex, apiVer);\r
- assertTrue(result);\r
- }\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void namedQueryConstraintSaysStopTestNull() throws AAIException {\r
- String transId = "test";\r
- String fromAppId = "test";\r
- Vertex namedQueryElementVertex = null;\r
- Vertex instanceVertex = new EmptyVertex();\r
- String apiVer = "test";\r
-\r
- namedQueryElementVertex.properties("property-collect-list", "");\r
-\r
- boolean result = processor.namedQueryConstraintSaysStop(transId, fromAppId, namedQueryElementVertex, instanceVertex, apiVer);\r
- assertTrue(result);\r
- }\r
-\r
- @Test(expected = AAIException.class)\r
- public void namedQuerynamedQueryElementVertexNullTest() throws AAIException {\r
- String transId = "test";\r
- String fromAppId = "test";\r
- Vertex namedQueryElementVertex = null;\r
- Vertex instanceVertex = null;\r
- String apiVer = "test";\r
-\r
-\r
- boolean result = processor.namedQueryConstraintSaysStop(transId, fromAppId, namedQueryElementVertex, instanceVertex, apiVer);\r
- assertTrue(result);\r
- }\r
-\r
- @Test(expected = NullPointerException.class)\r
-\r
- public void getNamedQueryExtraDataLookupTest() throws Exception {\r
-\r
- String transId = "test";\r
- String fromAppId = "test";\r
- Vertex namedQueryElementVertex = new EmptyVertex();\r
- Vertex instanceVertex = new EmptyVertex();\r
- String apiVer = "test";\r
-\r
- namedQueryElementVertex.properties("property-collect-list", "");\r
-\r
- Map<String, Object> result = processor.getNamedQueryExtraDataLookup(transId, fromAppId, namedQueryElementVertex, instanceVertex, apiVer);\r
-\r
- assertTrue(result.size() > 0);\r
- }\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void collectNQElementHash() throws AAIException {\r
- String transId = "test";\r
- String fromAppId = "test";\r
- Vertex thisLevelElemVtx = new EmptyVertex();\r
- String incomingTrail = "test";\r
- Map<String, String> currentHash = new HashMap<String, String>();\r
- ArrayList<String> vidsTraversed = new ArrayList<String>();\r
- int levelCounter = 1;\r
-\r
- Map<String, String> result = processor.collectNQElementHash(transId, fromAppId,\r
- thisLevelElemVtx, incomingTrail, currentHash,\r
- vidsTraversed, levelCounter);\r
-\r
- assertNotEquals(result, null);\r
- }\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void collectDeleteKeyHash() throws AAIException {\r
- String transId = "test";\r
- String fromAppId = "test";\r
- Vertex thisLevelElemVtx = new EmptyVertex();\r
- String incomingTrail = "test";\r
- Map<String, String> currentHash = new HashMap<String, String>();\r
- ArrayList<String> vidsTraversed = new ArrayList<String>();\r
- int levelCounter = 1;\r
- Map<String, Vertex> modConstraintHash = new HashMap<String, Vertex>();\r
- String overRideModelId = "test";\r
- String overRideModelVersionId = "test";\r
-\r
- Map<String, String> result = processor.collectDeleteKeyHash(transId, fromAppId,\r
- thisLevelElemVtx, incomingTrail, currentHash,\r
- vidsTraversed, levelCounter, modConstraintHash, overRideModelId, overRideModelVersionId);\r
-\r
- assertNotEquals(result, null);\r
- }\r
-\r
- @Test\r
- public void getLinkageConnectNodeTypesTest() throws AAIException {\r
- List<String> linkagePtList = new ArrayList<String>();\r
- linkagePtList.add("modern\\|testdata\\|");\r
- Set<String> result = processor.getLinkageConnectNodeTypes(linkagePtList);\r
- assertNotEquals(result, null);\r
-\r
- }\r
-\r
- @Test(expected = AAIException.class)\r
- public void getLinkageConnectNodeTypesTest1() throws AAIException {\r
-\r
- Set<String> result1 = processor.getLinkageConnectNodeTypes(null);\r
- assertNotEquals(result1, null);\r
-\r
- List<String> linkagePtList = new ArrayList<String>();\r
- linkagePtList.add("moderntestdata");\r
- Set<String> result = processor.getLinkageConnectNodeTypes(linkagePtList);\r
- assertNotEquals(result, null);\r
- }\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void collectTopology4ModelVerTest() throws AAIException {\r
- String transId = "test";\r
- String fromAppId = "test";\r
- Multimap<String, String> thisMap = ArrayListMultimap.create();\r
- Vertex thisLevelElemVtx = new EmptyVertex();\r
- String incomingTrail = "test";\r
- Map<String, Vertex> currentHash = new HashMap<String, Vertex>();\r
- List<String> vidsTraversed = new ArrayList<String>();\r
- int levelCounter = 1;\r
-\r
- Multimap<String, String> result = processor.collectTopology4ModelVer(transId, fromAppId,\r
- thisLevelElemVtx, incomingTrail, thisMap, vidsTraversed, levelCounter, currentHash\r
- , "test", "test");\r
-\r
- assertNotEquals(result, null);\r
- }\r
-\r
- @Test(expected = AAIException.class)\r
- public void check4EdgeRuleTest() throws AAIException {\r
- processor.check4EdgeRule("test", "test");\r
- }\r
-\r
- @Test(expected = AAIException.class)\r
- public void collectTopology4LinkagePointTest() throws AAIException {\r
- String transId = "test";\r
- String fromAppId = "test";\r
- String linkagePointStrVal = "test";\r
- String incomingTrail = "test";\r
- Multimap<String, String> currentMap = ArrayListMultimap.create();\r
-\r
- Multimap<String, String> result = processor.collectTopology4LinkagePoint(transId, fromAppId, linkagePointStrVal, incomingTrail, currentMap);\r
- assertNotEquals(result, null);\r
-\r
- }\r
-\r
- @Test(expected = AAIException.class)\r
- public void getNextStepElementsFromSet() throws AAIException {\r
- Vertex constrElemSetVtx = new EmptyVertex();\r
- constrElemSetVtx.<String>property(AAIProperties.NODE_TYPE);\r
- Map<String, Object> result = processor.getNextStepElementsFromSet(constrElemSetVtx);\r
- assertNotEquals(result, null);\r
- }\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void genTopoMap4NamedQTest() throws AAIException {\r
- String transId = "test";\r
- String fromAppId = "test";\r
- Vertex queryVertex = new EmptyVertex();\r
- String namedQueryUuid = "E44533334343";\r
- Multimap<String, String> result = processor.genTopoMap4NamedQ(transId, fromAppId, queryVertex, namedQueryUuid);\r
- assertNotEquals(result, null);\r
- }\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void collectTopology4NamedQTest() throws AAIException {\r
- String transId = "test";\r
- String fromAppId = "test";\r
- Multimap<String, String> thisMap = ArrayListMultimap.create();\r
- Vertex thisLevelElemVtx = new EmptyVertex();\r
- String incomingTrail = "test";\r
- Map<String, Vertex> currentHash = new HashMap<String, Vertex>();\r
- List<String> vidsTraversed = new ArrayList<String>();\r
- int levelCounter = 1;\r
-\r
- Multimap<String, String> result = processor.collectTopology4NamedQ(transId, fromAppId,\r
- thisLevelElemVtx, incomingTrail, thisMap, vidsTraversed, levelCounter);\r
- assertNotEquals(result, null);\r
- }\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void getModelThatNqElementRepresentsTest() throws AAIException {\r
- Vertex thisLevelElemVtx = new EmptyVertex();\r
- String incomingTrail = "test";\r
- Vertex vertex = processor.getModelThatNqElementRepresents(thisLevelElemVtx, incomingTrail);\r
- assertNotEquals(vertex, null);\r
- }\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void getModelGivenModelVer() throws AAIException {\r
- Vertex thisLevelElemVtx = new EmptyVertex();\r
- String incomingTrail = "test";\r
- Vertex vertex = processor.getModelGivenModelVer(thisLevelElemVtx, incomingTrail);\r
- assertNotEquals(vertex, null);\r
- }\r
-\r
- @Test(expected = AAIException.class)\r
- public void getModelTypeFromModel() throws AAIException {\r
- Vertex thisLevelElemVtx = new EmptyVertex();\r
- String incomingTrail = "test";\r
- String vertex = processor.getModelTypeFromModel(thisLevelElemVtx, incomingTrail);\r
- assertNotEquals(vertex, null);\r
- }\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void getModelTypeFromModelVer() throws AAIException {\r
- Vertex thisLevelElemVtx = new EmptyVertex();\r
- String incomingTrail = "test";\r
- String vertex = processor.getModelTypeFromModelVer(thisLevelElemVtx, incomingTrail);\r
- assertNotEquals(vertex, null);\r
- }\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void getModelElementStepName() throws AAIException {\r
- Vertex thisLevelElemVtx = new EmptyVertex();\r
- String incomingTrail = "test";\r
- String vertex = processor.getModelElementStepName(thisLevelElemVtx, incomingTrail);\r
- assertNotEquals(vertex, null);\r
- }\r
-\r
- @Test(expected = AAIException.class)\r
- public void nodeTypeSupportsPersona() throws AAIException {\r
- String incomingTrail = "";\r
- boolean vertex = processor.nodeTypeSupportsPersona(incomingTrail);\r
- assertFalse(vertex);\r
-\r
-\r
- incomingTrail = "test";\r
- boolean vertex1 = processor.nodeTypeSupportsPersona(incomingTrail);\r
- assertTrue(vertex1);\r
- }\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void getNqElementWidgetType() throws AAIException{\r
- String appId="test";\r
- String transID="test";\r
- Vertex thisLevelElemVtx = new EmptyVertex();\r
- String incomingTrail = "test";\r
- String vertex1 = processor.getNqElementWidgetType(appId,transID,thisLevelElemVtx,incomingTrail);\r
- assertNotEquals(vertex1,null);\r
- }\r
-\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void getModElementWidgetType() throws AAIException{\r
- String appId="test";\r
- String transID="test";\r
- Vertex thisLevelElemVtx = new EmptyVertex();\r
- String incomingTrail = "test";\r
- String vertex1 = processor.getModElementWidgetType(thisLevelElemVtx,incomingTrail);\r
- assertNotEquals(vertex1,null);\r
- }\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void getNodeUsingUniqueId() throws AAIException{\r
- String appId="test";\r
- String transID="test";\r
- String nodeType = "generic-vnf";\r
- String idPropertyName = "test";\r
- String uniqueIdVal="test";\r
- Vertex vertex1 = processor.getNodeUsingUniqueId(transID,appId,nodeType,idPropertyName,uniqueIdVal);\r
- assertNotEquals(vertex1,null);\r
- }\r
-\r
-\r
- @Test(expected = AAIException.class)\r
- public void getNodeUsingUniqueIdNull() throws AAIException{\r
- String appId="test";\r
- String transID="test";\r
- String nodeType = "generic-vnf";\r
- String idPropertyName = "test";\r
- String uniqueIdVal="";\r
- Vertex vertex1 = null;\r
- vertex1= processor.getNodeUsingUniqueId(transID,appId,nodeType,idPropertyName,uniqueIdVal);\r
- assertNotEquals(vertex1,null);\r
-\r
- }\r
-\r
-\r
- @Test(expected = AAIException.class)\r
- public void getNodeUsingUniqueIdNull1() throws AAIException{\r
- String appId="test";\r
- String transID="test";\r
- String nodeType = "generic-vnf";\r
- String idPropertyName="";\r
- String uniqueIdVal="test";\r
- Vertex vertex1 = null;\r
- vertex1= processor.getNodeUsingUniqueId(transID,appId,nodeType,idPropertyName,uniqueIdVal);\r
- assertNotEquals(vertex1,null);\r
-\r
-\r
- }\r
-\r
-\r
- @Test(expected = AAIException.class)\r
- public void getNodeUsingUniqueIdNull2() throws AAIException{\r
- String appId="test";\r
- String transID="test";\r
- String nodeType = "";\r
- String idPropertyName="test";\r
- String uniqueIdVal="test";\r
- Vertex vertex1 = null;\r
- vertex1= processor.getNodeUsingUniqueId(transID,appId,nodeType,idPropertyName,uniqueIdVal);\r
- assertNotEquals(vertex1,null);\r
-\r
-\r
- }\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void getModelVersUsingName() throws AAIException{\r
- String appId="test";\r
- String transID="test";\r
- String modelName = "test";\r
-\r
- List<Vertex> result= processor.getModelVersUsingName(transID,appId,modelName);\r
- assertNotEquals(result,null);\r
- }\r
-\r
-\r
- @Test(expected = AAIException.class)\r
- public void getModelVersUsingNameNull() throws AAIException{\r
- String appId="test";\r
- String transID="test";\r
- String modelName = "";\r
-\r
- List<Vertex> result= processor.getModelVersUsingName(transID,appId,modelName);\r
- assertNotEquals(result,null);\r
- }\r
-\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void getModVersUsingModelInvId() throws AAIException{\r
- String appId="test";\r
- String transID="test";\r
- String modelName = "test";\r
-\r
- Iterator<Vertex> result= processor.getModVersUsingModelInvId(transID,appId,modelName);\r
- assertNotEquals(result,null);\r
- }\r
-\r
- @Test(expected = AAIException.class)\r
- public void getModVersUsingModelInvIdNull() throws AAIException{\r
- String appId="test";\r
- String transID="test";\r
- String modelName = "";\r
-\r
- Iterator<Vertex> result= processor.getModVersUsingModelInvId(transID,appId,modelName);\r
- assertNotEquals(result,null);\r
- }\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void getModVersUsingModel() throws AAIException{\r
- String appId="test";\r
- String transID="test";\r
- String modelName = "test";\r
- Vertex thisLevelElemVtx = new EmptyVertex();\r
- List<Vertex> result= processor.getModVersUsingModel(transID,appId,thisLevelElemVtx);\r
- assertNotEquals(result,null);\r
- }\r
-\r
- @Test(expected = AAIException.class)\r
- public void getModVersUsingModel1() throws AAIException{\r
- String appId="test";\r
- String transID="test";\r
-\r
- Vertex thisLevelElemVtx = null;\r
- List<Vertex> result= processor.getModVersUsingModel(transID,appId,thisLevelElemVtx);\r
- assertNotEquals(result,null);\r
- }\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void getModelVerIdsUsingName() throws AAIException{\r
- String appId="test";\r
- String transID="test";\r
-\r
- String modelName= "test";\r
- List<String> result= processor.getModelVerIdsUsingName(transID,appId,modelName);\r
- assertNotEquals(result,null);\r
- }\r
-\r
- @Test(expected = AAIException.class)\r
- public void getModelVerIdsUsingName1() throws AAIException{\r
- String appId="test";\r
- String transID="test";\r
-\r
- String modelName= "";\r
- List<String> result= processor.getModelVerIdsUsingName(transID,appId,modelName);\r
- assertNotEquals(result,null);\r
- }\r
-\r
- @Test(expected =NullPointerException.class)\r
- public void validateModel() throws AAIException{\r
- String appId="test";\r
- String transID="test";\r
-\r
- String modelVersionId= "test";\r
- String modelInvId= "test";\r
- String modelName= "test";\r
- processor.validateModel(transID,appId,modelName,modelVersionId);\r
-\r
-\r
- }\r
-\r
-\r
-\r
-}\r
-\r
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.aai.dbgraphgen;
+
+import static org.junit.Assert.*;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyMap;
+import static org.mockito.Matchers.anyMapOf;
+import static org.mockito.Mockito.*;
+
+import com.bazaarvoice.jolt.modifier.DataType;
+import com.google.common.collect.ArrayListMultimap;
+import com.google.common.collect.LinkedListMultimap;
+import com.google.common.collect.Multimap;
+import com.thinkaurelius.titan.graphdb.olap.computer.VertexMapJob;
+import com.thinkaurelius.titan.graphdb.types.VertexLabelVertex;
+import com.thinkaurelius.titan.graphdb.types.system.BaseVertexLabel;
+import com.thinkaurelius.titan.graphdb.types.system.EmptyVertex;
+import com.thinkaurelius.titan.graphdb.types.vertices.EdgeLabelVertex;
+import com.thinkaurelius.titan.graphdb.types.vertices.PropertyKeyVertex;
+import org.apache.commons.lang.ObjectUtils;
+import org.apache.openjpa.kernel.exps.Exp;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.T;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.VertexProperty;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.*;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.aai.db.DbMethHelper;
+import org.onap.aai.db.props.AAIProperties;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.introspection.Loader;
+import org.onap.aai.introspection.LoaderFactory;
+import org.onap.aai.introspection.ModelType;
+import org.onap.aai.introspection.exceptions.AAIUnknownObjectException;
+import org.onap.aai.serialization.db.DBSerializer;
+import org.onap.aai.serialization.engines.TransactionalGraphEngine;
+
+import javax.inject.Inject;
+import java.util.*;
+@RunWith(MockitoJUnitRunner.class)
+public class ModelBasedProcessingInvalidDataTest {
+
+ @Mock
+ private static TransactionalGraphEngine dbEngine;
+ private static Loader loader;
+ @Mock
+ private static DBSerializer serializer;
+ ModelBasedProcessing processor;
+
+ @Mock
+ private ModelBasedProcessing mockProcessor;
+
+
+ @Mock
+ private DbMethHelper dbMethHelper;
+
+ @BeforeClass
+ public static void configure() throws Exception {
+ System.setProperty("AJSC_HOME", ".");
+ System.setProperty("BUNDLECONFIG_DIR", "bundleconfig-local");
+ loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, AAIProperties.LATEST);
+
+
+ }
+
+ @Before
+ public void init() {
+ MockitoAnnotations.initMocks(this);
+ processor = new ModelBasedProcessing(loader, dbEngine, serializer);
+
+ dbMethHelper = new DbMethHelper(loader, dbEngine);
+
+ }
+
+ @Test
+ public void getStartNodesAndModVersionIdsTest() throws AAIException {
+
+
+ List<Map<String, Object>> startNodeFilterArrayOfHashes = new ArrayList<Map<String, Object>>();
+ Map<String, Object> map = new HashMap<String, Object>();
+ map.put("test", new Object());
+ startNodeFilterArrayOfHashes.add(map);
+ Map<String, String> result=new HashMap<>();
+
+ Map<String, String> result1 = mockProcessor.getStartNodesAndModVersionIds("test", "test",
+ "test", "test", "test",
+ "test", startNodeFilterArrayOfHashes,
+ "test");
+ assertNotNull(result);
+
+ }
+
+
+ @Test(expected = NullPointerException.class)
+ public void getStartNodesAndModVersionIdsTest2() throws AAIException {
+ List<Map<String, Object>> startNodeFilterArrayOfHashes = new ArrayList<Map<String, Object>>();
+ Map<String, Object> map = new HashMap<String, Object>();
+ map.put("test", new Object());
+ startNodeFilterArrayOfHashes.add(map);
+ Map<String, String> result1 = processor.getStartNodesAndModVersionIds("test", "test",
+ "", "test", "test",
+ "test", startNodeFilterArrayOfHashes,
+ "test");
+ assertNotNull(result1);
+ }
+
+
+ @Test(expected = NullPointerException.class)
+ public void getStartNodesAndModVersionIdsTest3() throws AAIException {
+ List<Map<String, Object>> startNodeFilterArrayOfHashes = new ArrayList<Map<String, Object>>();
+ Map<String, Object> map = new HashMap<String, Object>();
+ map.put("test", new Object());
+ startNodeFilterArrayOfHashes.add(map);
+ Map<String, String> result1 = processor.getStartNodesAndModVersionIds("test", "test",
+ "", "", "test",
+ "test", startNodeFilterArrayOfHashes,
+ "test");
+ assertNotNull(result1);
+ }
+
+
+ @Test(expected = AAIException.class)
+ public void getStartNodesAndModVersionIdsTest4() throws AAIException {
+ List<Map<String, Object>> startNodeFilterArrayOfHashes = new ArrayList<Map<String, Object>>();
+ Map<String, Object> map = new HashMap<String, Object>();
+ map.put("test", new Object());
+ startNodeFilterArrayOfHashes.add(map);
+ Map<String, String> result1 = processor.getStartNodesAndModVersionIds("test", "test",
+ "", "", "",
+ "test", startNodeFilterArrayOfHashes,
+ "test");
+ assertNotNull(result1);
+ }
+
+
+ @Test(expected = AAIException.class)
+ public void getStartNodesAndModVersionIdsTest5() throws AAIException {
+ List<Map<String, Object>> startNodeFilterArrayOfHashes = new ArrayList<Map<String, Object>>();
+ Map<String, Object> map = new HashMap<String, Object>();
+ map.put("test", new Object());
+ startNodeFilterArrayOfHashes.add(map);
+ Map<String, String> result1 = processor.getStartNodesAndModVersionIds("test", "test",
+ "", "", "",
+ "", startNodeFilterArrayOfHashes,
+ "test");
+ assertNotNull(result1);
+ }
+
+
+ @Test(expected = AAIException.class)
+ public void getStartNodesAndModVersionIdsNullTest() throws AAIException {
+ List<Map<String, Object>> startNodeFilterArrayOfHashes = new ArrayList<Map<String, Object>>();
+
+ Map<String, String> result = null;
+ result = processor.getStartNodesAndModVersionIds("test", "test",
+ "", "", "",
+ "", startNodeFilterArrayOfHashes,
+ "test");
+
+ assertNotNull(result);
+ }
+
+
+ @Test(expected = NullPointerException.class)
+ public void getStartNodesAndModVersionIdsNullTest1() throws AAIException {
+ List<Map<String, Object>> startNodeFilterArrayOfHashes = new ArrayList<Map<String, Object>>();
+
+ Map<String, String> result = null;
+ result = processor.getStartNodesAndModVersionIds("test", "test",
+ "Test", "", "",
+ "", startNodeFilterArrayOfHashes,
+ "test");
+
+ assertNotNull(result);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void getStartNodesAndModVersionIdsNullTest2() throws AAIException {
+ List<Map<String, Object>> startNodeFilterArrayOfHashes = new ArrayList<Map<String, Object>>();
+
+ Map<String, String> result = null;
+ result = processor.getStartNodesAndModVersionIds("test", "test",
+ "", "test", "",
+ "", startNodeFilterArrayOfHashes,
+ "test");
+ assertNotNull(result);
+ }
+
+
+ @Test(expected = NullPointerException.class)
+ public void getStartNodesAndModVersionIdsNullTest3() throws AAIException {
+ List<Map<String, Object>> startNodeFilterArrayOfHashes = new ArrayList<Map<String, Object>>();
+
+ Map<String, String> result = null;
+ result = processor.getStartNodesAndModVersionIds("test", "test",
+ "", "", "test",
+ "", startNodeFilterArrayOfHashes,
+ "test");
+ assertNotNull(result);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void getModelVerTopWidgetTypeTest() throws AAIException {
+ Vertex vertex = new EmptyVertex();
+ //Mockito.when(mockProcessor.getModelVerTopWidgetType(Mockito.any(Vertex.class), Mockito.any(String.class))).thenReturn("Sucess");
+ String result = processor.getModelVerTopWidgetType(vertex, "test");
+ assertEquals("result has -local tacked on the end as it should", "Sucess", result
+ );
+
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void getModelVerTopWidgetType() throws AAIException {
+ /*Mockito.when(mockProcessor.getModelVerTopWidgetType(Mockito.any(String.class),
+ Mockito.any(String.class), Mockito.any(String.class),
+ Mockito.any(String.class), Mockito.any(String.class))
+ ).thenReturn("Sucess");*/
+ String result = processor.getModelVerTopWidgetType("test", "test", "test", "Test", "test");
+ assertEquals("result has -local tacked on the end as it should", "Sucess", result
+ );
+
+ }
+
+ @Test(expected = AAIException.class)
+ public void queryByModel() throws AAIException {
+ /*Mockito.when(mockProcessor.getModelVerTopWidgetType(Mockito.any(String.class),
+ Mockito.any(String.class), Mockito.any(String.class),
+ Mockito.any(String.class), Mockito.any(String.class))
+ ).thenReturn("Sucess");*/
+ List<ResultSet> result = processor.queryByModel("test", "test",
+ "test", "test", "test",
+ "generic-vnf", null,
+ "test");
+ assertEquals("result has -local tacked on the end as it should", 0, result.size());
+
+
+ }
+
+
+ @Test(expected = NullPointerException.class)
+ public void queryByModel_Timed() throws AAIException {
+ List<Map<String, Object>> startNodeFilterArrayOfHashes = new ArrayList<Map<String, Object>>();
+ Map<String, Object> map = new HashMap<String, Object>();
+ map.put("test", new Object());
+ startNodeFilterArrayOfHashes.add(map);
+ List<ResultSet> result = processor.queryByModel_Timed("test", "test",
+ "test", "test", "test",
+ "test", startNodeFilterArrayOfHashes,
+ "test");
+ assertEquals("result has -local tacked on the end as it should", 0, result.size());
+
+
+ }
+
+ @Mock
+ Map<String, Object> startNodeFilterHash;
+
+ @Test(expected = NullPointerException.class)
+ public void runDeleteByModel() throws AAIException {
+ Map<String, String> resultMock = new HashMap<String, String>();
+
+ // when(mockProcessor.getNodeUsingUniqueId(any(String.class),any(String.class),any(String.class),any(String.class),any(String.class))).thenReturn(vertex);
+ when(mockProcessor.runDeleteByModel(any(String.class),
+ any(String.class), any(String.class),
+ any(String.class), anyMapOf(String.class, Object.class), any(String.class), any(String.class))
+ ).thenReturn(resultMock);
+ Map<String, String> result = processor.runDeleteByModel("test", "test",
+ "test", "test", startNodeFilterHash,
+ "test",
+ "test");
+ assertEquals("result has -local tacked on the end as it should", result.size(), resultMock.size());
+
+
+ }
+
+ Optional<Vertex> vertext = Optional.empty();
+
+ @Test(expected = AAIException.class)
+ public void runDeleteByModelWithNullParams() throws AAIException {
+ Map<String, String> resultMock = new HashMap<String, String>();
+
+
+ Map<String, String> result = processor.runDeleteByModel("test", "test",
+ null, null, null,
+ "test",
+ "test");
+
+ assertNotNull(result);
+
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void runDeleteByModelWithNullParams1() throws AAIException {
+
+ Map<String, String> result1 = processor.runDeleteByModel("test", "test",
+ null, "unknown", null,
+ "test",
+ "test");
+ assertNotNull(result1);
+
+ }
+
+
+ @Test(expected = NullPointerException.class)
+ public void runDeleteByModelWithNullParams2() throws AAIException {
+
+ Map<String, String> result1 = processor.runDeleteByModel("test", "test",
+ null, "unknown", null,
+ "test",
+ "test");
+ assertNotNull(result1);
+
+ }
+
+ @Test(expected = AAIException.class)
+ public void queryByNamedQuery() throws AAIException{
+ String transId="test";
+ String fromAppId="test";
+ String namedQueryUuid="test";
+ ArrayList <Map<String,Object>> startNodeFilterArrayOfHashes=new ArrayList<Map<String,Object>>();
+ String apiVer="test";
+ List<ResultSet> result=processor.queryByNamedQuery(transId,fromAppId,namedQueryUuid,startNodeFilterArrayOfHashes,apiVer);
+ assertNotNull(result);
+ }
+
+ @Test(expected = AAIException.class)
+ public void queryByNamedQuery1() throws AAIException{
+ String transId="teet";
+ String fromAppId="test";
+ String namedQueryUuid="test";
+ String secondaryFilterCutPoint="test";
+ List <Map<String,Object>> startNodeFilterArrayOfHashes=new ArrayList<Map<String,Object>>();
+ String apiVer="test";
+ Map<String,Object> secondaryFilterHash=new HashMap<String,Object>();
+ List<ResultSet> result=processor.queryByNamedQuery(transId,fromAppId,namedQueryUuid,startNodeFilterArrayOfHashes,apiVer,secondaryFilterCutPoint,secondaryFilterHash);
+ assertNotNull(result);
+ }
+
+ @Test
+ public void deleteAsNeededFromResultSet() throws AAIException {
+ Vertex vert = new BaseVertexLabel("Test");
+ Map<String, String> resultMock = new HashMap<String, String>();
+ ResultSet resultSet = new ResultSet();
+ resultSet.setVert(null);
+
+ Map<String, String> result = processor.deleteAsNeededFromResultSet("test", "test",
+ resultSet, "test", "test",
+ "test",
+ resultMock);
+
+ assertEquals(result.size(), 0);
+
+ resultSet.setVert(vert);
+
+ Map<String, String> result1 = processor.deleteAsNeededFromResultSet("test", "test",
+ resultSet, "test", "test",
+ "test",
+ resultMock);
+
+ assertEquals(result.size(), 0);
+
+
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void pruneResultSetTest() throws AAIException {
+ ResultSet rs = new ResultSet();
+ Vertex v = new BaseVertexLabel(AAIProperties.NODE_TYPE);
+ rs.setVert(v);
+ List<ResultSet> rsList = new ArrayList<ResultSet>();
+ ResultSet rs1 = new ResultSet();
+ rsList.add(rs1);
+ rs.setSubResultSet(rsList);
+ Map<String, Object> map = new HashMap<String, Object>();
+ map.put("test", new Object());
+ ResultSet resultSet = processor.pruneResultSet(rs, "testr", map);
+ assertNotNull(resultSet);
+
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void satisfiesFiltersTest() throws AAIException {
+ ResultSet rs = new ResultSet();
+ Vertex v = new BaseVertexLabel(AAIProperties.NODE_TYPE);
+ rs.setVert(v);
+ rs.getVert().property(AAIProperties.NODE_TYPE);
+ List<ResultSet> rsList = new ArrayList<ResultSet>();
+ ResultSet rs1 = new ResultSet();
+ rsList.add(rs1);
+ rs.setSubResultSet(rsList);
+ Map<String, Object> map = new HashMap<String, Object>();
+
+ map.put("modern.vertex-id", new Object());
+
+ boolean result = processor.satisfiesFilters(rs, map);
+ assertEquals(result, true);
+ }
+
+ @Test
+ public void satisfiesFiltersTest1() throws AAIException {
+ ResultSet rs = new ResultSet();
+ Vertex v = new BaseVertexLabel(AAIProperties.NODE_TYPE);
+ rs.setVert(v);
+ List<ResultSet> rsList = new ArrayList<ResultSet>();
+ ResultSet rs1 = new ResultSet();
+ rsList.add(rs1);
+ rs.setSubResultSet(rsList);
+ Map<String, Object> map = new HashMap<String, Object>();
+ //map.put("test.filter",new Object());
+
+ boolean result = processor.satisfiesFilters(rs, map);
+ assertEquals(result, false);
+ }
+
+ @Test(expected = AAIException.class)
+ public void satisfiesFiltersTest2() throws AAIException {
+ ResultSet rs = new ResultSet();
+ Vertex v = new BaseVertexLabel(AAIProperties.NODE_TYPE);
+ rs.setVert(v);
+ List<ResultSet> rsList = new ArrayList<ResultSet>();
+ ResultSet rs1 = new ResultSet();
+ rsList.add(rs1);
+ rs.setSubResultSet(rsList);
+ Map<String, Object> map = new HashMap<String, Object>();
+ map.put("testfilter", new Object());
+
+ boolean result = processor.satisfiesFilters(rs, map);
+ assertEquals(result, false);
+ }
+
+ @Test
+ public void collapseForDoNotOutputTest() throws AAIException {
+ ResultSet rs = new ResultSet();
+ rs.setDoNotOutputFlag("true");
+ List<ResultSet> rsList = new ArrayList<ResultSet>();
+ ResultSet rs1 = new ResultSet();
+ rsList.add(rs1);
+ rs.setSubResultSet(rsList);
+ List<ResultSet> result = processor.collapseForDoNotOutput(rs);
+ assertEquals(result.size(), 1);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void collectInstanceDataTest() throws AAIException {
+
+ BaseVertexLabel bs = new BaseVertexLabel("test");
+ //bs.setId(80);
+ EmptyVertex ev = new EmptyVertex();
+ //ev.setId(50l);
+ Vertex thisLevelElemVtx = ev;
+
+
+ Multimap<String, String> thisMap = ArrayListMultimap.create();
+ List<String> vidsTraversed = new ArrayList<String>();
+ // only applies when collecting data using the default model for delete
+ Multimap<String, String> validNextStepMap = ArrayListMultimap.create();
+ Map<String, String> namedQueryElementHash = new HashMap<String, String>();
+ namedQueryElementHash.put("test", "test");
+ Map<String, String> delKeyHash = new HashMap<String, String>();
+
+ ResultSet rs = processor.collectInstanceData("test", "test", thisLevelElemVtx, "test", validNextStepMap, vidsTraversed, 1, delKeyHash, namedQueryElementHash, "test");
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void genTopoMap4ModelVerTest() throws
+ AAIException {
+ Vertex vertext = new EmptyVertex();
+ Multimap<String, String> map = processor.genTopoMap4ModelVer("test", "test", vertext, "test");
+ assertNotEquals(map, null);
+ }
+
+ @Test(expected = AAIException.class)
+ public void genTopoMap4ModelVerTestNull() throws
+ AAIException {
+ Vertex vertext = null;
+ Multimap<String, String> map = processor.genTopoMap4ModelVer("test", "test", vertext, "test");
+ assertNotEquals(map, null);
+ }
+
+ @Test
+ public void makeSureItsAnArrayListTest() {
+ String input = "model-versionId,modelTestID,modelTestid2;";
+ List<String> result = processor.makeSureItsAnArrayList(input);
+ assertTrue(result.size() > 0);
+ }
+
+ @Test(expected = AAIException.class)
+ public void getModConstraintHashTest() throws AAIException {
+ Vertex modelElementVtx = new EmptyVertex();
+ //modelElementVtx.property(AAIProperties.NODE_TYPE,"Model");
+ Vertex modelElementVtx1 = new EmptyVertex();
+ Map<String, Vertex> currentHash = new HashMap<String, Vertex>();
+ currentHash.put("constraint", modelElementVtx1);
+ Map<String, Vertex> result = processor.getModConstraintHash(modelElementVtx, currentHash);
+ assertTrue(result.size() > 0);
+ }
+
+ @Test(expected = AAIException.class)
+ public void getModConstraintHashTestNull() throws AAIException {
+ Vertex modelElementVtx = null;
+ //modelElementVtx.property(AAIProperties.NODE_TYPE,"Model");
+ Vertex modelElementVtx1 =null;
+ Map<String, Vertex> currentHash = new HashMap<String, Vertex>();
+ currentHash.put("constraint", modelElementVtx1);
+ Map<String, Vertex> result = processor.getModConstraintHash(modelElementVtx, currentHash);
+ assertTrue(result.size() > 0);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void getTopElementForSvcOrResModelVerTest() throws AAIException {
+ Vertex modelElementVtx = new EmptyVertex();
+ //modelElementVtx.property(AAIProperties.NODE_TYPE,"Model");
+ Vertex modelElementVtx1 = new EmptyVertex();
+ Map<String, Vertex> currentHash = new HashMap<String, Vertex>();
+ currentHash.put("constraint", modelElementVtx1);
+ Vertex result = processor.getTopElementForSvcOrResModelVer(modelElementVtx, "test");
+ assertNotEquals(result, null);
+ }
+
+ @Test
+ public void getNamedQueryPropOverRideTest() throws AAIException {
+ String transId = "test";
+ String fromAppId = "test";
+ Vertex namedQueryElementVertex = new EmptyVertex();
+ Vertex instanceVertex = new EmptyVertex();
+ String apiVer = "test";
+
+ namedQueryElementVertex.properties("property-collect-list", "");
+
+ Map<String, Object> result = processor.getNamedQueryPropOverRide(transId, fromAppId, namedQueryElementVertex, instanceVertex, apiVer);
+ assertNotEquals(result, null);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void getNamedQueryPropOverRideTestNull() throws AAIException {
+ String transId = "test";
+ String fromAppId = "test";
+ Vertex namedQueryElementVertex = null;
+ Vertex instanceVertex = new EmptyVertex();
+ String apiVer = "test";
+
+ namedQueryElementVertex.properties("property-collect-list", "");
+
+ Map<String, Object> result = processor.getNamedQueryPropOverRide(transId, fromAppId, namedQueryElementVertex, instanceVertex, apiVer);
+ assertNotEquals(result, null);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void namedQueryConstraintSaysStopTest() throws AAIException {
+ String transId = "test";
+ String fromAppId = "test";
+ Vertex namedQueryElementVertex = new EmptyVertex();
+ Vertex instanceVertex = new EmptyVertex();
+ String apiVer = "test";
+
+ namedQueryElementVertex.properties("property-collect-list", "");
+
+ boolean result = processor.namedQueryConstraintSaysStop(transId, fromAppId, namedQueryElementVertex, instanceVertex, apiVer);
+ assertTrue(result);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void namedQueryConstraintSaysStopTestNull() throws AAIException {
+ String transId = "test";
+ String fromAppId = "test";
+ Vertex namedQueryElementVertex = null;
+ Vertex instanceVertex = new EmptyVertex();
+ String apiVer = "test";
+
+ namedQueryElementVertex.properties("property-collect-list", "");
+
+ boolean result = processor.namedQueryConstraintSaysStop(transId, fromAppId, namedQueryElementVertex, instanceVertex, apiVer);
+ assertTrue(result);
+ }
+
+ @Test(expected = AAIException.class)
+ public void namedQuerynamedQueryElementVertexNullTest() throws AAIException {
+ String transId = "test";
+ String fromAppId = "test";
+ Vertex namedQueryElementVertex = null;
+ Vertex instanceVertex = null;
+ String apiVer = "test";
+
+
+ boolean result = processor.namedQueryConstraintSaysStop(transId, fromAppId, namedQueryElementVertex, instanceVertex, apiVer);
+ assertTrue(result);
+ }
+
+ @Test(expected = NullPointerException.class)
+
+ public void getNamedQueryExtraDataLookupTest() throws Exception {
+
+ String transId = "test";
+ String fromAppId = "test";
+ Vertex namedQueryElementVertex = new EmptyVertex();
+ Vertex instanceVertex = new EmptyVertex();
+ String apiVer = "test";
+
+ namedQueryElementVertex.properties("property-collect-list", "");
+
+ Map<String, Object> result = processor.getNamedQueryExtraDataLookup(transId, fromAppId, namedQueryElementVertex, instanceVertex, apiVer);
+
+ assertTrue(result.size() > 0);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void collectNQElementHash() throws AAIException {
+ String transId = "test";
+ String fromAppId = "test";
+ Vertex thisLevelElemVtx = new EmptyVertex();
+ String incomingTrail = "test";
+ Map<String, String> currentHash = new HashMap<String, String>();
+ ArrayList<String> vidsTraversed = new ArrayList<String>();
+ int levelCounter = 1;
+
+ Map<String, String> result = processor.collectNQElementHash(transId, fromAppId,
+ thisLevelElemVtx, incomingTrail, currentHash,
+ vidsTraversed, levelCounter);
+
+ assertNotEquals(result, null);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void collectDeleteKeyHash() throws AAIException {
+ String transId = "test";
+ String fromAppId = "test";
+ Vertex thisLevelElemVtx = new EmptyVertex();
+ String incomingTrail = "test";
+ Map<String, String> currentHash = new HashMap<String, String>();
+ ArrayList<String> vidsTraversed = new ArrayList<String>();
+ int levelCounter = 1;
+ Map<String, Vertex> modConstraintHash = new HashMap<String, Vertex>();
+ String overRideModelId = "test";
+ String overRideModelVersionId = "test";
+
+ Map<String, String> result = processor.collectDeleteKeyHash(transId, fromAppId,
+ thisLevelElemVtx, incomingTrail, currentHash,
+ vidsTraversed, levelCounter, modConstraintHash, overRideModelId, overRideModelVersionId);
+
+ assertNotEquals(result, null);
+ }
+
+ @Test
+ public void getLinkageConnectNodeTypesTest() throws AAIException {
+ List<String> linkagePtList = new ArrayList<String>();
+ linkagePtList.add("modern\\|testdata\\|");
+ Set<String> result = processor.getLinkageConnectNodeTypes(linkagePtList);
+ assertNotEquals(result, null);
+
+ }
+
+ @Test(expected = AAIException.class)
+ public void getLinkageConnectNodeTypesTest1() throws AAIException {
+
+ Set<String> result1 = processor.getLinkageConnectNodeTypes(null);
+ assertNotEquals(result1, null);
+
+ List<String> linkagePtList = new ArrayList<String>();
+ linkagePtList.add("moderntestdata");
+ Set<String> result = processor.getLinkageConnectNodeTypes(linkagePtList);
+ assertNotEquals(result, null);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void collectTopology4ModelVerTest() throws AAIException {
+ String transId = "test";
+ String fromAppId = "test";
+ Multimap<String, String> thisMap = ArrayListMultimap.create();
+ Vertex thisLevelElemVtx = new EmptyVertex();
+ String incomingTrail = "test";
+ Map<String, Vertex> currentHash = new HashMap<String, Vertex>();
+ List<String> vidsTraversed = new ArrayList<String>();
+ int levelCounter = 1;
+
+ Multimap<String, String> result = processor.collectTopology4ModelVer(transId, fromAppId,
+ thisLevelElemVtx, incomingTrail, thisMap, vidsTraversed, levelCounter, currentHash
+ , "test", "test");
+
+ assertNotEquals(result, null);
+ }
+
+ @Test(expected = AAIException.class)
+ public void check4EdgeRuleTest() throws AAIException {
+ processor.check4EdgeRule("test", "test");
+ }
+
+ @Test(expected = AAIException.class)
+ public void collectTopology4LinkagePointTest() throws AAIException {
+ String transId = "test";
+ String fromAppId = "test";
+ String linkagePointStrVal = "test";
+ String incomingTrail = "test";
+ Multimap<String, String> currentMap = ArrayListMultimap.create();
+
+ Multimap<String, String> result = processor.collectTopology4LinkagePoint(transId, fromAppId, linkagePointStrVal, incomingTrail, currentMap);
+ assertNotEquals(result, null);
+
+ }
+
+ @Test(expected = AAIException.class)
+ public void getNextStepElementsFromSet() throws AAIException {
+ Vertex constrElemSetVtx = new EmptyVertex();
+ constrElemSetVtx.<String>property(AAIProperties.NODE_TYPE);
+ Map<String, Object> result = processor.getNextStepElementsFromSet(constrElemSetVtx);
+ assertNotEquals(result, null);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void genTopoMap4NamedQTest() throws AAIException {
+ String transId = "test";
+ String fromAppId = "test";
+ Vertex queryVertex = new EmptyVertex();
+ String namedQueryUuid = "E44533334343";
+ Multimap<String, String> result = processor.genTopoMap4NamedQ(transId, fromAppId, queryVertex, namedQueryUuid);
+ assertNotEquals(result, null);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void collectTopology4NamedQTest() throws AAIException {
+ String transId = "test";
+ String fromAppId = "test";
+ Multimap<String, String> thisMap = ArrayListMultimap.create();
+ Vertex thisLevelElemVtx = new EmptyVertex();
+ String incomingTrail = "test";
+ Map<String, Vertex> currentHash = new HashMap<String, Vertex>();
+ List<String> vidsTraversed = new ArrayList<String>();
+ int levelCounter = 1;
+
+ Multimap<String, String> result = processor.collectTopology4NamedQ(transId, fromAppId,
+ thisLevelElemVtx, incomingTrail, thisMap, vidsTraversed, levelCounter);
+ assertNotEquals(result, null);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void getModelThatNqElementRepresentsTest() throws AAIException {
+ Vertex thisLevelElemVtx = new EmptyVertex();
+ String incomingTrail = "test";
+ Vertex vertex = processor.getModelThatNqElementRepresents(thisLevelElemVtx, incomingTrail);
+ assertNotEquals(vertex, null);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void getModelGivenModelVer() throws AAIException {
+ Vertex thisLevelElemVtx = new EmptyVertex();
+ String incomingTrail = "test";
+ Vertex vertex = processor.getModelGivenModelVer(thisLevelElemVtx, incomingTrail);
+ assertNotEquals(vertex, null);
+ }
+
+ @Test(expected = AAIException.class)
+ public void getModelTypeFromModel() throws AAIException {
+ Vertex thisLevelElemVtx = new EmptyVertex();
+ String incomingTrail = "test";
+ String vertex = processor.getModelTypeFromModel(thisLevelElemVtx, incomingTrail);
+ assertNotEquals(vertex, null);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void getModelTypeFromModelVer() throws AAIException {
+ Vertex thisLevelElemVtx = new EmptyVertex();
+ String incomingTrail = "test";
+ String vertex = processor.getModelTypeFromModelVer(thisLevelElemVtx, incomingTrail);
+ assertNotEquals(vertex, null);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void getModelElementStepName() throws AAIException {
+ Vertex thisLevelElemVtx = new EmptyVertex();
+ String incomingTrail = "test";
+ String vertex = processor.getModelElementStepName(thisLevelElemVtx, incomingTrail);
+ assertNotEquals(vertex, null);
+ }
+
+ @Test(expected = AAIException.class)
+ public void nodeTypeSupportsPersona() throws AAIException {
+ String incomingTrail = "";
+ boolean vertex = processor.nodeTypeSupportsPersona(incomingTrail);
+ assertFalse(vertex);
+
+
+ incomingTrail = "test";
+ boolean vertex1 = processor.nodeTypeSupportsPersona(incomingTrail);
+ assertTrue(vertex1);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void getNqElementWidgetType() throws AAIException{
+ String appId="test";
+ String transID="test";
+ Vertex thisLevelElemVtx = new EmptyVertex();
+ String incomingTrail = "test";
+ String vertex1 = processor.getNqElementWidgetType(appId,transID,thisLevelElemVtx,incomingTrail);
+ assertNotEquals(vertex1,null);
+ }
+
+
+ @Test(expected = NullPointerException.class)
+ public void getModElementWidgetType() throws AAIException{
+ String appId="test";
+ String transID="test";
+ Vertex thisLevelElemVtx = new EmptyVertex();
+ String incomingTrail = "test";
+ String vertex1 = processor.getModElementWidgetType(thisLevelElemVtx,incomingTrail);
+ assertNotEquals(vertex1,null);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void getNodeUsingUniqueId() throws AAIException{
+ String appId="test";
+ String transID="test";
+ String nodeType = "generic-vnf";
+ String idPropertyName = "test";
+ String uniqueIdVal="test";
+ Vertex vertex1 = processor.getNodeUsingUniqueId(transID,appId,nodeType,idPropertyName,uniqueIdVal);
+ assertNotEquals(vertex1,null);
+ }
+
+
+ @Test(expected = AAIException.class)
+ public void getNodeUsingUniqueIdNull() throws AAIException{
+ String appId="test";
+ String transID="test";
+ String nodeType = "generic-vnf";
+ String idPropertyName = "test";
+ String uniqueIdVal="";
+ Vertex vertex1 = null;
+ vertex1= processor.getNodeUsingUniqueId(transID,appId,nodeType,idPropertyName,uniqueIdVal);
+ assertNotEquals(vertex1,null);
+
+ }
+
+
+ @Test(expected = AAIException.class)
+ public void getNodeUsingUniqueIdNull1() throws AAIException{
+ String appId="test";
+ String transID="test";
+ String nodeType = "generic-vnf";
+ String idPropertyName="";
+ String uniqueIdVal="test";
+ Vertex vertex1 = null;
+ vertex1= processor.getNodeUsingUniqueId(transID,appId,nodeType,idPropertyName,uniqueIdVal);
+ assertNotEquals(vertex1,null);
+
+
+ }
+
+
+ @Test(expected = AAIException.class)
+ public void getNodeUsingUniqueIdNull2() throws AAIException{
+ String appId="test";
+ String transID="test";
+ String nodeType = "";
+ String idPropertyName="test";
+ String uniqueIdVal="test";
+ Vertex vertex1 = null;
+ vertex1= processor.getNodeUsingUniqueId(transID,appId,nodeType,idPropertyName,uniqueIdVal);
+ assertNotEquals(vertex1,null);
+
+
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void getModelVersUsingName() throws AAIException{
+ String appId="test";
+ String transID="test";
+ String modelName = "test";
+
+ List<Vertex> result= processor.getModelVersUsingName(transID,appId,modelName);
+ assertNotEquals(result,null);
+ }
+
+
+ @Test(expected = AAIException.class)
+ public void getModelVersUsingNameNull() throws AAIException{
+ String appId="test";
+ String transID="test";
+ String modelName = "";
+
+ List<Vertex> result= processor.getModelVersUsingName(transID,appId,modelName);
+ assertNotEquals(result,null);
+ }
+
+
+ @Test(expected = NullPointerException.class)
+ public void getModVersUsingModelInvId() throws AAIException{
+ String appId="test";
+ String transID="test";
+ String modelName = "test";
+
+ Iterator<Vertex> result= processor.getModVersUsingModelInvId(transID,appId,modelName);
+ assertNotEquals(result,null);
+ }
+
+ @Test(expected = AAIException.class)
+ public void getModVersUsingModelInvIdNull() throws AAIException{
+ String appId="test";
+ String transID="test";
+ String modelName = "";
+
+ Iterator<Vertex> result= processor.getModVersUsingModelInvId(transID,appId,modelName);
+ assertNotEquals(result,null);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void getModVersUsingModel() throws AAIException{
+ String appId="test";
+ String transID="test";
+ String modelName = "test";
+ Vertex thisLevelElemVtx = new EmptyVertex();
+ List<Vertex> result= processor.getModVersUsingModel(transID,appId,thisLevelElemVtx);
+ assertNotEquals(result,null);
+ }
+
+ @Test(expected = AAIException.class)
+ public void getModVersUsingModel1() throws AAIException{
+ String appId="test";
+ String transID="test";
+
+ Vertex thisLevelElemVtx = null;
+ List<Vertex> result= processor.getModVersUsingModel(transID,appId,thisLevelElemVtx);
+ assertNotEquals(result,null);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void getModelVerIdsUsingName() throws AAIException{
+ String appId="test";
+ String transID="test";
+
+ String modelName= "test";
+ List<String> result= processor.getModelVerIdsUsingName(transID,appId,modelName);
+ assertNotEquals(result,null);
+ }
+
+ @Test(expected = AAIException.class)
+ public void getModelVerIdsUsingName1() throws AAIException{
+ String appId="test";
+ String transID="test";
+
+ String modelName= "";
+ List<String> result= processor.getModelVerIdsUsingName(transID,appId,modelName);
+ assertNotEquals(result,null);
+ }
+
+ @Test(expected =NullPointerException.class)
+ public void validateModel() throws AAIException{
+ String appId="test";
+ String transID="test";
+
+ String modelVersionId= "test";
+ String modelInvId= "test";
+ String modelName= "test";
+ processor.validateModel(transID,appId,modelName,modelVersionId);
+
+
+ }
+
+
+
+}
+
-/*-\r
- * ============LICENSE_START=======================================================\r
- * org.openecomp.aai\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package org.openecomp.aai.dbgraphgen;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertNotNull;\r
-import static org.junit.Assert.assertTrue;\r
-\r
-import com.bazaarvoice.jolt.modifier.DataType;\r
-import com.google.common.collect.Multimap;\r
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;\r
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;\r
-import org.apache.tinkerpop.gremlin.structure.Vertex;\r
-import org.apache.tinkerpop.gremlin.structure.VertexProperty;\r
-import org.junit.Before;\r
-import org.junit.BeforeClass;\r
-import org.junit.Test;\r
-import org.junit.runner.RunWith;\r
-import org.mockito.*;\r
-import org.mockito.internal.exceptions.MockitoLimitations;\r
-import org.mockito.runners.MockitoJUnitRunner;\r
-import org.openecomp.aai.db.DbMethHelper;\r
-import org.openecomp.aai.db.props.AAIProperties;\r
-import org.openecomp.aai.exceptions.AAIException;\r
-import org.openecomp.aai.introspection.Introspector;\r
-import org.openecomp.aai.introspection.Loader;\r
-import org.openecomp.aai.introspection.LoaderFactory;\r
-import org.openecomp.aai.introspection.ModelType;\r
-import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException;\r
-import org.openecomp.aai.parsers.exceptions.AAIIdentityMapParseException;\r
-import org.openecomp.aai.query.builder.GraphTraversalBuilder;\r
-import org.openecomp.aai.query.builder.QueryBuilder;\r
-import org.openecomp.aai.query.builder.TraversalQuery;\r
-import org.openecomp.aai.schema.enums.PropertyMetadata;\r
-import org.openecomp.aai.serialization.db.DBSerializer;\r
-import org.openecomp.aai.serialization.db.EdgeType;\r
-import org.openecomp.aai.serialization.engines.QueryStyle;\r
-import org.openecomp.aai.serialization.engines.TransactionalGraphEngine;\r
-import org.powermock.modules.junit4.PowerMockRunner;\r
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;\r
-\r
-import java.util.*;\r
-\r
-@RunWith(MockitoJUnitRunner.class)\r
-public class ModelBasedProcessingTest {\r
-\r
- @Mock private static TransactionalGraphEngine dbEngine;\r
- private static Loader loader;\r
- @Mock private static DBSerializer serializer;\r
- @Mock private static TransactionalGraphEngine.Admin admin;\r
- ModelBasedProcessing mockProcessor;\r
- @Mock\r
- private DbMethHelper dbMethHelper;\r
-\r
- @BeforeClass\r
- public static void configure() throws Exception {\r
- System.setProperty("AJSC_HOME", ".");\r
- System.setProperty("BUNDLECONFIG_DIR", "bundleconfig-local");\r
- loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, AAIProperties.LATEST);\r
-\r
-\r
- }\r
-\r
- @Before\r
- public void init() {\r
- mockProcessor = new ModelBasedProcessing(loader, dbEngine, serializer);\r
-\r
- MockitoAnnotations.initMocks(this);\r
- }\r
-\r
- @Test\r
- public void testPropNameChange1() throws AAIUnknownObjectException {\r
- String result;\r
- ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);\r
- result = processor.getPropNameWithAliasIfNeeded("generic-vnf", "model-invariant-id");\r
- assertEquals("result has -local tacked on the end as it should", "model-invariant-id" + AAIProperties.DB_ALIAS_SUFFIX, result);\r
- result = processor.getPropNameWithAliasIfNeeded("generic-vnf", "vnf-id");\r
- assertEquals("result does NOT have -local tacked on the end as it should", "vnf-id", result);\r
- result = processor.getPropNameWithAliasIfNeeded("generic-vnf", "model-invariant-id" + AAIProperties.DB_ALIAS_SUFFIX);\r
- assertEquals("property not modified because it already includes the right suffix", "model-invariant-id" + AAIProperties.DB_ALIAS_SUFFIX, result);\r
- }\r
-\r
- @Mock\r
- GraphTraversal<Vertex, Vertex> v;\r
- @Mock\r
- GraphTraversal<Vertex, Vertex> graphTraversal;\r
- @Mock\r
- GraphTraversalSource graphTraversalSource;\r
- @Mock Iterable <?> uniqVerts;\r
- List<Vertex> vertexList=new ArrayList<>();\r
- @Mock Vertex vertex;\r
- @Mock Vertex vertex1;\r
- @Mock\r
- QueryBuilder<Vertex> queryBuilder;\r
-\r
- EdgeType treeType;\r
- @Test(expected = NullPointerException.class)\r
- public void getStartNodesAndModVersionIds() throws AAIException{\r
-\r
- vertex.property("model-ver","model-version-id");\r
- vertex1.property(AAIProperties.NODE_TYPE,"model-ver");\r
- graphTraversal.addV(vertex);\r
- v.addV(vertex1);\r
- vertexList.add(vertex);\r
- //vertexList.add(vertex1);\r
- Mockito.when(dbEngine.asAdmin()).thenReturn(admin);\r
- Mockito.when(admin.getReadOnlyTraversalSource()).thenReturn(graphTraversalSource);\r
- Mockito.when(graphTraversalSource.V()).thenReturn(v);\r
- Mockito.when(v.has(AAIProperties.NODE_TYPE,"model-ver")).thenReturn(graphTraversal);\r
- Mockito.when(graphTraversal.has("model-ver","model-version-id")).thenReturn(graphTraversal);\r
- Mockito.when(graphTraversal.toList()).thenReturn(vertexList);\r
- ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);\r
- //this.engine.getQueryBuilder(startV).createEdgeTraversal(treeType, startV, loader.introspectorFromName(connectedNodeType));\r
-\r
- queryBuilder.toList().add(vertex);\r
- Mockito.when(dbEngine.getQueryBuilder(vertex)).thenReturn(queryBuilder);\r
-\r
- Introspector obj=loader.introspectorFromName("model-ver");\r
-\r
- Mockito.when(queryBuilder.createEdgeTraversal(EdgeType.TREE,vertex,obj)).thenReturn(queryBuilder);\r
- //Vertex result=processor.getNodeUsingUniqueId("9999", "postmen","model-ver","model-version-id","vnf-id-1");\r
-\r
-\r
- List<Map<String,Object>> startNodeFilterArrayOfHashes=new ArrayList<>();\r
-\r
- Map<String,String> result1=processor.getStartNodesAndModVersionIds("9999","postmen","vnf-id-1","vnf-id-1",\r
- "vnf-id","generic-vnf",startNodeFilterArrayOfHashes,"");\r
- }\r
-\r
-\r
- @Test(expected = AAIException.class)\r
- public void getStartNodesAndModVersionIds1() throws AAIException{\r
-\r
- vertex.property("model-version-id","vnf-id-1");\r
- vertex1.property(AAIProperties.NODE_TYPE,"model-ver");\r
- graphTraversal.addV(vertex);\r
- v.addV(vertex1);\r
- vertexList.add(vertex);\r
- //vertexList.add(vertex1);\r
- Mockito.when(dbEngine.asAdmin()).thenReturn(admin);\r
- Mockito.when(admin.getReadOnlyTraversalSource()).thenReturn(graphTraversalSource);\r
- Mockito.when(graphTraversalSource.V()).thenReturn(v);\r
- Mockito.when(v.has(AAIProperties.NODE_TYPE,"model-ver")).thenReturn(graphTraversal);\r
- Mockito.when(graphTraversal.has("model-version-id","vnf-id-1")).thenReturn(graphTraversal);\r
- Mockito.when(graphTraversal.toList()).thenReturn(vertexList);\r
- ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);\r
- //this.engine.getQueryBuilder(startV).createEdgeTraversal(treeType, startV, loader.introspectorFromName(connectedNodeType));\r
-\r
- queryBuilder.toList().add(vertex);\r
- Mockito.when(dbEngine.getQueryBuilder(vertex)).thenReturn(queryBuilder);\r
-\r
- Introspector obj=loader.introspectorFromName("generic-vnf");\r
- Mockito.when(queryBuilder.createEdgeTraversal(EdgeType.TREE,vertex,obj)).thenReturn(queryBuilder);\r
- //Vertex result=processor.getNodeUsingUniqueId("9999", "postmen","model-ver","model-version-id","vnf-id-1");\r
-\r
-\r
- List<Map<String,Object>> startNodeFilterArrayOfHashes=new ArrayList<>();\r
-\r
- Map<String,String> result1=processor.getStartNodesAndModVersionIds("9999","postmen","vnf-id-1","vnf-id-1",\r
- "vnf-id","generic-vnf",startNodeFilterArrayOfHashes,"");\r
- }\r
-\r
- @Test\r
- public void getNodeUsingUniqueIdTest() throws AAIException{\r
- vertex.property("vnf-id","vnf-id-1");\r
- vertex1.property(AAIProperties.NODE_TYPE,"generic-vnf");\r
- graphTraversal.addV(vertex);\r
- v.addV(vertex1);\r
- vertexList.add(vertex);\r
- //vertexList.add(vertex1);\r
- Mockito.when(dbEngine.asAdmin()).thenReturn(admin);\r
- Mockito.when(admin.getReadOnlyTraversalSource()).thenReturn(graphTraversalSource);\r
- Mockito.when(graphTraversalSource.V()).thenReturn(v);\r
- Mockito.when(v.has(AAIProperties.NODE_TYPE,"generic-vnf")).thenReturn(graphTraversal);\r
- Mockito.when(graphTraversal.has("vnf-id","vnf-id-1")).thenReturn(graphTraversal);\r
- Mockito.when(graphTraversal.toList()).thenReturn(vertexList);\r
- ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);\r
-\r
- Vertex result=processor.getNodeUsingUniqueId("9999", "postmen","generic-vnf","vnf-id","vnf-id-1");\r
-\r
- assertNotNull(result);\r
- }\r
-\r
- @Test\r
- public void getNodeUsingUniqueIdTest1() throws AAIException{\r
- vertex.property("named-query-uui","vnf-id-1");\r
- vertex1.property(AAIProperties.NODE_TYPE,"named-query");\r
- graphTraversal.addV(vertex);\r
- v.addV(vertex1);\r
- vertexList.add(vertex);\r
- //vertexList.add(vertex1);\r
- Mockito.when(dbEngine.asAdmin()).thenReturn(admin);\r
- Mockito.when(admin.getReadOnlyTraversalSource()).thenReturn(graphTraversalSource);\r
- Mockito.when(graphTraversalSource.V()).thenReturn(v);\r
- Mockito.when(v.has(AAIProperties.NODE_TYPE,"named-query")).thenReturn(graphTraversal);\r
- Mockito.when(graphTraversal.has("named-query-uui","vnf-id-1")).thenReturn(graphTraversal);\r
- Mockito.when(graphTraversal.toList()).thenReturn(vertexList);\r
- ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);\r
-\r
- Vertex result=processor.getNodeUsingUniqueId("9999", "postmen","named-query","named-query-uui","vnf-id-1");\r
-\r
- assertNotNull(result);\r
- }\r
-\r
- @Test(expected = AAIException.class)\r
- public void getModelVersUsingNameTest() throws AAIException{\r
-\r
- vertex.property(AAIProperties.NODE_TYPE,"generic-vnf");\r
- vertex1.property("generic-vnf","generic-vnf");\r
- graphTraversal.addV(vertex1);\r
- v.addV(vertex1);\r
- vertexList.add(vertex);\r
- vertexList.add(vertex1);\r
- Mockito.when(dbEngine.asAdmin()).thenReturn(admin);\r
- Mockito.when(admin.getReadOnlyTraversalSource()).thenReturn(graphTraversalSource);\r
- Mockito.when(graphTraversalSource.V()).thenReturn(v);\r
- Mockito.when(v.has(AAIProperties.NODE_TYPE,"model-ver")).thenReturn(graphTraversal);\r
- Mockito.when(graphTraversal.has("model-name","generic-vnf")).thenReturn(graphTraversal);\r
- Mockito.when(graphTraversal.toList()).thenReturn(vertexList);\r
- //Mockito.when(vertexList.listIterator().hasNext()).thenReturn(true);\r
- ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);\r
-\r
- List<Vertex> result=processor.getModelVersUsingName("9999","postment","generic-vnf");\r
-\r
- assertTrue(result.size()>0);\r
- }\r
-\r
- //uniqueIdVal Null Expecting AAI Excpetion\r
- @Test(expected = AAIException.class)\r
- public void getNodeUsingUniqueIdTestNull() throws AAIException{\r
- ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);\r
- Vertex result=processor.getNodeUsingUniqueId("9999", "postmen","generic-vnf","vnf-id","");\r
-\r
-\r
- }\r
-\r
- //idPropertyName Null Expecting AAI Excpetion\r
- @Test(expected = AAIException.class)\r
- public void getNodeUsingUniqueIdTestNull1() throws AAIException{\r
- ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);\r
- Vertex result=processor.getNodeUsingUniqueId("9999", "postmen","generic-vnf","","vnf-id-1");\r
-\r
-\r
- }\r
-\r
- //idPropertyName Null Expecting AAI Excpetion\r
- @Test(expected = AAIException.class)\r
- public void getNodeUsingUniqueIdTestNull2() throws AAIException{\r
- ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);\r
- Vertex result=processor.getNodeUsingUniqueId("9999", "postmen","","vnf-id","vnf-id-1");\r
-\r
-\r
- }\r
-\r
- @Test(expected = AAIException.class)\r
- public void getNodeUsingUniqueIdTestTwoVertex() throws AAIException{\r
- vertex.property("vnf-id","vnf-id-1");\r
- vertex1.property(AAIProperties.NODE_TYPE,"generic-vnf");\r
- graphTraversal.addV(vertex);\r
- v.addV(vertex1);\r
- vertexList.add(vertex);\r
- vertexList.add(vertex1);\r
- Mockito.when(dbEngine.asAdmin()).thenReturn(admin);\r
- Mockito.when(admin.getReadOnlyTraversalSource()).thenReturn(graphTraversalSource);\r
- Mockito.when(graphTraversalSource.V()).thenReturn(v);\r
- Mockito.when(v.has(AAIProperties.NODE_TYPE,"generic-vnf")).thenReturn(graphTraversal);\r
- Mockito.when(graphTraversal.has("vnf-id","vnf-id-1")).thenReturn(graphTraversal);\r
- Mockito.when(graphTraversal.toList()).thenReturn(vertexList);\r
- ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);\r
-\r
- Vertex result=processor.getNodeUsingUniqueId("9999", "postmen","generic-vnf","vnf-id","vnf-id-1");\r
-\r
- assertNotNull(result);\r
- }\r
-\r
- //uniqVerts Null Expection AAI Exception\r
- @Test(expected = AAIException.class)\r
- public void getNodeUsingUniqueIdTestVertexNull() throws AAIException{\r
- vertex.property("vnf-id","vnf-id-1");\r
- vertex1.property(AAIProperties.NODE_TYPE,"generic-vnf");\r
- graphTraversal.addV(vertex);\r
- v.addV(vertex1);\r
- vertexList.add(vertex);\r
- //vertexList.add(vertex1);\r
- Mockito.when(dbEngine.asAdmin()).thenReturn(admin);\r
- Mockito.when(admin.getReadOnlyTraversalSource()).thenReturn(graphTraversalSource);\r
- Mockito.when(graphTraversalSource.V()).thenReturn(v);\r
- Mockito.when(v.has(AAIProperties.NODE_TYPE,"generic-vnf")).thenReturn(graphTraversal);\r
- Mockito.when(graphTraversal.has("vnf-id","vnf-id-1")).thenReturn(graphTraversal);\r
- Mockito.when(graphTraversal.toList()).thenReturn(null);\r
- ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);\r
-\r
- Vertex result=processor.getNodeUsingUniqueId("9999", "postmen","generic-vnf","vnf-id","vnf-id-1");\r
-\r
- assertNotNull(result);\r
- }\r
-\r
- //uniqVerts Null Expection AAI Exception\r
- @Test(expected = AAIException.class)\r
- public void getNodeUsingUniqueIdTestVertexHasNot() throws AAIException{\r
- vertex.property("vnf-id","vnf-id-1");\r
- vertex1.property(AAIProperties.NODE_TYPE,"generic-vnf");\r
- graphTraversal.addV(vertex);\r
- v.addV(vertex1);\r
- //vertexList.add(vertex);\r
- //vertexList.add(vertex1);\r
- Mockito.when(dbEngine.asAdmin()).thenReturn(admin);\r
- Mockito.when(admin.getReadOnlyTraversalSource()).thenReturn(graphTraversalSource);\r
- Mockito.when(graphTraversalSource.V()).thenReturn(v);\r
- Mockito.when(v.has(AAIProperties.NODE_TYPE,"generic-vnf")).thenReturn(graphTraversal);\r
- Mockito.when(graphTraversal.has("vnf-id","vnf-id-1")).thenReturn(graphTraversal);\r
- Mockito.when(graphTraversal.toList()).thenReturn(vertexList);\r
- ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);\r
-\r
- Vertex result=processor.getNodeUsingUniqueId("9999", "postmen","generic-vnf","vnf-id","vnf-id-1");\r
-\r
- assertNotNull(result);\r
- }\r
-\r
- @Test(expected = AAIIdentityMapParseException.class)\r
- public void runDeleteByModelTest() throws AAIException{\r
- ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);\r
- Optional<Vertex> vertex=Optional.empty();\r
- Map<String,Object> startNodeFilterHash=new HashMap<>();\r
- startNodeFilterHash.put("related-link.data","relationshipdata");\r
- startNodeFilterHash.put("generic-vnf.d","relationshipdata");\r
- Mockito.when(dbMethHelper.searchVertexByIdentityMap("relationship-data",startNodeFilterHash)).thenReturn(vertex);\r
- Map<String,String> re =processor.runDeleteByModel("9999","postmen","","relationship-data",startNodeFilterHash,"vnf-id","vnf-id");\r
- assertNotNull(re);\r
-\r
-\r
- }\r
-\r
- @Test(expected = AAIException.class)\r
- public void getModelGivenModelVerTest() throws AAIException{\r
- vertex.property("named-query-uuid","vnf-id-1");\r
- vertex1.property(AAIProperties.NODE_TYPE,"named-query");\r
- graphTraversal.addV(vertex);\r
- v.addV(vertex1);\r
- vertexList.add(vertex);\r
- //vertexList.add(vertex1);\r
- Mockito.when(dbEngine.asAdmin()).thenReturn(admin);\r
- Mockito.when(admin.getReadOnlyTraversalSource()).thenReturn(graphTraversalSource);\r
- Mockito.when(graphTraversalSource.V()).thenReturn(v);\r
- Mockito.when(v.has(AAIProperties.NODE_TYPE,"named-query")).thenReturn(graphTraversal);\r
- Mockito.when(graphTraversal.has("named-query-uuid","vnf-id-1")).thenReturn(graphTraversal);\r
- Mockito.when(graphTraversal.toList()).thenReturn(vertexList);\r
-\r
- QueryBuilder qub=Mockito.mock(QueryBuilder.class);\r
- qub.toList().addAll(vertexList);\r
- Mockito.when(dbEngine.getQueryBuilder(Mockito.any(Vertex.class))).thenReturn(queryBuilder);\r
-\r
- Mockito.when(queryBuilder.createEdgeTraversal(Mockito.any(EdgeType.class),Mockito.any(Vertex.class),Mockito.any(Introspector.class))).thenReturn(qub);\r
-\r
- ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);\r
-\r
- Vertex result=processor.getModelGivenModelVer(vertex,"");\r
- assertNotNull(result);\r
-\r
- }\r
-\r
- @Test(expected = AAIException.class)\r
- public void queryByNamedQuery_TimedTest() throws AAIException{\r
- vertex.property("named-query-uuid","named-query-element");\r
- vertex1.property(AAIProperties.NODE_TYPE,"named-query");\r
- graphTraversal.addV(vertex);\r
- v.addV(vertex1);\r
- vertexList.add(vertex);\r
- //vertexList.add(vertex1);\r
- Mockito.when(dbEngine.asAdmin()).thenReturn(admin);\r
- Mockito.when(admin.getReadOnlyTraversalSource()).thenReturn(graphTraversalSource);\r
- Mockito.when(graphTraversalSource.V()).thenReturn(v);\r
- Mockito.when(v.has(AAIProperties.NODE_TYPE,"named-query")).thenReturn(graphTraversal);\r
- Mockito.when(graphTraversal.has("named-query-uuid","named-query-element")).thenReturn(graphTraversal);\r
- Mockito.when(graphTraversal.toList()).thenReturn(vertexList);\r
-\r
- QueryBuilder qub=Mockito.mock(QueryBuilder.class);\r
- qub.toList().addAll(vertexList);\r
- Mockito.when(dbEngine.getQueryBuilder(Mockito.any(Vertex.class))).thenReturn(queryBuilder);\r
-\r
- Mockito.when(queryBuilder.createEdgeTraversal(Mockito.any(EdgeType.class),Mockito.any(Vertex.class),Mockito.any(Introspector.class))).thenReturn(qub);\r
-\r
- ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);\r
-\r
- List<Map<String,Object>> startNodeFilterArrayOfHashes=new ArrayList<>();\r
- Map<String,Object> secondaryFilterHash=new HashMap<>();\r
-\r
- List<ResultSet> res=processor.queryByNamedQuery_Timed("99999","postmen","named-query-element",startNodeFilterArrayOfHashes,"vnf","vnf",\r
- secondaryFilterHash);\r
-\r
-\r
- }\r
-\r
- @Test(expected = AAIException.class)\r
- public void genTopoMap4NamedQTest() throws AAIException{\r
- ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);\r
-\r
- vertex.property("named-query-uuid","named-query-element");\r
- vertex1.property(AAIProperties.NODE_TYPE,"named-query-element");\r
- graphTraversal.addV(vertex);\r
- v.addV(vertex1);\r
- vertexList.add(vertex);\r
- QueryBuilder qub=Mockito.mock(QueryBuilder.class);\r
- qub.toList().addAll(vertexList);\r
- Mockito.when(dbEngine.getQueryBuilder(Mockito.any(Vertex.class))).thenReturn(queryBuilder);\r
-\r
- Mockito.when(queryBuilder.createEdgeTraversal(Mockito.any(EdgeType.class),Mockito.any(Vertex.class),Mockito.any(Introspector.class))).thenReturn(qub);\r
-\r
- Multimap<String, String> map =processor.genTopoMap4NamedQ("9999","postmen",vertex,"named-query-element");\r
- }\r
-\r
- @Test(expected = AAIException.class)\r
- public void genTopoMap4NamedQTest1() throws AAIException{\r
- ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);\r
-\r
- vertex.property("named-query-uuid","named-query-element");\r
- vertex1.property(AAIProperties.NODE_TYPE,"named-query-element");\r
- graphTraversal.addV(vertex);\r
- v.addV(vertex1);\r
- vertexList.add(vertex);\r
- QueryBuilder qub=Mockito.mock(QueryBuilder.class);\r
- qub.toList().addAll(vertexList);\r
- Mockito.when(dbEngine.getQueryBuilder(Mockito.any(Vertex.class))).thenReturn(queryBuilder);\r
-\r
- Mockito.when(queryBuilder.createEdgeTraversal(Mockito.any(EdgeType.class),Mockito.any(Vertex.class),Mockito.any(Introspector.class))).thenReturn(qub);\r
-\r
- Multimap<String, String> map =processor.genTopoMap4NamedQ("9999","postmen",null,"named-query-element");\r
- }\r
-\r
- @Test(expected = AAIException.class)\r
- public void getModelThatNqElementRepresentsTest() throws AAIException{\r
- vertex.property("model-ver","named-query-element");\r
- vertex1.property(AAIProperties.NODE_TYPE,"named-query-element");\r
- graphTraversal.addV(vertex);\r
- v.addV(vertex1);\r
- vertexList.add(vertex);\r
- QueryBuilder qub=Mockito.mock(QueryBuilder.class);\r
- qub.toList().addAll(vertexList);\r
- Mockito.when(dbEngine.getQueryBuilder(Mockito.any(Vertex.class))).thenReturn(queryBuilder);\r
-\r
- Mockito.when(queryBuilder.createEdgeTraversal(Mockito.any(EdgeType.class),Mockito.any(Vertex.class),Mockito.any(Introspector.class))).thenReturn(qub);\r
- ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);\r
- Vertex v=processor.getModelThatNqElementRepresents(vertex,"g");\r
- }\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void getModelTypeFromModel() throws AAIException{\r
- Vertex vt=Mockito.mock(Vertex.class);\r
- vt.property("model-type","named-query-element");\r
- ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);\r
- String v=processor.getModelTypeFromModel(vt,"g");\r
- }\r
-\r
- @Test(expected = AAIException.class)\r
- public void getModelTypeFromModel1() throws AAIException{\r
- Vertex vt=Mockito.mock(Vertex.class);\r
- vt.property("model-type","named-query-element");\r
- ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);\r
- String v=processor.getModelTypeFromModel(null,"g");\r
- }\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void getModVersUsingModelInvId() throws AAIException{\r
-\r
- vertex.property(AAIProperties.NODE_TYPE,"model-invariant-id");\r
- vertex1.property("model","model-invariant-id");\r
- graphTraversal.addV(vertex1);\r
- v.addV(vertex1);\r
- vertexList.add(vertex);\r
- vertexList.add(vertex1);\r
- Mockito.when(dbEngine.asAdmin()).thenReturn(admin);\r
- Mockito.when(admin.getReadOnlyTraversalSource()).thenReturn(graphTraversalSource);\r
- Mockito.when(graphTraversalSource.V()).thenReturn(v);\r
- Mockito.when(v.has(AAIProperties.NODE_TYPE,"model-invariant-id")).thenReturn(graphTraversal);\r
- Mockito.when(graphTraversal.has("model","model-invariant-id")).thenReturn(graphTraversal);\r
- Mockito.when(graphTraversal.toList()).thenReturn(vertexList);\r
- ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);\r
-\r
- Iterator<Vertex> result=processor.getModVersUsingModelInvId("9999","postment","model");\r
- }\r
-\r
- @Test(expected = AAIException.class)\r
- public void getNamedQueryExtraDataLookupTest() throws AAIException{\r
- ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);\r
-\r
- Map<String,Object> re=processor.getNamedQueryExtraDataLookup("","",null,vertex,\r
- "");\r
- }\r
-\r
- @Test(expected = AAIException.class)\r
- public void getNamedQueryExtraDataLookupTest1() throws AAIException{\r
- ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);\r
-\r
- Map<String,Object> re=processor.getNamedQueryExtraDataLookup("","",vertex,null,\r
- "");\r
- }\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void showResultSet() throws AAIException{\r
- vertex.property("model-ver","model-versionId");\r
- vertex.property("aai","model-versionId");\r
-\r
-\r
- ResultSet rs= Mockito.mock(ResultSet.class);\r
- Mockito.when(rs.getVert()).thenReturn(vertex);\r
-\r
- List<VertexProperty<String>> vb=new ArrayList<>();\r
- VertexProperty<String> v=Mockito.mock(VertexProperty.class);\r
- v.property("model-ver","1");\r
- vb.add(v);\r
- v.property("aai","5");\r
- vb.add(v);\r
- v.property("source-of-truth","6");\r
- vb.add(v);\r
-\r
- vertex.properties("model-ver","aai");\r
- Mockito.when(vertex.<String>property(AAIProperties.NODE_TYPE)).thenReturn(v);\r
- //Mockito.when(vertex.properties()).thenReturn(Mockito.any());\r
- ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);\r
- processor.showResultSet(rs,8);\r
-\r
- }\r
-}\r
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.aai.dbgraphgen;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import com.bazaarvoice.jolt.modifier.DataType;
+import com.google.common.collect.Multimap;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.VertexProperty;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.*;
+import org.mockito.internal.exceptions.MockitoLimitations;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.aai.db.DbMethHelper;
+import org.onap.aai.db.props.AAIProperties;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.introspection.Introspector;
+import org.onap.aai.introspection.Loader;
+import org.onap.aai.introspection.LoaderFactory;
+import org.onap.aai.introspection.ModelType;
+import org.onap.aai.introspection.exceptions.AAIUnknownObjectException;
+import org.onap.aai.parsers.exceptions.AAIIdentityMapParseException;
+import org.onap.aai.query.builder.GraphTraversalBuilder;
+import org.onap.aai.query.builder.QueryBuilder;
+import org.onap.aai.query.builder.TraversalQuery;
+import org.onap.aai.schema.enums.PropertyMetadata;
+import org.onap.aai.serialization.db.DBSerializer;
+import org.onap.aai.serialization.db.EdgeType;
+import org.onap.aai.serialization.engines.QueryStyle;
+import org.onap.aai.serialization.engines.TransactionalGraphEngine;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import java.util.*;
+
+@RunWith(MockitoJUnitRunner.class)
+public class ModelBasedProcessingTest {
+
+ @Mock private static TransactionalGraphEngine dbEngine;
+ private static Loader loader;
+ @Mock private static DBSerializer serializer;
+ @Mock private static TransactionalGraphEngine.Admin admin;
+ ModelBasedProcessing mockProcessor;
+ @Mock
+ private DbMethHelper dbMethHelper;
+
+ @BeforeClass
+ public static void configure() throws Exception {
+ System.setProperty("AJSC_HOME", ".");
+ System.setProperty("BUNDLECONFIG_DIR", "bundleconfig-local");
+ loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, AAIProperties.LATEST);
+
+
+ }
+
+ @Before
+ public void init() {
+ mockProcessor = new ModelBasedProcessing(loader, dbEngine, serializer);
+
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Test
+ public void testPropNameChange1() throws AAIUnknownObjectException {
+ String result;
+ ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);
+ result = processor.getPropNameWithAliasIfNeeded("generic-vnf", "model-invariant-id");
+ assertEquals("result has -local tacked on the end as it should", "model-invariant-id" + AAIProperties.DB_ALIAS_SUFFIX, result);
+ result = processor.getPropNameWithAliasIfNeeded("generic-vnf", "vnf-id");
+ assertEquals("result does NOT have -local tacked on the end as it should", "vnf-id", result);
+ result = processor.getPropNameWithAliasIfNeeded("generic-vnf", "model-invariant-id" + AAIProperties.DB_ALIAS_SUFFIX);
+ assertEquals("property not modified because it already includes the right suffix", "model-invariant-id" + AAIProperties.DB_ALIAS_SUFFIX, result);
+ }
+
+ @Mock
+ GraphTraversal<Vertex, Vertex> v;
+ @Mock
+ GraphTraversal<Vertex, Vertex> graphTraversal;
+ @Mock
+ GraphTraversalSource graphTraversalSource;
+ @Mock Iterable <?> uniqVerts;
+ List<Vertex> vertexList=new ArrayList<>();
+ @Mock Vertex vertex;
+ @Mock Vertex vertex1;
+ @Mock
+ QueryBuilder<Vertex> queryBuilder;
+
+ EdgeType treeType;
+ @Test(expected = NullPointerException.class)
+ public void getStartNodesAndModVersionIds() throws AAIException{
+
+ vertex.property("model-ver","model-version-id");
+ vertex1.property(AAIProperties.NODE_TYPE,"model-ver");
+ graphTraversal.addV(vertex);
+ v.addV(vertex1);
+ vertexList.add(vertex);
+ //vertexList.add(vertex1);
+ Mockito.when(dbEngine.asAdmin()).thenReturn(admin);
+ Mockito.when(admin.getReadOnlyTraversalSource()).thenReturn(graphTraversalSource);
+ Mockito.when(graphTraversalSource.V()).thenReturn(v);
+ Mockito.when(v.has(AAIProperties.NODE_TYPE,"model-ver")).thenReturn(graphTraversal);
+ Mockito.when(graphTraversal.has("model-ver","model-version-id")).thenReturn(graphTraversal);
+ Mockito.when(graphTraversal.toList()).thenReturn(vertexList);
+ ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);
+ //this.engine.getQueryBuilder(startV).createEdgeTraversal(treeType, startV, loader.introspectorFromName(connectedNodeType));
+
+ queryBuilder.toList().add(vertex);
+ Mockito.when(dbEngine.getQueryBuilder(vertex)).thenReturn(queryBuilder);
+
+ Introspector obj=loader.introspectorFromName("model-ver");
+
+ Mockito.when(queryBuilder.createEdgeTraversal(EdgeType.TREE,vertex,obj)).thenReturn(queryBuilder);
+ //Vertex result=processor.getNodeUsingUniqueId("9999", "postmen","model-ver","model-version-id","vnf-id-1");
+
+
+ List<Map<String,Object>> startNodeFilterArrayOfHashes=new ArrayList<>();
+
+ Map<String,String> result1=processor.getStartNodesAndModVersionIds("9999","postmen","vnf-id-1","vnf-id-1",
+ "vnf-id","generic-vnf",startNodeFilterArrayOfHashes,"");
+ }
+
+
+ @Test(expected = AAIException.class)
+ public void getStartNodesAndModVersionIds1() throws AAIException{
+
+ vertex.property("model-version-id","vnf-id-1");
+ vertex1.property(AAIProperties.NODE_TYPE,"model-ver");
+ graphTraversal.addV(vertex);
+ v.addV(vertex1);
+ vertexList.add(vertex);
+ //vertexList.add(vertex1);
+ Mockito.when(dbEngine.asAdmin()).thenReturn(admin);
+ Mockito.when(admin.getReadOnlyTraversalSource()).thenReturn(graphTraversalSource);
+ Mockito.when(graphTraversalSource.V()).thenReturn(v);
+ Mockito.when(v.has(AAIProperties.NODE_TYPE,"model-ver")).thenReturn(graphTraversal);
+ Mockito.when(graphTraversal.has("model-version-id","vnf-id-1")).thenReturn(graphTraversal);
+ Mockito.when(graphTraversal.toList()).thenReturn(vertexList);
+ ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);
+ //this.engine.getQueryBuilder(startV).createEdgeTraversal(treeType, startV, loader.introspectorFromName(connectedNodeType));
+
+ queryBuilder.toList().add(vertex);
+ Mockito.when(dbEngine.getQueryBuilder(vertex)).thenReturn(queryBuilder);
+
+ Introspector obj=loader.introspectorFromName("generic-vnf");
+ Mockito.when(queryBuilder.createEdgeTraversal(EdgeType.TREE,vertex,obj)).thenReturn(queryBuilder);
+ //Vertex result=processor.getNodeUsingUniqueId("9999", "postmen","model-ver","model-version-id","vnf-id-1");
+
+
+ List<Map<String,Object>> startNodeFilterArrayOfHashes=new ArrayList<>();
+
+ Map<String,String> result1=processor.getStartNodesAndModVersionIds("9999","postmen","vnf-id-1","vnf-id-1",
+ "vnf-id","generic-vnf",startNodeFilterArrayOfHashes,"");
+ }
+
+ @Test
+ public void getNodeUsingUniqueIdTest() throws AAIException{
+ vertex.property("vnf-id","vnf-id-1");
+ vertex1.property(AAIProperties.NODE_TYPE,"generic-vnf");
+ graphTraversal.addV(vertex);
+ v.addV(vertex1);
+ vertexList.add(vertex);
+ //vertexList.add(vertex1);
+ Mockito.when(dbEngine.asAdmin()).thenReturn(admin);
+ Mockito.when(admin.getReadOnlyTraversalSource()).thenReturn(graphTraversalSource);
+ Mockito.when(graphTraversalSource.V()).thenReturn(v);
+ Mockito.when(v.has(AAIProperties.NODE_TYPE,"generic-vnf")).thenReturn(graphTraversal);
+ Mockito.when(graphTraversal.has("vnf-id","vnf-id-1")).thenReturn(graphTraversal);
+ Mockito.when(graphTraversal.toList()).thenReturn(vertexList);
+ ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);
+
+ Vertex result=processor.getNodeUsingUniqueId("9999", "postmen","generic-vnf","vnf-id","vnf-id-1");
+
+ assertNotNull(result);
+ }
+
+ @Test
+ public void getNodeUsingUniqueIdTest1() throws AAIException{
+ vertex.property("named-query-uui","vnf-id-1");
+ vertex1.property(AAIProperties.NODE_TYPE,"named-query");
+ graphTraversal.addV(vertex);
+ v.addV(vertex1);
+ vertexList.add(vertex);
+ //vertexList.add(vertex1);
+ Mockito.when(dbEngine.asAdmin()).thenReturn(admin);
+ Mockito.when(admin.getReadOnlyTraversalSource()).thenReturn(graphTraversalSource);
+ Mockito.when(graphTraversalSource.V()).thenReturn(v);
+ Mockito.when(v.has(AAIProperties.NODE_TYPE,"named-query")).thenReturn(graphTraversal);
+ Mockito.when(graphTraversal.has("named-query-uui","vnf-id-1")).thenReturn(graphTraversal);
+ Mockito.when(graphTraversal.toList()).thenReturn(vertexList);
+ ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);
+
+ Vertex result=processor.getNodeUsingUniqueId("9999", "postmen","named-query","named-query-uui","vnf-id-1");
+
+ assertNotNull(result);
+ }
+
+ @Test(expected = AAIException.class)
+ public void getModelVersUsingNameTest() throws AAIException{
+
+ vertex.property(AAIProperties.NODE_TYPE,"generic-vnf");
+ vertex1.property("generic-vnf","generic-vnf");
+ graphTraversal.addV(vertex1);
+ v.addV(vertex1);
+ vertexList.add(vertex);
+ vertexList.add(vertex1);
+ Mockito.when(dbEngine.asAdmin()).thenReturn(admin);
+ Mockito.when(admin.getReadOnlyTraversalSource()).thenReturn(graphTraversalSource);
+ Mockito.when(graphTraversalSource.V()).thenReturn(v);
+ Mockito.when(v.has(AAIProperties.NODE_TYPE,"model-ver")).thenReturn(graphTraversal);
+ Mockito.when(graphTraversal.has("model-name","generic-vnf")).thenReturn(graphTraversal);
+ Mockito.when(graphTraversal.toList()).thenReturn(vertexList);
+ //Mockito.when(vertexList.listIterator().hasNext()).thenReturn(true);
+ ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);
+
+ List<Vertex> result=processor.getModelVersUsingName("9999","postment","generic-vnf");
+
+ assertTrue(result.size()>0);
+ }
+
+ //uniqueIdVal Null Expecting AAI Excpetion
+ @Test(expected = AAIException.class)
+ public void getNodeUsingUniqueIdTestNull() throws AAIException{
+ ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);
+ Vertex result=processor.getNodeUsingUniqueId("9999", "postmen","generic-vnf","vnf-id","");
+
+
+ }
+
+ //idPropertyName Null Expecting AAI Excpetion
+ @Test(expected = AAIException.class)
+ public void getNodeUsingUniqueIdTestNull1() throws AAIException{
+ ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);
+ Vertex result=processor.getNodeUsingUniqueId("9999", "postmen","generic-vnf","","vnf-id-1");
+
+
+ }
+
+ //idPropertyName Null Expecting AAI Excpetion
+ @Test(expected = AAIException.class)
+ public void getNodeUsingUniqueIdTestNull2() throws AAIException{
+ ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);
+ Vertex result=processor.getNodeUsingUniqueId("9999", "postmen","","vnf-id","vnf-id-1");
+
+
+ }
+
+ @Test(expected = AAIException.class)
+ public void getNodeUsingUniqueIdTestTwoVertex() throws AAIException{
+ vertex.property("vnf-id","vnf-id-1");
+ vertex1.property(AAIProperties.NODE_TYPE,"generic-vnf");
+ graphTraversal.addV(vertex);
+ v.addV(vertex1);
+ vertexList.add(vertex);
+ vertexList.add(vertex1);
+ Mockito.when(dbEngine.asAdmin()).thenReturn(admin);
+ Mockito.when(admin.getReadOnlyTraversalSource()).thenReturn(graphTraversalSource);
+ Mockito.when(graphTraversalSource.V()).thenReturn(v);
+ Mockito.when(v.has(AAIProperties.NODE_TYPE,"generic-vnf")).thenReturn(graphTraversal);
+ Mockito.when(graphTraversal.has("vnf-id","vnf-id-1")).thenReturn(graphTraversal);
+ Mockito.when(graphTraversal.toList()).thenReturn(vertexList);
+ ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);
+
+ Vertex result=processor.getNodeUsingUniqueId("9999", "postmen","generic-vnf","vnf-id","vnf-id-1");
+
+ assertNotNull(result);
+ }
+
+ //uniqVerts Null Expection AAI Exception
+ @Test(expected = AAIException.class)
+ public void getNodeUsingUniqueIdTestVertexNull() throws AAIException{
+ vertex.property("vnf-id","vnf-id-1");
+ vertex1.property(AAIProperties.NODE_TYPE,"generic-vnf");
+ graphTraversal.addV(vertex);
+ v.addV(vertex1);
+ vertexList.add(vertex);
+ //vertexList.add(vertex1);
+ Mockito.when(dbEngine.asAdmin()).thenReturn(admin);
+ Mockito.when(admin.getReadOnlyTraversalSource()).thenReturn(graphTraversalSource);
+ Mockito.when(graphTraversalSource.V()).thenReturn(v);
+ Mockito.when(v.has(AAIProperties.NODE_TYPE,"generic-vnf")).thenReturn(graphTraversal);
+ Mockito.when(graphTraversal.has("vnf-id","vnf-id-1")).thenReturn(graphTraversal);
+ Mockito.when(graphTraversal.toList()).thenReturn(null);
+ ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);
+
+ Vertex result=processor.getNodeUsingUniqueId("9999", "postmen","generic-vnf","vnf-id","vnf-id-1");
+
+ assertNotNull(result);
+ }
+
+ //uniqVerts Null Expection AAI Exception
+ @Test(expected = AAIException.class)
+ public void getNodeUsingUniqueIdTestVertexHasNot() throws AAIException{
+ vertex.property("vnf-id","vnf-id-1");
+ vertex1.property(AAIProperties.NODE_TYPE,"generic-vnf");
+ graphTraversal.addV(vertex);
+ v.addV(vertex1);
+ //vertexList.add(vertex);
+ //vertexList.add(vertex1);
+ Mockito.when(dbEngine.asAdmin()).thenReturn(admin);
+ Mockito.when(admin.getReadOnlyTraversalSource()).thenReturn(graphTraversalSource);
+ Mockito.when(graphTraversalSource.V()).thenReturn(v);
+ Mockito.when(v.has(AAIProperties.NODE_TYPE,"generic-vnf")).thenReturn(graphTraversal);
+ Mockito.when(graphTraversal.has("vnf-id","vnf-id-1")).thenReturn(graphTraversal);
+ Mockito.when(graphTraversal.toList()).thenReturn(vertexList);
+ ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);
+
+ Vertex result=processor.getNodeUsingUniqueId("9999", "postmen","generic-vnf","vnf-id","vnf-id-1");
+
+ assertNotNull(result);
+ }
+
+ @Test(expected = AAIIdentityMapParseException.class)
+ public void runDeleteByModelTest() throws AAIException{
+ ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);
+ Optional<Vertex> vertex=Optional.empty();
+ Map<String,Object> startNodeFilterHash=new HashMap<>();
+ startNodeFilterHash.put("related-link.data","relationshipdata");
+ startNodeFilterHash.put("generic-vnf.d","relationshipdata");
+ Mockito.when(dbMethHelper.searchVertexByIdentityMap("relationship-data",startNodeFilterHash)).thenReturn(vertex);
+ Map<String,String> re =processor.runDeleteByModel("9999","postmen","","relationship-data",startNodeFilterHash,"vnf-id","vnf-id");
+ assertNotNull(re);
+
+
+ }
+
+ @Test(expected = AAIException.class)
+ public void getModelGivenModelVerTest() throws AAIException{
+ vertex.property("named-query-uuid","vnf-id-1");
+ vertex1.property(AAIProperties.NODE_TYPE,"named-query");
+ graphTraversal.addV(vertex);
+ v.addV(vertex1);
+ vertexList.add(vertex);
+ //vertexList.add(vertex1);
+ Mockito.when(dbEngine.asAdmin()).thenReturn(admin);
+ Mockito.when(admin.getReadOnlyTraversalSource()).thenReturn(graphTraversalSource);
+ Mockito.when(graphTraversalSource.V()).thenReturn(v);
+ Mockito.when(v.has(AAIProperties.NODE_TYPE,"named-query")).thenReturn(graphTraversal);
+ Mockito.when(graphTraversal.has("named-query-uuid","vnf-id-1")).thenReturn(graphTraversal);
+ Mockito.when(graphTraversal.toList()).thenReturn(vertexList);
+
+ QueryBuilder qub=Mockito.mock(QueryBuilder.class);
+ qub.toList().addAll(vertexList);
+ Mockito.when(dbEngine.getQueryBuilder(Mockito.any(Vertex.class))).thenReturn(queryBuilder);
+
+ Mockito.when(queryBuilder.createEdgeTraversal(Mockito.any(EdgeType.class),Mockito.any(Vertex.class),Mockito.any(Introspector.class))).thenReturn(qub);
+
+ ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);
+
+ Vertex result=processor.getModelGivenModelVer(vertex,"");
+ assertNotNull(result);
+
+ }
+
+ @Test(expected = AAIException.class)
+ public void queryByNamedQuery_TimedTest() throws AAIException{
+ vertex.property("named-query-uuid","named-query-element");
+ vertex1.property(AAIProperties.NODE_TYPE,"named-query");
+ graphTraversal.addV(vertex);
+ v.addV(vertex1);
+ vertexList.add(vertex);
+ //vertexList.add(vertex1);
+ Mockito.when(dbEngine.asAdmin()).thenReturn(admin);
+ Mockito.when(admin.getReadOnlyTraversalSource()).thenReturn(graphTraversalSource);
+ Mockito.when(graphTraversalSource.V()).thenReturn(v);
+ Mockito.when(v.has(AAIProperties.NODE_TYPE,"named-query")).thenReturn(graphTraversal);
+ Mockito.when(graphTraversal.has("named-query-uuid","named-query-element")).thenReturn(graphTraversal);
+ Mockito.when(graphTraversal.toList()).thenReturn(vertexList);
+
+ QueryBuilder qub=Mockito.mock(QueryBuilder.class);
+ qub.toList().addAll(vertexList);
+ Mockito.when(dbEngine.getQueryBuilder(Mockito.any(Vertex.class))).thenReturn(queryBuilder);
+
+ Mockito.when(queryBuilder.createEdgeTraversal(Mockito.any(EdgeType.class),Mockito.any(Vertex.class),Mockito.any(Introspector.class))).thenReturn(qub);
+
+ ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);
+
+ List<Map<String,Object>> startNodeFilterArrayOfHashes=new ArrayList<>();
+ Map<String,Object> secondaryFilterHash=new HashMap<>();
+
+ List<ResultSet> res=processor.queryByNamedQuery_Timed("99999","postmen","named-query-element",startNodeFilterArrayOfHashes,"vnf","vnf",
+ secondaryFilterHash);
+
+
+ }
+
+ @Test(expected = AAIException.class)
+ public void genTopoMap4NamedQTest() throws AAIException{
+ ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);
+
+ vertex.property("named-query-uuid","named-query-element");
+ vertex1.property(AAIProperties.NODE_TYPE,"named-query-element");
+ graphTraversal.addV(vertex);
+ v.addV(vertex1);
+ vertexList.add(vertex);
+ QueryBuilder qub=Mockito.mock(QueryBuilder.class);
+ qub.toList().addAll(vertexList);
+ Mockito.when(dbEngine.getQueryBuilder(Mockito.any(Vertex.class))).thenReturn(queryBuilder);
+
+ Mockito.when(queryBuilder.createEdgeTraversal(Mockito.any(EdgeType.class),Mockito.any(Vertex.class),Mockito.any(Introspector.class))).thenReturn(qub);
+
+ Multimap<String, String> map =processor.genTopoMap4NamedQ("9999","postmen",vertex,"named-query-element");
+ }
+
+ @Test(expected = AAIException.class)
+ public void genTopoMap4NamedQTest1() throws AAIException{
+ ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);
+
+ vertex.property("named-query-uuid","named-query-element");
+ vertex1.property(AAIProperties.NODE_TYPE,"named-query-element");
+ graphTraversal.addV(vertex);
+ v.addV(vertex1);
+ vertexList.add(vertex);
+ QueryBuilder qub=Mockito.mock(QueryBuilder.class);
+ qub.toList().addAll(vertexList);
+ Mockito.when(dbEngine.getQueryBuilder(Mockito.any(Vertex.class))).thenReturn(queryBuilder);
+
+ Mockito.when(queryBuilder.createEdgeTraversal(Mockito.any(EdgeType.class),Mockito.any(Vertex.class),Mockito.any(Introspector.class))).thenReturn(qub);
+
+ Multimap<String, String> map =processor.genTopoMap4NamedQ("9999","postmen",null,"named-query-element");
+ }
+
+ @Test(expected = AAIException.class)
+ public void getModelThatNqElementRepresentsTest() throws AAIException{
+ vertex.property("model-ver","named-query-element");
+ vertex1.property(AAIProperties.NODE_TYPE,"named-query-element");
+ graphTraversal.addV(vertex);
+ v.addV(vertex1);
+ vertexList.add(vertex);
+ QueryBuilder qub=Mockito.mock(QueryBuilder.class);
+ qub.toList().addAll(vertexList);
+ Mockito.when(dbEngine.getQueryBuilder(Mockito.any(Vertex.class))).thenReturn(queryBuilder);
+
+ Mockito.when(queryBuilder.createEdgeTraversal(Mockito.any(EdgeType.class),Mockito.any(Vertex.class),Mockito.any(Introspector.class))).thenReturn(qub);
+ ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);
+ Vertex v=processor.getModelThatNqElementRepresents(vertex,"g");
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void getModelTypeFromModel() throws AAIException{
+ Vertex vt=Mockito.mock(Vertex.class);
+ vt.property("model-type","named-query-element");
+ ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);
+ String v=processor.getModelTypeFromModel(vt,"g");
+ }
+
+ @Test(expected = AAIException.class)
+ public void getModelTypeFromModel1() throws AAIException{
+ Vertex vt=Mockito.mock(Vertex.class);
+ vt.property("model-type","named-query-element");
+ ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);
+ String v=processor.getModelTypeFromModel(null,"g");
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void getModVersUsingModelInvId() throws AAIException{
+
+ vertex.property(AAIProperties.NODE_TYPE,"model-invariant-id");
+ vertex1.property("model","model-invariant-id");
+ graphTraversal.addV(vertex1);
+ v.addV(vertex1);
+ vertexList.add(vertex);
+ vertexList.add(vertex1);
+ Mockito.when(dbEngine.asAdmin()).thenReturn(admin);
+ Mockito.when(admin.getReadOnlyTraversalSource()).thenReturn(graphTraversalSource);
+ Mockito.when(graphTraversalSource.V()).thenReturn(v);
+ Mockito.when(v.has(AAIProperties.NODE_TYPE,"model-invariant-id")).thenReturn(graphTraversal);
+ Mockito.when(graphTraversal.has("model","model-invariant-id")).thenReturn(graphTraversal);
+ Mockito.when(graphTraversal.toList()).thenReturn(vertexList);
+ ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);
+
+ Iterator<Vertex> result=processor.getModVersUsingModelInvId("9999","postment","model");
+ }
+
+ @Test(expected = AAIException.class)
+ public void getNamedQueryExtraDataLookupTest() throws AAIException{
+ ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);
+
+ Map<String,Object> re=processor.getNamedQueryExtraDataLookup("","",null,vertex,
+ "");
+ }
+
+ @Test(expected = AAIException.class)
+ public void getNamedQueryExtraDataLookupTest1() throws AAIException{
+ ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);
+
+ Map<String,Object> re=processor.getNamedQueryExtraDataLookup("","",vertex,null,
+ "");
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void showResultSet() throws AAIException{
+ vertex.property("model-ver","model-versionId");
+ vertex.property("aai","model-versionId");
+
+
+ ResultSet rs= Mockito.mock(ResultSet.class);
+ Mockito.when(rs.getVert()).thenReturn(vertex);
+
+ List<VertexProperty<String>> vb=new ArrayList<>();
+ VertexProperty<String> v=Mockito.mock(VertexProperty.class);
+ v.property("model-ver","1");
+ vb.add(v);
+ v.property("aai","5");
+ vb.add(v);
+ v.property("source-of-truth","6");
+ vb.add(v);
+
+ vertex.properties("model-ver","aai");
+ Mockito.when(vertex.<String>property(AAIProperties.NODE_TYPE)).thenReturn(v);
+ //Mockito.when(vertex.properties()).thenReturn(Mockito.any());
+ ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);
+ processor.showResultSet(rs,8);
+
+ }
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * org.openecomp.aai\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package org.openecomp.aai.dbgraphmap;\r
-\r
-import com.thinkaurelius.titan.core.TitanGraph;\r
-import com.thinkaurelius.titan.graphdb.types.system.EmptyVertex;\r
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;\r
-import org.apache.tinkerpop.gremlin.structure.Graph;\r
-import org.apache.tinkerpop.gremlin.structure.Vertex;\r
-import org.apache.tinkerpop.gremlin.structure.VertexProperty;\r
-import org.apache.velocity.util.ArrayListWrapper;\r
-import org.eclipse.persistence.dynamic.DynamicEntity;\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.mockito.InjectMocks;\r
-import org.mockito.Mock;\r
-import org.mockito.Mockito;\r
-import org.openecomp.aai.dbgraphgen.ModelBasedProcessing;\r
-import org.openecomp.aai.dbmap.DBConnectionType;\r
-import org.openecomp.aai.exceptions.AAIException;\r
-import org.openecomp.aai.extensions.AAIExtensionMap;\r
-import org.openecomp.aai.introspection.*;\r
-import org.openecomp.aai.parsers.relationship.RelationshipToURI;\r
-import org.openecomp.aai.serialization.db.DBSerializer;\r
-import org.openecomp.aai.serialization.engines.QueryStyle;\r
-import org.openecomp.aai.serialization.engines.TitanDBEngine;\r
-import org.openecomp.aai.serialization.engines.TransactionalGraphEngine;\r
-import org.openecomp.aai.serialization.queryformats.utils.UrlBuilder;\r
-\r
-\r
-import javax.servlet.http.HttpServletRequest;\r
-import javax.ws.rs.core.*;\r
-import java.net.URI;\r
-import java.sql.ResultSet;\r
-import java.util.*;\r
-import java.util.stream.Stream;\r
-\r
-import static org.mockito.Matchers.anyObject;\r
-import static org.mockito.Mockito.*;\r
-\r
-public class SearchGraphTest {\r
-\r
- private SearchGraph searchGraph;\r
-\r
- protected static final MediaType APPLICATION_JSON = MediaType.valueOf("application/json");\r
-\r
- private static final Set<Integer> VALID_HTTP_STATUS_CODES = new HashSet<>();\r
-\r
- private final static Version version = Version.getLatest();\r
- private final static ModelType introspectorFactoryType = ModelType.MOXY;\r
- private final static QueryStyle queryStyle = QueryStyle.TRAVERSAL;\r
- private final static DBConnectionType type = DBConnectionType.REALTIME;\r
-\r
- static {\r
- VALID_HTTP_STATUS_CODES.add(200);\r
- VALID_HTTP_STATUS_CODES.add(201);\r
- VALID_HTTP_STATUS_CODES.add(204);\r
- }\r
-\r
- private HttpHeaders httpHeaders;\r
-\r
- private UriInfo uriInfo;\r
-\r
- private MultivaluedMap<String, String> headersMultiMap;\r
- private MultivaluedMap<String, String> queryParameters;\r
-\r
- private List<String> aaiRequestContextList;\r
-\r
- private List<MediaType> outputMediaTypes;\r
-\r
- private Loader loader;\r
- private TitanGraph graph;\r
-\r
- private Graph tx;\r
-\r
- private GraphTraversalSource g;\r
- private TransactionalGraphEngine dbEngine;\r
-\r
- @Before\r
- public void setup(){\r
-\r
- System.setProperty("AJSC_HOME", ".");\r
- System.setProperty("BUNDLECONFIG_DIR", "bundleconfig-local");\r
-\r
- searchGraph = new SearchGraph();\r
-\r
- httpHeaders = mock(HttpHeaders.class);\r
- uriInfo = mock(UriInfo.class);\r
-\r
- headersMultiMap = new MultivaluedHashMap<>();\r
- queryParameters = Mockito.spy(new MultivaluedHashMap<>());\r
-\r
- headersMultiMap.add("X-FromAppId", "JUNIT");\r
- headersMultiMap.add("X-TransactionId", UUID.randomUUID().toString());\r
- headersMultiMap.add("Real-Time", "true");\r
- headersMultiMap.add("Accept", "application/json");\r
- headersMultiMap.add("aai-request-context", "");\r
-\r
- outputMediaTypes = new ArrayList<>();\r
- outputMediaTypes.add(APPLICATION_JSON);\r
-\r
- aaiRequestContextList = new ArrayList<>();\r
- aaiRequestContextList.add("");\r
-\r
- when(httpHeaders.getAcceptableMediaTypes()).thenReturn(outputMediaTypes);\r
- when(httpHeaders.getRequestHeaders()).thenReturn(headersMultiMap);\r
- when(httpHeaders.getRequestHeader("X-FromAppId")).thenReturn(Arrays.asList("JUNIT"));\r
- when(httpHeaders.getRequestHeader("X-TransactionId")).thenReturn(Arrays.asList("JUNIT"));\r
-\r
- when(httpHeaders.getRequestHeader("aai-request-context")).thenReturn(aaiRequestContextList);\r
-\r
-\r
- when(uriInfo.getQueryParameters()).thenReturn(queryParameters);\r
- when(uriInfo.getQueryParameters(false)).thenReturn(queryParameters);\r
-\r
- // TODO - Check if this is valid since RemoveDME2QueryParameters seems to be very unreasonable\r
- Mockito.doReturn(null).when(queryParameters).remove(anyObject());\r
-\r
- when(httpHeaders.getMediaType()).thenReturn(APPLICATION_JSON);\r
- loader = LoaderFactory.createLoaderForVersion(introspectorFactoryType, version);\r
- dbEngine = new TitanDBEngine(\r
- queryStyle,\r
- type,\r
- loader);\r
- }\r
-\r
-@Test(expected = AAIException.class)\r
- public void runNodesQuery() throws AAIException{\r
- DBSerializer serializer = new DBSerializer(version, dbEngine, introspectorFactoryType, "JUNIT");\r
- UrlBuilder urlBuilder = new UrlBuilder(version, serializer);\r
- searchGraph.runNodesQuery(httpHeaders,"",null,\r
- null,dbEngine,loader,urlBuilder);\r
- }\r
- @Test(expected = AAIException.class)\r
- public void runNodesQueryNull() throws AAIException{\r
- DBSerializer serializer = new DBSerializer(version, dbEngine, introspectorFactoryType, "JUNIT");\r
- UrlBuilder urlBuilder = new UrlBuilder(version, serializer);\r
- searchGraph.runNodesQuery(httpHeaders,"nnn",null,\r
- null,dbEngine,loader,urlBuilder);\r
- }\r
- @Test(expected = AAIException.class)\r
- public void testRunGenericQueryFailWhenInvalidRelationshipList() throws AAIException {\r
-\r
- List<String> keys = new ArrayList<>();\r
- keys.add("cloud-region.cloud-owner:test-aic");\r
-\r
- List<String> includeStrings = new ArrayList<>();\r
- includeStrings.add("cloud-region");\r
-\r
- DBSerializer serializer = new DBSerializer(version, dbEngine, introspectorFactoryType, "JUNIT");\r
- UrlBuilder urlBuilder = new UrlBuilder(version, serializer);\r
- Response response = searchGraph.runGenericQuery(httpHeaders, "service-instance", keys, includeStrings, 1, dbEngine, loader, urlBuilder);\r
- System.out.println(response);\r
- }\r
-\r
-\r
- @Test(expected = AAIException.class)\r
- public void testRunGenericQueryFailWhenInvalidRelationshipList1() throws AAIException {\r
-\r
- List<String> keys = new ArrayList<>();\r
- keys.add("cloud-region.cloud-owner:test-aic");\r
-\r
- List<String> includeStrings = new ArrayList<>();\r
- includeStrings.add("cloud-region");\r
-\r
- DBSerializer serializer = new DBSerializer(version, dbEngine, introspectorFactoryType, "JUNIT");\r
- UrlBuilder urlBuilder = new UrlBuilder(version, serializer);\r
- Response response = searchGraph.runGenericQuery(httpHeaders, null, keys, includeStrings, 1, dbEngine, loader, urlBuilder);\r
- System.out.println(response);\r
- }\r
-\r
- @Test(expected = AAIException.class)\r
- public void testRunGenericQueryFailWhenInvalidRelationshipList2() throws AAIException {\r
-\r
- List<String> keys = new ArrayList<>();\r
- keys.add("cloud-region.cloud-owner:test-aic");\r
-\r
- List<String> includeStrings = new ArrayList<>();\r
- includeStrings.add("cloud-region");\r
-\r
- DBSerializer serializer = new DBSerializer(version, dbEngine, introspectorFactoryType, "JUNIT");\r
- UrlBuilder urlBuilder = new UrlBuilder(version, serializer);\r
- Response response = searchGraph.runGenericQuery(httpHeaders, "", null, includeStrings, 1, dbEngine, loader, urlBuilder);\r
- System.out.println(response);\r
- }\r
-\r
- @Test(expected = AAIException.class)\r
- public void testRunGenericQueryFailWhenInvalidRelationshipList3() throws AAIException {\r
-\r
- List<String> keys = new ArrayList<>();\r
- keys.add("cloud-region.cloud-owner:test-aic");\r
-\r
- List<String> includeStrings = new ArrayList<>();\r
- includeStrings.add("cloud-region");\r
-\r
- DBSerializer serializer = new DBSerializer(version, dbEngine, introspectorFactoryType, "JUNIT");\r
- UrlBuilder urlBuilder = new UrlBuilder(version, serializer);\r
- Response response = searchGraph.runGenericQuery(httpHeaders, "", keys, null, 1, dbEngine, loader, urlBuilder);\r
- System.out.println(response);\r
- }\r
-\r
-\r
- /*@Test(expected = NullPointerException.class)\r
- public void createSearchResults() throws AAIException {\r
-\r
- List<Vertex> keys = new ArrayList<>();\r
- Vertex vertex=new EmptyVertex();\r
- keys.add(vertex);\r
-\r
-\r
-\r
- List<String> includeStrings = new ArrayList<>();\r
- includeStrings.add("cloud-region");\r
-\r
- DBSerializer serializer = new DBSerializer(version, dbEngine, introspectorFactoryType, "JUNIT");\r
- UrlBuilder urlBuilder = new UrlBuilder(version, serializer);\r
- Introspector response = searchGraph.createSearchResults(loader, urlBuilder, keys);\r
- System.out.println(response);\r
- }*/\r
- @Test\r
- public void createSearchResults1() throws Exception {\r
-\r
- List<Vertex> keys = new ArrayList<>();\r
- Vertex vertex=new EmptyVertex();\r
- keys.add(vertex);\r
- DBSerializer ds=mock(DBSerializer.class);\r
- UrlBuilder urlBuilder=mock(UrlBuilder.class);\r
- when(urlBuilder.pathed(vertex)).thenReturn("cloud-region");\r
- Stream<Vertex> stream=mock(Stream.class);\r
- when(stream.isParallel()).thenReturn(true);\r
- List<String> includeStrings = new ArrayList<>();\r
- includeStrings.add("cloud-region");\r
- RelationshipToURI relationshipToURI=mock(RelationshipToURI.class);\r
- URI uri =new URI("");\r
- when(relationshipToURI.getUri()).thenReturn(uri);\r
-\r
- DBSerializer serializer = new DBSerializer(version, dbEngine, introspectorFactoryType, "JUNIT");\r
- // UrlBuilder urlBuilder = new UrlBuilder(version, serializer);\r
- Introspector response = searchGraph.createSearchResults(loader, urlBuilder, keys);\r
- System.out.println(response);\r
- }\r
- @Test(expected = AAIException.class)\r
- public void executeModelOperationTest() throws Exception{\r
- Vertex vertex=new EmptyVertex();\r
- vertex.property("model-name");\r
- Map<String,Object> mapObj=new HashMap<String,Object>();\r
- mapObj.put("modle-version",vertex);\r
- List<Map<String,Object>> startNodeFilterArrayOfHashes=new ArrayList<>();\r
- startNodeFilterArrayOfHashes.add(mapObj);\r
- List<org.openecomp.aai.dbgraphgen.ResultSet> resultSet=new ArrayList<org.openecomp.aai.dbgraphgen.ResultSet>();\r
- DBSerializer serializer = new DBSerializer(version, dbEngine, introspectorFactoryType, "JUNIT");\r
- // ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);\r
- AAIExtensionMap map=mock(AAIExtensionMap.class);\r
- HttpServletRequest servletRequest=mock(HttpServletRequest.class);\r
-\r
- when(map.getHttpServletRequest()).thenReturn(servletRequest);\r
- when(servletRequest.getContentType()).thenReturn("application/json");\r
- DynamicEntity modelAndNamedQuerySearch=mock(DynamicEntity.class);\r
- when(modelAndNamedQuerySearch.isSet("topNodeType")).thenReturn(true);\r
-\r
-\r
-/* when(processor.queryByModel("9999","model-ver","model-version-id",\r
- "model-inv-id","modelname","aai",\r
- startNodeFilterArrayOfHashes,"aai-ver")).thenReturn(resultSet);*/\r
-\r
- searchGraph.executeModelOperation("","","",type,true,\r
- map);\r
- }\r
-\r
- @Test(expected = AAIException.class)\r
- public void executeModelOperationXMLTest() throws Exception{\r
- Vertex vertex=new EmptyVertex();\r
- vertex.property("model-name");\r
- Map<String,Object> mapObj=new HashMap<String,Object>();\r
- mapObj.put("modle-version",vertex);\r
- List<Map<String,Object>> startNodeFilterArrayOfHashes=new ArrayList<>();\r
- startNodeFilterArrayOfHashes.add(mapObj);\r
- List<org.openecomp.aai.dbgraphgen.ResultSet> resultSet=new ArrayList<org.openecomp.aai.dbgraphgen.ResultSet>();\r
- DBSerializer serializer = new DBSerializer(version, dbEngine, introspectorFactoryType, "JUNIT");\r
- // ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);\r
- AAIExtensionMap map=mock(AAIExtensionMap.class);\r
- HttpServletRequest servletRequest=mock(HttpServletRequest.class);\r
-\r
- when(map.getHttpServletRequest()).thenReturn(servletRequest);\r
- when(servletRequest.getContentType()).thenReturn("application/xml");\r
-\r
- DynamicEntity modelAndNamedQuerySearch=mock(DynamicEntity.class);\r
- when(modelAndNamedQuerySearch.isSet("queryParameters")).thenReturn(true);\r
-/* when(processor.queryByModel("9999","model-ver","model-version-id",\r
- "model-inv-id","modelname","aai",\r
- startNodeFilterArrayOfHashes,"aai-ver")).thenReturn(resultSet);*/\r
-\r
- searchGraph.executeModelOperation("","","",type,true,\r
- map);\r
- }\r
- @Test\r
- public void runNodesQueryTest() throws AAIException{\r
- UrlBuilder urlBuilder=mock(UrlBuilder.class);\r
- List<String> filter=new ArrayList<String>();\r
- filter.add("model:EQUALS:DOES-NOT-EXIST:AAI");\r
- List<String> edgeFilter=new ArrayList<String>();\r
- edgeFilter.add("model:DOES-NOT-EXIST:DOES-NOT-EXIST:AAI");\r
- Response response= searchGraph.runNodesQuery(httpHeaders,"model-ver",edgeFilter,\r
- filter,dbEngine,loader,urlBuilder);\r
- Assert.assertNotNull(response);\r
- }\r
-\r
- @Test\r
- public void runNodesQueryExistsTest() throws AAIException{\r
- UrlBuilder urlBuilder=mock(UrlBuilder.class);\r
- List<String> filter=new ArrayList<String>();\r
- filter.add("model:EQUALS:DOES-NOT-EXIST:AAI");\r
- List<String> edgeFilter=new ArrayList<String>();\r
- edgeFilter.add("model:EXISTS:DOES-NOT-EXIST:AAI");\r
- Response response= searchGraph.runNodesQuery(httpHeaders,"model-ver",edgeFilter,\r
- filter,dbEngine,loader,urlBuilder);\r
- Assert.assertNotNull(response);\r
- }\r
-\r
- @Test\r
- public void runNodesQueryTestDOESNOTEQUAL() throws AAIException{\r
- UrlBuilder urlBuilder=mock(UrlBuilder.class);\r
- List<String> filter=new ArrayList<String>();\r
- filter.add("model:DOES-NOT-EQUAL:DOES-NOT-EXIST");\r
- List<String> edgeFilter=new ArrayList<String>();\r
- searchGraph.runNodesQuery(httpHeaders,"model-ver",edgeFilter,\r
- filter,dbEngine,loader,urlBuilder);\r
- }\r
-\r
- @Test\r
- public void runNodesQueryTestGreaterThan3() throws AAIException{\r
- UrlBuilder urlBuilder=mock(UrlBuilder.class);\r
- List<String> filter=new ArrayList<String>();\r
- filter.add("model:DOES-NOT-EQUAL:DOES-NOT-EXIST:AAI");\r
- List<String> edgeFilter=new ArrayList<String>();\r
- searchGraph.runNodesQuery(httpHeaders,"model-ver",edgeFilter,\r
- filter,dbEngine,loader,urlBuilder);\r
- }\r
-\r
- @Test\r
- public void runNodesQueryTestGreaterThanExists() throws AAIException{\r
- UrlBuilder urlBuilder=mock(UrlBuilder.class);\r
- List<String> filter=new ArrayList<String>();\r
- filter.add("model:EXISTS:DOES-NOT-EXIST:AAI");\r
- List<String> edgeFilter=new ArrayList<String>();\r
- searchGraph.runNodesQuery(httpHeaders,"model-ver",edgeFilter,\r
- filter,dbEngine,loader,urlBuilder);\r
- }\r
-\r
- @Test(expected = AAIException.class)\r
- public void runNodesQueryTestGreaterThanDoesNotExists() throws AAIException{\r
- UrlBuilder urlBuilder=mock(UrlBuilder.class);\r
- List<String> filter=new ArrayList<String>();\r
- filter.add("model:DOES_NOT_EXIST:DOES-NOT-EXIST:AAI");\r
- List<String> edgeFilter=new ArrayList<String>();\r
- searchGraph.runNodesQuery(httpHeaders,"model-ver",edgeFilter,\r
- filter,dbEngine,loader,urlBuilder);\r
- }\r
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.aai.dbgraphmap;
+
+import com.thinkaurelius.titan.core.TitanGraph;
+import com.thinkaurelius.titan.graphdb.types.system.EmptyVertex;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.VertexProperty;
+import org.apache.velocity.util.ArrayListWrapper;
+import org.eclipse.persistence.dynamic.DynamicEntity;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.aai.dbgraphgen.ModelBasedProcessing;
+import org.onap.aai.dbmap.DBConnectionType;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.extensions.AAIExtensionMap;
+import org.onap.aai.introspection.*;
+import org.onap.aai.parsers.relationship.RelationshipToURI;
+import org.onap.aai.serialization.db.DBSerializer;
+import org.onap.aai.serialization.engines.QueryStyle;
+import org.onap.aai.serialization.engines.TitanDBEngine;
+import org.onap.aai.serialization.engines.TransactionalGraphEngine;
+import org.onap.aai.serialization.queryformats.utils.UrlBuilder;
+
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.core.*;
+import java.net.URI;
+import java.sql.ResultSet;
+import java.util.*;
+import java.util.stream.Stream;
+
+import static org.mockito.Matchers.anyObject;
+import static org.mockito.Mockito.*;
+
+public class SearchGraphTest {
+
+ private SearchGraph searchGraph;
+
+ protected static final MediaType APPLICATION_JSON = MediaType.valueOf("application/json");
+
+ private static final Set<Integer> VALID_HTTP_STATUS_CODES = new HashSet<>();
+
+ private final static Version version = Version.getLatest();
+ private final static ModelType introspectorFactoryType = ModelType.MOXY;
+ private final static QueryStyle queryStyle = QueryStyle.TRAVERSAL;
+ private final static DBConnectionType type = DBConnectionType.REALTIME;
+
+ static {
+ VALID_HTTP_STATUS_CODES.add(200);
+ VALID_HTTP_STATUS_CODES.add(201);
+ VALID_HTTP_STATUS_CODES.add(204);
+ }
+
+ private HttpHeaders httpHeaders;
+
+ private UriInfo uriInfo;
+
+ private MultivaluedMap<String, String> headersMultiMap;
+ private MultivaluedMap<String, String> queryParameters;
+
+ private List<String> aaiRequestContextList;
+
+ private List<MediaType> outputMediaTypes;
+
+ private Loader loader;
+ private TitanGraph graph;
+
+ private Graph tx;
+
+ private GraphTraversalSource g;
+ private TransactionalGraphEngine dbEngine;
+
+ @Before
+ public void setup(){
+
+ System.setProperty("AJSC_HOME", ".");
+ System.setProperty("BUNDLECONFIG_DIR", "bundleconfig-local");
+
+ searchGraph = new SearchGraph();
+
+ httpHeaders = mock(HttpHeaders.class);
+ uriInfo = mock(UriInfo.class);
+
+ headersMultiMap = new MultivaluedHashMap<>();
+ queryParameters = Mockito.spy(new MultivaluedHashMap<>());
+
+ headersMultiMap.add("X-FromAppId", "JUNIT");
+ headersMultiMap.add("X-TransactionId", UUID.randomUUID().toString());
+ headersMultiMap.add("Real-Time", "true");
+ headersMultiMap.add("Accept", "application/json");
+ headersMultiMap.add("aai-request-context", "");
+
+ outputMediaTypes = new ArrayList<>();
+ outputMediaTypes.add(APPLICATION_JSON);
+
+ aaiRequestContextList = new ArrayList<>();
+ aaiRequestContextList.add("");
+
+ when(httpHeaders.getAcceptableMediaTypes()).thenReturn(outputMediaTypes);
+ when(httpHeaders.getRequestHeaders()).thenReturn(headersMultiMap);
+ when(httpHeaders.getRequestHeader("X-FromAppId")).thenReturn(Arrays.asList("JUNIT"));
+ when(httpHeaders.getRequestHeader("X-TransactionId")).thenReturn(Arrays.asList("JUNIT"));
+
+ when(httpHeaders.getRequestHeader("aai-request-context")).thenReturn(aaiRequestContextList);
+
+
+ when(uriInfo.getQueryParameters()).thenReturn(queryParameters);
+ when(uriInfo.getQueryParameters(false)).thenReturn(queryParameters);
+
+ // TODO - Check if this is valid since RemoveDME2QueryParameters seems to be very unreasonable
+ Mockito.doReturn(null).when(queryParameters).remove(anyObject());
+
+ when(httpHeaders.getMediaType()).thenReturn(APPLICATION_JSON);
+ loader = LoaderFactory.createLoaderForVersion(introspectorFactoryType, version);
+ dbEngine = new TitanDBEngine(
+ queryStyle,
+ type,
+ loader);
+ }
+
+@Test(expected = AAIException.class)
+ public void runNodesQuery() throws AAIException{
+ DBSerializer serializer = new DBSerializer(version, dbEngine, introspectorFactoryType, "JUNIT");
+ UrlBuilder urlBuilder = new UrlBuilder(version, serializer);
+ searchGraph.runNodesQuery(httpHeaders,"",null,
+ null,dbEngine,loader,urlBuilder);
+ }
+ @Test(expected = AAIException.class)
+ public void runNodesQueryNull() throws AAIException{
+ DBSerializer serializer = new DBSerializer(version, dbEngine, introspectorFactoryType, "JUNIT");
+ UrlBuilder urlBuilder = new UrlBuilder(version, serializer);
+ searchGraph.runNodesQuery(httpHeaders,"nnn",null,
+ null,dbEngine,loader,urlBuilder);
+ }
+ @Test(expected = AAIException.class)
+ public void testRunGenericQueryFailWhenInvalidRelationshipList() throws AAIException {
+
+ List<String> keys = new ArrayList<>();
+ keys.add("cloud-region.cloud-owner:test-aic");
+
+ List<String> includeStrings = new ArrayList<>();
+ includeStrings.add("cloud-region");
+
+ DBSerializer serializer = new DBSerializer(version, dbEngine, introspectorFactoryType, "JUNIT");
+ UrlBuilder urlBuilder = new UrlBuilder(version, serializer);
+ Response response = searchGraph.runGenericQuery(httpHeaders, "service-instance", keys, includeStrings, 1, dbEngine, loader, urlBuilder);
+ System.out.println(response);
+ }
+
+
+ @Test(expected = AAIException.class)
+ public void testRunGenericQueryFailWhenInvalidRelationshipList1() throws AAIException {
+
+ List<String> keys = new ArrayList<>();
+ keys.add("cloud-region.cloud-owner:test-aic");
+
+ List<String> includeStrings = new ArrayList<>();
+ includeStrings.add("cloud-region");
+
+ DBSerializer serializer = new DBSerializer(version, dbEngine, introspectorFactoryType, "JUNIT");
+ UrlBuilder urlBuilder = new UrlBuilder(version, serializer);
+ Response response = searchGraph.runGenericQuery(httpHeaders, null, keys, includeStrings, 1, dbEngine, loader, urlBuilder);
+ System.out.println(response);
+ }
+
+ @Test(expected = AAIException.class)
+ public void testRunGenericQueryFailWhenInvalidRelationshipList2() throws AAIException {
+
+ List<String> keys = new ArrayList<>();
+ keys.add("cloud-region.cloud-owner:test-aic");
+
+ List<String> includeStrings = new ArrayList<>();
+ includeStrings.add("cloud-region");
+
+ DBSerializer serializer = new DBSerializer(version, dbEngine, introspectorFactoryType, "JUNIT");
+ UrlBuilder urlBuilder = new UrlBuilder(version, serializer);
+ Response response = searchGraph.runGenericQuery(httpHeaders, "", null, includeStrings, 1, dbEngine, loader, urlBuilder);
+ System.out.println(response);
+ }
+
+ @Test(expected = AAIException.class)
+ public void testRunGenericQueryFailWhenInvalidRelationshipList3() throws AAIException {
+
+ List<String> keys = new ArrayList<>();
+ keys.add("cloud-region.cloud-owner:test-aic");
+
+ List<String> includeStrings = new ArrayList<>();
+ includeStrings.add("cloud-region");
+
+ DBSerializer serializer = new DBSerializer(version, dbEngine, introspectorFactoryType, "JUNIT");
+ UrlBuilder urlBuilder = new UrlBuilder(version, serializer);
+ Response response = searchGraph.runGenericQuery(httpHeaders, "", keys, null, 1, dbEngine, loader, urlBuilder);
+ System.out.println(response);
+ }
+
+
+ /*@Test(expected = NullPointerException.class)
+ public void createSearchResults() throws AAIException {
+
+ List<Vertex> keys = new ArrayList<>();
+ Vertex vertex=new EmptyVertex();
+ keys.add(vertex);
+
+
+
+ List<String> includeStrings = new ArrayList<>();
+ includeStrings.add("cloud-region");
+
+ DBSerializer serializer = new DBSerializer(version, dbEngine, introspectorFactoryType, "JUNIT");
+ UrlBuilder urlBuilder = new UrlBuilder(version, serializer);
+ Introspector response = searchGraph.createSearchResults(loader, urlBuilder, keys);
+ System.out.println(response);
+ }*/
+ @Test
+ public void createSearchResults1() throws Exception {
+
+ List<Vertex> keys = new ArrayList<>();
+ Vertex vertex=new EmptyVertex();
+ keys.add(vertex);
+ DBSerializer ds=mock(DBSerializer.class);
+ UrlBuilder urlBuilder=mock(UrlBuilder.class);
+ when(urlBuilder.pathed(vertex)).thenReturn("cloud-region");
+ Stream<Vertex> stream=mock(Stream.class);
+ when(stream.isParallel()).thenReturn(true);
+ List<String> includeStrings = new ArrayList<>();
+ includeStrings.add("cloud-region");
+ RelationshipToURI relationshipToURI=mock(RelationshipToURI.class);
+ URI uri =new URI("");
+ when(relationshipToURI.getUri()).thenReturn(uri);
+
+ DBSerializer serializer = new DBSerializer(version, dbEngine, introspectorFactoryType, "JUNIT");
+ // UrlBuilder urlBuilder = new UrlBuilder(version, serializer);
+ Introspector response = searchGraph.createSearchResults(loader, urlBuilder, keys);
+ System.out.println(response);
+ }
+ @Test(expected = AAIException.class)
+ public void executeModelOperationTest() throws Exception{
+ Vertex vertex=new EmptyVertex();
+ vertex.property("model-name");
+ Map<String,Object> mapObj=new HashMap<String,Object>();
+ mapObj.put("modle-version",vertex);
+ List<Map<String,Object>> startNodeFilterArrayOfHashes=new ArrayList<>();
+ startNodeFilterArrayOfHashes.add(mapObj);
+ List<org.onap.aai.dbgraphgen.ResultSet> resultSet=new ArrayList<org.onap.aai.dbgraphgen.ResultSet>();
+ DBSerializer serializer = new DBSerializer(version, dbEngine, introspectorFactoryType, "JUNIT");
+ // ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);
+ AAIExtensionMap map=mock(AAIExtensionMap.class);
+ HttpServletRequest servletRequest=mock(HttpServletRequest.class);
+
+ when(map.getHttpServletRequest()).thenReturn(servletRequest);
+ when(servletRequest.getContentType()).thenReturn("application/json");
+ DynamicEntity modelAndNamedQuerySearch=mock(DynamicEntity.class);
+ when(modelAndNamedQuerySearch.isSet("topNodeType")).thenReturn(true);
+
+
+/* when(processor.queryByModel("9999","model-ver","model-version-id",
+ "model-inv-id","modelname","aai",
+ startNodeFilterArrayOfHashes,"aai-ver")).thenReturn(resultSet);*/
+
+ searchGraph.executeModelOperation("","","",type,true,
+ map);
+ }
+
+ @Test(expected = AAIException.class)
+ public void executeModelOperationXMLTest() throws Exception{
+ Vertex vertex=new EmptyVertex();
+ vertex.property("model-name");
+ Map<String,Object> mapObj=new HashMap<String,Object>();
+ mapObj.put("modle-version",vertex);
+ List<Map<String,Object>> startNodeFilterArrayOfHashes=new ArrayList<>();
+ startNodeFilterArrayOfHashes.add(mapObj);
+ List<org.onap.aai.dbgraphgen.ResultSet> resultSet=new ArrayList<org.onap.aai.dbgraphgen.ResultSet>();
+ DBSerializer serializer = new DBSerializer(version, dbEngine, introspectorFactoryType, "JUNIT");
+ // ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);
+ AAIExtensionMap map=mock(AAIExtensionMap.class);
+ HttpServletRequest servletRequest=mock(HttpServletRequest.class);
+
+ when(map.getHttpServletRequest()).thenReturn(servletRequest);
+ when(servletRequest.getContentType()).thenReturn("application/xml");
+
+ DynamicEntity modelAndNamedQuerySearch=mock(DynamicEntity.class);
+ when(modelAndNamedQuerySearch.isSet("queryParameters")).thenReturn(true);
+/* when(processor.queryByModel("9999","model-ver","model-version-id",
+ "model-inv-id","modelname","aai",
+ startNodeFilterArrayOfHashes,"aai-ver")).thenReturn(resultSet);*/
+
+ searchGraph.executeModelOperation("","","",type,true,
+ map);
+ }
+ @Test
+ public void runNodesQueryTest() throws AAIException{
+ UrlBuilder urlBuilder=mock(UrlBuilder.class);
+ List<String> filter=new ArrayList<String>();
+ filter.add("model:EQUALS:DOES-NOT-EXIST:AAI");
+ List<String> edgeFilter=new ArrayList<String>();
+ edgeFilter.add("model:DOES-NOT-EXIST:DOES-NOT-EXIST:AAI");
+ Response response= searchGraph.runNodesQuery(httpHeaders,"model-ver",edgeFilter,
+ filter,dbEngine,loader,urlBuilder);
+ Assert.assertNotNull(response);
+ }
+
+ @Test
+ public void runNodesQueryExistsTest() throws AAIException{
+ UrlBuilder urlBuilder=mock(UrlBuilder.class);
+ List<String> filter=new ArrayList<String>();
+ filter.add("model:EQUALS:DOES-NOT-EXIST:AAI");
+ List<String> edgeFilter=new ArrayList<String>();
+ edgeFilter.add("model:EXISTS:DOES-NOT-EXIST:AAI");
+ Response response= searchGraph.runNodesQuery(httpHeaders,"model-ver",edgeFilter,
+ filter,dbEngine,loader,urlBuilder);
+ Assert.assertNotNull(response);
+ }
+
+ @Test
+ public void runNodesQueryTestDOESNOTEQUAL() throws AAIException{
+ UrlBuilder urlBuilder=mock(UrlBuilder.class);
+ List<String> filter=new ArrayList<String>();
+ filter.add("model:DOES-NOT-EQUAL:DOES-NOT-EXIST");
+ List<String> edgeFilter=new ArrayList<String>();
+ searchGraph.runNodesQuery(httpHeaders,"model-ver",edgeFilter,
+ filter,dbEngine,loader,urlBuilder);
+ }
+
+ @Test
+ public void runNodesQueryTestGreaterThan3() throws AAIException{
+ UrlBuilder urlBuilder=mock(UrlBuilder.class);
+ List<String> filter=new ArrayList<String>();
+ filter.add("model:DOES-NOT-EQUAL:DOES-NOT-EXIST:AAI");
+ List<String> edgeFilter=new ArrayList<String>();
+ searchGraph.runNodesQuery(httpHeaders,"model-ver",edgeFilter,
+ filter,dbEngine,loader,urlBuilder);
+ }
+
+ @Test
+ public void runNodesQueryTestGreaterThanExists() throws AAIException{
+ UrlBuilder urlBuilder=mock(UrlBuilder.class);
+ List<String> filter=new ArrayList<String>();
+ filter.add("model:EXISTS:DOES-NOT-EXIST:AAI");
+ List<String> edgeFilter=new ArrayList<String>();
+ searchGraph.runNodesQuery(httpHeaders,"model-ver",edgeFilter,
+ filter,dbEngine,loader,urlBuilder);
+ }
+
+ @Test(expected = AAIException.class)
+ public void runNodesQueryTestGreaterThanDoesNotExists() throws AAIException{
+ UrlBuilder urlBuilder=mock(UrlBuilder.class);
+ List<String> filter=new ArrayList<String>();
+ filter.add("model:DOES_NOT_EXIST:DOES-NOT-EXIST:AAI");
+ List<String> edgeFilter=new ArrayList<String>();
+ searchGraph.runNodesQuery(httpHeaders,"model-ver",edgeFilter,
+ filter,dbEngine,loader,urlBuilder);
+ }
}
\ No newline at end of file
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
+ * 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,
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.interceptors;
+package org.onap.aai.interceptors;
import org.apache.cxf.message.Exchange;
import org.apache.cxf.message.ExchangeImpl;
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
+ * 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,
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.interceptors;
+package org.onap.aai.interceptors;
import org.apache.cxf.io.CacheAndWriteOutputStream;
import org.apache.cxf.message.Exchange;
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
+ * 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,
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.interceptors;
+package org.onap.aai.interceptors;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
-import org.openecomp.aai.logging.LoggingContext;
+import org.onap.aai.logging.LoggingContext;
import javax.servlet.http.HttpServletRequest;
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
+ * 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,
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.interceptors;
+package org.onap.aai.interceptors;
import org.junit.Before;
import org.junit.Test;
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
+ * 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,
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest;
+package org.onap.aai.rest;
import com.fasterxml.jackson.core.JsonLocation;
import com.fasterxml.jackson.core.JsonParseException;
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
import java.util.Map;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Test;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
public class CloudRegionFromNfTypeQueryTest extends QueryTest {
public CloudRegionFromNfTypeQueryTest() throws AAIException, NoEdgeRuleFoundException {
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
import java.util.Map;
import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Test;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
public class CloudRegionFromNfTypeVendorVersionTest extends QueryTest {
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
import java.util.Map;
import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Test;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
public class CloudRegionFromNfTypeVendorVersion_withOptionalTest extends QueryTest {
-package org.openecomp.aai.rest.search;
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.aai.rest.search;
import static org.junit.Assert.*;
import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Test;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
public class CloudRegionFromVnfTest extends QueryTest {
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
import java.util.Map;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Test;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
public class CloudRegionfromCountryCloudRegionVersionQueryTest extends QueryTest {
public CloudRegionfromCountryCloudRegionVersionQueryTest() throws AAIException, NoEdgeRuleFoundException {
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
import java.util.Map;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Test;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
public class CloudRegionfromCountryQueryTest extends QueryTest {
public CloudRegionfromCountryQueryTest() throws AAIException, NoEdgeRuleFoundException {
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
import java.util.Map;
import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Test;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
public class FirstNetTopology_LineOfBusinessTest extends QueryTest {
public FirstNetTopology_LineOfBusinessTest() throws AAIException, NoEdgeRuleFoundException {
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
import java.util.Map;
import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Test;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
public class FirstNetTopology_ServiceInstanceTest extends QueryTest {
public FirstNetTopology_ServiceInstanceTest() throws AAIException, NoEdgeRuleFoundException {
-/*-\r
- * ============LICENSE_START=======================================================\r
- * org.openecomp.aai\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-\r
-package org.openecomp.aai.rest.search;\r
-\r
-import com.thinkaurelius.titan.core.TitanGraph;\r
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;\r
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;\r
-import org.apache.tinkerpop.gremlin.structure.Graph;\r
-import org.apache.tinkerpop.gremlin.structure.T;\r
-import org.apache.tinkerpop.gremlin.structure.Vertex;\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.mockito.Mockito;\r
-import org.openecomp.aai.dbmap.DBConnectionType;\r
-import org.openecomp.aai.exceptions.AAIException;\r
-import org.openecomp.aai.introspection.Loader;\r
-import org.openecomp.aai.introspection.LoaderFactory;\r
-import org.openecomp.aai.introspection.ModelType;\r
-import org.openecomp.aai.introspection.Version;\r
-import org.openecomp.aai.serialization.engines.QueryStyle;\r
-import org.openecomp.aai.serialization.engines.TitanDBEngine;\r
-import org.openecomp.aai.serialization.engines.TransactionalGraphEngine;\r
-import org.openecomp.aai.serialization.queryformats.SubGraphStyle;\r
-\r
-import javax.ws.rs.core.*;\r
-import java.net.URI;\r
-import java.util.*;\r
-\r
-import static org.mockito.Matchers.anyObject;\r
-import static org.mockito.Mockito.mock;\r
-import static org.mockito.Mockito.when;\r
-\r
-public class GremlinServerImplTest {\r
-\r
- GremlinServerImpl gremlinServerImpl;\r
-\r
- protected static final MediaType APPLICATION_JSON = MediaType.valueOf("application/json");\r
-\r
- private static final Set<Integer> VALID_HTTP_STATUS_CODES = new HashSet<>();\r
-\r
- private final static Version version = Version.getLatest();\r
- private final static ModelType introspectorFactoryType = ModelType.MOXY;\r
- private final static QueryStyle queryStyle = QueryStyle.TRAVERSAL;\r
- private final static DBConnectionType type = DBConnectionType.REALTIME;\r
-\r
- static {\r
- VALID_HTTP_STATUS_CODES.add(200);\r
- VALID_HTTP_STATUS_CODES.add(201);\r
- VALID_HTTP_STATUS_CODES.add(204);\r
- }\r
-\r
- private GenericQueryProcessor genericQueryProcessor;\r
- private HttpHeaders httpHeaders;\r
-\r
- private UriInfo uriInfo;\r
-\r
- private MultivaluedMap<String, String> headersMultiMap;\r
- private MultivaluedMap<String, String> queryParameters;\r
-\r
- private List<String> aaiRequestContextList;\r
-\r
- private List<MediaType> outputMediaTypes;\r
-\r
- private Loader loader;\r
- private TitanGraph graph;\r
-\r
- private Graph tx;\r
-\r
- private GraphTraversalSource g;\r
- private TransactionalGraphEngine dbEngine;\r
-\r
-\r
-\r
-@Before\r
- public void setup()throws AAIException{\r
-\r
- httpHeaders = mock(HttpHeaders.class);\r
- uriInfo = mock(UriInfo.class);\r
-\r
- headersMultiMap = new MultivaluedHashMap<>();\r
- queryParameters = Mockito.spy(new MultivaluedHashMap<>());\r
-\r
- headersMultiMap.add("X-FromAppId", "JUNIT");\r
- headersMultiMap.add("X-TransactionId", UUID.randomUUID().toString());\r
- headersMultiMap.add("Real-Time", "true");\r
- headersMultiMap.add("Accept", "application/json");\r
- headersMultiMap.add("aai-request-context", "");\r
-\r
- outputMediaTypes = new ArrayList<>();\r
- outputMediaTypes.add(APPLICATION_JSON);\r
-\r
- aaiRequestContextList = new ArrayList<>();\r
- aaiRequestContextList.add("");\r
-\r
- when(httpHeaders.getAcceptableMediaTypes()).thenReturn(outputMediaTypes);\r
- when(httpHeaders.getRequestHeaders()).thenReturn(headersMultiMap);\r
- when(httpHeaders.getRequestHeader("X-FromAppId")).thenReturn(Arrays.asList("JUNIT"));\r
- when(httpHeaders.getRequestHeader("X-TransactionId")).thenReturn(Arrays.asList("JUNIT"));\r
-\r
- when(httpHeaders.getRequestHeader("aai-request-context")).thenReturn(aaiRequestContextList);\r
-\r
-\r
- when(uriInfo.getQueryParameters()).thenReturn(queryParameters);\r
- when(uriInfo.getQueryParameters(false)).thenReturn(queryParameters);\r
-\r
- // TODO - Check if this is valid since RemoveDME2QueryParameters seems to be very unreasonable\r
- Mockito.doReturn(null).when(queryParameters).remove(anyObject());\r
-\r
- when(httpHeaders.getMediaType()).thenReturn(APPLICATION_JSON);\r
- loader = LoaderFactory.createLoaderForVersion(introspectorFactoryType, version);\r
- dbEngine = new TitanDBEngine(\r
- queryStyle,\r
- type,\r
- loader);\r
- GenericQueryProcessor.Builder builder=new GenericQueryProcessor.Builder(dbEngine);\r
-builder.queryFrom(URI.create("te"));\r
-builder.queryFrom("te");\r
-builder.create();\r
-builder.processWith(QueryProcessorType.GREMLIN_SERVER);\r
- builder.processWith(QueryProcessorType.LOCAL_GROOVY);\r
-\r
- gremlinServerImpl= new GremlinServerImpl(builder);\r
- }\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void processSubGraphTest() throws Exception{\r
- GraphTraversal<Vertex, Vertex> g=Mockito.mock(GraphTraversal.class);\r
- g.has("cloud-region-id", "cloud-region-id-1");\r
- gremlinServerImpl.processSubGraph(SubGraphStyle.prune,g);\r
-}\r
-\r
- @Test(expected = RuntimeException.class)\r
- public void executeTest() throws Exception{\r
- GraphTraversal<Vertex, Vertex> g=Mockito.mock(GraphTraversal.class);\r
- g.has("cloud-region-id", "cloud-region-id-1");\r
- //Mockito.when(etPath()).thenReturn("testpath");\r
- List<Object> re= gremlinServerImpl.execute(SubGraphStyle.prune);\r
- Assert.assertNotNull(re);\r
- }\r
-\r
-\r
-\r
-}\r
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+
+package org.onap.aai.rest.search;
+
+import com.thinkaurelius.titan.core.TitanGraph;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.T;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.onap.aai.dbmap.DBConnectionType;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.introspection.Loader;
+import org.onap.aai.introspection.LoaderFactory;
+import org.onap.aai.introspection.ModelType;
+import org.onap.aai.introspection.Version;
+import org.onap.aai.serialization.engines.QueryStyle;
+import org.onap.aai.serialization.engines.TitanDBEngine;
+import org.onap.aai.serialization.engines.TransactionalGraphEngine;
+import org.onap.aai.serialization.queryformats.SubGraphStyle;
+
+import javax.ws.rs.core.*;
+import java.net.URI;
+import java.util.*;
+
+import static org.mockito.Matchers.anyObject;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+public class GremlinServerImplTest {
+
+ GremlinServerImpl gremlinServerImpl;
+
+ protected static final MediaType APPLICATION_JSON = MediaType.valueOf("application/json");
+
+ private static final Set<Integer> VALID_HTTP_STATUS_CODES = new HashSet<>();
+
+ private final static Version version = Version.getLatest();
+ private final static ModelType introspectorFactoryType = ModelType.MOXY;
+ private final static QueryStyle queryStyle = QueryStyle.TRAVERSAL;
+ private final static DBConnectionType type = DBConnectionType.REALTIME;
+
+ static {
+ VALID_HTTP_STATUS_CODES.add(200);
+ VALID_HTTP_STATUS_CODES.add(201);
+ VALID_HTTP_STATUS_CODES.add(204);
+ }
+
+ private GenericQueryProcessor genericQueryProcessor;
+ private HttpHeaders httpHeaders;
+
+ private UriInfo uriInfo;
+
+ private MultivaluedMap<String, String> headersMultiMap;
+ private MultivaluedMap<String, String> queryParameters;
+
+ private List<String> aaiRequestContextList;
+
+ private List<MediaType> outputMediaTypes;
+
+ private Loader loader;
+ private TitanGraph graph;
+
+ private Graph tx;
+
+ private GraphTraversalSource g;
+ private TransactionalGraphEngine dbEngine;
+
+
+
+@Before
+ public void setup()throws AAIException{
+
+ httpHeaders = mock(HttpHeaders.class);
+ uriInfo = mock(UriInfo.class);
+
+ headersMultiMap = new MultivaluedHashMap<>();
+ queryParameters = Mockito.spy(new MultivaluedHashMap<>());
+
+ headersMultiMap.add("X-FromAppId", "JUNIT");
+ headersMultiMap.add("X-TransactionId", UUID.randomUUID().toString());
+ headersMultiMap.add("Real-Time", "true");
+ headersMultiMap.add("Accept", "application/json");
+ headersMultiMap.add("aai-request-context", "");
+
+ outputMediaTypes = new ArrayList<>();
+ outputMediaTypes.add(APPLICATION_JSON);
+
+ aaiRequestContextList = new ArrayList<>();
+ aaiRequestContextList.add("");
+
+ when(httpHeaders.getAcceptableMediaTypes()).thenReturn(outputMediaTypes);
+ when(httpHeaders.getRequestHeaders()).thenReturn(headersMultiMap);
+ when(httpHeaders.getRequestHeader("X-FromAppId")).thenReturn(Arrays.asList("JUNIT"));
+ when(httpHeaders.getRequestHeader("X-TransactionId")).thenReturn(Arrays.asList("JUNIT"));
+
+ when(httpHeaders.getRequestHeader("aai-request-context")).thenReturn(aaiRequestContextList);
+
+
+ when(uriInfo.getQueryParameters()).thenReturn(queryParameters);
+ when(uriInfo.getQueryParameters(false)).thenReturn(queryParameters);
+
+ // TODO - Check if this is valid since RemoveDME2QueryParameters seems to be very unreasonable
+ Mockito.doReturn(null).when(queryParameters).remove(anyObject());
+
+ when(httpHeaders.getMediaType()).thenReturn(APPLICATION_JSON);
+ loader = LoaderFactory.createLoaderForVersion(introspectorFactoryType, version);
+ dbEngine = new TitanDBEngine(
+ queryStyle,
+ type,
+ loader);
+ GenericQueryProcessor.Builder builder=new GenericQueryProcessor.Builder(dbEngine);
+builder.queryFrom(URI.create("te"));
+builder.queryFrom("te");
+builder.create();
+builder.processWith(QueryProcessorType.GREMLIN_SERVER);
+ builder.processWith(QueryProcessorType.LOCAL_GROOVY);
+
+ gremlinServerImpl= new GremlinServerImpl(builder);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void processSubGraphTest() throws Exception{
+ GraphTraversal<Vertex, Vertex> g=Mockito.mock(GraphTraversal.class);
+ g.has("cloud-region-id", "cloud-region-id-1");
+ gremlinServerImpl.processSubGraph(SubGraphStyle.prune,g);
+}
+
+ @Test(expected = RuntimeException.class)
+ public void executeTest() throws Exception{
+ GraphTraversal<Vertex, Vertex> g=Mockito.mock(GraphTraversal.class);
+ g.has("cloud-region-id", "cloud-region-id-1");
+ //Mockito.when(etPath()).thenReturn("testpath");
+ List<Object> re= gremlinServerImpl.execute(SubGraphStyle.prune);
+ Assert.assertNotNull(re);
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * org.openecomp.aai\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-\r
-package org.openecomp.aai.rest.search;\r
-\r
-import com.thinkaurelius.titan.core.TitanGraph;\r
-import groovy.lang.MissingPropertyException;\r
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;\r
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;\r
-import org.apache.tinkerpop.gremlin.structure.Graph;\r
-import org.apache.tinkerpop.gremlin.structure.Vertex;\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.mockito.Mockito;\r
-import org.openecomp.aai.dbmap.DBConnectionType;\r
-import org.openecomp.aai.exceptions.AAIException;\r
-import org.openecomp.aai.introspection.Loader;\r
-import org.openecomp.aai.introspection.LoaderFactory;\r
-import org.openecomp.aai.introspection.ModelType;\r
-import org.openecomp.aai.introspection.Version;\r
-import org.openecomp.aai.serialization.engines.QueryStyle;\r
-import org.openecomp.aai.serialization.engines.TitanDBEngine;\r
-import org.openecomp.aai.serialization.engines.TransactionalGraphEngine;\r
-import org.openecomp.aai.serialization.queryformats.SubGraphStyle;\r
-\r
-import javax.ws.rs.core.*;\r
-import java.net.URI;\r
-import java.util.*;\r
-\r
-import static org.mockito.Matchers.anyObject;\r
-import static org.mockito.Mockito.mock;\r
-import static org.mockito.Mockito.when;\r
-\r
-public class GroovyShellImplTest {\r
-\r
- GroovyShellImpl groovyShellImpl ;\r
-\r
- protected static final MediaType APPLICATION_JSON = MediaType.valueOf("application/json");\r
-\r
- private static final Set<Integer> VALID_HTTP_STATUS_CODES = new HashSet<>();\r
-\r
- private final static Version version = Version.getLatest();\r
- private final static ModelType introspectorFactoryType = ModelType.MOXY;\r
- private final static QueryStyle queryStyle = QueryStyle.TRAVERSAL;\r
- private final static DBConnectionType type = DBConnectionType.REALTIME;\r
-\r
- static {\r
- VALID_HTTP_STATUS_CODES.add(200);\r
- VALID_HTTP_STATUS_CODES.add(201);\r
- VALID_HTTP_STATUS_CODES.add(204);\r
- }\r
-\r
- private GenericQueryProcessor genericQueryProcessor;\r
- private HttpHeaders httpHeaders;\r
-\r
- private UriInfo uriInfo;\r
-\r
- private MultivaluedMap<String, String> headersMultiMap;\r
- private MultivaluedMap<String, String> queryParameters;\r
-\r
- private List<String> aaiRequestContextList;\r
-\r
- private List<MediaType> outputMediaTypes;\r
-\r
- private Loader loader;\r
- private TitanGraph graph;\r
-\r
- private Graph tx;\r
-\r
- private GraphTraversalSource g;\r
- private TransactionalGraphEngine dbEngine;\r
-\r
-\r
-\r
-@Before\r
- public void setup()throws AAIException{\r
-\r
- httpHeaders = mock(HttpHeaders.class);\r
- uriInfo = mock(UriInfo.class);\r
-\r
- headersMultiMap = new MultivaluedHashMap<>();\r
- queryParameters = Mockito.spy(new MultivaluedHashMap<>());\r
-\r
- headersMultiMap.add("X-FromAppId", "JUNIT");\r
- headersMultiMap.add("X-TransactionId", UUID.randomUUID().toString());\r
- headersMultiMap.add("Real-Time", "true");\r
- headersMultiMap.add("Accept", "application/json");\r
- headersMultiMap.add("aai-request-context", "");\r
-\r
- outputMediaTypes = new ArrayList<>();\r
- outputMediaTypes.add(APPLICATION_JSON);\r
-\r
- aaiRequestContextList = new ArrayList<>();\r
- aaiRequestContextList.add("");\r
-\r
- when(httpHeaders.getAcceptableMediaTypes()).thenReturn(outputMediaTypes);\r
- when(httpHeaders.getRequestHeaders()).thenReturn(headersMultiMap);\r
- when(httpHeaders.getRequestHeader("X-FromAppId")).thenReturn(Arrays.asList("JUNIT"));\r
- when(httpHeaders.getRequestHeader("X-TransactionId")).thenReturn(Arrays.asList("JUNIT"));\r
-\r
- when(httpHeaders.getRequestHeader("aai-request-context")).thenReturn(aaiRequestContextList);\r
-\r
-\r
- when(uriInfo.getQueryParameters()).thenReturn(queryParameters);\r
- when(uriInfo.getQueryParameters(false)).thenReturn(queryParameters);\r
-\r
- // TODO - Check if this is valid since RemoveDME2QueryParameters seems to be very unreasonable\r
- Mockito.doReturn(null).when(queryParameters).remove(anyObject());\r
-\r
- when(httpHeaders.getMediaType()).thenReturn(APPLICATION_JSON);\r
- loader = LoaderFactory.createLoaderForVersion(introspectorFactoryType, version);\r
- dbEngine = new TitanDBEngine(\r
- queryStyle,\r
- type,\r
- loader);\r
- GenericQueryProcessor.Builder builder=new GenericQueryProcessor.Builder(dbEngine);\r
-builder.queryFrom(URI.create("te"));\r
-builder.queryFrom("te");\r
-builder.create();\r
-builder.processWith(QueryProcessorType.GREMLIN_SERVER);\r
- builder.processWith(QueryProcessorType.LOCAL_GROOVY);\r
-\r
- groovyShellImpl= new GroovyShellImpl(builder);\r
- }\r
-\r
- @Test(expected = MissingPropertyException.class)\r
- public void processSubGraphTest() throws Exception{\r
- GraphTraversal<Vertex, Vertex> g=Mockito.mock(GraphTraversal.class);\r
- g.has("cloud-region-id", "cloud-region-id-1");\r
- Map<String, Object> params = new HashMap<>();\r
- groovyShellImpl.runQuery("vnfs-fromServiceInstance",params);\r
-}\r
-\r
-\r
-\r
-\r
-\r
-}\r
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+
+package org.onap.aai.rest.search;
+
+import com.thinkaurelius.titan.core.TitanGraph;
+import groovy.lang.MissingPropertyException;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.onap.aai.dbmap.DBConnectionType;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.introspection.Loader;
+import org.onap.aai.introspection.LoaderFactory;
+import org.onap.aai.introspection.ModelType;
+import org.onap.aai.introspection.Version;
+import org.onap.aai.serialization.engines.QueryStyle;
+import org.onap.aai.serialization.engines.TitanDBEngine;
+import org.onap.aai.serialization.engines.TransactionalGraphEngine;
+import org.onap.aai.serialization.queryformats.SubGraphStyle;
+
+import javax.ws.rs.core.*;
+import java.net.URI;
+import java.util.*;
+
+import static org.mockito.Matchers.anyObject;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+public class GroovyShellImplTest {
+
+ GroovyShellImpl groovyShellImpl ;
+
+ protected static final MediaType APPLICATION_JSON = MediaType.valueOf("application/json");
+
+ private static final Set<Integer> VALID_HTTP_STATUS_CODES = new HashSet<>();
+
+ private final static Version version = Version.getLatest();
+ private final static ModelType introspectorFactoryType = ModelType.MOXY;
+ private final static QueryStyle queryStyle = QueryStyle.TRAVERSAL;
+ private final static DBConnectionType type = DBConnectionType.REALTIME;
+
+ static {
+ VALID_HTTP_STATUS_CODES.add(200);
+ VALID_HTTP_STATUS_CODES.add(201);
+ VALID_HTTP_STATUS_CODES.add(204);
+ }
+
+ private GenericQueryProcessor genericQueryProcessor;
+ private HttpHeaders httpHeaders;
+
+ private UriInfo uriInfo;
+
+ private MultivaluedMap<String, String> headersMultiMap;
+ private MultivaluedMap<String, String> queryParameters;
+
+ private List<String> aaiRequestContextList;
+
+ private List<MediaType> outputMediaTypes;
+
+ private Loader loader;
+ private TitanGraph graph;
+
+ private Graph tx;
+
+ private GraphTraversalSource g;
+ private TransactionalGraphEngine dbEngine;
+
+
+
+@Before
+ public void setup()throws AAIException{
+
+ httpHeaders = mock(HttpHeaders.class);
+ uriInfo = mock(UriInfo.class);
+
+ headersMultiMap = new MultivaluedHashMap<>();
+ queryParameters = Mockito.spy(new MultivaluedHashMap<>());
+
+ headersMultiMap.add("X-FromAppId", "JUNIT");
+ headersMultiMap.add("X-TransactionId", UUID.randomUUID().toString());
+ headersMultiMap.add("Real-Time", "true");
+ headersMultiMap.add("Accept", "application/json");
+ headersMultiMap.add("aai-request-context", "");
+
+ outputMediaTypes = new ArrayList<>();
+ outputMediaTypes.add(APPLICATION_JSON);
+
+ aaiRequestContextList = new ArrayList<>();
+ aaiRequestContextList.add("");
+
+ when(httpHeaders.getAcceptableMediaTypes()).thenReturn(outputMediaTypes);
+ when(httpHeaders.getRequestHeaders()).thenReturn(headersMultiMap);
+ when(httpHeaders.getRequestHeader("X-FromAppId")).thenReturn(Arrays.asList("JUNIT"));
+ when(httpHeaders.getRequestHeader("X-TransactionId")).thenReturn(Arrays.asList("JUNIT"));
+
+ when(httpHeaders.getRequestHeader("aai-request-context")).thenReturn(aaiRequestContextList);
+
+
+ when(uriInfo.getQueryParameters()).thenReturn(queryParameters);
+ when(uriInfo.getQueryParameters(false)).thenReturn(queryParameters);
+
+ // TODO - Check if this is valid since RemoveDME2QueryParameters seems to be very unreasonable
+ Mockito.doReturn(null).when(queryParameters).remove(anyObject());
+
+ when(httpHeaders.getMediaType()).thenReturn(APPLICATION_JSON);
+ loader = LoaderFactory.createLoaderForVersion(introspectorFactoryType, version);
+ dbEngine = new TitanDBEngine(
+ queryStyle,
+ type,
+ loader);
+ GenericQueryProcessor.Builder builder=new GenericQueryProcessor.Builder(dbEngine);
+builder.queryFrom(URI.create("te"));
+builder.queryFrom("te");
+builder.create();
+builder.processWith(QueryProcessorType.GREMLIN_SERVER);
+ builder.processWith(QueryProcessorType.LOCAL_GROOVY);
+
+ groovyShellImpl= new GroovyShellImpl(builder);
+ }
+
+ @Test(expected = MissingPropertyException.class)
+ public void processSubGraphTest() throws Exception{
+ GraphTraversal<Vertex, Vertex> g=Mockito.mock(GraphTraversal.class);
+ g.has("cloud-region-id", "cloud-region-id-1");
+ Map<String, Object> params = new HashMap<>();
+ groovyShellImpl.runQuery("vnfs-fromServiceInstance",params);
+}
+
+
+
+
+
+}
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
import java.util.Map;
import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Test;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
public class ImageFromCloudRegionNfTypeTest extends QueryTest {
-package org.openecomp.aai.rest.search;
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.aai.rest.search;
import java.util.Map;
import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Test;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
public class LinkedDevices_ComplicatedGVtoGV extends QueryTest {
-package org.openecomp.aai.rest.search;
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.aai.rest.search;
import static org.junit.Assert.*;
import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Test;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
public class LinkedDevices_NewvceVserverTest extends QueryTest {
-package org.openecomp.aai.rest.search;
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.aai.rest.search;
import java.util.Map;
import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Test;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
public class LinkedDevices_SimpleGVtoGVQueryTest extends QueryTest {
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
import java.util.Map;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Test;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
public class LocationNetTypeNetRolefromCloudRegionQueryTest extends QueryTest {
public LocationNetTypeNetRolefromCloudRegionQueryTest() throws AAIException, NoEdgeRuleFoundException {
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
-import org.openecomp.aai.dbmap.DBConnectionType;
-import org.openecomp.aai.introspection.Loader;
-import org.openecomp.aai.introspection.LoaderFactory;
-import org.openecomp.aai.introspection.ModelType;
-import org.openecomp.aai.introspection.Version;
-import org.openecomp.aai.serialization.db.DBSerializer;
-import org.openecomp.aai.serialization.engines.QueryStyle;
-import org.openecomp.aai.serialization.engines.TitanDBEngine;
-import org.openecomp.aai.serialization.engines.TransactionalGraphEngine;
-import org.openecomp.aai.serialization.queryformats.utils.UrlBuilder;
+import org.onap.aai.dbmap.DBConnectionType;
+import org.onap.aai.introspection.Loader;
+import org.onap.aai.introspection.LoaderFactory;
+import org.onap.aai.introspection.ModelType;
+import org.onap.aai.introspection.Version;
+import org.onap.aai.serialization.db.DBSerializer;
+import org.onap.aai.serialization.engines.QueryStyle;
+import org.onap.aai.serialization.engines.TitanDBEngine;
+import org.onap.aai.serialization.engines.TransactionalGraphEngine;
+import org.onap.aai.serialization.queryformats.utils.UrlBuilder;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.*;
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
import java.util.Map;
import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Test;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
public class MsoRequestVfModuleTest extends QueryTest {
public MsoRequestVfModuleTest() throws AAIException, NoEdgeRuleFoundException {
-package org.openecomp.aai.rest.search;
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.aai.rest.search;
import static org.junit.Assert.*;
import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Test;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
public class NetworkNameFromNetworkRoleQueryTest extends QueryTest {
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
import java.util.Map;
import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Test;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
public class NfTypefromCloudRegionQueryTest extends QueryTest {
public NfTypefromCloudRegionQueryTest() throws AAIException, NoEdgeRuleFoundException {
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Test;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
import java.util.Map;
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
import java.util.Map;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Test;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
public class PendingTopologyDetailTest extends QueryTest {
public PendingTopologyDetailTest() throws AAIException, NoEdgeRuleFoundException {
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
import java.util.Map;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Test;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
public class PserverfromConfigurationFilterInterfaceIdTest extends QueryTest {
public PserverfromConfigurationFilterInterfaceIdTest() throws AAIException, NoEdgeRuleFoundException {
-/*-
+/**
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
+ * 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,
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
import java.util.Map;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Test;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
public class PserverfromConfigurationTest extends QueryTest {
public PserverfromConfigurationTest() throws AAIException, NoEdgeRuleFoundException {
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
import java.util.Map;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Test;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
public class PserversFromVnfQueryTest extends QueryTest {
public PserversFromVnfQueryTest() throws AAIException, NoEdgeRuleFoundException {
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.any;
import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.introspection.Loader;
-import org.openecomp.aai.introspection.LoaderFactory;
-import org.openecomp.aai.introspection.ModelType;
-import org.openecomp.aai.introspection.Version;
-import org.openecomp.aai.query.builder.GremlinTraversal;
-import org.openecomp.aai.serialization.db.EdgeRules;
-import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
-import org.openecomp.aai.serialization.engines.QueryStyle;
-import org.openecomp.aai.serialization.engines.TransactionalGraphEngine;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.introspection.Loader;
+import org.onap.aai.introspection.LoaderFactory;
+import org.onap.aai.introspection.ModelType;
+import org.onap.aai.introspection.Version;
+import org.onap.aai.query.builder.GremlinTraversal;
+import org.onap.aai.serialization.db.EdgeRules;
+import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.onap.aai.serialization.engines.QueryStyle;
+import org.onap.aai.serialization.engines.TransactionalGraphEngine;
public abstract class QueryTest {
-package org.openecomp.aai.rest.search;
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.aai.rest.search;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Test;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
import java.util.Map;
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
-import org.openecomp.aai.dbmap.DBConnectionType;
-import org.openecomp.aai.introspection.Loader;
-import org.openecomp.aai.introspection.LoaderFactory;
-import org.openecomp.aai.introspection.ModelType;
-import org.openecomp.aai.introspection.Version;
-import org.openecomp.aai.serialization.db.DBSerializer;
-import org.openecomp.aai.serialization.engines.QueryStyle;
-import org.openecomp.aai.serialization.engines.TitanDBEngine;
-import org.openecomp.aai.serialization.engines.TransactionalGraphEngine;
-import org.openecomp.aai.serialization.queryformats.utils.UrlBuilder;
+import org.onap.aai.dbmap.DBConnectionType;
+import org.onap.aai.introspection.Loader;
+import org.onap.aai.introspection.LoaderFactory;
+import org.onap.aai.introspection.ModelType;
+import org.onap.aai.introspection.Version;
+import org.onap.aai.serialization.db.DBSerializer;
+import org.onap.aai.serialization.engines.QueryStyle;
+import org.onap.aai.serialization.engines.TitanDBEngine;
+import org.onap.aai.serialization.engines.TransactionalGraphEngine;
+import org.onap.aai.serialization.queryformats.utils.UrlBuilder;
import javax.ws.rs.core.*;
import java.util.*;
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
import java.util.Map;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Test;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
public class ServiceFromPserverAndSubsNameTest extends QueryTest {
public ServiceFromPserverAndSubsNameTest() throws AAIException, NoEdgeRuleFoundException {
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import org.openecomp.aai.dbmap.DBConnectionType;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.introspection.Loader;
-import org.openecomp.aai.introspection.LoaderFactory;
-import org.openecomp.aai.introspection.ModelType;
-import org.openecomp.aai.introspection.Version;
-import org.openecomp.aai.serialization.db.DBSerializer;
-import org.openecomp.aai.serialization.db.EdgeRules;
-import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
-import org.openecomp.aai.serialization.engines.QueryStyle;
-import org.openecomp.aai.serialization.engines.TitanDBEngine;
-import org.openecomp.aai.serialization.engines.TransactionalGraphEngine;
-import org.openecomp.aai.serialization.queryformats.RawFormat;
-import org.openecomp.aai.serialization.queryformats.exceptions.AAIFormatVertexException;
-import org.openecomp.aai.serialization.queryformats.utils.UrlBuilder;
+import org.onap.aai.dbmap.DBConnectionType;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.introspection.Loader;
+import org.onap.aai.introspection.LoaderFactory;
+import org.onap.aai.introspection.ModelType;
+import org.onap.aai.introspection.Version;
+import org.onap.aai.serialization.db.DBSerializer;
+import org.onap.aai.serialization.db.EdgeRules;
+import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.onap.aai.serialization.engines.QueryStyle;
+import org.onap.aai.serialization.engines.TitanDBEngine;
+import org.onap.aai.serialization.engines.TransactionalGraphEngine;
+import org.onap.aai.serialization.queryformats.RawFormat;
+import org.onap.aai.serialization.queryformats.exceptions.AAIFormatVertexException;
+import org.onap.aai.serialization.queryformats.utils.UrlBuilder;
import com.google.gson.JsonObject;
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
import java.util.Map;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Test;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
public class TopologyDetailFromVserverQueryTest extends QueryTest {
public TopologyDetailFromVserverQueryTest() throws AAIException, NoEdgeRuleFoundException {
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
import java.util.Map;
import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Test;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
public class TopologyDetailsQueryTest extends QueryTest {
public TopologyDetailsQueryTest() throws AAIException, NoEdgeRuleFoundException {
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
import java.util.Map;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Test;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
public class TopologyFromCloudRegionIdAndServiceIdTest extends QueryTest {
public TopologyFromCloudRegionIdAndServiceIdTest() throws AAIException, NoEdgeRuleFoundException {
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
import java.util.Map;
import com.google.common.base.CaseFormat;
import org.junit.Test;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
public class TopologyFromSubscriberNameAndServiceTypeTest extends QueryTest {
private static final EELFLogger LOGGER = EELFManager.getInstance()
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
import java.util.Map;
import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Test;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
public class VnfInstancesFromServiceInstancebyModelVersionTest extends QueryTest {
public VnfInstancesFromServiceInstancebyModelVersionTest() throws AAIException, NoEdgeRuleFoundException {
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
import java.util.Map;
import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Test;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
public class VnfTopologyFromServiceInstanceTest extends QueryTest {
public VnfTopologyFromServiceInstanceTest() throws AAIException, NoEdgeRuleFoundException {
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
import java.util.Map;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Test;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
public class VnfTopologyFromVfModuleTest extends QueryTest {
public VnfTopologyFromVfModuleTest() throws AAIException, NoEdgeRuleFoundException {
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
import java.util.Map;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Test;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
public class VnfTopologyFromVnfTest extends QueryTest {
public VnfTopologyFromVnfTest() throws AAIException, NoEdgeRuleFoundException {
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
import java.util.Map;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Test;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
public class VnfsFromPserverQueryTest extends QueryTest {
public VnfsFromPserverQueryTest() throws AAIException, NoEdgeRuleFoundException {
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
import java.util.Map;
import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Test;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
public class VnfsFromServiceInstanceTest extends QueryTest {
public VnfsFromServiceInstanceTest() throws AAIException, NoEdgeRuleFoundException {
-package org.openecomp.aai.rest.search;
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.aai.rest.search;
import static org.junit.Assert.*;
import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Test;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
public class VserverFromVnfQueryTest extends QueryTest {
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.search;
+package org.onap.aai.rest.search;
import static org.junit.Assert.*;
import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Test;
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
public class VserverLogicallinkFromPServerTest extends QueryTest {
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
+ * 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,
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.util;
+package org.onap.aai.rest.util;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
-/*-\r
- * ============LICENSE_START=======================================================\r
- * org.openecomp.aai\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package org.openecomp.aai.rest.util;\r
-\r
-import org.junit.Test;\r
-\r
-import static org.junit.Assert.assertNotNull;\r
-\r
-public class LogFormatToolsTest {\r
-\r
- @Test\r
- public void testLogFormatTools(){\r
-\r
- String dateTime = new LogFormatTools().getCurrentDateTime();\r
- assertNotNull(dateTime);\r
- }\r
-}\r
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.aai.rest.util;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertNotNull;
+
+public class LogFormatToolsTest {
+
+ @Test
+ public void testLogFormatTools(){
+
+ String dateTime = new LogFormatTools().getCurrentDateTime();
+ assertNotNull(dateTime);
+ }
+}
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.rest.util;
+package org.onap.aai.rest.util;
import static org.junit.Assert.*;
-/*-\r
- * ============LICENSE_START=======================================================\r
- * org.openecomp.aai\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package org.openecomp.aai.retiredcustomer;\r
-\r
-import com.att.eelf.configuration.EELFLogger;\r
-import com.att.eelf.configuration.EELFManager;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.mockito.Mockito;\r
-import org.openecomp.aai.ajsc_aai.JaxrsUserService;\r
-import org.openecomp.aai.introspection.Version;\r
-import org.openecomp.aai.rest.retired.RetiredConsumer;\r
-\r
-import javax.ws.rs.core.*;\r
-import java.util.*;\r
-\r
-import static org.junit.Assert.assertNotNull;\r
-import static org.mockito.Matchers.anyObject;\r
-import static org.mockito.Mockito.when;\r
-\r
-public class JaxrsUserServiceTest {\r
-\r
-\r
- protected static final MediaType APPLICATION_JSON = MediaType.valueOf("application/json");\r
-\r
- private static final Set<Integer> VALID_HTTP_STATUS_CODES = new HashSet<>();\r
-\r
- static {\r
- VALID_HTTP_STATUS_CODES.add(200);\r
- VALID_HTTP_STATUS_CODES.add(201);\r
- VALID_HTTP_STATUS_CODES.add(204);\r
- }\r
-\r
- protected JaxrsUserService jaxrsUserService;\r
- protected HttpHeaders httpHeaders;\r
- protected UriInfo uriInfo;\r
-\r
- private MultivaluedMap<String, String> headersMultiMap;\r
- private MultivaluedMap<String, String> queryParameters;\r
-\r
- private List<String> aaiRequestContextList;\r
-\r
- private List<MediaType> outputMediaTypes;\r
-\r
- private static final EELFLogger logger = EELFManager.getInstance().getLogger(RetiredConsumer.class.getName());\r
-\r
- @Before\r
- public void setup(){\r
- logger.info("Starting the setup for the integration tests of Rest Endpoints");\r
-\r
- jaxrsUserService = new JaxrsUserService();\r
- httpHeaders = Mockito.mock(HttpHeaders.class);\r
- uriInfo = Mockito.mock(UriInfo.class);\r
-\r
- headersMultiMap = new MultivaluedHashMap<>();\r
- queryParameters = Mockito.spy(new MultivaluedHashMap<>());\r
-\r
- headersMultiMap.add("X-FromAppId", "JUNIT");\r
- headersMultiMap.add("X-TransactionId", UUID.randomUUID().toString());\r
- headersMultiMap.add("Real-Time", "true");\r
- headersMultiMap.add("Accept", "application/json");\r
- headersMultiMap.add("aai-request-context", "");\r
-\r
- outputMediaTypes = new ArrayList<>();\r
- outputMediaTypes.add(APPLICATION_JSON);\r
-\r
- aaiRequestContextList = new ArrayList<>();\r
- aaiRequestContextList.add("");\r
-\r
- when(httpHeaders.getAcceptableMediaTypes()).thenReturn(outputMediaTypes);\r
- when(httpHeaders.getRequestHeaders()).thenReturn(headersMultiMap);\r
-\r
- when(httpHeaders.getRequestHeader("aai-request-context")).thenReturn(aaiRequestContextList);\r
-\r
-\r
- when(uriInfo.getQueryParameters()).thenReturn(queryParameters);\r
- when(uriInfo.getQueryParameters(false)).thenReturn(queryParameters);\r
-\r
- // TODO - Check if this is valid since RemoveDME2QueryParameters seems to be very unreasonable\r
- Mockito.doReturn(null).when(queryParameters).remove(anyObject());\r
-\r
- when(httpHeaders.getMediaType()).thenReturn(APPLICATION_JSON);\r
- }\r
- @Test\r
- public void lookUpUserTest(){\r
- when(uriInfo.getPath()).thenReturn("/user?userID1");\r
- String response = jaxrsUserService.lookupUser("userID1");\r
- assertNotNull(response);\r
-\r
-\r
- }\r
-}\r
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.aai.retiredcustomer;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.onap.aai.ajsc_aai.JaxrsUserService;
+import org.onap.aai.introspection.Version;
+import org.onap.aai.rest.retired.RetiredConsumer;
+
+import javax.ws.rs.core.*;
+import java.util.*;
+
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.Matchers.anyObject;
+import static org.mockito.Mockito.when;
+
+public class JaxrsUserServiceTest {
+
+
+ protected static final MediaType APPLICATION_JSON = MediaType.valueOf("application/json");
+
+ private static final Set<Integer> VALID_HTTP_STATUS_CODES = new HashSet<>();
+
+ static {
+ VALID_HTTP_STATUS_CODES.add(200);
+ VALID_HTTP_STATUS_CODES.add(201);
+ VALID_HTTP_STATUS_CODES.add(204);
+ }
+
+ protected JaxrsUserService jaxrsUserService;
+ protected HttpHeaders httpHeaders;
+ protected UriInfo uriInfo;
+
+ private MultivaluedMap<String, String> headersMultiMap;
+ private MultivaluedMap<String, String> queryParameters;
+
+ private List<String> aaiRequestContextList;
+
+ private List<MediaType> outputMediaTypes;
+
+ private static final EELFLogger logger = EELFManager.getInstance().getLogger(RetiredConsumer.class.getName());
+
+ @Before
+ public void setup(){
+ logger.info("Starting the setup for the integration tests of Rest Endpoints");
+
+ jaxrsUserService = new JaxrsUserService();
+ httpHeaders = Mockito.mock(HttpHeaders.class);
+ uriInfo = Mockito.mock(UriInfo.class);
+
+ headersMultiMap = new MultivaluedHashMap<>();
+ queryParameters = Mockito.spy(new MultivaluedHashMap<>());
+
+ headersMultiMap.add("X-FromAppId", "JUNIT");
+ headersMultiMap.add("X-TransactionId", UUID.randomUUID().toString());
+ headersMultiMap.add("Real-Time", "true");
+ headersMultiMap.add("Accept", "application/json");
+ headersMultiMap.add("aai-request-context", "");
+
+ outputMediaTypes = new ArrayList<>();
+ outputMediaTypes.add(APPLICATION_JSON);
+
+ aaiRequestContextList = new ArrayList<>();
+ aaiRequestContextList.add("");
+
+ when(httpHeaders.getAcceptableMediaTypes()).thenReturn(outputMediaTypes);
+ when(httpHeaders.getRequestHeaders()).thenReturn(headersMultiMap);
+
+ when(httpHeaders.getRequestHeader("aai-request-context")).thenReturn(aaiRequestContextList);
+
+
+ when(uriInfo.getQueryParameters()).thenReturn(queryParameters);
+ when(uriInfo.getQueryParameters(false)).thenReturn(queryParameters);
+
+ // TODO - Check if this is valid since RemoveDME2QueryParameters seems to be very unreasonable
+ Mockito.doReturn(null).when(queryParameters).remove(anyObject());
+
+ when(httpHeaders.getMediaType()).thenReturn(APPLICATION_JSON);
+ }
+ @Test
+ public void lookUpUserTest(){
+ when(uriInfo.getPath()).thenReturn("/user?userID1");
+ String response = jaxrsUserService.lookupUser("userID1");
+ assertNotNull(response);
+
+
+ }
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * org.openecomp.aai\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package org.openecomp.aai.retiredcustomer;\r
-\r
-import com.att.eelf.configuration.EELFLogger;\r
-import com.att.eelf.configuration.EELFManager;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.mockito.Mockito;\r
-import org.openecomp.aai.introspection.Version;\r
-import org.openecomp.aai.rest.retired.RetiredConsumer;\r
-\r
-import javax.ws.rs.core.*;\r
-import java.util.*;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertNotNull;\r
-import static org.mockito.Matchers.anyObject;\r
-import static org.mockito.Mockito.when;\r
-\r
-public abstract class RetiredConsumerTest {\r
-\r
- protected static final MediaType APPLICATION_JSON = MediaType.valueOf("application/json");\r
-\r
- private static final Set<Integer> VALID_HTTP_STATUS_CODES = new HashSet<>();\r
-\r
- static {\r
- VALID_HTTP_STATUS_CODES.add(200);\r
- VALID_HTTP_STATUS_CODES.add(201);\r
- VALID_HTTP_STATUS_CODES.add(204);\r
- }\r
-\r
- protected RetiredConsumer retiredConsumer;\r
- protected HttpHeaders httpHeaders;\r
- protected UriInfo uriInfo;\r
-\r
- private MultivaluedMap<String, String> headersMultiMap;\r
- private MultivaluedMap<String, String> queryParameters;\r
-\r
- private List<String> aaiRequestContextList;\r
-\r
- private List<MediaType> outputMediaTypes;\r
-\r
- private static final EELFLogger logger = EELFManager.getInstance().getLogger(RetiredConsumer.class.getName());\r
-\r
- @Before\r
- public void setup(){\r
- logger.info("Starting the setup for the integration tests of Rest Endpoints");\r
-\r
- retiredConsumer = getRetiredConsumer();\r
- httpHeaders = Mockito.mock(HttpHeaders.class);\r
- uriInfo = Mockito.mock(UriInfo.class);\r
-\r
- headersMultiMap = new MultivaluedHashMap<>();\r
- queryParameters = Mockito.spy(new MultivaluedHashMap<>());\r
-\r
- headersMultiMap.add("X-FromAppId", "JUNIT");\r
- headersMultiMap.add("X-TransactionId", UUID.randomUUID().toString());\r
- headersMultiMap.add("Real-Time", "true");\r
- headersMultiMap.add("Accept", "application/json");\r
- headersMultiMap.add("aai-request-context", "");\r
-\r
- outputMediaTypes = new ArrayList<>();\r
- outputMediaTypes.add(APPLICATION_JSON);\r
-\r
- aaiRequestContextList = new ArrayList<>();\r
- aaiRequestContextList.add("");\r
-\r
- when(httpHeaders.getAcceptableMediaTypes()).thenReturn(outputMediaTypes);\r
- when(httpHeaders.getRequestHeaders()).thenReturn(headersMultiMap);\r
-\r
- when(httpHeaders.getRequestHeader("aai-request-context")).thenReturn(aaiRequestContextList);\r
-\r
-\r
- when(uriInfo.getQueryParameters()).thenReturn(queryParameters);\r
- when(uriInfo.getQueryParameters(false)).thenReturn(queryParameters);\r
-\r
- // TODO - Check if this is valid since RemoveDME2QueryParameters seems to be very unreasonable\r
- Mockito.doReturn(null).when(queryParameters).remove(anyObject());\r
-\r
- when(httpHeaders.getMediaType()).thenReturn(APPLICATION_JSON);\r
- }\r
-\r
- @Test\r
- public void testRetiredForAllEndPoints(){\r
- when(uriInfo.getPath()).thenReturn("/aai/v3/cloud-infrastructure/pservers/pserver/test-pserver1");\r
-\r
- Response response = retiredConsumer.createMessageGet(Version.getLatest().toString(), httpHeaders, uriInfo, null);\r
- assertNotNull(response);\r
- assertEquals(Response.Status.GONE.getStatusCode(), response.getStatus());\r
-\r
- response = retiredConsumer.createMessagePost(Version.getLatest().toString(), httpHeaders, uriInfo, null);\r
- assertNotNull(response);\r
- assertEquals(Response.Status.GONE.getStatusCode(), response.getStatus());\r
-\r
- response = retiredConsumer.createMessagePatch(Version.getLatest().toString(), httpHeaders, uriInfo, null);\r
- assertNotNull(response);\r
- assertEquals(Response.Status.GONE.getStatusCode(), response.getStatus());\r
-\r
- response = retiredConsumer.createMessagePut(Version.getLatest().toString(), httpHeaders, uriInfo, null);\r
- assertNotNull(response);\r
- assertEquals(Response.Status.GONE.getStatusCode(), response.getStatus());\r
-\r
- response = retiredConsumer.createMessageDelete(Version.getLatest().toString(), httpHeaders, uriInfo, null);\r
- assertNotNull(response);\r
- assertEquals(Response.Status.GONE.getStatusCode(), response.getStatus());\r
- }\r
-\r
- public abstract RetiredConsumer getRetiredConsumer();\r
-}\r
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.aai.retiredcustomer;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.onap.aai.introspection.Version;
+import org.onap.aai.rest.retired.RetiredConsumer;
+
+import javax.ws.rs.core.*;
+import java.util.*;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.Matchers.anyObject;
+import static org.mockito.Mockito.when;
+
+public abstract class RetiredConsumerTest {
+
+ protected static final MediaType APPLICATION_JSON = MediaType.valueOf("application/json");
+
+ private static final Set<Integer> VALID_HTTP_STATUS_CODES = new HashSet<>();
+
+ static {
+ VALID_HTTP_STATUS_CODES.add(200);
+ VALID_HTTP_STATUS_CODES.add(201);
+ VALID_HTTP_STATUS_CODES.add(204);
+ }
+
+ protected RetiredConsumer retiredConsumer;
+ protected HttpHeaders httpHeaders;
+ protected UriInfo uriInfo;
+
+ private MultivaluedMap<String, String> headersMultiMap;
+ private MultivaluedMap<String, String> queryParameters;
+
+ private List<String> aaiRequestContextList;
+
+ private List<MediaType> outputMediaTypes;
+
+ private static final EELFLogger logger = EELFManager.getInstance().getLogger(RetiredConsumer.class.getName());
+
+ @Before
+ public void setup(){
+ logger.info("Starting the setup for the integration tests of Rest Endpoints");
+
+ retiredConsumer = getRetiredConsumer();
+ httpHeaders = Mockito.mock(HttpHeaders.class);
+ uriInfo = Mockito.mock(UriInfo.class);
+
+ headersMultiMap = new MultivaluedHashMap<>();
+ queryParameters = Mockito.spy(new MultivaluedHashMap<>());
+
+ headersMultiMap.add("X-FromAppId", "JUNIT");
+ headersMultiMap.add("X-TransactionId", UUID.randomUUID().toString());
+ headersMultiMap.add("Real-Time", "true");
+ headersMultiMap.add("Accept", "application/json");
+ headersMultiMap.add("aai-request-context", "");
+
+ outputMediaTypes = new ArrayList<>();
+ outputMediaTypes.add(APPLICATION_JSON);
+
+ aaiRequestContextList = new ArrayList<>();
+ aaiRequestContextList.add("");
+
+ when(httpHeaders.getAcceptableMediaTypes()).thenReturn(outputMediaTypes);
+ when(httpHeaders.getRequestHeaders()).thenReturn(headersMultiMap);
+
+ when(httpHeaders.getRequestHeader("aai-request-context")).thenReturn(aaiRequestContextList);
+
+
+ when(uriInfo.getQueryParameters()).thenReturn(queryParameters);
+ when(uriInfo.getQueryParameters(false)).thenReturn(queryParameters);
+
+ // TODO - Check if this is valid since RemoveDME2QueryParameters seems to be very unreasonable
+ Mockito.doReturn(null).when(queryParameters).remove(anyObject());
+
+ when(httpHeaders.getMediaType()).thenReturn(APPLICATION_JSON);
+ }
+
+ @Test
+ public void testRetiredForAllEndPoints(){
+ when(uriInfo.getPath()).thenReturn("/aai/v3/cloud-infrastructure/pservers/pserver/test-pserver1");
+
+ Response response = retiredConsumer.createMessageGet(Version.getLatest().toString(), httpHeaders, uriInfo, null);
+ assertNotNull(response);
+ assertEquals(Response.Status.GONE.getStatusCode(), response.getStatus());
+
+ response = retiredConsumer.createMessagePost(Version.getLatest().toString(), httpHeaders, uriInfo, null);
+ assertNotNull(response);
+ assertEquals(Response.Status.GONE.getStatusCode(), response.getStatus());
+
+ response = retiredConsumer.createMessagePatch(Version.getLatest().toString(), httpHeaders, uriInfo, null);
+ assertNotNull(response);
+ assertEquals(Response.Status.GONE.getStatusCode(), response.getStatus());
+
+ response = retiredConsumer.createMessagePut(Version.getLatest().toString(), httpHeaders, uriInfo, null);
+ assertNotNull(response);
+ assertEquals(Response.Status.GONE.getStatusCode(), response.getStatus());
+
+ response = retiredConsumer.createMessageDelete(Version.getLatest().toString(), httpHeaders, uriInfo, null);
+ assertNotNull(response);
+ assertEquals(Response.Status.GONE.getStatusCode(), response.getStatus());
+ }
+
+ public abstract RetiredConsumer getRetiredConsumer();
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * org.openecomp.aai\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package org.openecomp.aai.retiredcustomer;\r
-\r
-import org.openecomp.aai.rest.retired.RetiredConsumer;\r
-import org.openecomp.aai.rest.retired.V3ThroughV7Consumer;\r
-\r
-\r
-public class V3ThroughV7ConsumerTest extends RetiredConsumerTest {\r
-\r
- @Override\r
- public RetiredConsumer getRetiredConsumer() {\r
- return new V3ThroughV7Consumer();\r
- }\r
-}\r
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.aai.retiredcustomer;
+
+import org.onap.aai.rest.retired.RetiredConsumer;
+import org.onap.aai.rest.retired.V3ThroughV7Consumer;
+
+
+public class V3ThroughV7ConsumerTest extends RetiredConsumerTest {
+
+ @Override
+ public RetiredConsumer getRetiredConsumer() {
+ return new V3ThroughV7Consumer();
+ }
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * org.openecomp.aai\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-\r
-package org.openecomp.aai.retiredcustomer;\r
-\r
-import org.openecomp.aai.rest.retired.RetiredConsumer;\r
-import org.openecomp.aai.rest.retired.V7V8NamedQueries;\r
-\r
-public class V7V8NamedQueriesTest extends RetiredConsumerTest {\r
-\r
- @Override\r
- public RetiredConsumer getRetiredConsumer() {\r
- return new V7V8NamedQueries();\r
- }\r
-}\r
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+
+package org.onap.aai.retiredcustomer;
+
+import org.onap.aai.rest.retired.RetiredConsumer;
+import org.onap.aai.rest.retired.V7V8NamedQueries;
+
+public class V7V8NamedQueriesTest extends RetiredConsumerTest {
+
+ @Override
+ public RetiredConsumer getRetiredConsumer() {
+ return new V7V8NamedQueries();
+ }
+}
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.transforms;
+package org.onap.aai.transforms;
import java.io.IOException;
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-
-package org.openecomp.aai.transforms;
+package org.onap.aai.transforms;
import org.junit.Test;
import org.junit.runner.RunWith;
-/*-
+/**
* ============LICENSE_START=======================================================
- * org.openecomp.aai
+ * org.onap.aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 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
- *
+ *
+ * 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
+package org.onap.aai.transforms;
-package org.openecomp.aai.transforms;
-
-import org.openecomp.aai.transforms.LowerCamelToLowerHyphenConverter;
-import org.openecomp.aai.transforms.MapTraverser;
+import org.onap.aai.transforms.LowerCamelToLowerHyphenConverter;
+import org.onap.aai.transforms.MapTraverser;
import com.bazaarvoice.jolt.JsonUtils;
import org.junit.Test;
-/*-\r
- * ============LICENSE_START=======================================================\r
- * org.openecomp.aai\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package org.openecomp.aai.util;\r
-\r
-import ch.qos.logback.classic.Level;\r
-import ch.qos.logback.classic.Logger;\r
-import ch.qos.logback.classic.PatternLayout;\r
-import ch.qos.logback.classic.spi.ILoggingEvent;\r
-import ch.qos.logback.core.AppenderBase;\r
-import org.apache.commons.lang.ObjectUtils;\r
-import org.junit.Before;\r
-import org.junit.Ignore;\r
-import org.junit.Rule;\r
-import org.junit.Test;\r
-import org.openecomp.aai.dbmap.AAIGraph;\r
-import org.openecomp.aai.logging.ErrorLogHelper;\r
-import org.powermock.api.mockito.PowerMockito;\r
-import org.powermock.core.classloader.annotations.PrepareForTest;\r
-import org.powermock.modules.agent.PowerMockAgent;\r
-import org.powermock.modules.junit4.rule.PowerMockRule;\r
-import org.slf4j.LoggerFactory;\r
-\r
-import javax.servlet.ServletContextEvent;\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import static org.junit.Assert.assertFalse;\r
-import static org.junit.Assert.assertTrue;\r
-\r
-@PrepareForTest({AAIGraph.class, AAIConfig.class, ErrorLogHelper.class})\r
-public class AAIAppServletContextListenerTest {\r
- \r
- @Rule\r
- public PowerMockRule rule = new PowerMockRule();\r
- \r
- static {\r
- PowerMockAgent.initializeIfNeeded();\r
- }\r
- \r
- private ServletContextEvent arg; \r
- private AAIAppServletContextListener listener;\r
- \r
- /**\r
- * Initialize.\r
- */\r
- @Before\r
- @PrepareForTest({AAIGraph.class, AAIConfig.class, ErrorLogHelper.class})\r
- public void initialize(){\r
- arg = PowerMockito.mock(ServletContextEvent.class);\r
- PowerMockito.mockStatic(AAIGraph.class);\r
- PowerMockito.mockStatic(AAIConfig.class);\r
- PowerMockito.mockStatic(ErrorLogHelper.class);\r
- \r
- listener = new AAIAppServletContextListener();\r
- configureLog();\r
- }\r
- \r
- /**\r
- * Test contextDestroyed.\r
- */\r
- @Test(expected = NullPointerException.class)\r
- //@Ignore\r
- public void testContextDestroyed(){\r
- listener.contextDestroyed(arg);\r
- assertTrue(logContains(Level.DEBUG, "AAI Server shutdown"));\r
- assertTrue(logContains(Level.INFO, "AAI graph shutdown"));\r
- }\r
- \r
- /**\r
- * Test contextInitialized.\r
- */\r
- @Test\r
- //@Ignore\r
- public void testContextInitialized(){\r
- listener.contextInitialized(arg);\r
- assertFalse(logContains(Level.DEBUG, "Loading aaiconfig.properties"));\r
- assertFalse(logContains(Level.DEBUG, "Loading error.properties"));\r
- assertFalse(logContains(Level.DEBUG, "Loading graph database"));\r
- assertFalse(logContains(Level.INFO, "AAI Server initialization"));\r
- }\r
- \r
- \r
- /**\r
- * Helper method to check if a String appears in the desired log level.\r
- *\r
- * @param level Log level to use\r
- * @param expected String to search for\r
- * @return True if search String is found, false otherwise\r
- */\r
- private boolean logContains(Level level, String expected) {\r
- String actual[] = RecordingAppender.messages();\r
- for (String log : actual) {\r
- if (log.contains(level.toString()) && log.contains(expected))\r
- return true;\r
- }\r
- return false;\r
- }\r
-\r
- /**\r
- * Set logging level, and initialize log-appender.\r
- */\r
- private void configureLog() {\r
- org.slf4j.Logger rootLogger = LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);\r
- rootLogger.debug("debug");\r
- // rootLogger.();\r
- // rootLogger.addAppender(RecordingAppender.appender(new PatternLayout()));\r
- }\r
-\r
-}\r
-\r
-\r
-/**\r
- * Appender class that appends log messages to a String List when some logging event occurs\r
- */\r
-class RecordingAppender extends AppenderBase<ILoggingEvent> {\r
- private static List<String> messages = new ArrayList<String>();\r
- private static RecordingAppender appender = new RecordingAppender();\r
- private PatternLayout patternLayout;\r
-\r
- private RecordingAppender() {\r
- super();\r
- }\r
-\r
- /**\r
- * @param patternLayout Pattern to format log message\r
- * @return Current appender \r
- */\r
- public static RecordingAppender appender(PatternLayout patternLayout) {\r
- appender.patternLayout = patternLayout;\r
- appender.clear();\r
- return appender;\r
- }\r
-\r
- @Override\r
- protected void append(ILoggingEvent event) {\r
- messages.add(patternLayout.doLayout(event));\r
- }\r
-\r
- public void close() {}\r
-\r
- public boolean requiresLayout() {\r
- return false;\r
- }\r
-\r
- /**\r
- * @return Return logs as a String array\r
- */\r
- public static String[] messages() {\r
- return (String[]) messages.toArray(new String[messages.size()]);\r
- }\r
-\r
- /**\r
- * Clear the message container\r
- */\r
- private void clear() {\r
- messages.clear();\r
- }\r
- \r
-}\r
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 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=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.aai.util;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.PatternLayout;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import ch.qos.logback.core.AppenderBase;
+import org.apache.commons.lang.ObjectUtils;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+import org.onap.aai.dbmap.AAIGraph;
+import org.onap.aai.logging.ErrorLogHelper;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.agent.PowerMockAgent;
+import org.powermock.modules.junit4.rule.PowerMockRule;
+import org.slf4j.LoggerFactory;
+
+import javax.servlet.ServletContextEvent;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+@PrepareForTest({AAIGraph.class, AAIConfig.class, ErrorLogHelper.class})
+public class AAIAppServletContextListenerTest {
+
+ @Rule
+ public PowerMockRule rule = new PowerMockRule();
+
+ static {
+ PowerMockAgent.initializeIfNeeded();
+ }
+
+ private ServletContextEvent arg;
+ private AAIAppServletContextListener listener;
+
+ /**
+ * Initialize.
+ */
+ @Before
+ @PrepareForTest({AAIGraph.class, AAIConfig.class, ErrorLogHelper.class})
+ public void initialize(){
+ arg = PowerMockito.mock(ServletContextEvent.class);
+ PowerMockito.mockStatic(AAIGraph.class);
+ PowerMockito.mockStatic(AAIConfig.class);
+ PowerMockito.mockStatic(ErrorLogHelper.class);
+
+ listener = new AAIAppServletContextListener();
+ configureLog();
+ }
+
+ /**
+ * Test contextDestroyed.
+ */
+ @Test(expected = NullPointerException.class)
+ //@Ignore
+ public void testContextDestroyed(){
+ listener.contextDestroyed(arg);
+ assertTrue(logContains(Level.DEBUG, "AAI Server shutdown"));
+ assertTrue(logContains(Level.INFO, "AAI graph shutdown"));
+ }
+
+ /**
+ * Test contextInitialized.
+ */
+ @Test
+ //@Ignore
+ public void testContextInitialized(){
+ listener.contextInitialized(arg);
+ assertFalse(logContains(Level.DEBUG, "Loading aaiconfig.properties"));
+ assertFalse(logContains(Level.DEBUG, "Loading error.properties"));
+ assertFalse(logContains(Level.DEBUG, "Loading graph database"));
+ assertFalse(logContains(Level.INFO, "AAI Server initialization"));
+ }
+
+
+ /**
+ * Helper method to check if a String appears in the desired log level.
+ *
+ * @param level Log level to use
+ * @param expected String to search for
+ * @return True if search String is found, false otherwise
+ */
+ private boolean logContains(Level level, String expected) {
+ String actual[] = RecordingAppender.messages();
+ for (String log : actual) {
+ if (log.contains(level.toString()) && log.contains(expected))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Set logging level, and initialize log-appender.
+ */
+ private void configureLog() {
+ org.slf4j.Logger rootLogger = LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
+ rootLogger.debug("debug");
+ // rootLogger.();
+ // rootLogger.addAppender(RecordingAppender.appender(new PatternLayout()));
+ }
+
+}
+
+
+/**
+ * Appender class that appends log messages to a String List when some logging event occurs
+ */
+class RecordingAppender extends AppenderBase<ILoggingEvent> {
+ private static List<String> messages = new ArrayList<String>();
+ private static RecordingAppender appender = new RecordingAppender();
+ private PatternLayout patternLayout;
+
+ private RecordingAppender() {
+ super();
+ }
+
+ /**
+ * @param patternLayout Pattern to format log message
+ * @return Current appender
+ */
+ public static RecordingAppender appender(PatternLayout patternLayout) {
+ appender.patternLayout = patternLayout;
+ appender.clear();
+ return appender;
+ }
+
+ @Override
+ protected void append(ILoggingEvent event) {
+ messages.add(patternLayout.doLayout(event));
+ }
+
+ public void close() {}
+
+ public boolean requiresLayout() {
+ return false;
+ }
+
+ /**
+ * @return Return logs as a String array
+ */
+ public static String[] messages() {
+ return (String[]) messages.toArray(new String[messages.size()]);
+ }
+
+ /**
+ * Clear the message container
+ */
+ private void clear() {
+ messages.clear();
+ }
+
+}
-###
+#
# ============LICENSE_START=======================================================
-# org.openecomp.aai
+# org.onap.aai
# ================================================================================
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 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
-#
+#
+# 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=========================================================
-###
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
####################################################################
# REMEMBER TO THINK ABOUT ENVIRONMENTAL DIFFERENCES AND CHANGE THE
-###
+#
# ============LICENSE_START=======================================================
-# org.openecomp.aai
+# org.onap.aai
# ================================================================================
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 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
-#
+#
+# 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=========================================================
-###
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
query.fast-property=true
# the following parameters are not reloaded automatically and require a manual bounce
-###
+#
# ============LICENSE_START=======================================================
-# org.openecomp.aai
+# org.onap.aai
# ================================================================================
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 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
-#
+#
+# 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=========================================================
-###
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
query.fast-property=true
# the following parameters are not reloaded automatically and require a manual bounce
-###
+#
# ============LICENSE_START=======================================================
-# org.openecomp.aai
+# org.onap.aai
# ================================================================================
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 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
-#
+#
+# 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=========================================================
-###
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
storage.backend=inmemory
<!--
- ============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=========================================================
- -->
+ ============LICENSE_START=======================================================
+ org.onap.aai
+ ================================================================================
+ Copyright © 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=========================================================
+
+ ECOMP is a trademark and service mark of AT&T Intellectual Property.
+
+-->
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<contextName>${module.ajsc.namespace.name}</contextName>
<jmxConfigurator />
</logger>
-->
- <logger name="org.openecomp.aai" level="INFO" />
+ <logger name="org.onap.aai" level="INFO" />
<!--
- <logger name="org.openecomp.aai.util" level="WARN" />
- <logger name="org.openecomp.aai.rest" level="WARN" />
- <logger name="org.openecomp.aai.rest.Business" level="WARN" />
+ <logger name="org.onap.aai.util" level="WARN" />
+ <logger name="org.onap.aai.rest" level="WARN" />
+ <logger name="org.onap.aai.rest.Business" level="WARN" />
-->
<logger name="org.apache" level="WARN" />
-###
+#
# ============LICENSE_START=======================================================
-# org.openecomp.aai
+# org.onap.aai
# ================================================================================
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 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
-#
+#
+# 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=========================================================
-###
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
####################################################################
# REMEMBER TO THINK ABOUT ENVIRONMENTAL DIFFERENCES AND CHANGE THE
<!-- For SOA Cloud Installation -->
<installOwnerUser>aaiadmin</installOwnerUser>
<installOwnerGroup>aaiadmin</installOwnerGroup>
- <ownerManagementGroup>org.openecomp.aai.dev</ownerManagementGroup>
+ <ownerManagementGroup>org.onap.aai.dev</ownerManagementGroup>
<!-- Port Selection. A value of 0 will allow for dynamic port selection.
For local testing, you may choose to hardcode this value to something like