diff options
10 files changed, 416 insertions, 92 deletions
diff --git a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/openecomp/appc/adapter/messaging/dmaap/http/CommonHttpClient.java b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/openecomp/appc/adapter/messaging/dmaap/http/CommonHttpClient.java index ed2f13ff0..cd42e9dc6 100644 --- a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/openecomp/appc/adapter/messaging/dmaap/http/CommonHttpClient.java +++ b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/openecomp/appc/adapter/messaging/dmaap/http/CommonHttpClient.java @@ -50,23 +50,19 @@ public class CommonHttpClient { } public HttpGet getReq(URI uri, int timeoutMs) throws Exception { - if (AUTH_STR == null) { - throw new Exception("All DMaaP requests require authentication and none was provided."); - } - HttpGet out = (uri == null) ? new HttpGet() : new HttpGet(uri); - out.setHeader("Authorization", String.format("Basic %s", AUTH_STR)); + if (AUTH_STR != null) { + out.setHeader("Authorization", String.format("Basic %s", AUTH_STR)); + } out.setConfig(getConfig(timeoutMs)); return out; } public HttpPost postReq(String url) throws Exception { - if (AUTH_STR == null) { - throw new Exception("All DMaaP requests require authentication and none was provided."); - } - HttpPost out = (url == null) ? new HttpPost() : new HttpPost(url); - out.setHeader("Authorization", String.format("Basic %s", AUTH_STR)); + if (AUTH_STR != null) { + out.setHeader("Authorization", String.format("Basic %s", AUTH_STR)); + } out.setConfig(getConfig(0)); return out; } diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/DCAEReporterPluginImpl.java b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/DCAEReporterPluginImpl.java index 0f99f8314..dd667c270 100644 --- a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/DCAEReporterPluginImpl.java +++ b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/DCAEReporterPluginImpl.java @@ -33,9 +33,6 @@ import org.openecomp.appc.adapter.message.event.EventStatus; import org.openecomp.appc.dg.common.DCAEReporterPlugin; import org.openecomp.appc.exceptions.APPCException; import org.openecomp.sdnc.sli.SvcLogicContext; -import org.osgi.framework.BundleContext; -import org.osgi.framework.FrameworkUtil; -import org.osgi.framework.ServiceReference; import java.util.Map; @@ -44,9 +41,16 @@ public class DCAEReporterPluginImpl implements DCAEReporterPlugin { private EventSender eventSender; public DCAEReporterPluginImpl() { - BundleContext bctx = FrameworkUtil.getBundle(this.getClass()).getBundleContext(); - ServiceReference sref = bctx.getServiceReference(EventSender.class); - eventSender = (EventSender) bctx.getService(sref); + // do nothing + } + + /** + * Injected by blueprint + * + * @param eventSender to be set + */ + public void setEventSender(EventSender eventSender) { + this.eventSender = eventSender; } @Override @@ -62,7 +66,9 @@ public class DCAEReporterPluginImpl implements DCAEReporterPlugin { apiVersion = ctx.getAttribute("input.common-header.api-ver"); eventId = ctx.getAttribute("input.common-header.request-id"); - EventMessage eventMessage = new EventMessage(new EventHeader((new java.util.Date()).toString(), apiVersion, eventId), new EventStatus(errorCode, errorDescription)); + EventMessage eventMessage = new EventMessage(new EventHeader( + (new java.util.Date()).toString(), apiVersion, eventId), + new EventStatus(errorCode, errorDescription)); String eventWriteTopic = params.get("event-topic-name"); if(!StringUtils.isEmpty(eventWriteTopic) && eventWriteTopic!=null){ eventSender.sendEvent(MessageDestination.DCAE, eventMessage,eventWriteTopic); @@ -102,7 +108,9 @@ public class DCAEReporterPluginImpl implements DCAEReporterPlugin { if (null == successDescription) { successDescription = "Success"; } - EventMessage eventMessage = new EventMessage(new EventHeader((new java.util.Date()).toString(), apiVersion, eventId), new EventStatus(successReportCode, successDescription)); + EventMessage eventMessage = new EventMessage(new EventHeader( + (new java.util.Date()).toString(), apiVersion, eventId), + new EventStatus(successReportCode, successDescription)); String eventWriteTopic = params.get("event-topic-name"); if(!StringUtils.isEmpty(eventWriteTopic) && eventWriteTopic!=null){ eventSender.sendEvent(MessageDestination.DCAE, eventMessage,eventWriteTopic); @@ -120,7 +128,9 @@ public class DCAEReporterPluginImpl implements DCAEReporterPlugin { apiVersion = ctx.getAttribute("input.common-header.api-ver"); eventId = ctx.getAttribute("input.common-header.request-id"); - EventMessage eventMessage = new EventMessage(new EventHeader((new java.util.Date()).toString(), apiVersion, eventId), new EventStatus(errorCode, errorDescription)); + EventMessage eventMessage = new EventMessage(new EventHeader( + (new java.util.Date()).toString(), apiVersion, eventId), + new EventStatus(errorCode, errorDescription)); String eventWriteTopic = params.get("event-topic-name"); if(!StringUtils.isEmpty(eventWriteTopic) && eventWriteTopic!=null){ eventSender.sendEvent(MessageDestination.DCAE, eventMessage,eventWriteTopic); diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/appc-dg/appc-dg-shared/appc-dg-common/src/main/resources/OSGI-INF/blueprint/blueprint.xml index 9c282f0ee..9014d9f9d 100644 --- a/appc-dg/appc-dg-shared/appc-dg-common/src/main/resources/OSGI-INF/blueprint/blueprint.xml +++ b/appc-dg/appc-dg-shared/appc-dg-common/src/main/resources/OSGI-INF/blueprint/blueprint.xml @@ -27,41 +27,54 @@ Starter Blueprint Camel Definition appc-aai-adapter-blueprint --> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"> - <bean id="JsonDgUtilBean" class="org.openecomp.appc.dg.common.impl.JsonDgUtilImpl"/> + <bean id="JsonDgUtilBean" class="org.openecomp.appc.dg.common.impl.JsonDgUtilImpl"/> <service id="JsonDgUtil" interface="org.openecomp.appc.dg.common.JsonDgUtil" ref="JsonDgUtilBean"/> - <!-- <reference id="eventSenderRef" availability="mandatory" activation="eager" interface="org.openecomp.appc.adapter.message.EventSender" /> --> + <reference id="eventSenderReference" availability="mandatory" activation="eager" + interface="org.openecomp.appc.adapter.message.EventSender"/> - <bean id="DCAEReporterPluginBean" class="org.openecomp.appc.dg.common.impl.DCAEReporterPluginImpl" scope="singleton"/> - <service id="DCAEReporterPlugin" interface="org.openecomp.appc.dg.common.DCAEReporterPlugin" ref="DCAEReporterPluginBean"/> + <bean id="DCAEReporterPluginBean" class="org.openecomp.appc.dg.common.impl.DCAEReporterPluginImpl" + scope="singleton"> + <property name="eventSender" ref="eventSenderReference"/> + </bean> - <bean id="OutputMessagePluginBean" class="org.openecomp.appc.dg.common.impl.OutputMessagePluginImpl" scope="singleton"/> - <service id="OutputMessagePlugin" interface="org.openecomp.appc.dg.common.OutputMessagePlugin" ref="OutputMessagePluginBean"/> + <service id="DCAEReporterPlugin" interface="org.openecomp.appc.dg.common.DCAEReporterPlugin" + ref="DCAEReporterPluginBean"/> - <bean id="legacyUtilBean" class="org.openecomp.appc.dg.common.impl.LegacyUtilImpl" scope="singleton"/> - <service id="legacyUtil" interface="org.openecomp.appc.dg.common.LegacyUtil" ref="legacyUtilBean"/> + <bean id="OutputMessagePluginBean" class="org.openecomp.appc.dg.common.impl.OutputMessagePluginImpl" + scope="singleton"/> + <service id="OutputMessagePlugin" interface="org.openecomp.appc.dg.common.OutputMessagePlugin" + ref="OutputMessagePluginBean"/> - <bean id="DgResolverPluginBean" class="org.openecomp.appc.dg.common.impl.DgResolverPluginImpl" scope="singleton"> - </bean> + <bean id="legacyUtilBean" class="org.openecomp.appc.dg.common.impl.LegacyUtilImpl" scope="singleton"/> + <service id="legacyUtil" interface="org.openecomp.appc.dg.common.LegacyUtil" ref="legacyUtilBean"/> - <service id="DgResolverPlugin" interface="org.openecomp.appc.dg.common.DgResolverPlugin" ref="DgResolverPluginBean"/> + <bean id="DgResolverPluginBean" class="org.openecomp.appc.dg.common.impl.DgResolverPluginImpl" scope="singleton"/> - <bean id="vnfExecutionFlowBean" class="org.openecomp.appc.dg.common.impl.VnfExecutionFlowImpl" scope="singleton"/> - <service id="vnfExecutionFlowService" interface="org.openecomp.appc.dg.common.VnfExecutionFlow" ref="vnfExecutionFlowBean"/> + <service id="DgResolverPlugin" interface="org.openecomp.appc.dg.common.DgResolverPlugin" + ref="DgResolverPluginBean"/> - <bean id="VNFCDgResolverPluginBean" class="org.openecomp.appc.dg.common.impl.VNFCDgResolverPluginImpl" scope="singleton"> - </bean> + <bean id="vnfExecutionFlowBean" class="org.openecomp.appc.dg.common.impl.VnfExecutionFlowImpl" scope="singleton"/> + <service id="vnfExecutionFlowService" interface="org.openecomp.appc.dg.common.VnfExecutionFlow" + ref="vnfExecutionFlowBean"/> - <service id="VNFCDgResolverPlugin" interface="org.openecomp.appc.dg.common.VNFCDgResolverPlugin" ref="VNFCDgResolverPluginBean"/> + <bean id="VNFCDgResolverPluginBean" class="org.openecomp.appc.dg.common.impl.VNFCDgResolverPluginImpl" + scope="singleton"/> - <bean id="vnfConfiguratorBean" class="org.openecomp.appc.dg.common.impl.VNFConfiguratorImpl" scope="singleton"/> + <service id="VNFCDgResolverPlugin" interface="org.openecomp.appc.dg.common.VNFCDgResolverPlugin" + ref="VNFCDgResolverPluginBean"/> - <service id="vnfConfigurationService" interface="org.openecomp.appc.dg.common.VNFConfigurator" ref="vnfConfiguratorBean"/> + <bean id="vnfConfiguratorBean" class="org.openecomp.appc.dg.common.impl.VNFConfiguratorImpl" scope="singleton"/> - <bean id="interimMessageSender" class="org.openecomp.appc.dg.common.impl.IntermediateMessageSenderImpl" init-method="init" scope="singleton"/> - <service id="interimMessageSenderService" ref="interimMessageSender" interface="org.openecomp.appc.dg.common.IntermediateMessageSender"/> + <service id="vnfConfigurationService" interface="org.openecomp.appc.dg.common.VNFConfigurator" + ref="vnfConfiguratorBean"/> + + <bean id="interimMessageSender" class="org.openecomp.appc.dg.common.impl.IntermediateMessageSenderImpl" + init-method="init" scope="singleton"/> + <service id="interimMessageSenderService" ref="interimMessageSender" + interface="org.openecomp.appc.dg.common.IntermediateMessageSender"/> </blueprint> diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/test/java/org/openecomp/appc/dg/common/impl/DCAEReporterPluginImplTest.java b/appc-dg/appc-dg-shared/appc-dg-common/src/test/java/org/openecomp/appc/dg/common/impl/DCAEReporterPluginImplTest.java index 4534f8521..78a11fb48 100644 --- a/appc-dg/appc-dg-shared/appc-dg-common/src/test/java/org/openecomp/appc/dg/common/impl/DCAEReporterPluginImplTest.java +++ b/appc-dg/appc-dg-shared/appc-dg-common/src/test/java/org/openecomp/appc/dg/common/impl/DCAEReporterPluginImplTest.java @@ -24,13 +24,14 @@ package org.openecomp.appc.dg.common.impl; -import org.junit.*; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.*; import org.openecomp.appc.adapter.message.EventSender; import org.openecomp.appc.adapter.message.MessageDestination; import org.openecomp.appc.adapter.message.event.EventMessage; -import org.openecomp.appc.dg.common.impl.DCAEReporterPluginImpl; import org.openecomp.appc.exceptions.APPCException; import org.openecomp.sdnc.sli.SvcLogicContext; import org.osgi.framework.Bundle; @@ -50,35 +51,31 @@ public class DCAEReporterPluginImplTest { private SvcLogicContext ctx; private Map<String, String> params; - private final BundleContext bundleContext=Mockito.mock(BundleContext.class); - private final Bundle bundleService=Mockito.mock(Bundle.class); - private final ServiceReference sref=Mockito.mock(ServiceReference.class); - + private final BundleContext bundleContext = Mockito.mock(BundleContext.class); + private final Bundle bundleService = Mockito.mock(Bundle.class); + private final ServiceReference sref = Mockito.mock(ServiceReference.class); + @InjectMocks private DCAEReporterPluginImpl dcaeReporterPlugin; - private EventSenderMock eventSender; + @Spy + private EventSenderMock eventSender = new EventSenderMock(); private String apiVer = "2.0.0"; private String requestId = "123"; private String error = "test-error"; + @SuppressWarnings("unchecked") @Before public void setUp() throws NoSuchFieldException, IllegalAccessException { - eventSender = new EventSenderMock(); PowerMockito.mockStatic(FrameworkUtil.class); PowerMockito.when(FrameworkUtil.getBundle(Matchers.any(Class.class))).thenReturn(bundleService); PowerMockito.when(bundleService.getBundleContext()).thenReturn(bundleContext); PowerMockito.when(bundleContext.getServiceReference(Matchers.any(Class.class))).thenReturn(sref); PowerMockito.when(bundleContext.<EventSender>getService(sref)).thenReturn(eventSender); - dcaeReporterPlugin = new DCAEReporterPluginImpl(); - } - - @Test public void testReportErrorDescriptionNullBwcModeFalse() throws Exception { - ctx = new SvcLogicContext(); params = new HashMap<>(); params.put("output.status.message", null); @@ -88,6 +85,17 @@ public class DCAEReporterPluginImplTest { errorReasonNullAssert(); } + @Test + public void testReportBwcFalse() throws Exception { + ctx = new SvcLogicContext(); + params = new HashMap<>(); + ctx.setAttribute("isBwcMode", "false"); + params.put("output.status.message", error); + ctx.setAttribute("input.common-header.api-ver", apiVer); + ctx.setAttribute("input.common-header.request-id", requestId); + + positiveAssert(); + } private void errorReasonNullAssert() throws APPCException { dcaeReporterPlugin.report(params, ctx); @@ -97,10 +105,8 @@ public class DCAEReporterPluginImplTest { Assert.assertEquals("wrong requestId", requestId, msg.getEventHeader().getEventId()); Assert.assertEquals("wrong error message", "Unknown", msg.getEventStatus().getReason()); Assert.assertEquals("wrong destination", destination.name(), "DCAE"); - } - private void positiveAssert() throws APPCException { dcaeReporterPlugin.report(params, ctx); MessageDestination destination = eventSender.getDestination(); @@ -109,20 +115,5 @@ public class DCAEReporterPluginImplTest { Assert.assertEquals("wrong requestId", requestId, msg.getEventHeader().getEventId()); Assert.assertEquals("wrong error message", error, msg.getEventStatus().getReason()); Assert.assertEquals("wrong destination", destination.name(), "DCAE"); - } - - - @Test - public void testReportBwcFalse() throws Exception { - ctx = new SvcLogicContext(); - params = new HashMap<>(); - ctx.setAttribute("isBwcMode", "false"); - params.put("output.status.message", error); - ctx.setAttribute("input.common-header.api-ver", apiVer); - ctx.setAttribute("input.common-header.request-id", requestId); - - positiveAssert(); - - } - } +} diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-installer/.gitignore b/appc-dispatcher/appc-command-executor/appc-command-executor-installer/.gitignore new file mode 100644 index 000000000..731eb433c --- /dev/null +++ b/appc-dispatcher/appc-command-executor/appc-command-executor-installer/.gitignore @@ -0,0 +1,2 @@ +/target/ +/.settings/ diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-installer/pom.xml b/appc-dispatcher/appc-command-executor/appc-command-executor-installer/pom.xml new file mode 100644 index 000000000..d91d2e0f0 --- /dev/null +++ b/appc-dispatcher/appc-command-executor/appc-command-executor-installer/pom.xml @@ -0,0 +1,137 @@ +<?xml version="1.0" encoding="UTF-8"?> +<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/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.openecomp.appc</groupId> + <artifactId>appc-command-executor</artifactId> + <version>1.1.0-SNAPSHOT</version> + </parent> + + <artifactId>appc-command-executor-installer</artifactId> + <name>APPC Command Executor - Karaf Installer</name> + <packaging>pom</packaging> + + <properties> + <application.name>appc-command-executor</application.name> + <features.boot>appc-command-executor</features.boot> + <features.repositories> + mvn:org.openecomp.appc/appc-command-executor-features/${project.version}/xml/features + </features.repositories> + <include.transitive.dependencies>false</include.transitive.dependencies> + </properties> + + <dependencies> + <dependency> + <groupId>org.openecomp.appc</groupId> + <artifactId>appc-command-executor-features</artifactId> + <version>${project.version}</version> + <classifier>features</classifier> + <type>xml</type> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.openecomp.appc</groupId> + <artifactId>appc-command-executor-api</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.openecomp.appc</groupId> + <artifactId>appc-command-executor-core</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <executions> + <execution> + <id>maven-repo-zip</id> + <goals> + <goal>single</goal> + </goals> + <phase>package</phase> + <configuration> + <appendAssemblyId>false</appendAssemblyId> + <attach>false</attach> + <finalName>stage/${application.name}-${project.version}</finalName> + <descriptors> + <descriptor>src/assembly/assemble_mvnrepo_zip.xml</descriptor> + </descriptors> + </configuration> + </execution> + <execution> + <id>installer-zip</id> + <goals> + <goal>single</goal> + </goals> + <phase>package</phase> + <configuration> + <appendAssemblyId>false</appendAssemblyId> + <attach>true</attach> + <finalName>${application.name}-${project.version}</finalName> + <descriptors> + <descriptor>src/assembly/assemble_installer_zip.xml</descriptor> + </descriptors> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>copy-dependencies</id> + <goals> + <goal>copy-dependencies</goal> + </goals> + <phase>prepare-package</phase> + <configuration> + <outputDirectory>${project.build.directory}/assembly/system</outputDirectory> + <overWriteReleases>false</overWriteReleases> + <overWriteSnapshots>true</overWriteSnapshots> + <overWriteIfNewer>true</overWriteIfNewer> + <useRepositoryLayout>true</useRepositoryLayout> + <addParentPoms>false</addParentPoms> + <copyPom>false</copyPom> + <excludeGroupIds>org.opendaylight</excludeGroupIds> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-resources-plugin</artifactId> + <executions> + <execution> + <id>copy-version</id> + <goals> + <goal>copy-resources</goal> + </goals> + <!-- here the phase you need --> + <phase>validate</phase> + <configuration> + <outputDirectory>${basedir}/target/stage</outputDirectory> + <resources> + <resource> + <directory>src/main/resources/scripts</directory> + <includes> + <include>install-feature.sh</include> + </includes> + <filtering>true</filtering> + </resource> + </resources> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-installer/src/assembly/assemble_installer_zip.xml b/appc-dispatcher/appc-command-executor/appc-command-executor-installer/src/assembly/assemble_installer_zip.xml new file mode 100644 index 000000000..df18e1889 --- /dev/null +++ b/appc-dispatcher/appc-command-executor/appc-command-executor-installer/src/assembly/assemble_installer_zip.xml @@ -0,0 +1,60 @@ +<!-- + ============LICENSE_START======================================================= + ONAP : APPC + ================================================================================ + Copyright (C) 2017 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. + + ECOMP is a trademark and service mark of AT&T Intellectual Property. + ============LICENSE_END========================================================= + --> + +<!-- Defines how we build the .zip file which is our distribution. --> + +<assembly + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> + <id>controller</id> + <formats> + <format>zip</format> + </formats> + + <!-- we want "system" and related files right at the root level + as this file is suppose to be unzip on top of a karaf + distro. --> + <includeBaseDirectory>false</includeBaseDirectory> + + <fileSets> + <fileSet> + <directory>target/stage/</directory> + <outputDirectory>${application.name}</outputDirectory> + <fileMode>755</fileMode> + <includes> + <include>*.sh</include> + </includes> + </fileSet> + <fileSet> + <directory>target/stage/</directory> + <outputDirectory>${application.name}</outputDirectory> + <fileMode>644</fileMode> + <excludes> + <exclude>*.sh</exclude> + </excludes> + </fileSet> + </fileSets> + +</assembly> diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-installer/src/assembly/assemble_mvnrepo_zip.xml b/appc-dispatcher/appc-command-executor/appc-command-executor-installer/src/assembly/assemble_mvnrepo_zip.xml new file mode 100644 index 000000000..4278b4d95 --- /dev/null +++ b/appc-dispatcher/appc-command-executor/appc-command-executor-installer/src/assembly/assemble_mvnrepo_zip.xml @@ -0,0 +1,51 @@ +<!-- + ============LICENSE_START======================================================= + ONAP : APPC + ================================================================================ + Copyright (C) 2017 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. + + ECOMP is a trademark and service mark of AT&T Intellectual Property. + ============LICENSE_END========================================================= + --> + +<!-- Defines how we build the .zip file which is our distribution. --> + +<assembly + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 + http://maven.apache.org/xsd/assembly-1.1.0.xsd"> + <id>controller</id> + <formats> + <format>zip</format> + </formats> + + <!-- we want "system" and related files right at the root level + as this file is suppose to be unzip on top of a karaf + distro. --> + <includeBaseDirectory>false</includeBaseDirectory> + + <fileSets> + <fileSet> + <directory>target/assembly/</directory> + <outputDirectory>.</outputDirectory> + <excludes> + </excludes> + </fileSet> + </fileSets> + +</assembly> diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-installer/src/main/resources/scripts/install-feature.sh b/appc-dispatcher/appc-command-executor/appc-command-executor-installer/src/main/resources/scripts/install-feature.sh new file mode 100644 index 000000000..d3596c688 --- /dev/null +++ b/appc-dispatcher/appc-command-executor/appc-command-executor-installer/src/main/resources/scripts/install-feature.sh @@ -0,0 +1,63 @@ +### +# ============LICENSE_START======================================================= +# ONAP : APPC +# ================================================================================ +# Copyright (C) 2017 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. +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# ============LICENSE_END========================================================= +### + +#!/bin/bash + +ODL_HOME=${ODL_HOME:-/opt/opendaylight/current} +ODL_KARAF_CLIENT=${ODL_KARAF_CLIENT:-${ODL_HOME}/bin/client} +ODL_KARAF_CLIENT_OPTS=${ODL_KARAF_CLIENT_OPTS:-"-u karaf"} +INSTALLERDIR=$(dirname $0) + +REPOZIP=${INSTALLERDIR}/${features.boot}-${project.version}.zip + +if [ -f ${REPOZIP} ] +then + unzip -n -d ${ODL_HOME} ${REPOZIP} +else + echo "ERROR : repo zip ($REPOZIP) not found" + exit 1 +fi + +COUNT=0 +while [ $COUNT -lt 10 ]; do + ${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:repo-add ${features.repositories} 2> /tmp/installErr + cat /tmp/installErr + if grep -q 'Failed to get the session' /tmp/installErr; then + sleep 10 + else + let COUNT=10 + fi + let COUNT=COUNT+1 +done +COUNT=0 +while [ $COUNT -lt 10 ]; do + ${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:install ${features.boot} 2> /tmp/installErr + cat /tmp/installErr + if grep -q 'Failed to get the session' /tmp/installErr; then + sleep 10 + else + let COUNT=10 + fi + let COUNT=COUNT+1 +done diff --git a/appc-dispatcher/appc-command-executor/pom.xml b/appc-dispatcher/appc-command-executor/pom.xml index fe853eb07..d506b302e 100644 --- a/appc-dispatcher/appc-command-executor/pom.xml +++ b/appc-dispatcher/appc-command-executor/pom.xml @@ -1,22 +1,23 @@ <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/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.openecomp.appc</groupId> - <artifactId>appc-dispatcher</artifactId> - <version>1.1.0-SNAPSHOT</version> - </parent> - <artifactId>appc-command-executor</artifactId> - <packaging>pom</packaging> - <name>APPC Command Executor</name> - <description>APPC Command Executor</description> - - <!-- ================================================================================== --> - <!-- The modules we build --> - <!-- ================================================================================== --> - <modules> - <module>appc-command-executor-api</module> - <module>appc-command-executor-core</module> - <module>appc-command-executor-features</module> - </modules> - + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.openecomp.appc</groupId> + <artifactId>appc-dispatcher</artifactId> + <version>1.1.0-SNAPSHOT</version> + </parent> + <artifactId>appc-command-executor</artifactId> + <packaging>pom</packaging> + <name>APPC Command Executor</name> + <description>APPC Command Executor</description> + + <!-- ================================================================================== --> + <!-- The modules we build --> + <!-- ================================================================================== --> + <modules> + <module>appc-command-executor-api</module> + <module>appc-command-executor-core</module> + <module>appc-command-executor-features</module> + <module>appc-command-executor-installer</module> + </modules> + </project>
\ No newline at end of file |