diff options
author | Patrick Brady <patrick.brady@att.com> | 2019-02-22 13:37:19 -0800 |
---|---|---|
committer | Patrick Brady <patrick.brady@att.com> | 2019-02-25 22:33:05 +0000 |
commit | 13c0353d0f637ec88ca4cdbeb64c4de3917e6a2b (patch) | |
tree | a9d1561322f2f66556aa7c8a6e3ddae592a23d08 /appc-inbound/appc-artifact-handler | |
parent | 356dba9fb407b1df3fe89a4c8f082a09aa564d36 (diff) |
Changes for new odl version
Changes required to update to latest opendaylight
version. Some powermock tests have been temporarily
removed due to an powermock incompatibility. They
will be fixed and re-added.
Change-Id: I418d44913fcd42423d2d9bd37b189f6301eaab81
Signed-off-by: Patrick Brady <patrick.brady@att.com>
Issue-ID: APPC-1370
Diffstat (limited to 'appc-inbound/appc-artifact-handler')
12 files changed, 68 insertions, 357 deletions
diff --git a/appc-inbound/appc-artifact-handler/features/onap-appc-artifact-handler/pom.xml b/appc-inbound/appc-artifact-handler/features/onap-appc-artifact-handler/pom.xml index 1fd78b0c7..07337e89b 100644 --- a/appc-inbound/appc-artifact-handler/features/onap-appc-artifact-handler/pom.xml +++ b/appc-inbound/appc-artifact-handler/features/onap-appc-artifact-handler/pom.xml @@ -3,7 +3,7 @@ ============LICENSE_START======================================================= ONAP : APPC ================================================================================ -Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. +Copyright (C) 2018-2019 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. diff --git a/appc-inbound/appc-artifact-handler/features/src/main/resources/features.xml b/appc-inbound/appc-artifact-handler/features/src/main/resources/features.xml deleted file mode 100644 index 3909d1c4b..000000000 --- a/appc-inbound/appc-artifact-handler/features/src/main/resources/features.xml +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ============LICENSE_START======================================================= - ONAP : APPC - ================================================================================ - Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. - ================================================================================ - Copyright (C) 2017 Amdocs - ============================================================================= - 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========================================================= - --> - - -<features name="app-cntrl-artifact-handler-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0"> - - - <!--<repository>mvn:org.opendaylight.mdsal/features-mdsal/${odl.mdsal.features.version}/xml/features</repository>--> - - <feature name='appc-artifact-handler' description="Application Controller Artifact Handler" - version='${project.version}'> - <!-- Most applications will have a dependency on the ODL MD-SAL Broker --> - <feature >odl-mdsal-broker</feature> - <feature>ccsdk-sli</feature> - <!-- <bundle>wrap:mvn:org.onap.appc/appc-yang-generator/${project.version}</bundle> --> - <bundle>wrap:mvn:org.openecomp.sdc.common/openecomp-tosca-datatype/${tosca.datatype.version}</bundle> - <bundle>mvn:org.onap.appc/appc-config-params-provider/${project.version}</bundle> - <bundle>mvn:org.onap.appc/appc-artifact-handler-model/${project.version}</bundle> - <bundle>mvn:org.onap.appc/appc-artifact-handler-provider/${project.version}</bundle> - <bundle>wrap:mvn:org.onap.appc/appc-yang-generator/${project.version}</bundle> - <configfile finalname="etc/opendaylight/karaf/200-artifact-handler-provider.xml">mvn:org.onap.appc/appc-artifact-handler-provider/${project.version}/xml/config</configfile> - </feature> - -</features> diff --git a/appc-inbound/appc-artifact-handler/installer/pom.xml b/appc-inbound/appc-artifact-handler/installer/pom.xml index 8f5f0b728..e6b4babf8 100755 --- a/appc-inbound/appc-artifact-handler/installer/pom.xml +++ b/appc-inbound/appc-artifact-handler/installer/pom.xml @@ -3,7 +3,7 @@ ============LICENSE_START======================================================= ONAP : APPC ================================================================================ - Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. Copyright (C) 2017 Amdocs ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); @@ -45,8 +45,8 @@ <dependency> <groupId>org.onap.appc</groupId> <artifactId>onap-appc-artifact-handler</artifactId> - <classifier>features</classifier> <version>${project.version}</version> + <classifier>features</classifier> <type>xml</type> <exclusions> <exclusion> @@ -60,7 +60,6 @@ <artifactId>appc-artifact-handler-provider</artifactId> <version>${project.version}</version> </dependency> - </dependencies> diff --git a/appc-inbound/appc-artifact-handler/model/pom.xml b/appc-inbound/appc-artifact-handler/model/pom.xml index 2fef74457..48f058096 100755 --- a/appc-inbound/appc-artifact-handler/model/pom.xml +++ b/appc-inbound/appc-artifact-handler/model/pom.xml @@ -30,8 +30,8 @@ </parent> <groupId>org.onap.appc</groupId> <artifactId>appc-artifact-handler-model</artifactId> - <name>APPC Artifact Handler - Model</name> <packaging>bundle</packaging> + <name>APPC Artifact Handler - Model</name> <build> @@ -42,7 +42,7 @@ <extensions>true</extensions> <configuration> <instructions> - <Import-Package>!com.google.common.collect,*</Import-Package> + <Import-Package>com.google.common.collect,com.google.common.base,*</Import-Package> <Embed-Dependency>guava</Embed-Dependency> </instructions> </configuration> @@ -76,6 +76,7 @@ </execution> </executions> </plugin> + <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-install-plugin</artifactId> @@ -110,15 +111,11 @@ </dependency> <dependency> <groupId>org.opendaylight.mdsal.model</groupId> - <artifactId>ietf-inet-types</artifactId> + <artifactId>ietf-inet-types-2013-07-15</artifactId> </dependency> <dependency> <groupId>org.opendaylight.mdsal.model</groupId> - <artifactId>ietf-yang-types</artifactId> - </dependency> - <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> + <artifactId>ietf-yang-types-20130715</artifactId> </dependency> </dependencies> <version>1.5.0-SNAPSHOT</version> diff --git a/appc-inbound/appc-artifact-handler/model/src/main/yang/artifact-handler.yang b/appc-inbound/appc-artifact-handler/model/src/main/yang/artifact-handler.yang index f9bf7ae10..0aa8082d4 100644 --- a/appc-inbound/appc-artifact-handler/model/src/main/yang/artifact-handler.yang +++ b/appc-inbound/appc-artifact-handler/model/src/main/yang/artifact-handler.yang @@ -28,7 +28,6 @@ module artifact-handler { namespace "org.onap.appc:artifacthandler"; prefix artifacthandler; - import ietf-inet-types { prefix "ietf"; revision-date "2010-09-24"; } organization "AT&T, Inc."; description diff --git a/appc-inbound/appc-artifact-handler/pom.xml b/appc-inbound/appc-artifact-handler/pom.xml index 2a9f7f2af..5c642df5c 100755 --- a/appc-inbound/appc-artifact-handler/pom.xml +++ b/appc-inbound/appc-artifact-handler/pom.xml @@ -1,72 +1,44 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ============LICENSE_START=======================================================
- ONAP : APPC
- ================================================================================
- Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
- Copyright (C) 2017 Amdocs
- ================================================================================
- 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=========================================================
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <parent>
- <groupId>org.onap.appc.parent</groupId>
- <artifactId>odlparent-lite</artifactId>
- <version>1.5.0-SNAPSHOT</version>
- <relativePath />
- </parent>
- <groupId>org.onap.appc</groupId>
- <modelVersion>4.0.0</modelVersion>
- <packaging>pom</packaging>
- <artifactId>appc-artifact-handler</artifactId>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.onap.appc</groupId>
- <artifactId>appc-artifact-handler-features</artifactId>
- <classifier>features</classifier>
- <type>xml</type>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.appc</groupId>
- <artifactId>appc-artifact-handler-model</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.appc</groupId>
- <artifactId>appc-artifact-handler-provider</artifactId>
- <version>${project.version}</version>
- <classifier>config</classifier>
- <type>xml</type>
- </dependency>
- <dependency>
- <groupId>org.onap.appc</groupId>
- <artifactId>appc-artifact-handler-provider</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <modules>
- <module>model</module>
- <module>provider</module>
- <module>features</module>
- <module>installer</module>
- </modules>
- <version>1.5.0-SNAPSHOT</version>
-</project>
+<?xml version="1.0" encoding="UTF-8"?> +<!-- + ============LICENSE_START======================================================= + ONAP : APPC + ================================================================================ + Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. + Copyright (C) 2017 Amdocs + ================================================================================ + 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========================================================= + --> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.appc.parent</groupId> + <artifactId>odlparent-lite</artifactId> + <version>1.5.0-SNAPSHOT</version> + <relativePath /> + </parent> + + <packaging>pom</packaging> + <groupId>org.onap.appc</groupId> + <artifactId>appc-artifact-handler</artifactId> + + <modules> + <module>model</module> + <module>features</module> + <module>provider</module> + <module>installer</module> + </modules> + + <version>1.5.0-SNAPSHOT</version> +</project> diff --git a/appc-inbound/appc-artifact-handler/provider/pom.xml b/appc-inbound/appc-artifact-handler/provider/pom.xml index 4b0fe415b..8c465cc1c 100755 --- a/appc-inbound/appc-artifact-handler/provider/pom.xml +++ b/appc-inbound/appc-artifact-handler/provider/pom.xml @@ -3,7 +3,7 @@ ============LICENSE_START======================================================= ONAP : APPC ================================================================================ -Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. +Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. ================================================================================ Copyright (C) 2017 Amdocs ============================================================================= @@ -43,9 +43,8 @@ limitations under the License. <configuration> <instructions> <Bundle-SymbolicName>org.onap.appc.artifact.handler</Bundle-SymbolicName> - <Bundle-Activator>org.onap.appc.artifact.handler.SdcArtifactHandlerActivator</Bundle-Activator> <Export-Package>org.onap.appc.artifact.handler,org.opendaylight.controller.config.yang.config.artifact-handler_provider.impl</Export-Package> - <Import-Package>!com.google,!org.apache.commons.configuration,*;resolution:=optional</Import-Package> + <Import-Package>com.google.common.base,com.google.common.collect,!com.google,!org.apache.commons.configuration,*;resolution:=optional</Import-Package> <Embed-Dependency>commons-configuration,guava,jackson-databind,jackson-annotations,jackson-core,jackson-dataformat-yaml,json</Embed-Dependency> </instructions> </configuration> @@ -68,11 +67,6 @@ limitations under the License. <artifactId>appc-yang-generator</artifactId> <version>${project.version}</version> </dependency> - - <dependency> - <groupId>org.opendaylight.controller</groupId> - <artifactId>sal-binding-config</artifactId> - </dependency> <dependency> <groupId>org.opendaylight.controller</groupId> <artifactId>sal-binding-api</artifactId> @@ -109,19 +103,6 @@ limitations under the License. <scope>test</scope> </dependency> <dependency> - <groupId>org.opendaylight.controller</groupId> - <artifactId>sal-binding-broker-impl</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.opendaylight.controller</groupId> - <artifactId>sal-binding-broker-impl</artifactId> - <version>${odl.mdsal.version}</version> - <classifier>tests</classifier> - <type>test-jar</type> - <scope>test</scope> - </dependency> - <dependency> <groupId>com.att.eelf</groupId> <artifactId>eelf-core</artifactId> </dependency> diff --git a/appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/ArtifactHandlerProvider.java b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/ArtifactHandlerProvider.java index 3246ef1ff..065bdd69a 100644 --- a/appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/ArtifactHandlerProvider.java +++ b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/ArtifactHandlerProvider.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP : APPC * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Copyright (C) 2017 Amdocs * ================================================================================ @@ -25,20 +25,10 @@ package org.onap.appc.artifact.handler; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; - +import org.onap.appc.artifact.handler.utils.ArtifactHandlerProviderUtil; +import org.onap.appc.artifact.handler.utils.SdcArtifactHandlerConstants; import org.opendaylight.controller.md.sal.binding.api.DataBroker; -import org.opendaylight.controller.md.sal.binding.api.DataChangeListener; import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService; -import org.opendaylight.controller.md.sal.binding.api.WriteTransaction; -import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; -import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; -import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException; -import org.opendaylight.controller.sal.binding.api.BindingAwareBroker; -import org.opendaylight.controller.sal.binding.api.NotificationProviderService; import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; import org.opendaylight.yang.gen.v1.org.onap.appc.artifacthandler.rev170321.ArtifactHandlerService; import org.opendaylight.yang.gen.v1.org.onap.appc.artifacthandler.rev170321.UploadartifactInput; @@ -46,101 +36,40 @@ import org.opendaylight.yang.gen.v1.org.onap.appc.artifacthandler.rev170321.Uplo import org.opendaylight.yang.gen.v1.org.onap.appc.artifacthandler.rev170321.UploadartifactOutput; import org.opendaylight.yang.gen.v1.org.onap.appc.artifacthandler.rev170321.UploadartifactOutputBuilder; import org.opendaylight.yang.gen.v1.org.onap.appc.artifacthandler.rev170321.uploadartifact.output.ConfigDocumentResponseBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.Services; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServicesBuilder; -import org.opendaylight.yangtools.concepts.ListenerRegistration; -import org.opendaylight.yangtools.yang.binding.DataObject; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.common.RpcResult; import org.opendaylight.yangtools.yang.common.RpcResultBuilder; -import org.onap.appc.artifact.handler.utils.ArtifactHandlerProviderUtil; -import org.onap.appc.artifact.handler.utils.SdcArtifactHandlerConstants; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; -import com.google.common.util.concurrent.CheckedFuture; import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; - - -public class ArtifactHandlerProvider implements AutoCloseable, ArtifactHandlerService, DataChangeListener { +public class ArtifactHandlerProvider implements AutoCloseable, ArtifactHandlerService { private static final EELFLogger log = EELFManager.getInstance().getLogger(ArtifactHandlerProvider.class); private final String appName = "ArtifactsHandler"; - private final ExecutorService executor; protected DataBroker dataBroker; protected NotificationPublishService notificationService; protected RpcProviderRegistry rpcRegistry; - private ListenerRegistration<DataChangeListener> dclServices; - - protected BindingAwareBroker.RpcRegistration<ArtifactHandlerService> rpcRegistration; - public ArtifactHandlerProvider(DataBroker dataBroker2, - NotificationPublishService notificationProviderService, + public ArtifactHandlerProvider(DataBroker dataBroker2, NotificationPublishService notificationProviderService, RpcProviderRegistry rpcProviderRegistry) { this.log.info("Creating provider for " + appName); - executor = Executors.newFixedThreadPool(10); dataBroker = dataBroker2; notificationService = notificationProviderService; rpcRegistry = rpcProviderRegistry; initialize(); - } public void initialize() { log.info("Initializing provider for " + appName); - // Create the top level containers - createContainers(); try { ArtifactHandlerProviderUtil.loadProperties(); } catch (Exception e) { log.error("Caught exception while trying to load properties file", e); } - // Listener for changes to Services tree - log.info("Initialization complete for " + appName); } - private void createContainers() { - final WriteTransaction t = dataBroker.newReadWriteTransaction(); - // Create the Services container - t.merge(LogicalDatastoreType.CONFIGURATION,InstanceIdentifier.create(Services.class),new ServicesBuilder().build()); - t.merge(LogicalDatastoreType.OPERATIONAL,InstanceIdentifier.create(Services.class),new ServicesBuilder().build()); - - try { - CheckedFuture<Void, TransactionCommitFailedException> checkedFuture = t.submit(); - checkedFuture.get(); - log.info("Create containers succeeded!"); - - } catch (InterruptedException e) { - log.error("Create containers failed", e); - Thread.currentThread().interrupt(); - } catch (ExecutionException e) { - log.error("Create containers failed", e); - } - } - - - @Override - public void onDataChanged(AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> arg0) { - // TODO Auto-generated method stub - - } - - - - @Override - public void close() throws Exception { - - log.info("Closing provider for " + appName); - if(this.executor != null){ - executor.shutdown(); - } - if(this.rpcRegistration != null){ - rpcRegistration.close(); - } - log.info("Successfully closed provider for " + appName); - - } private RpcResult<UploadartifactOutput> buildResponse1( String svcRequestId, @@ -158,9 +87,8 @@ public class ArtifactHandlerProvider implements AutoCloseable, ArtifactHandlerSe .withResult(responseBuilder.build()).build(); return rpcResult; } - @Override - public Future<RpcResult<UploadartifactOutput>> uploadartifact(UploadartifactInput input) { + public ListenableFuture<RpcResult<UploadartifactOutput>> uploadartifact(UploadartifactInput input) { if (input == null || input.getDocumentParameters() == null || input.getDocumentParameters().getArtifactContents() == null ) { RpcResult<UploadartifactOutput> rpcResult = @@ -201,7 +129,12 @@ public class ArtifactHandlerProvider implements AutoCloseable, ArtifactHandlerSe responseBuilder.setConfigDocumentResponse(configResponseBuilder.build()); RpcResult<UploadartifactOutput> rpcResult = RpcResultBuilder.<UploadartifactOutput> status(true).withResult(responseBuilder.build()).build(); return Futures.immediateFuture(rpcResult); + } + @Override + public void close() throws Exception { + log.info("Closing provider for " + appName); + log.info("Successfully closed provider for " + appName); } protected ArtifactHandlerProviderUtil getArtifactHandlerProviderUtil(UploadartifactInput input) { diff --git a/appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/SdcArtifactHandlerActivator.java b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/SdcArtifactHandlerActivator.java deleted file mode 100644 index 58f4a12ed..000000000 --- a/appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/SdcArtifactHandlerActivator.java +++ /dev/null @@ -1,59 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP : APPC - * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Copyright (C) 2017 Amdocs - * ================================================================================ - * Modifications Copyright (C) 2019 Ericsson - * ============================================================================= - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ============LICENSE_END========================================================= - */ - -package org.onap.appc.artifact.handler; - -import java.util.LinkedList; -import java.util.List; - -import org.onap.appc.artifact.handler.node.ArtifactHandlerNode; -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceRegistration; - -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; - -public class SdcArtifactHandlerActivator implements BundleActivator { - - private static final EELFLogger log = EELFManager.getInstance().getLogger(SdcArtifactHandlerActivator.class); - private List<ServiceRegistration> registrations = new LinkedList<ServiceRegistration>(); - - @Override - public void start(BundleContext ctx) throws Exception { - ArtifactHandlerNode artifactHandlerNode = new ArtifactHandlerNode(); - log.info("Registering service-- " + artifactHandlerNode.getClass().getName()); - registrations.add(ctx.registerService(artifactHandlerNode.getClass().getName(), artifactHandlerNode, null)); - - } - - @Override - public void stop(BundleContext arg0) throws Exception { - for (ServiceRegistration registration : registrations) { - registration.unregister(); - registration = null; - } - } -} diff --git a/appc-inbound/appc-artifact-handler/provider/src/main/resources/org/opendaylight/blueprint/artifact-handler-blueprint.xml b/appc-inbound/appc-artifact-handler/provider/src/main/resources/org/opendaylight/blueprint/artifact-handler.xml index d74724ce7..8185e6c5b 100644 --- a/appc-inbound/appc-artifact-handler/provider/src/main/resources/org/opendaylight/blueprint/artifact-handler-blueprint.xml +++ b/appc-inbound/appc-artifact-handler/provider/src/main/resources/org/opendaylight/blueprint/artifact-handler.xml @@ -3,7 +3,7 @@ ============LICENSE_START======================================================= ONAP : APPC ================================================================================ - Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + Copyright (C) 2018-2019 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. @@ -22,8 +22,6 @@ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0" odl:use-default-for-reference-types="true"> - - <reference id="dataBroker" interface="org.opendaylight.controller.md.sal.binding.api.DataBroker" odl:type="default" /> @@ -44,4 +42,4 @@ <odl:rpc-implementation ref="artifact-handler"/> -</blueprint>
\ No newline at end of file +</blueprint> diff --git a/appc-inbound/appc-artifact-handler/provider/src/test/java/org/onap/appc/artifact/handler/ArtifactHandlerProviderTest.java b/appc-inbound/appc-artifact-handler/provider/src/test/java/org/onap/appc/artifact/handler/ArtifactHandlerProviderTest.java index 56a999126..aa1c86ad2 100644 --- a/appc-inbound/appc-artifact-handler/provider/src/test/java/org/onap/appc/artifact/handler/ArtifactHandlerProviderTest.java +++ b/appc-inbound/appc-artifact-handler/provider/src/test/java/org/onap/appc/artifact/handler/ArtifactHandlerProviderTest.java @@ -65,13 +65,6 @@ public class ArtifactHandlerProviderTest { Mockito.doReturn(checkedFuture).when(writeTransaction).submit(); } - @Test - public void testClose() throws Exception { - artifactHandlerProvider = new ArtifactHandlerProvider(dataBroker, notificationService, rpcRegistry); - Whitebox.setInternalState(artifactHandlerProvider, "rpcRegistration", rpcRegistration); - artifactHandlerProvider.close(); - Mockito.verify(rpcRegistration).close(); - } @Test public void testUploadArtifactNullInput() throws InterruptedException, ExecutionException { diff --git a/appc-inbound/appc-artifact-handler/provider/src/test/java/org/onap/appc/artifact/handler/SdcArtifactHandlerActivatorTest.java b/appc-inbound/appc-artifact-handler/provider/src/test/java/org/onap/appc/artifact/handler/SdcArtifactHandlerActivatorTest.java deleted file mode 100644 index 995ffecc6..000000000 --- a/appc-inbound/appc-artifact-handler/provider/src/test/java/org/onap/appc/artifact/handler/SdcArtifactHandlerActivatorTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP : APPC - * ================================================================================ - * Copyright (C) 2019 Ericsson - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ============LICENSE_END========================================================= - */ - -package org.onap.appc.artifact.handler; - -import java.util.LinkedList; -import org.junit.Test; -import org.mockito.Mockito; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceRegistration; -import org.powermock.reflect.Whitebox; - - -public class SdcArtifactHandlerActivatorTest { - - @Test - public void testStart() throws Exception { - SdcArtifactHandlerActivator activator = new SdcArtifactHandlerActivator(); - BundleContext ctx = Mockito.mock(BundleContext.class); - LinkedList<ServiceRegistration> list = Mockito.spy(new LinkedList<>()); - Whitebox.setInternalState(activator, "registrations", list); - activator.start(ctx); - Mockito.verify(list).add(Mockito.any()); - } - - @Test - public void testStop() throws Exception { - SdcArtifactHandlerActivator activator = new SdcArtifactHandlerActivator(); - BundleContext ctx = Mockito.mock(BundleContext.class); - LinkedList<ServiceRegistration> list = Mockito.spy(new LinkedList<>()); - ServiceRegistration serviceRegistration = Mockito.mock(ServiceRegistration.class); - list.add(serviceRegistration); - Whitebox.setInternalState(activator, "registrations", list); - activator.stop(ctx); - Mockito.verify(serviceRegistration).unregister(); - } -} |