aboutsummaryrefslogtreecommitdiffstats
path: root/kubernetes/robot/requirements.yaml
blob: 9b24f824d50c7a8cf652e8257d6a693910cd0fdc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Copyright © 2017 Amdocs, Bell Canada
#
# 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.

dependencies:
  - name: common
    version: ~2.0.0
    # local reference to common chart, as it is
    # a part of this chart's package and will not
    # be published independently to a repo (at this point)
    repository: '@local'
t; 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. # # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= # # # Docker file to build an image that runs the simulators # FROM onap/policy-jre-alpine:2.0.1 LABEL maintainer="Policy Team" ARG POLICY_LOGS=/var/log/onap/policy/simulators ENV POLICY_HOME /opt/app/policy ENV POLICY_LOGS ${POLICY_LOGS} # Create DMaaP simulator user and group # Add simulator-specific directories and set ownership as the simulator user RUN mkdir -p ${POLICY_HOME}/simulators \ && mkdir -p ${POLICY_HOME}/simulators/bin \ && mkdir -p ${POLICY_LOGS} \ && mkdir /packages # Unpack the tarball COPY policy-models-simulators-tarball.tar.gz /packages RUN tar xvfz /packages/policy-models-simulators-tarball.tar.gz --directory ${POLICY_HOME}/simulators \ && rm /packages/policy-models-simulators-tarball.tar.gz # Ensure everything has the correct permissions # Copy scripts simulator user area COPY simulators.sh ${POLICY_HOME}/simulators/bin RUN find /opt/app -type d -perm 755 \ && find /opt/app -type f -perm 644 \ && chmod 755 ${POLICY_HOME}/simulators/bin/* \ && chown -R policy:policy $POLICY_HOME $POLICY_LOGS USER policy:policy ENV PATH ${POLICY_HOME}/simulators/bin:$PATH ENTRYPOINT [ "bash", "simulators.sh" ] lass="cm"> * ============LICENSE_END========================================================= */ package org.onap.policy.common.im; import static org.junit.Assert.assertEquals; import java.util.List; import javax.persistence.Query; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import org.onap.policy.common.im.jpa.StateManagementEntity; import org.onap.policy.common.utils.jpa.EntityTransCloser; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class StateManagementEntityTest extends IntegrityMonitorTestBase { private static Logger logger = LoggerFactory.getLogger(StateManagementEntityTest.class); /** * Set up for the test class. */ @BeforeClass public static void setUpClass() throws Exception { IntegrityMonitorTestBase .setUpBeforeClass(DEFAULT_DB_URL_PREFIX + StateManagementEntityTest.class.getSimpleName()); } /** * Tear down after the test class. */ @AfterClass public static void tearDownClass() throws Exception { IntegrityMonitorTestBase.tearDownAfterClass(); } /** * Set up for the test cases. */ @Before public void setUp() { super.setUpTest(); } /** * Tear down after the test cases. */ @After public void tearDown() { super.tearDownTest(); } @Test public void testJpa() throws Exception { logger.debug("\n??? logger.infor StateManagementEntityTest: Entering\n\n"); // Define the resourceName for the StateManagement constructor String resourceName = "test_resource1"; // logger.debug("Create StateManagementEntity, resourceName: {}", resourceName); logger.debug("??? instantiate StateManagementEntity object"); StateManagementEntity sme = new StateManagementEntity(); logger.debug("??? setResourceName : {}", resourceName); sme.setResourceName(resourceName); logger.debug("??? getResourceName : {}", sme.getResourceName()); sme.setAdminState(StateManagement.UNLOCKED); assertEquals(StateManagement.UNLOCKED, sme.getAdminState()); sme.setOpState(StateManagement.ENABLED); assertEquals(StateManagement.ENABLED, sme.getOpState()); sme.setAvailStatus(StateManagement.NULL_VALUE); assertEquals(StateManagement.NULL_VALUE, sme.getAvailStatus()); sme.setStandbyStatus(StateManagement.COLD_STANDBY); assertEquals(StateManagement.COLD_STANDBY, sme.getStandbyStatus()); try (EntityTransCloser et = new EntityTransCloser(em.getTransaction())) { logger.debug("??? before persist"); em.persist(sme); logger.debug("??? after persist"); em.flush(); logger.debug("??? after flush"); et.commit(); logger.debug("??? after commit"); } try { Query query = em.createQuery("Select p from StateManagementEntity p where p.resourceName=:resource"); query.setParameter("resource", resourceName); // Just test that we are retrieving the right object @SuppressWarnings("rawtypes") List resourceList = query.getResultList(); if (!resourceList.isEmpty()) { // exist StateManagementEntity sme2 = (StateManagementEntity) resourceList.get(0); assertEquals(sme.getResourceName(), sme2.getResourceName()); assertEquals(sme.getAdminState(), sme2.getAdminState()); assertEquals(sme.getOpState(), sme2.getOpState()); assertEquals(sme.getAvailStatus(), sme2.getAvailStatus()); assertEquals(sme.getStandbyStatus(), sme2.getStandbyStatus()); logger.debug("--"); } else { logger.debug("Record not found, resourceName: {}", resourceName); } } catch (Exception ex) { logger.error("Exception on select query: " + ex.toString()); } logger.debug("\n\nJpaTest: Exit\n\n"); } }