From: sebdet Date: Tue, 4 Aug 2020 12:16:00 +0000 (+0200) Subject: Upgrade to java 11 X-Git-Tag: 1.7.1~13 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=30670accb070b20c1c770d1ebbd6d72e24fee2db;p=sdc.git Upgrade to java 11 MOve SDC to Java 11, this is one of the PR to move to Jdk 11, jenkins will have to be changed as well Issue-ID: SDC-2725 Change-Id: I85f13f14ba8004f6e9656093a837465a2e4af3e1 Signed-off-by: sebdet Signed-off-by: xuegao Signed-off-by: sebdet --- diff --git a/asdctool/sdc-cassandra-init/Dockerfile b/asdctool/sdc-cassandra-init/Dockerfile index 1beec7e2f6..e35f841984 100644 --- a/asdctool/sdc-cassandra-init/Dockerfile +++ b/asdctool/sdc-cassandra-init/Dockerfile @@ -1,4 +1,33 @@ -FROM onap/base_sdc-cqlsh:1.7.0 +FROM onap/policy-jdk-debian:2.0.1 + +#RUN addgroup --gid 1000 sdc +RUN addgroup sdc +#RUN adduser --gecos "sdc sdc,1,1,1" -u 1000 --disabled-password --ingroup sdc --shell /bin/sh sdc +RUN adduser --gecos "sdc sdc,1,1,1" --disabled-password --ingroup sdc --shell /bin/sh sdc +USER sdc +RUN mkdir ~/.cassandra/ && \ + echo '[cql]' > ~/.cassandra/cqlshrc && \ + echo 'version=3.4.4' >> ~/.cassandra/cqlshrc +USER root + +RUN apt-get update && apt-get install -y python-pip && \ + pip install cqlsh && \ + mkdir ~/.cassandra/ && \ + echo '[cql]' > ~/.cassandra/cqlshrc && \ + echo 'version=3.4.4' >> ~/.cassandra/cqlshrc && \ + set -ex && \ + pip install cqlsh && \ + apt-get install -y \ + make \ + gcc \ + ruby \ + ruby-dev \ + libffi-dev \ + libxml2-dev && \ + gem install chef:13.8.5 berkshelf:6.3.1 io-console:0.4.6 etc webrick --no-document && \ + apt-get update -y && \ + apt-get install -y binutils && apt-get clean && gem cleanup +USER sdc COPY --chown=sdc:sdc chef-solo /home/sdc/chef-solo/ diff --git a/asdctool/sdc-cassandra-init/startup.sh b/asdctool/sdc-cassandra-init/startup.sh index 3e474f3c89..2a20eaa67d 100644 --- a/asdctool/sdc-cassandra-init/startup.sh +++ b/asdctool/sdc-cassandra-init/startup.sh @@ -1,6 +1,6 @@ -#!/bin/bash +#!/bin/sh cd /home/sdc/chef-solo chef-solo -c solo.rb -E ${ENVNAME} rc=$? -if [[ $rc != 0 ]]; then exit $rc; fi +if [ $rc -ne 0 ]; then exit $rc; fi diff --git a/catalog-be/pom.xml b/catalog-be/pom.xml index eef3d7c7dc..89be979b65 100644 --- a/catalog-be/pom.xml +++ b/catalog-be/pom.xml @@ -749,10 +749,10 @@ org.apache.maven.plugins - maven-surefire-plugin - - 1 - + maven-surefire-plugin + + 1 + @@ -870,6 +870,18 @@ com.jcabi jcabi-maven-plugin ${jcabi.maven.plugin.version} + + + org.aspectj + aspectjtools + 1.9.2 + + + org.aspectj + aspectjweaver + 1.9.2 + + diff --git a/catalog-be/sdc-backend/Dockerfile b/catalog-be/sdc-backend/Dockerfile index 2a60ce77ad..bc4f27a79a 100644 --- a/catalog-be/sdc-backend/Dockerfile +++ b/catalog-be/sdc-backend/Dockerfile @@ -1,13 +1,55 @@ -FROM onap/base_sdc-jetty:1.7.0 - +FROM jetty:9.4.31-jre11-slim + +USER root + +# Install Chef +RUN set -ex && \ + apt-get update -y && \ + apt-get install -y \ + jq \ + curl \ + curl \ + vim \ + make \ + gcc \ + ruby \ + ruby-dev \ + libffi-dev \ + libxml2-dev && \ + gem install \ + chef:13.8.5 \ + berkshelf:6.3.1 \ + io-console:0.4.6 \ + etc webrick \ + --no-document && \ + gem cleanup && \ + apt-get update -y && \ + apt-get install -y binutils jq && \ + apt-get clean + +# Replace Jetty user ID +ENV USER_JETTY="jetty" +ENV GROUP_JETTY="jetty" +ENV UID_JETTY="352070" +ENV GID_JETTY="35953" + +# Remove user: +RUN deluser ${USER_JETTY} +#RUN delgroup ${GROUP_JETTY} +RUN echo "${USER_JETTY}:x:${UID_JETTY}:${GID_JETTY}::/home/${USER_JETTY}:Linux User,,,:/home/jetty:/bin/false" >> /etc/passwd +RUN echo "${GROUP_JETTY}:x:${GID_JETTY}:${USER_JETTY}" >> /etc/group +RUN echo "${USER_JETTY}:!:17501:0:99999:7:::" >> /etc/shadow +RUN mkdir /home/${USER_JETTY} && chown ${USER_JETTY}:${GROUP_JETTY} /home/${USER_JETTY} +RUN chown -R jetty:jetty ${JETTY_BASE}/webapps /var/lib/jetty + +USER jetty + COPY --chown=jetty:jetty chef-solo ${JETTY_BASE}/chef-solo/ COPY --chown=jetty:jetty chef-repo/cookbooks/. ${JETTY_BASE}/chef-solo/cookbooks/ - ADD --chown=jetty:jetty catalog-be-*.war ${JETTY_BASE}/webappwar/ ADD --chown=jetty:jetty context.xml ${JETTY_BASE}/webapps/ - -COPY --chown=jetty:jetty startup.sh ${JETTY_BASE}/ +COPY --chown=jetty:jetty startup.sh ${JETTY_BASE}/ RUN chmod 770 ${JETTY_BASE}/startup.sh -ENTRYPOINT ${JETTY_BASE}/startup.sh +ENTRYPOINT [ "sh", "-c", "${JETTY_BASE}/startup.sh"] \ No newline at end of file diff --git a/catalog-be/sdc-backend/startup.sh b/catalog-be/sdc-backend/startup.sh index 4f5ef8ca2e..0dc54a8849 100644 --- a/catalog-be/sdc-backend/startup.sh +++ b/catalog-be/sdc-backend/startup.sh @@ -15,18 +15,16 @@ cd /var/lib/jetty/chef-solo chef-solo -c solo.rb -E ${ENVNAME} status=$? -if [ $status != 0 ]; then +if [ $status -ne 0 ]; then echo "[ERROR] Problem detected while running chef. Aborting !" exit 1 fi # Execute Jetty cd /var/lib/jetty -/docker-entrypoint.sh & -exec "$@"; +java $JAVA_OPTIONS -jar "$JETTY_HOME/start.jar" -while true; do sleep 2; done diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/impl/aaf/RoleAuthorizationHandlerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/impl/aaf/RoleAuthorizationHandlerTest.java index c488a9a6ca..30a123dcad 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/impl/aaf/RoleAuthorizationHandlerTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/impl/aaf/RoleAuthorizationHandlerTest.java @@ -22,8 +22,9 @@ package org.openecomp.sdc.be.impl.aaf; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.Signature; +import org.hibernate.validator.internal.util.annotationfactory.AnnotationDescriptor; +import org.hibernate.validator.internal.util.annotationfactory.AnnotationFactory; import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; @@ -36,15 +37,12 @@ import org.openecomp.sdc.be.components.impl.exceptions.ComponentException; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.servlets.BeGenericServlet; -import org.openecomp.sdc.common.api.ConfigurationSource; import org.openecomp.sdc.common.api.FilterDecisionEnum; import org.openecomp.sdc.common.impl.ExternalConfiguration; import org.openecomp.sdc.common.impl.FSConfigurationSource; import org.openecomp.sdc.common.util.ThreadLocalsHolder; -import sun.reflect.annotation.AnnotationParser; import javax.servlet.http.HttpServletRequest; -import java.util.Collections; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.catchThrowable; @@ -78,8 +76,9 @@ public class RoleAuthorizationHandlerTest { @Test public void testAuthorizeRoleOnePermittedRole() { String[] permsAllowed = {AafPermission.PermNames.WRITE_VALUE}; - PermissionAllowed rolesAllowed = - (PermissionAllowed) AnnotationParser.annotationForMap(PermissionAllowed.class, Collections.singletonMap("value", permsAllowed)); + AnnotationDescriptor permissionDescriptor = new AnnotationDescriptor(PermissionAllowed.class); + permissionDescriptor.setValue("value", permsAllowed); + PermissionAllowed rolesAllowed = (PermissionAllowed) AnnotationFactory.create(permissionDescriptor); when(httpServletRequest.isUserInRole(AafPermission.getEnumByString(permsAllowed[0]).getFullPermission())) .thenReturn(true); roleAuthorizationHandler.authorizeRole(joinPoint, rolesAllowed); @@ -88,8 +87,9 @@ public class RoleAuthorizationHandlerTest { @Test public void testAuthorizeRoleTwoPermittedRole() { String[] permsAllowed = {AafPermission.PermNames.WRITE_VALUE, AafPermission.PermNames.READ_VALUE}; - PermissionAllowed rolesAllowed = - (PermissionAllowed) AnnotationParser.annotationForMap(PermissionAllowed.class, Collections.singletonMap("value", permsAllowed)); + AnnotationDescriptor permissionDescriptor = new AnnotationDescriptor(PermissionAllowed.class); + permissionDescriptor.setValue("value", permsAllowed); + PermissionAllowed rolesAllowed = (PermissionAllowed)AnnotationFactory.create(permissionDescriptor); when(httpServletRequest.isUserInRole(AafPermission.getEnumByString(permsAllowed[0]).getFullPermission())) .thenReturn(true); roleAuthorizationHandler.authorizeRole(joinPoint, rolesAllowed); @@ -98,8 +98,9 @@ public class RoleAuthorizationHandlerTest { @Test public void testAuthorizeRoleNonPermittedRole() { String[] permsAllowed = {AafPermission.PermNames.WRITE_VALUE, AafPermission.PermNames.READ_VALUE}; - PermissionAllowed rolesAllowed = - (PermissionAllowed) AnnotationParser.annotationForMap(PermissionAllowed.class, Collections.singletonMap("value", permsAllowed)); + AnnotationDescriptor permissionDescriptor = new AnnotationDescriptor(PermissionAllowed.class); + permissionDescriptor.setValue("value", permsAllowed); + PermissionAllowed rolesAllowed = (PermissionAllowed)AnnotationFactory.create(permissionDescriptor); when(httpServletRequest.isUserInRole(AafPermission.getEnumByString(permsAllowed[0]).getFullPermission())) .thenReturn(false); @@ -110,8 +111,9 @@ public class RoleAuthorizationHandlerTest { @Test public void testAuthorizeRoleEmptyRole() { String[] permsAllowed = {}; - PermissionAllowed rolesAllowed = - (PermissionAllowed) AnnotationParser.annotationForMap(PermissionAllowed.class, Collections.singletonMap("value", permsAllowed)); + AnnotationDescriptor permissionDescriptor = new AnnotationDescriptor(PermissionAllowed.class); + permissionDescriptor.setValue("value", permsAllowed); + PermissionAllowed rolesAllowed = (PermissionAllowed)AnnotationFactory.create(permissionDescriptor); ComponentException thrown = (ComponentException) catchThrowable(()->roleAuthorizationHandler.authorizeRole(joinPoint, rolesAllowed)); assertThat(thrown.getActionStatus()).isEqualTo(ActionStatus.AUTH_FAILED); diff --git a/catalog-fe/pom.xml b/catalog-fe/pom.xml index d1762ba985..be4b0651ff 100644 --- a/catalog-fe/pom.xml +++ b/catalog-fe/pom.xml @@ -232,30 +232,37 @@ compile - - - org.onap.portal.sdk - epsdk-fw - ${ecomp.version} - compile - - - com.att.nsa - cambriaClient - - - slf4j-log4j12 - org.slf4j - - - - - - org.fusesource - sigar - ${sigar.version} - compile - + + javax.xml.bind + jaxb-api + ${jaxb-api.version} + compile + + + + + org.onap.portal.sdk + epsdk-fw + ${ecomp.version} + compile + + + com.att.nsa + cambriaClient + + + slf4j-log4j12 + org.slf4j + + + + + + org.fusesource + sigar + ${sigar.version} + compile + @@ -337,6 +344,18 @@ com.jcabi jcabi-maven-plugin ${jcabi.maven.plugin.version} + + + org.aspectj + aspectjtools + 1.9.2 + + + org.aspectj + aspectjweaver + 1.9.2 + + diff --git a/catalog-fe/sdc-frontend/Dockerfile b/catalog-fe/sdc-frontend/Dockerfile index 9d4029c32a..3a2359c4ab 100644 --- a/catalog-fe/sdc-frontend/Dockerfile +++ b/catalog-fe/sdc-frontend/Dockerfile @@ -1,4 +1,48 @@ -FROM onap/base_sdc-jetty:1.7.0 +FROM jetty:9.4.31-jre11-slim + +USER root + +# Install Chef +RUN set -ex && \ + apt-get update -y && \ + apt-get install -y \ + jq \ + curl \ + curl \ + vim \ + make \ + gcc \ + ruby \ + ruby-dev \ + libffi-dev \ + libxml2-dev && \ + gem install \ + chef:13.8.5 \ + berkshelf:6.3.1 \ + io-console:0.4.6 \ + etc webrick \ + --no-document && \ + gem cleanup && \ + apt-get update -y && \ + apt-get install -y binutils jq && \ + apt-get clean + +# Replace Jetty user ID +ENV USER_JETTY="jetty" +ENV GROUP_JETTY="jetty" +ENV UID_JETTY="352070" +ENV GID_JETTY="35953" + +# Remove user: +RUN deluser ${USER_JETTY} +#RUN delgroup ${GROUP_JETTY} +RUN echo "${USER_JETTY}:x:${UID_JETTY}:${GID_JETTY}::/home/${USER_JETTY}:Linux User,,,:/home/jetty:/bin/false" >> /etc/passwd +RUN echo "${GROUP_JETTY}:x:${GID_JETTY}:${USER_JETTY}" >> /etc/group +RUN echo "${USER_JETTY}:!:17501:0:99999:7:::" >> /etc/shadow +RUN mkdir /home/${USER_JETTY} && chown ${USER_JETTY}:${GROUP_JETTY} /home/${USER_JETTY} +RUN chown -R jetty:jetty ${JETTY_BASE}/webapps /var/lib/jetty + +USER jetty RUN mkdir -p ${JETTY_BASE}/config/catalog-fe @@ -14,4 +58,4 @@ COPY --chown=jetty:jetty startup.sh ${JETTY_BASE} RUN chmod 770 ${JETTY_BASE}/startup.sh -ENTRYPOINT ${JETTY_BASE}/startup.sh +ENTRYPOINT [ "sh", "-c", "${JETTY_BASE}/startup.sh"] \ No newline at end of file diff --git a/catalog-fe/sdc-frontend/startup.sh b/catalog-fe/sdc-frontend/startup.sh index 9eb742fd2b..b2443f1aee 100644 --- a/catalog-fe/sdc-frontend/startup.sh +++ b/catalog-fe/sdc-frontend/startup.sh @@ -14,6 +14,5 @@ cd /var/lib/jetty/chef-solo chef-solo -c solo.rb -E ${ENVNAME} cd /var/lib/jetty -/docker-entrypoint.sh & -while true; do sleep 2; done +java $JAVA_OPTIONS -jar "$JETTY_HOME/start.jar" diff --git a/catalog-fe/src/test/java/org/openecomp/sdc/fe/servlets/PortalServletTest.java b/catalog-fe/src/test/java/org/openecomp/sdc/fe/servlets/PortalServletTest.java index fccb41bc99..35b775a227 100644 --- a/catalog-fe/src/test/java/org/openecomp/sdc/fe/servlets/PortalServletTest.java +++ b/catalog-fe/src/test/java/org/openecomp/sdc/fe/servlets/PortalServletTest.java @@ -28,7 +28,6 @@ import org.junit.BeforeClass; import org.junit.Test; import org.mockito.Mockito; import org.mockito.stubbing.Answer; -import org.onap.sdc.security.CipherUtil; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.fe.config.Configuration; import org.openecomp.sdc.fe.config.ConfigurationManager; @@ -64,7 +63,6 @@ public class PortalServletTest extends JerseyTest { private final static Configuration configuration = Mockito.mock(Configuration.class); private final static HttpServletResponse response = Mockito.spy(HttpServletResponse.class); private final static RequestDispatcher rd = Mockito.spy(RequestDispatcher.class); - private static CipherUtil cipherUtil = Mockito.mock(CipherUtil.class); final static Configuration.CookieConfig cookieConfiguration = Mockito.mock(Configuration.CookieConfig.class); @SuppressWarnings("serial") diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/ToscaType.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/ToscaType.java index 71abc54cb7..034f6fab92 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/ToscaType.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/ToscaType.java @@ -25,6 +25,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import java.io.IOException; import java.text.DateFormat; import java.text.ParseException; +import java.text.SimpleDateFormat; import java.util.List; import java.util.Locale; import java.util.Map; @@ -90,7 +91,7 @@ public enum ToscaType { return true; case TIMESTAMP: try { - DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM, Locale.US).parse(value); + new SimpleDateFormat("MMM dd, yyyy hh:mm:ss a", Locale.US).parse(value); return true; } catch (ParseException e) { return false; @@ -168,7 +169,7 @@ public enum ToscaType { return Long.valueOf(value); case TIMESTAMP: try { - return DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM, Locale.US).parse(value); + return new SimpleDateFormat("MMM dd, yyyy hh:mm:ss a", Locale.US).parse(value); } catch (ParseException e) { throw new IllegalArgumentException("Value must be a valid timestamp", e); } diff --git a/common-app-api/pom.xml b/common-app-api/pom.xml index 39be0353af..ee5f412249 100644 --- a/common-app-api/pom.xml +++ b/common-app-api/pom.xml @@ -268,6 +268,31 @@ + + + src/test/resources + + **/*.zip + + true + + + src/test/resources/zip + + **.zip + + false + zip + + + src/test/resources/zip-slip + + **.zip + + false + zip-slip + + com.github.sylvainlaurent.maven diff --git a/common/onap-tosca-datatype/pom.xml b/common/onap-tosca-datatype/pom.xml index 9a621e02f1..e6c6bc5b28 100644 --- a/common/onap-tosca-datatype/pom.xml +++ b/common/onap-tosca-datatype/pom.xml @@ -33,7 +33,7 @@ org.yaml snakeyaml - 1.17 + ${snakeyaml.version} org.apache.commons @@ -90,4 +90,12 @@ test + + + + src/test/resources + true + + + diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeTemplate.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeTemplate.java index 82f1581fa9..ae1ca01673 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeTemplate.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeTemplate.java @@ -20,16 +20,23 @@ package org.onap.sdc.tosca.datatypes.model; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; +import java.util.Set; + import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; + +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.MapUtils; import org.onap.sdc.tosca.error.ToscaRuntimeException; +import org.onap.sdc.tosca.services.ToscaExtensionYamlUtil; import org.onap.sdc.tosca.services.YamlUtil; +import org.yaml.snakeyaml.constructor.ConstructorException; @Getter @@ -37,6 +44,7 @@ import org.onap.sdc.tosca.services.YamlUtil; @EqualsAndHashCode public class NodeTemplate implements Template, Cloneable { + private static final String INVALID_TOSCA_REQUIREMENT_SECTION = "Invalid TOSCA requirement section"; private String type; private String description; private Map metadata; @@ -50,6 +58,62 @@ public class NodeTemplate implements Template, Cloneable { private NodeFilter node_filter; private String copy; + public void setRequirements(List requirementAssignmentObj) { + this.requirements = convertToscaRequirementAssignment(requirementAssignmentObj); + } + + public static List> convertToscaRequirementAssignment(List requirementAssignmentObj) { + + List> convertedRequirements = new ArrayList<>(); + if (CollectionUtils.isEmpty(requirementAssignmentObj)) { + return null; + } + for (Object requirementEntry : requirementAssignmentObj) { + convertToscaRequirementAssignmentEntry(convertedRequirements, requirementEntry); + } + return convertedRequirements; + } + + private static void convertToscaRequirementAssignmentEntry(List> convertedRequirements, Object requirementEntry) { + if (requirementEntry instanceof Map) { + try { + Set> requirementEntries = ((Map)requirementEntry).entrySet(); + for (Map.Entry toscaRequirements : requirementEntries) { + String key = toscaRequirements.getKey(); + Object requirementValue = toscaRequirements.getValue(); + if (requirementValue instanceof Map) { + RequirementAssignment requirementObject; + try { + YamlUtil yamlUtil = new YamlUtil(); + requirementObject = yamlUtil + .yamlToObject(yamlUtil.objectToYaml(requirementValue), RequirementAssignment.class); + } catch (ConstructorException ex) { + // The requirement might contains extended attribute, so try to parse it into RequirementAssignmentExt as well + ToscaExtensionYamlUtil toscaExtensionYamlUtil = new ToscaExtensionYamlUtil(); + requirementObject = toscaExtensionYamlUtil + .yamlToObject(toscaExtensionYamlUtil.objectToYaml(requirementValue), RequirementAssignment.class); + } + Map convertedToscaRequirement = new HashMap<>(); + convertedToscaRequirement.put(key, requirementObject); + convertedRequirements.add(convertedToscaRequirement); + } else if (requirementValue instanceof RequirementAssignment) { + Map convertedToscaRequirement = new HashMap<>(); + convertedToscaRequirement.put(key, (RequirementAssignment)requirementValue); + convertedRequirements.add(convertedToscaRequirement); + } + } + } catch (Exception ex) { + throw new ToscaRuntimeException(INVALID_TOSCA_REQUIREMENT_SECTION, ex); + } + } + } + + public void addRequirements(Map newRequirement) { + if (CollectionUtils.isEmpty(this.requirements)) { + this.requirements = new ArrayList>(); + } + this.requirements.add(newRequirement); + } public Map getNormalizeInterfaces() { if (MapUtils.isEmpty(interfaces)) { diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/NodeTemplateTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/NodeTemplateTest.java index b9f2b838c2..e265d4bd8b 100644 --- a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/NodeTemplateTest.java +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/NodeTemplateTest.java @@ -75,17 +75,17 @@ public class NodeTemplateTest { @Test public void shouldHaveValidGettersAndSetters() { - assertThat(NodeTemplate.class, hasValidGettersAndSettersExcluding("normalizeInterfaces")); + assertThat(NodeTemplate.class, hasValidGettersAndSettersExcluding("requirements", "normalizeInterfaces")); } @Test public void shouldHaveValidEquals() { - assertThat(NodeTemplate.class, hasValidBeanEqualsExcluding("normalizeInterfaces")); + assertThat(NodeTemplate.class, hasValidBeanEqualsExcluding("requirements", "normalizeInterfaces")); } @Test public void shouldHaveValidHashCode() { - assertThat(NodeTemplate.class, hasValidBeanHashCodeExcluding("normalizeInterfaces")); + assertThat(NodeTemplate.class, hasValidBeanHashCodeExcluding("requirements", "normalizeInterfaces")); } private InterfaceDefinitionTemplate createInterfaceDefinitionTemplate() { diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index e292195c38..ce38c9ee9c 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -485,9 +485,7 @@ limitations under the License. ${it.sdc.password} ${it.env.name} onap/cert - -Xdebug - -agentlib:jdwp=transport=dt_socket,address=4001,server=y,suspend=n -Xmx1g -Xms1g - + -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:4001 -Xmx1g -Xms1g sdc-onboard-BE @@ -498,7 +496,7 @@ limitations under the License. - + sdc-onboard-BE direct @@ -531,10 +529,8 @@ limitations under the License. ${it.cassandra.ssl.enabled} ${it.env.name} - -Xdebug - -agentlib:jdwp=transport=dt_socket,address=4000,server=y,suspend=n -Xmx1536m - -Xms1536m - + -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:4000 + -Xmx1536m -Xms1536m sdc-BE @@ -601,10 +597,8 @@ limitations under the License. ${it.env.name} - -Xdebug - -agentlib:jdwp=transport=dt_socket,address=6000,server=y,suspend=n -Xmx256m - -Xms256m - + -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:6000 + -Xmx256m -Xms256m sdc-FE diff --git a/onboarding/pom.xml b/onboarding/pom.xml index 034c642de3..55823b1163 100644 --- a/onboarding/pom.xml +++ b/onboarding/pom.xml @@ -38,13 +38,10 @@ true - 1.8 - 1.8 UTF-8 2.1 - 3.7.0 2.5 3.1.0 2.4 diff --git a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/Dockerfile b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/Dockerfile index 78a8f64a93..9c6275d87a 100644 --- a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/Dockerfile +++ b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/Dockerfile @@ -1,15 +1,54 @@ -FROM onap/base_sdc-jetty:1.7.0 +FROM jetty:9.4.31-jre11-slim -COPY --chown=jetty:jetty chef-solo ${JETTY_BASE}/chef-solo/ +USER root -COPY --chown=jetty:jetty chef-repo/cookbooks ${JETTY_BASE}/chef-solo/cookbooks/ +# Install Chef +RUN set -ex && \ + apt-get update -y && \ + apt-get install -y \ + jq \ + curl \ + vim \ + make \ + gcc \ + ruby \ + ruby-dev \ + libffi-dev \ + libxml2-dev && \ + gem install \ + chef:13.8.5 \ + berkshelf:6.3.1 \ + io-console:0.4.6 \ + etc webrick \ + --no-document && \ + gem cleanup && \ + apt-get update -y && \ + apt-get install -y binutils jq && \ + apt-get clean -ADD --chown=jetty:jetty onboarding-be-*.war ${JETTY_BASE}/webapps/ +# Replace Jetty user ID +ENV USER_JETTY="jetty" +ENV GROUP_JETTY="jetty" +ENV UID_JETTY="352070" +ENV GID_JETTY="35953" -ADD --chown=jetty:jetty api-docs.war ${JETTY_BASE}/webapps/ +# Remove user: +RUN deluser ${USER_JETTY} +#RUN delgroup ${GROUP_JETTY} +RUN echo "${USER_JETTY}:x:${UID_JETTY}:${GID_JETTY}::/home/${USER_JETTY}:Linux User,,,:/home/jetty:/bin/false" >> /etc/passwd +RUN echo "${GROUP_JETTY}:x:${GID_JETTY}:${USER_JETTY}" >> /etc/group +RUN echo "${USER_JETTY}:!:17501:0:99999:7:::" >> /etc/shadow +RUN mkdir /home/${USER_JETTY} && chown ${USER_JETTY}:${GROUP_JETTY} /home/${USER_JETTY} +RUN chown -R jetty:jetty ${JETTY_BASE}/webapps /var/lib/jetty + +USER jetty -COPY --chown=jetty:jetty startup.sh ${JETTY_BASE}/ +COPY --chown=jetty:jetty chef-solo ${JETTY_BASE}/chef-solo/ +COPY --chown=jetty:jetty chef-repo/cookbooks ${JETTY_BASE}/chef-solo/cookbooks/ +ADD --chown=jetty:jetty onboarding-be-*.war ${JETTY_BASE}/webapps/ +ADD --chown=jetty:jetty api-docs.war ${JETTY_BASE}/webapps/ +COPY --chown=jetty:jetty startup.sh ${JETTY_BASE}/ RUN chmod 770 ${JETTY_BASE}/startup.sh -ENTRYPOINT ${JETTY_BASE}/startup.sh +ENTRYPOINT [ "sh", "-c", "${JETTY_BASE}/startup.sh"] diff --git a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/startup.sh b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/startup.sh index df8cefbd85..cf1b6227ad 100644 --- a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/startup.sh +++ b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/startup.sh @@ -1,10 +1,9 @@ #!/bin/sh - cd /var/lib/jetty/chef-solo chef-solo -c solo.rb -E ${ENVNAME} rc=$? -if [[ $rc != 0 ]]; then +if [ $rc -ne 0 ]; then echo "Chef exaction failed." exit $rc; fi @@ -19,6 +18,4 @@ JAVA_OPTIONS=" ${JAVA_OPTIONS} \ cd /var/lib/jetty -/docker-entrypoint.sh & - -while true; do sleep 2; done +java $JAVA_OPTIONS -jar "$JETTY_HOME/start.jar" diff --git a/openecomp-be/dist/sdc-onboard-db-init-docker/artifacts/Dockerfile b/openecomp-be/dist/sdc-onboard-db-init-docker/artifacts/Dockerfile index 788ca48ecc..226654ddc3 100644 --- a/openecomp-be/dist/sdc-onboard-db-init-docker/artifacts/Dockerfile +++ b/openecomp-be/dist/sdc-onboard-db-init-docker/artifacts/Dockerfile @@ -1,4 +1,34 @@ -FROM onap/base_sdc-cqlsh:1.7.0 +FROM onap/policy-jdk-debian:2.0.1 + +#RUN addgroup --gid 1000 sdc +RUN addgroup sdc +#RUN adduser --gecos "sdc sdc,1,1,1" -u 1000 --disabled-password --ingroup sdc --shell /bin/sh sdc +RUN adduser --gecos "sdc sdc,1,1,1" --disabled-password --ingroup sdc --shell /bin/sh sdc +USER sdc +RUN mkdir ~/.cassandra/ && \ + echo '[cql]' > ~/.cassandra/cqlshrc && \ + echo 'version=3.4.4' >> ~/.cassandra/cqlshrc +USER root + +RUN apt-get update && apt-get install -y python-pip && \ + pip install cqlsh && \ + mkdir ~/.cassandra/ && \ + echo '[cql]' > ~/.cassandra/cqlshrc && \ + echo 'version=3.4.4' >> ~/.cassandra/cqlshrc && \ + set -ex && \ + pip install cqlsh && \ + apt-get install -y \ + make \ + gcc \ + ruby \ + ruby-dev \ + libffi-dev \ + libxml2-dev && \ + gem install chef:13.8.5 berkshelf:6.3.1 io-console:0.4.6 etc webrick --no-document && \ + apt-get update -y && \ + apt-get install -y binutils && apt-get clean && gem cleanup + +USER sdc COPY --chown=sdc:sdc init_keyspaces.cql /home/sdc/ diff --git a/openecomp-be/lib/openecomp-heat-lib/pom.xml b/openecomp-be/lib/openecomp-heat-lib/pom.xml index f20b24aa95..eee0b85e40 100644 --- a/openecomp-be/lib/openecomp-heat-lib/pom.xml +++ b/openecomp-be/lib/openecomp-heat-lib/pom.xml @@ -72,6 +72,12 @@ ${project.version} - - + + + + src/test/resources + true + + + diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/pom.xml b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/pom.xml index cf0150a58e..950f5dc923 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/pom.xml @@ -31,6 +31,11 @@ lombok compile + + javax.xml.bind + jaxb-api + ${jaxb-api.version} + diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/pom.xml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/pom.xml index d635fb0a08..83ad8738d5 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/pom.xml @@ -81,6 +81,12 @@ + + + src/test/resources + true + + org.apache.maven.plugins diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/pom.xml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/pom.xml index a63fc9bfdd..eeca992bc8 100644 --- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/pom.xml +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/pom.xml @@ -58,5 +58,23 @@ openecomp-tosca-converter-core - + + + + src/test/resources + + **/*.csar + + true + + + src/test/resources/csar + + **.csar + + false + csar + + + \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/impl/ToscaSolConverterVnfTest.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/impl/ToscaSolConverterVnfTest.java index f130f262a7..a9ee1a7518 100644 --- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/impl/ToscaSolConverterVnfTest.java +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/impl/ToscaSolConverterVnfTest.java @@ -135,7 +135,7 @@ public class ToscaSolConverterVnfTest { } private byte[] getFileResource(final String filePath) { - try (final InputStream inputStream = ClassLoader.class.getResourceAsStream(filePath)) { + try (final InputStream inputStream = this.getClass().getResourceAsStream(filePath)) { return IOUtils.toByteArray(inputStream); } catch (final IOException ex) { fail(String.format("Could not load file: %s", filePath)); diff --git a/openecomp-be/lib/openecomp-tosca-lib/pom.xml b/openecomp-be/lib/openecomp-tosca-lib/pom.xml index 6867d17cde..fd1728e905 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/pom.xml +++ b/openecomp-be/lib/openecomp-tosca-lib/pom.xml @@ -109,6 +109,24 @@ false - + + + + src/test/resources + + **/*.csar + + true + + + src/test/resources/mock/analyzerService + + **.csar + + false + mock/analyzerService + + + diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java index 70cae71f17..f7188379dc 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java @@ -373,12 +373,9 @@ public class DataModelUtil { throw new CoreException(new InvalidRequirementAssignmentErrorBuilder(requirementId).build()); } - if (nodeTemplate.getRequirements() == null) { - nodeTemplate.setRequirements(new ArrayList<>()); - } Map requirement = new HashMap<>(); requirement.put(requirementId, requirementAssignment); - nodeTemplate.getRequirements().add(requirement); + nodeTemplate.addRequirements(requirement); } /** diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/ToscaModelTest.java b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/ToscaModelTest.java index 4ad4d2b53e..5a19eacf3e 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/ToscaModelTest.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/ToscaModelTest.java @@ -268,8 +268,7 @@ public class ToscaModelTest { Map nodeTemplateRequirement2 = new HashMap<>(); nodeTemplateRequirement1.put(REQ1, reqAssignment1); nodeTemplateRequirement2.put(REQ2, reqAssignment2); - nodeTemplate.setRequirements(new ArrayList<>()); - nodeTemplate.getRequirements().add(nodeTemplateRequirement1); + nodeTemplate.addRequirements(nodeTemplateRequirement1); nodeTemplate.getRequirements().add(nodeTemplateRequirement2); CapabilityAssignment capAss = new CapabilityAssignment(); diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/DataModelUtilTest.java b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/DataModelUtilTest.java index fe4a37f39b..8b732df95c 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/DataModelUtilTest.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/DataModelUtilTest.java @@ -681,7 +681,7 @@ public class DataModelUtilTest { requirementAssignment1.setRelationship("relationshipId"); DataModelUtil.removeRequirementAssignment(nodeTemplate, REQUIREMENT_KEY, requirementAssignment); - assertTrue(requirementList.isEmpty()); + assertTrue(nodeTemplate.getRequirements().isEmpty()); } @Test diff --git a/pom.xml b/pom.xml index 6b727da9aa..aa887e83b7 100644 --- a/pom.xml +++ b/pom.xml @@ -20,9 +20,9 @@ Modifications copyright (c) 2018-2019 Nokia ================================================================================ --> - 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"> + 4.0.0 org.openecomp.sdc sdc-main @@ -30,695 +30,699 @@ Modifications copyright (c) 2018-2019 Nokia pom sdc - - org.onap.oparent - oparent - 2.0.0 - - - - - UTF-8 - - ${project.version} - - - 0.11 - 3.10 - 18.0 - 0.3.1 - 4.3.18.RELEASE - 2.27 - 4.1.48.Final - 3.1.0 - 2.26.3 - 2.6.0 - 4.3.1.0 - 2.1.8 - 1.18.12 - 1.9.4 - 2.3 - 4.1.0 - 1.6.1 - 1.9 - - 4.1 - 2.1 - - 9.4.18.v20190429 - - - 2.11.0 - ${jackson.version} - - 2.1.1 - false - - - 1.14 - 4.7 - 4.5.3 - 4.4.1 - 1.1 - - - - 1.2.3 - 1.7.25 - 1.10 - 1.2 - 3.0.6 - 2.13.1 - - - 0.20.1 - 1.8.4 - 1.7.4 - 0.13.2 - - - - 1.6.4 - - 3.0.3 - - - 2.3.1 - - - 1.1 - - - 3.3.3 - 3.3.3 - 1.35 - 4.12 - 1.6.0 - 5.6.0 - 3.16.0 - 7.2.0 - 5.6.0 - 0.11 - 2.1 - 1.3 - 2.22.2 - 2.4 - - - 1.6.5 - - - ${project.version} - ${project.basedir}/node/node - ${project.build.directory}/surefire-reports - - ${project.build.directory}/code-coverage/lcov.info - - - ${project.reporting.outputDirectory}/jacoco-ut/jacoco.xml - - ${project.build.sourceEncoding} - ${project.basedir} - pom.xml,src/test - - 3.8.0 - - nexus - nexus - - - https://registry.npmjs.org/ - https://nexus.onap.org - /content/sites/site/org/openecomp/sdc/${project.version} - 176c31dfe190a - - yyyyMMdd'T'HHmmss'Z' - - ${project.version}-${maven.build.timestamp} - - 2.6.1.Final - - 2.9.9 - - - 1.6.0 - - 0.8.5 - 4.5.1 - - - 1C - true - - - - - - com.google.guava - guava - ${guava.version} - - - - org.glassfish.jersey.ext - jersey-bean-validation - ${jersey-bom.version} - - - - org.glassfish.hk2.external - asm-all-repackaged - 2.4.0 - - - - org.assertj - assertj-core - ${assertj.version} - - - - org.jmockit - jmockit - ${jmockit.version} - - - - com.github.tomakehurst - wiremock-standalone - ${wire-mock.version} - - - - io.cucumber - cucumber-java - ${cucumber.version} - - - - io.cucumber - cucumber-junit - ${cucumber.version} - - - - org.apache.commons - commons-lang3 - ${lang3.version} - - - org.codehaus.groovy - groovy - 2.4.13 - - - io.netty - netty-all - ${netty.version} - - - io.netty - netty-handler - ${netty.version} - - - - - - - - org.jacoco - org.jacoco.agent - runtime - ${jacoco.version} - test - - - - org.junit.jupiter - junit-jupiter-engine - ${junitJupiter.version} - test - - - - org.junit.vintage - junit-vintage-engine - ${junitJupiter.version} - test - - - - org.mockito - mockito-core - ${mockito.version} - test - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 3.0.1 - - false - org.umlgraph.doclet.UmlGraphDoc - - org.umlgraph - umlgraph - 5.6 - - true - - - - - - - - - - org.jacoco - jacoco-maven-plugin - ${jacoco.version} - - - org.apache.maven.plugins - maven-assembly-plugin - 3.1.0 - - posix - - - - - org.codehaus.mojo - exec-maven-plugin - 1.6.0 - - - org.sonarsource.scanner.maven - sonar-maven-plugin - 3.7.0.1746 - - - org.apache.maven.plugins - maven-clean-plugin - 3.1.0 - - - ru.yaal.maven - write-text-files-maven-plugin - 1.1 - - - org.codehaus.gmaven - gmaven-plugin - 1.5 - - - org.codehaus.mojo - build-helper-maven-plugin - 3.2.0 - - - org.apache.maven.plugins - maven-deploy-plugin - 2.8.2 - - - org.apache.maven.plugins - maven-shade-plugin - 3.1.1 - - - org.apache.maven.plugins - maven-resources-plugin - 3.2.0 - - - io.fabric8 - docker-maven-plugin - 0.31.0 - - - org.apache.maven.plugins - maven-war-plugin - 3.2.2 - - - com.github.eirslett - frontend-maven-plugin - 1.8.0 - - - org.apache.maven.plugins - maven-surefire-plugin - ${maven-surefire-plugin.version} - - - org.apache.maven.plugins - maven-failsafe-plugin - ${maven-surefire-plugin.version} - - - org.apache.maven.plugins - maven-compiler-plugin - 3.8.0 - - - com.github.sylvainlaurent.maven - yaml-json-validator-maven-plugin - 1.0.2 - - - pl.project13.maven - git-commit-id-plugin - 4.0.0 - - - - - - - maven-checkstyle-plugin - 2.17 - - checkstyle-suppressions.xml - checkstyle.suppressions.file - ${checkstyle.skip} - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - parse-version - pre-clean - - parse-version - - - - - - - - org.jacoco - jacoco-maven-plugin - false - - - default-instrument - - instrument - - - - default-restore-instrumented-classes - - restore-instrumented-classes - - - - default-report - - report - - - ${project.build.directory}/jacoco.exec - - - - - - - org.apache.maven.plugins - maven-site-plugin - 3.7.1 - - - org.apache.maven.wagon - wagon-webdav-jackrabbit - 3.0.0 - - - - - - - org.codehaus.gmaven - gmaven-plugin - - - false - integration-test - - execute - - - - pom.properties['deploy.url'] = - pom.version.contains('-SNAPSHOT') ? - project.distributionManagement.snapshotRepository.url : - project.distributionManagement.repository.url; - pom.properties['repo.id'] = pom.version.contains('-SNAPSHOT') ? - project.distributionManagement.snapshotRepository.id : - project.distributionManagement.repository.id; - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.8 - 1.8 - - - - org.apache.maven.plugins - maven-surefire-plugin + + org.onap.oparent + oparent + 2.0.0 + + + + + UTF-8 + + ${project.version} + + + 0.11 + 3.10 + 18.0 + 0.3.1 + 4.3.18.RELEASE + 2.27 + 4.1.48.Final + 3.1.0 + 2.26.3 + 2.6.0 + 4.3.1.0 + 2.1.8 + 1.18.12 + 1.9.4 + 2.3 + 4.1.0 + 1.6.1 + 1.9 + 2.3.1 + + 4.1 + 2.1 + + 9.4.18.v20190429 + + + 2.11.0 + ${jackson.version} + + 2.1.1 + false + + + 1.14 + 4.7 + 4.5.3 + 4.4.1 + 1.1 + + + + 1.2.3 + 1.7.25 + 1.10 + 1.2 + 3.0.6 + 2.13.1 + + + 0.20.1 + 1.8.4 + 1.7.4 + 0.13.2 + + + + 1.6.4 + + 3.0.3 + + + 2.3.1 + + + 1.1 + + + 3.3.3 + 3.3.3 + 1.35 + 4.12 + 1.6.0 + 5.6.0 + 3.16.0 + 7.2.0 + 5.6.0 + 0.11 + 2.1 + 1.3 + 2.22.2 + 2.4 + + + 1.6.5 + + + ${project.version} + ${project.basedir}/node/node + ${project.build.directory}/surefire-reports + + ${project.build.directory}/code-coverage/lcov.info + + + ${project.reporting.outputDirectory}/jacoco-ut/jacoco.xml + + ${project.build.sourceEncoding} + ${project.basedir} + pom.xml,src/test + + 3.8.0 + + nexus + nexus + + + https://registry.npmjs.org/ + https://nexus.onap.org + /content/sites/site/org/openecomp/sdc/${project.version} + 176c31dfe190a + + yyyyMMdd'T'HHmmss'Z' + + ${project.version}-${maven.build.timestamp} + + 2.6.1.Final + + 2.9.9 + + + 1.6.0 + + 0.8.5 + + 4.5.1 + + + 1C + true + + + - - org.apache.maven.surefire - surefire-junit-platform - ${maven-surefire-plugin.version} - + + com.google.guava + guava + ${guava.version} + + + + org.glassfish.jersey.ext + jersey-bean-validation + ${jersey-bom.version} + + + + org.glassfish.hk2.external + asm-all-repackaged + 2.4.0 + + + + org.assertj + assertj-core + ${assertj.version} + + + + org.jmockit + jmockit + ${jmockit.version} + + + + com.github.tomakehurst + wiremock-standalone + ${wire-mock.version} + + + + io.cucumber + cucumber-java + ${cucumber.version} + + + + io.cucumber + cucumber-junit + ${cucumber.version} + + + + org.apache.commons + commons-lang3 + ${lang3.version} + + + org.codehaus.groovy + groovy + 2.4.13 + + + io.netty + netty-all + ${netty.version} + + + io.netty + netty-handler + ${netty.version} + - - false - - ${project.build.directory}/jacoco.exec - - ${surefire.forkCount} - ${surefire.reuseForks} - methods - - - - pl.project13.maven - git-commit-id-plugin - - - - revision - - - - - true - ${project.build.outputDirectory}/META-INF/git.properties - - true - false - - git.build.version - git.build.time - git.commit.id - git.commit.time - git.commit.user.name - git.commit.user.email - git.commit.message.short - git.commit.message.full - - - true - - false - - - - - - - - all - - true - - - true - - - onboarding - common-app-logging - common-app-api - common-be - catalog-dao - catalog-model - catalog-be - catalog-be-plugins - asdctool - catalog-ui - catalog-fe - sdc-os-chef - utils/webseal-simulator - integration-tests - - - - skip-integration-tests - - - skipITs - true - - - - true - - - onboarding - common-app-logging - common-app-api - common-be - catalog-dao - catalog-model - catalog-be - asdctool - catalog-ui - catalog-fe - sdc-os-chef - utils/webseal-simulator - - - - fast-build - - false - - - true - true - true - true - - - onboarding - common-app-logging - common-app-api - common-be - catalog-be-plugins - catalog-dao - catalog-model - catalog-be - asdctool - catalog-ui - catalog-fe - sdc-os-chef - utils/webseal-simulator - - - - start-sdc - - false - - - true - true - true - true - true - - - integration-tests - - - - stop-sdc - - false - - - true - true - true - true - true - - - integration-tests - - - - run-integration-tests - - false - - - true - true - true - - - integration-tests - - - - - - - - ecomp-releases - Release Repository - ${nexus.proxy}/content/repositories/releases/ - - - ecomp-snapshots - Snapshots Repository - ${nexus.proxy}/content/repositories/snapshots/ - - - ecomp-public - Public Repository - ${nexus.proxy}/content/repositories/public/ - - - - - - - ecomp-releases - Release Repository - ${nexus.proxy}/content/repositories/releases/ - - - ecomp-snapshots - Snapshot Repository - ${nexus.proxy}/content/repositories/snapshots/ - - - ecomp-site - dav:${nexus.proxy}${sitePath} - - + + + + + + org.jacoco + org.jacoco.agent + runtime + ${jacoco.version} + test + + + + org.junit.jupiter + junit-jupiter-engine + ${junitJupiter.version} + test + + + + org.junit.vintage + junit-vintage-engine + ${junitJupiter.version} + test + + + + org.mockito + mockito-core + ${mockito.version} + test + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.0.1 + + false + org.umlgraph.doclet.UmlGraphDoc + + org.umlgraph + umlgraph + 5.6 + + true + + + + + + + + + + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + org.apache.maven.plugins + maven-assembly-plugin + 3.1.0 + + posix + + + + + org.codehaus.mojo + exec-maven-plugin + 1.6.0 + + + org.sonarsource.scanner.maven + sonar-maven-plugin + 3.7.0.1746 + + + org.apache.maven.plugins + maven-clean-plugin + 3.1.0 + + + ru.yaal.maven + write-text-files-maven-plugin + 1.1 + + + org.codehaus.gmaven + gmaven-plugin + 1.5 + + + org.codehaus.mojo + build-helper-maven-plugin + 3.2.0 + + + org.apache.maven.plugins + maven-deploy-plugin + 2.8.2 + + + org.apache.maven.plugins + maven-shade-plugin + 3.1.1 + + + org.apache.maven.plugins + maven-resources-plugin + 3.2.0 + + + io.fabric8 + docker-maven-plugin + 0.31.0 + + + org.apache.maven.plugins + maven-war-plugin + 3.2.2 + + + com.github.eirslett + frontend-maven-plugin + 1.8.0 + + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + org.apache.maven.plugins + maven-failsafe-plugin + ${maven-surefire-plugin.version} + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + + com.github.sylvainlaurent.maven + yaml-json-validator-maven-plugin + 1.0.2 + + + pl.project13.maven + git-commit-id-plugin + 4.0.0 + + + + + + + maven-checkstyle-plugin + 2.17 + + checkstyle-suppressions.xml + checkstyle.suppressions.file + ${checkstyle.skip} + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + parse-version + pre-clean + + parse-version + + + + + + + + org.jacoco + jacoco-maven-plugin + false + + + default-instrument + + instrument + + + + default-restore-instrumented-classes + + restore-instrumented-classes + + + + default-report + + report + + + ${project.build.directory}/jacoco.exec + + + + + + + org.apache.maven.plugins + maven-site-plugin + 3.7.1 + + + org.apache.maven.wagon + wagon-webdav-jackrabbit + 3.0.0 + + + + + + + org.codehaus.gmaven + gmaven-plugin + + + false + integration-test + + execute + + + + pom.properties['deploy.url'] = + pom.version.contains('-SNAPSHOT') ? + project.distributionManagement.snapshotRepository.url : + project.distributionManagement.repository.url; + pom.properties['repo.id'] = pom.version.contains('-SNAPSHOT') ? + project.distributionManagement.snapshotRepository.id : + project.distributionManagement.repository.id; + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 11 + 11 + + + + org.apache.maven.plugins + maven-surefire-plugin + + + org.apache.maven.surefire + surefire-junit-platform + ${maven-surefire-plugin.version} + + + + false + + ${project.build.directory}/jacoco.exec + + ${surefire.forkCount} + ${surefire.reuseForks} + methods + + + + pl.project13.maven + git-commit-id-plugin + + + + revision + + + + + true + ${project.build.outputDirectory}/META-INF/git.properties + + true + false + + git.build.version + git.build.time + git.commit.id + git.commit.time + git.commit.user.name + git.commit.user.email + git.commit.message.short + git.commit.message.full + + + true + + false + + + + + + + + all + + true + + + true + + + onboarding + common-app-logging + common-app-api + common-be + catalog-dao + catalog-model + catalog-be + catalog-be-plugins + asdctool + catalog-ui + catalog-fe + sdc-os-chef + utils/webseal-simulator + integration-tests + + + + skip-integration-tests + + + skipITs + true + + + + true + + + onboarding + common-app-logging + common-app-api + common-be + catalog-dao + catalog-model + catalog-be + catalog-be-plugins + asdctool + catalog-ui + catalog-fe + sdc-os-chef + utils/webseal-simulator + + + + fast-build + + false + + + true + true + true + true + + + onboarding + common-app-logging + common-app-api + common-be + catalog-dao + catalog-model + catalog-be + catalog-be-plugins + asdctool + catalog-ui + catalog-fe + sdc-os-chef + utils/webseal-simulator + + + + start-sdc + + false + + + true + true + true + true + true + + + integration-tests + + + + stop-sdc + + false + + + true + true + true + true + true + + + integration-tests + + + + run-integration-tests + + false + + + true + true + true + + + integration-tests + + + + + + + + + ecomp-releases + Release Repository + ${nexus.proxy}/content/repositories/releases/ + + + ecomp-snapshots + Snapshots Repository + ${nexus.proxy}/content/repositories/snapshots/ + + + ecomp-public + Public Repository + ${nexus.proxy}/content/repositories/public/ + + + + + + + ecomp-releases + Release Repository + ${nexus.proxy}/content/repositories/releases/ + + + ecomp-snapshots + Snapshot Repository + ${nexus.proxy}/content/repositories/snapshots/ + + + ecomp-site + dav:${nexus.proxy}${sitePath} + + diff --git a/utils/webseal-simulator/sdc-simulator/Dockerfile b/utils/webseal-simulator/sdc-simulator/Dockerfile index d217d5aabf..24a7dd1943 100644 --- a/utils/webseal-simulator/sdc-simulator/Dockerfile +++ b/utils/webseal-simulator/sdc-simulator/Dockerfile @@ -1,4 +1,48 @@ -FROM onap/base_sdc-jetty:1.7.0 +FROM jetty:9.4.31-jre11-slim + +USER root + +# Install Chef +RUN set -ex && \ + apt-get update -y && \ + apt-get install -y \ + jq \ + curl \ + curl \ + vim \ + make \ + gcc \ + ruby \ + ruby-dev \ + libffi-dev \ + libxml2-dev && \ + gem install \ + chef:13.8.5 \ + berkshelf:6.3.1 \ + io-console:0.4.6 \ + etc webrick \ + --no-document && \ + gem cleanup && \ + apt-get update -y && \ + apt-get install -y binutils jq && \ + apt-get clean + +# Replace Jetty user ID +ENV USER_JETTY="jetty" +ENV GROUP_JETTY="jetty" +ENV UID_JETTY="352070" +ENV GID_JETTY="35953" + +# Remove user: +RUN deluser ${USER_JETTY} +#RUN delgroup ${GROUP_JETTY} +RUN echo "${USER_JETTY}:x:${UID_JETTY}:${GID_JETTY}::/home/${USER_JETTY}:Linux User,,,:/home/jetty:/bin/false" >> /etc/passwd +RUN echo "${GROUP_JETTY}:x:${GID_JETTY}:${USER_JETTY}" >> /etc/group +RUN echo "${USER_JETTY}:!:17501:0:99999:7:::" >> /etc/shadow +RUN mkdir /home/${USER_JETTY} && chown ${USER_JETTY}:${GROUP_JETTY} /home/${USER_JETTY} +RUN chown -R jetty:jetty ${JETTY_BASE}/webapps /var/lib/jetty + +USER jetty COPY chef-solo /root/chef-solo/ @@ -10,8 +54,8 @@ USER root RUN chown -R jetty:jetty ${JETTY_BASE}/webapps -COPY startup.sh /root/ +COPY startup.sh ${JETTY_BASE}/ -RUN chmod 777 /root/startup.sh +RUN chmod 777 ${JETTY_BASE}/startup.sh -ENTRYPOINT [ "/root/startup.sh" ] +ENTRYPOINT [ "sh", "-c", "${JETTY_BASE}/startup.sh"] diff --git a/utils/webseal-simulator/sdc-simulator/startup.sh b/utils/webseal-simulator/sdc-simulator/startup.sh index 66add3a75e..3f6e2a02b5 100644 --- a/utils/webseal-simulator/sdc-simulator/startup.sh +++ b/utils/webseal-simulator/sdc-simulator/startup.sh @@ -1,11 +1,9 @@ #!/bin/sh - - cd /root/chef-solo chef-solo -c solo.rb -E ${ENVNAME} rc=$? -if [[ $rc != 0 ]]; then +if [ $rc -ne 0 ]; then echo "Chef exaction failed." exit $rc; fi @@ -21,5 +19,6 @@ JAVA_OPTIONS=" ${JAVA_OPTIONS} \ cd /var/lib/jetty -/docker-entrypoint.sh + +java $JAVA_OPTIONS -jar "$JETTY_HOME/start.jar"