Update CMSO dev project to pass all Robot ETE test 07/70207/5
authorJerry Flood <jf9860@att.com>
Wed, 10 Oct 2018 22:10:43 +0000 (18:10 -0400)
committerJerry Flood <jflood@att.com>
Thu, 11 Oct 2018 16:17:40 +0000 (12:17 -0400)
Issue-ID: OPTFRA-373
Change-Id: I05cffb239909bf6ed68c9c79f17b203357d8b057
Signed-off-by: Jerry Flood <jf9860@att.com>
Signed-off-by: Jerry Flood <jflood@att.com>
29 files changed:
cmso-database/src/main/resources/cmso-dbchangelog/onap-cmso-v1-schema.sql
cmso-robot/red.xml
cmso-robot/robot/assets/test_properties.py
cmso-robot/robot/resources/scheduler_common.robot
cmso-robot/robot/resources/scheduler_requests/create_schedule.robot
cmso-robot/robot/testsuites/VtmAccess.robot [deleted file]
cmso-service/etc/config/cmso.properties
cmso-service/pom.xml
cmso-service/src/main/java/org/onap/optf/cmso/Application.java
cmso-service/src/main/java/org/onap/optf/cmso/ApplicationPropertiesFiles.java [moved from cmso-service/src/test/java/org/onap/optf/cmso/service/H2Test.java with 71% similarity]
cmso-service/src/main/java/org/onap/optf/cmso/AuthProvider.java [new file with mode: 0644]
cmso-service/src/main/java/org/onap/optf/cmso/CMSEnvironmentPostProcessor.java
cmso-service/src/main/java/org/onap/optf/cmso/SecurityConfig.java [new file with mode: 0644]
cmso-service/src/main/java/org/onap/optf/cmso/model/ApprovalType.java
cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementChangeWindow.java
cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementDetail.java
cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementGroup.java
cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementSchedule.java
cmso-service/src/main/java/org/onap/optf/cmso/model/DomainData.java
cmso-service/src/main/java/org/onap/optf/cmso/model/Schedule.java
cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleApproval.java
cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleEvent.java
cmso-service/src/main/java/org/onap/optf/cmso/service/rs/BaseSchedulerServiceImpl.java
cmso-service/src/main/java/org/onap/optf/cmso/service/rs/HealthCheckImpl.java
cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusClient.java
cmso-service/src/main/resources/META-INF/spring.factories [new file with mode: 0644]
cmso-service/src/main/resources/application.properties
cmso-service/src/main/resources/swagger-ui/dist/swagger.json
cmso-service/src/test/java/org/onap/optf/cmso/service/rs/CMSOServiceImplTest.java [deleted file]

index 4a99994..470cb3d 100644 (file)
@@ -1,6 +1,6 @@
 
-CREATE DATABASE IF NOT EXISTS CMSCHEDULER;
-USE CMSCHEDULER;
+CREATE DATABASE IF NOT EXISTS CMSO;
+USE CMSO;
 
 CREATE TABLE IF NOT EXISTS DOMAINS (
     domain VARCHAR(256) NOT NULL,
index 368d2e8..6d935dd 100644 (file)
     <configVersion>1.0</configVersion>\r
     <robotExecEnvironment path="C:\Python27"/>\r
     <relativeTo>PROJECT</relativeTo>\r
-    <referencedLibrary type="PYTHON" name="PycURLLibrary" path="SchedulerRobot/robot/library"/>\r
-    <referencedLibrary type="PYTHON" name="RequestsLibrary" path="SchedulerRobot/robot/library"/>\r
-    <referencedLibrary type="PYTHON" name="Selenium2Library" path="SchedulerRobot/robot/library"/>\r
-    <referencedLibrary type="PYTHON" name="selenium" path="SchedulerRobot/robot/library"/>\r
-    <referencedLibrary type="PYTHON" name="SSHLibrary" path="SchedulerRobot/robot/library"/>\r
-    <referencedLibrary type="PYTHON" name="HttpLibrary" path="SchedulerRobot/robot/library"/>\r
-    <referencedLibrary type="PYTHON" name="HttpLibrary.HTTP" path="SchedulerRobot/robot/library"/>\r
-    <referencedLibrary type="PYTHON" name="StringTemplater" path="SchedulerRobot/robot/locallibrary/cmsoUtils"/>\r
-    <referencedLibrary type="PYTHON" name="UUID" path="SchedulerRobot/robot/locallibrary/cmsoUtils"/>\r
-    <referencedLibrary type="PYTHON" name="OSUtils" path="SchedulerRobot/robot/locallibrary/cmsoUtils"/>\r
-    <referencedLibrary type="PYTHON" name="HTTPUtils" path="SchedulerRobot/robot/locallibrary/cmsoUtils"/>\r
-    <referencedLibrary type="PYTHON" name="JSONUtils" path="SchedulerRobot/robot/locallibrary/cmsoUtils"/>\r
-    <referencedLibrary type="PYTHON" name="FtpLibrary" path="C:/test/jerryVNFNames/SchedulerRobot/robot/library"/>\r
+    <referencedLibrary type="PYTHON" name="PycURLLibrary" path="cmso-robot/robot/library"/>\r
+    <referencedLibrary type="PYTHON" name="RequestsLibrary" path="cmso-robot/robot/library"/>\r
+    <referencedLibrary type="PYTHON" name="Selenium2Library" path="cmso-robot/robot/library"/>\r
+    <referencedLibrary type="PYTHON" name="selenium" path="cmso-robot/robot/library"/>\r
+    <referencedLibrary type="PYTHON" name="SSHLibrary" path="cmso-robot/robot/library"/>\r
+    <referencedLibrary type="PYTHON" name="HttpLibrary" path="cmso-robot/robot/library"/>\r
+    <referencedLibrary type="PYTHON" name="HttpLibrary.HTTP" path="cmso-robot/robot/library"/>\r
+    <referencedLibrary type="PYTHON" name="StringTemplater" path="cmso-robot/robot/locallibrary/cmsoUtils"/>\r
+    <referencedLibrary type="PYTHON" name="UUID" path="cmso-robot/robot/locallibrary/cmsoUtils"/>\r
+    <referencedLibrary type="PYTHON" name="OSUtils" path="cmso-robot/robot/locallibrary/cmsoUtils"/>\r
+    <referencedLibrary type="PYTHON" name="HTTPUtils" path="cmso-robot/robot/locallibrary/cmsoUtils"/>\r
+    <referencedLibrary type="PYTHON" name="JSONUtils" path="cmso-robot/robot/locallibrary/cmsoUtils"/>\r
     <pythonpath>\r
         <path location="robot/library"/>\r
     </pythonpath>\r
     <classpath/>\r
-    <variableFiles path="SchedulerRobot/robot/assets/test_properties.py"/>\r
+    <variableFiles path="cmso-robot/robot/assets/test_properties.py"/>\r
     <excludedForValidation/>\r
     <isValidatedFileSizeCheckingEnabled>true</isValidatedFileSizeCheckingEnabled>\r
     <validatedFileMaxSize>1024</validatedFileMaxSize>\r
index cab823d..9afd43d 100644 (file)
@@ -3,25 +3,19 @@ from os.path import isfile, join
 
 # Should be provided in Jenkins job
 
-GLOBAL_SCHEDULER_HOST = "dummy-host"
-GLOBAL_SCHEDULER_PORT = dummy-port
-GLOBAL_SCHEDULER_PROTOCOL = "https"
-GLOBAL_VID_USERID = "onap-user"
+GLOBAL_SCHEDULER_URL = "http://127.0.0.1:8080"
+GLOBAL_SCHEDULER_USER = "onap-user"
 GLOBAL_SCHEDULER_PASSWORD = "pwd"
 
-GLOBAL_SCHEDULER_USER = "dummy-user"
+GLOBAL_CALLBACK_USERID = "onap-user"
+GLOBAL_CALLBACK_PASSWORD = "onap-user"
+
 GLOBAL_APPLICATION_ID= "schedulertest"
-GLOBAL_VTM_URL="http://localhost:25055"
-GLOBAL_LISTCHANGE_PATH="/service=searchchangerecord.vtm.att.com/vtm/searchChangeRecord/v1/listChangeRecords/version=1.0.0/envContext=TEST/routeOffer=DEFAULT"
+GLOBAL_CALLBACK_URL="http://localhost:8900/scheduler/v1/loopbacktest/vid"
+
 
 
-GLOBAL_VTM_PROTO="http"
-GLOBAL_VTM_HOST="dummy-host"
-GLOBAL_VTM_CLOSE_PORT=31127
 
-GLOBAL_VTM_USER="dummy-user"
-GLOBAL_VTM_PASSWORD="dummy-pwd"
-GLOBAL_VID_CALLBACK_URL="http://localhost:8900/scheduler/v1/loopbacktest/vid"
 cmFailurePath= "robot/assets/templates/FailureCasesChangeManagement"
 GLOBAL_CM_FAILURE_TEMPLATES= [f for f in listdir(cmFailurePath) if isfile(join(cmFailurePath, f))]
 
@@ -37,5 +31,5 @@ DELETE_TICKET_ENVS = [
     {"scheduler" : "dummy", "vtm" : "dummy"},
 ]
 
-NODES = "dummy,dummy,dummy,dummy";
+NODES = "node1,node2,node3,node4";
  
\ No newline at end of file
index 7fa8a59..0784d71 100644 (file)
@@ -9,8 +9,8 @@ Library           String
 Resource   misc.robot
 *** Variables ***
 *** Variables ***
-${SCHEDULER_PATH}    /scheduler/v1
-${CHANGE_MANAGEMENT_PATH}    ${SCHEDULER_PATH}/ChangeManagement
+${SCHEDULER_PATH}    /cmso/v1
+${CHANGE_MANAGEMENT_PATH}    ${SCHEDULER_PATH}
 ${valid_status_codes}    200    202    400    404    204    409
 #**************** Test Case Variables ******************
 
@@ -41,7 +41,7 @@ Get Change Management
 Post Scheduler
     [Documentation]    Runs a scheduler POST request
     [Arguments]    ${alias}   ${data_path}   ${data}={}
-    ${url}=   Catenate   ${GLOBAL_SCHEDULER_PROTOCOL}://${GLOBAL_SCHEDULER_HOST}:${GLOBAL_SCHEDULER_PORT}
+    ${url}=   Catenate   ${GLOBAL_SCHEDULER_URL}
     ${uuid}=    Generate UUID
     ${proxies}=   Create Dictionary   no=pass
     ${session}=    Create Session      ${alias}   ${url}        
@@ -57,7 +57,7 @@ Post Scheduler
 Delete Scheduler
     [Documentation]    Runs a scheduler POST request
     [Arguments]    ${alias}   ${data_path} 
-    ${url}=   Catenate   ${GLOBAL_SCHEDULER_PROTOCOL}://${GLOBAL_SCHEDULER_HOST}:${GLOBAL_SCHEDULER_PORT}
+    ${url}=   Catenate   ${GLOBAL_SCHEDULER_URL}
     ${uuid}=    Generate UUID
     ${proxies}=   Create Dictionary   no=pass
     ${session}=    Create Session      ${alias}   ${url}     
@@ -72,7 +72,7 @@ Delete Scheduler
 Get Scheduler
     [Documentation]    Runs a scheduler GET request
     [Arguments]    ${alias}   ${data_path} 
-    ${url}=   Catenate   ${GLOBAL_SCHEDULER_PROTOCOL}://${GLOBAL_SCHEDULER_HOST}:${GLOBAL_SCHEDULER_PORT}
+    ${url}=   Catenate   ${GLOBAL_SCHEDULER_URL}
     ${uuid}=    Generate UUID
     ${proxies}=   Create Dictionary   no=pass
     ${session}=    Create Session      ${alias}   ${url}     
index 7264b05..c7b79e7 100644 (file)
@@ -24,7 +24,7 @@ Create Schedule
     ${dict}=   Create Dictionary   serviceInstanceId=${uuid}   parent_service_model_name=${uuid}
     ${callbackData}=   Fill JSON Template File    ${VID_TEMPLATES}/VidCallbackData.json.template   ${dict} 
     ${callbackDataString}=   Json Escape    ${callbackData}   
-       ${map}=   Create Dictionary   uuid=${uuid}   callbackUrl=${GLOBAL_VID_CALLBACK_URL}   callbackData=${callbackDataString}    testid=${testid}   workflow=${workflow}      userId=${GLOBAL_VID_USERID}
+       ${map}=   Create Dictionary   uuid=${uuid}   callbackUrl=${GLOBAL_CALLBACK_URL}   callbackData=${callbackDataString}    testid=${testid}   workflow=${workflow}      userId=${GLOBAL_CALLBACK_USERID}
        ${nodelist}=   Split String    ${NODES}   ,
        ${nn}=    Catenate    1
     # Support up to 4 ChangeWindows
diff --git a/cmso-robot/robot/testsuites/VtmAccess.robot b/cmso-robot/robot/testsuites/VtmAccess.robot
deleted file mode 100644 (file)
index 4a9c0aa..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-*** Settings ***
-Documentation    Creates VID VNF Instance
-
-Library         String
-Library        OperatingSystem
-Library              StringTemplater
-Library        Collections
-Library        XML
-
-Resource    ../resources/scheduler_common.robot
-Resource    ../resources/vtm_common.robot
-*** Variables ****
-${AOTS_USER}    ${GLOBAL_VID_USERID}
-${ASSETSSTRING}       dummy-id
-
-*** Test Cases ***
-Test1
-   ${display}   Create List    actualStartDate   actualEndDate   dateModified   assetId
-   ${assets}=   Create List   dummy
-   ${status}=   Create List   New   Assigned   Planning   Scheduled   Pending   WorkInProgress   Resolved  
-   ${filter}=   Create Dictionary   plannedStartDateFrom=1505389844   assetId=${assets}   
-   vTM Query Template   vtm   display=${display}   filter=${filter}   
-  
-Delete Tickets
-   ${tickets}   Create List   dummy-id     
-   :for   ${ticket}   in   @{tickets}
-   \   vTM Close Ticket  vtm   ${ticket}   ${GLOBAL_VID_USERID}
-
-Delete Old Tickets Atomic
-   @{assets}=   Split String    ${ASSETS}      separator=,   
-   ${end_time}=   Get Current Date  UTC   - 1440 minutes   result_format=timestamp    exclude_millis=False
-   ${end_time}=   Convert Date  ${end_time}   epoch
-   ${end_time}=   Evaluate   int(${end_time})
-   ${display}   Create List    actualStartDate   actualEndDate   dateModified   assetId
-   ${status}=   Create List   New   Assigned   Planning   Scheduled   Pending   WorkInProgress   Resolved  
-   ${filter}=   Create Dictionary   plannedStartDateFrom=0   plannedEndDateTo=${end_time}   assetId=@{assets}   status=${status} 
-   ${resp}=  vTM Query Template   vtm   display=${display}   filter=${filter}   
-   Log   ${resp.json()} 
-   ${list}=   Get From Dictionary    ${resp.json()}  changeInfo
-   ${changeIds}=   Create Dictionary 
-   :for   ${ticket}   in   @{list}
-   \   ${changeId}=   Get From Dictionary    ${ticket}   changeId
-   \   Set To Dictionary    ${changeIds}    ${changeId}=1
-   # Weed out dupes if any
-   ${idlist}   Get Dictionary Keys    ${changeIds}      
-   :for   ${changeId}   in   @{idlist}
-   \   vTM Close Ticket  vtm   ${changeId}   ${AOTS_USER}     
-
-Delete Old Scheduler Tickets
-   :for   ${env}   in    @{DELETE_TICKET_ENVS}
-   \    Set Global Variable    ${GLOBAL_SCHEDULER_HOST}   ${env['scheduler']}    
-   \    Set Global Variable    ${GLOBAL_VTM_HOST}   ${env['vtm']}    
-   \    Delete Scheduler Tickets For ENV
-
-    
-Cancel Tickets
-   ${tickets}   Create List   dummy-id   
-   :for   ${ticket}   in   @{tickets}
-   \   vTM Cancel Ticket  vtm   ${ticket}     
-
-
-Delete Schedule
-    ${uuid}=   Catenate   dummy-id
-    ${resp}=   Delete Change Management   auth   schedules/${uuid}      
-
-
-*** Keywords ***
-Delete Scheduler Tickets For ENV
-   # Make sure that the Scheduler in the config and the vTM system are the same.
-   # We will match the tickets to be deleted to the tickets in the scheduler DB
-   # to ensure we don't clobber other folks test data!
-   ${scheduler_tickets}=   Get Scheduler Tickets
-   # ELiminate dupes 
-   @{assets}   Get Dictionary Values    ${scheduler_tickets}
-   @{assets}=   Remove Duplicates   ${assets}
-   ${end_time}=   Get Current Date  UTC   - 1440 minutes   result_format=timestamp    exclude_millis=False
-   ${end_time}=   Convert Date  ${end_time}   epoch
-   ${end_time}=   Evaluate   int(${end_time})
-   ${display}   Create List    actualStartDate   actualEndDate   dateModified   assetId   requesterId
-   ${status}=   Create List   New   Assigned   Planning   Scheduled   Pending   WorkInProgress   Resolved  
-   ${filter}=   Create Dictionary   plannedStartDateFrom=0   plannedEndDateTo=${end_time}   assetId=@{assets}   status=${status} 
-   ${resp}=  vTM Query Template   vtm   display=${display}   filter=${filter}   
-   Log   ${resp.json()} 
-   ${list}=   Get From Dictionary    ${resp.json()}  changeInfo
-   
-   ## Get list of tickets that are both in our DB and in AOTS
-   ${changeIds}=   Create Dictionary 
-   :for   ${ticket}   in   @{list}
-   \   ${changeId}=   Get From Dictionary    ${ticket}   changeId
-   \   ${status}   ${value}=   Run Keyword and Ignore Error   Get From Dictionary   ${scheduler_tickets}    ${changeId}
-   \   Run Keyword If   '${status}'=='PASS'   Set To Dictionary    ${changeIds}    ${changeId}=1
-   # Weed out dupes if any and only cance ones in our DB!
-   ${idlist}   Get Dictionary Keys    ${changeIds}      
-   :for   ${changeId}   in   @{idlist}
-   \   vTM Cancel Ticket  vtm   ${changeId}
-
-Get Scheduler Tickets 
-    ${resp}=   Get Change Management   auth   schedules/scheduleDetails
-    ${dict}=    Create Dictionary
-    Log   ${resp.json()}
-    :for    ${details}   in   @{resp.json()}
-    \    ${status}   ${value}=   Run Keyword and Ignore Error   Get From Dictionary   ${details}   aotsChangeId
-    \    ${assetId}=   Get From Dictionary   ${details}   vnfName
-    \    Run Keyword If   '${status}'=='PASS'   Set To Dictionary   ${dict}   ${value}=${assetId}
-    [Return]   ${dict}
index 6f50e60..f103c57 100644 (file)
 ###\r
 \r
 ### MySQL DB.\r
-spring.datasource.url=jdbc:mariadb://localhost:3305/cmso\r
+spring.datasource.url=jdbc:mariadb://localhost:3306/cmso\r
 spring.datasource.driver-class-name=org.mariadb.jdbc.Driver\r
-spring.datasource.username=cmso\r
-cmso.database.password=enc:bfodXf8qRfCqMvlxVBYNWQ==\r
-\r
-###\r
-###\r
-### H2 DB.\r
-#spring.datasource.url=jdbc:h2:file:./h2db;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=true;MODE=MYSQL\r
-#spring.datasource.driver-class-name=org.h2.Driver\r
-#spring.datasource.username=sa\r
-#spring.datasource.password=sa\r
+spring.datasource.username=root\r
+spring.datasource.password=beer\r
+cmso.database.password=beer\r
 \r
 spring.datasource.initialize=false\r
 spring.datasource.tomcat.max-wait=10000\r
@@ -51,23 +44,19 @@ spring.datasource.tomcat.initialSize=5
 spring.datasource.tomcat.max-active=25\r
 spring.datasource.tomcat.test-on-borrow=true\r
 \r
-spring.jpa.show-sql=false\r
+spring.jpa.show-sql=true\r
 spring.jpa.hibernate.ddl-auto=none\r
 spring.jpa.hibernate.naming.strategy=org.hibernate.cfg.EJB3NamingStrategy\r
 spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect\r
 spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl\r
+spring.jpa.hibernate.id.new_generator_mappings=false\r
+hibernate.id.new_generator_mappings=false\r
 \r
 logging.level.org.hibernate.SQL=TRACE\r
 \r
 logging.level.org.hibernate=TRACE\r
 \r
 #\r
-#@BP.name="Enable AAF authentication"\r
-#@BP.description="Log level for \r
-#@BP.type=enum(true,false)\r
-##BP.default=true\r
-#@BP.required=false\r
-#@BP.volatility=1\r
 cmso.aaf.enabled=false\r
 \r
 # Enable swagger - Enable in development and test only\r
index 5317b98..a36cb32 100644 (file)
@@ -40,7 +40,6 @@
                <artifactId>oparent</artifactId>\r
                <version>1.2.0</version>\r
        </parent>\r
-\r
        <groupId>org.onap.optf.cmso</groupId>\r
        <artifactId>cmso-service</artifactId>\r
        <version>0.1.0-SNAPSHOT</version>\r
@@ -67,8 +66,7 @@
                <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>\r
                <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>\r
                <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>\r
-\r
-               <h2database.version>1.4.197</h2database.version>\r
+               <mariadb.version>2.2.1</mariadb.version>\r
                <swagger.directory>${basedir}/src/main/resources/swagger-ui/dist</swagger.directory>\r
 \r
                <!-- Sonar -->\r
 \r
                <!-- Database -->\r
                <dependency>\r
-                       <groupId>com.h2database</groupId>\r
-                       <artifactId>h2</artifactId>\r
+                       <groupId>org.mariadb.jdbc</groupId>\r
+                       <artifactId>mariadb-java-client</artifactId>\r
                </dependency>\r
 \r
+\r
                <!-- Pact -->\r
                <dependency>\r
                        <groupId>au.com.dius</groupId>\r
index 7327124..f0580bd 100644 (file)
@@ -97,6 +97,7 @@ public class Application extends SpringBootServletInitializer {
         TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory();\r
         int port = Integer.parseInt(dispatchPort);\r
         tomcat.addAdditionalTomcatConnectors(createStandardConnector(port));\r
+        org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter ss = null;\r
         return tomcat;\r
     }\r
 \r
@@ -1,47 +1,46 @@
-/*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- *         http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * \r
- * \r
- * Unless otherwise specified, all documentation contained herein is licensed\r
- * under the Creative Commons License, Attribution 4.0 Intl. (the "License");\r
- * you may not use this documentation except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- *         https://creativecommons.org/licenses/by/4.0/\r
- * \r
- * Unless required by applicable law or agreed to in writing, documentation\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
-*/\r
-\r
-package org.onap.optf.cmso.service;\r
-\r
-import org.junit.Test;\r
-import org.junit.runner.RunWith;\r
-import org.springframework.test.context.ContextConfiguration;\r
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;\r
-\r
-@RunWith(SpringJUnit4ClassRunner.class)\r
-@ContextConfiguration(locations = {"classpath:testConfig.xml"})\r
-public class H2Test {\r
-\r
-    @Test\r
-    public void h2Test() {\r
-\r
-    }\r
-}\r
+/*
+ * Copyright © 2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
+ * 
+ * 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.
+ * 
+ * 
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *         https://creativecommons.org/licenses/by/4.0/
+ * 
+ * Unless required by applicable law or agreed to in writing, documentation
+ * 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.
+*/
+package org.onap.optf.cmso;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.context.annotation.PropertySources;
+
+
+@Configuration
+@PropertySources({
+       @PropertySource("file:etc/config/cmso.properties"),
+       @PropertySource("file:etc/config/optimizer.properties"),
+       @PropertySource("file:etc/config/ticketmgt.properties"),
+})
+public class ApplicationPropertiesFiles 
+{
+}
\ No newline at end of file
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/AuthProvider.java b/cmso-service/src/main/java/org/onap/optf/cmso/AuthProvider.java
new file mode 100644 (file)
index 0000000..e002b7d
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * Copyright © 2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
+ * 
+ * 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.
+ * 
+ * 
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *         https://creativecommons.org/licenses/by/4.0/
+ * 
+ * Unless required by applicable law or agreed to in writing, documentation
+ * 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.
+*/
+package org.onap.optf.cmso;
+
+import java.util.ArrayList;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.security.authentication.AuthenticationProvider;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.AuthenticationException;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AuthProvider
+  implements AuthenticationProvider {
+       @Autowired
+       Environment env;
+       
+    @Override
+    public Authentication authenticate(Authentication authentication) 
+      throws AuthenticationException {
+       org.springframework.security.web.authentication.www.BasicAuthenticationFilter f = null;
+        String name = authentication.getName();
+        String password = authentication.getCredentials().toString();
+        //TODO check credentials until we enable AAF 
+        return new UsernamePasswordAuthenticationToken(
+          name, password, new ArrayList<>());
+    }
+    @Override
+    public boolean supports(Class<?> authentication) {
+        return authentication.equals(
+          UsernamePasswordAuthenticationToken.class);
+    }
+}
index d1ccb7e..e5aca31 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
+ * Copyright Â© 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright Â© 2018 IBM.\r
  * \r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -41,7 +41,8 @@ import org.springframework.core.env.MapPropertySource;
 import org.springframework.core.env.MutablePropertySources;\r
 \r
 public class CMSEnvironmentPostProcessor implements EnvironmentPostProcessor {\r
-\r
+    // TODO tested in ONAP springboot and this is called before all of the properties files have been loaded...\r
+       //      perhaps there is a post post processor? Until this works. DB password will be in the clear in the proeprties files.\r
     @Override\r
     public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {\r
         String pwd = environment.getProperty("cmso.database.password");\r
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/SecurityConfig.java b/cmso-service/src/main/java/org/onap/optf/cmso/SecurityConfig.java
new file mode 100644 (file)
index 0000000..a4802d2
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright © 2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
+ * 
+ * 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.
+ * 
+ * 
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *         https://creativecommons.org/licenses/by/4.0/
+ * 
+ * Unless required by applicable law or agreed to in writing, documentation
+ * 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.
+*/
+package org.onap.optf.cmso;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+
+@Configuration
+@EnableWebSecurity
+@ComponentScan("org.onap.optf")
+public class SecurityConfig extends WebSecurityConfigurerAdapter {
+  
+    @Autowired
+    private AuthProvider authProvider;
+    @Override
+    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
+  
+        auth.authenticationProvider(authProvider);
+    }
+    @Override
+    protected void configure(HttpSecurity http) throws Exception {
+       
+        http.csrf().disable().authorizeRequests().anyRequest().authenticated().and().httpBasic();
+        
+    }
+}
\ No newline at end of file
index d4ab593..121774b 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
+ * Copyright Â© 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright Â© 2018 IBM.\r
  * \r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -35,6 +35,7 @@ import java.io.Serializable;
 import javax.persistence.Column;\r
 import javax.persistence.Entity;\r
 import javax.persistence.GeneratedValue;\r
+import javax.persistence.GenerationType;\r
 import javax.persistence.Id;\r
 import javax.persistence.NamedQuery;\r
 import javax.persistence.Table;\r
@@ -50,11 +51,11 @@ public class ApprovalType implements Serializable {
     private static final long serialVersionUID = 1L;\r
 \r
     @Id\r
-    @GeneratedValue\r
-    private int id;\r
+    @GeneratedValue(strategy=GenerationType.IDENTITY)\r
+    private Integer id;\r
 \r
     @Column(name = "approval_count")\r
-    private int approvalCount;\r
+    private Integer approvalCount;\r
 \r
     @Column(name = "approval_type")\r
     private String approvalType;\r
@@ -65,19 +66,19 @@ public class ApprovalType implements Serializable {
 \r
     public ApprovalType() {}\r
 \r
-    public int getId() {\r
+    public Integer getId() {\r
         return this.id;\r
     }\r
 \r
-    public void setId(int id) {\r
+    public void setId(Integer id) {\r
         this.id = id;\r
     }\r
 \r
-    public int getApprovalCount() {\r
+    public Integer getApprovalCount() {\r
         return this.approvalCount;\r
     }\r
 \r
-    public void setApprovalCount(int approvalCount) {\r
+    public void setApprovalCount(Integer approvalCount) {\r
         this.approvalCount = approvalCount;\r
     }\r
 \r
index ceece9a..7224508 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
+ * Copyright Â© 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright Â© 2018 IBM.\r
  * \r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -35,6 +35,7 @@ import java.io.Serializable;
 import javax.persistence.Column;\r
 import javax.persistence.Entity;\r
 import javax.persistence.GeneratedValue;\r
+import javax.persistence.GenerationType;\r
 import javax.persistence.Id;\r
 import javax.persistence.NamedQuery;\r
 import javax.persistence.Table;\r
@@ -58,8 +59,8 @@ public class ChangeManagementChangeWindow implements Serializable {
 \r
     @JsonIgnore\r
     @Id\r
-    @GeneratedValue\r
-    private int id;\r
+    @GeneratedValue(strategy=GenerationType.IDENTITY)\r
+    private Integer id;\r
 \r
     @JsonIgnore\r
     @Column(name = "finish_time")\r
@@ -81,15 +82,15 @@ public class ChangeManagementChangeWindow implements Serializable {
 \r
     @JsonIgnore\r
     @Column(name = "change_management_groups_id")\r
-    private int changeManagementGroupsId;\r
+    private Integer changeManagementGroupsId;\r
 \r
     public ChangeManagementChangeWindow() {}\r
 \r
-    public int getId() {\r
+    public Integer getId() {\r
         return this.id;\r
     }\r
 \r
-    public void setId(int id) {\r
+    public void setId(Integer id) {\r
         this.id = id;\r
     }\r
 \r
@@ -109,11 +110,11 @@ public class ChangeManagementChangeWindow implements Serializable {
 \r
     public void setStartTime(String startTime) {}\r
 \r
-    public int getChangeManagementGroupsId() {\r
+    public Integer getChangeManagementGroupsId() {\r
         return changeManagementGroupsId;\r
     }\r
 \r
-    public void setChangeManagementGroupsId(int changeManagementGroupsId) {\r
+    public void setChangeManagementGroupsId(Integer changeManagementGroupsId) {\r
         this.changeManagementGroupsId = changeManagementGroupsId;\r
     }\r
 \r
index 3b82c62..31c4a2b 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
+ * Copyright Â© 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright Â© 2018 IBM.\r
  * \r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -34,6 +34,7 @@ package org.onap.optf.cmso.model;
 import javax.persistence.Column;\r
 import javax.persistence.Entity;\r
 import javax.persistence.GeneratedValue;\r
+import javax.persistence.GenerationType;\r
 import javax.persistence.Id;\r
 import javax.persistence.Lob;\r
 import javax.persistence.Transient;\r
@@ -58,8 +59,8 @@ import io.swagger.annotations.ApiModelProperty;
 public class ChangeManagementDetail {\r
     @Id\r
     @JsonIgnore\r
-    @GeneratedValue\r
-    private int id;\r
+    @GeneratedValue(strategy=GenerationType.IDENTITY)\r
+    private Integer id;\r
 \r
     @ApiModelProperty(value = "Name of the VNF.")\r
     @Column(name = "vnf_name")\r
@@ -167,7 +168,7 @@ public class ChangeManagementDetail {
     private String msoTime;\r
 \r
     @JsonIgnore\r
-    private int schedules_id;\r
+    private Integer schedules_id;\r
 \r
     public String getVnfName() {\r
         return vnfName;\r
@@ -241,11 +242,11 @@ public class ChangeManagementDetail {
         this.policyId = policyId;\r
     }\r
 \r
-    public int getSchedulesId() {\r
+    public Integer getSchedulesId() {\r
         return schedules_id;\r
     }\r
 \r
-    public void setSchedulesId(int schedules_id) {\r
+    public void setSchedulesId(Integer schedules_id) {\r
         this.schedules_id = schedules_id;\r
     }\r
 \r
index 0664851..6aeb325 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
+ * Copyright Â© 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright Â© 2018 IBM.\r
  * \r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -36,6 +36,7 @@ import java.util.List;
 import javax.persistence.Column;\r
 import javax.persistence.Entity;\r
 import javax.persistence.GeneratedValue;\r
+import javax.persistence.GenerationType;\r
 import javax.persistence.Id;\r
 import javax.persistence.NamedQuery;\r
 import javax.persistence.Table;\r
@@ -59,8 +60,8 @@ public class ChangeManagementGroup implements Serializable {
 \r
     @JsonIgnore\r
     @Id\r
-    @GeneratedValue\r
-    private int id;\r
+    @GeneratedValue(strategy=GenerationType.IDENTITY)\r
+    private Integer id;\r
 \r
     @JsonIgnore\r
     @Column(name = "finish_time")\r
@@ -95,19 +96,19 @@ public class ChangeManagementGroup implements Serializable {
 \r
     @JsonIgnore\r
     @Column(name = "schedules_id")\r
-    private int schedulesId;\r
+    private Integer schedulesId;\r
 \r
     @Column(name = "additional_duration_in_secs")\r
     @ApiModelProperty(value = "Time added to the workflow interval to allow for rollback in case of failure.")\r
-    private int additionalDurationInSecs;\r
+    private Integer additionalDurationInSecs;\r
 \r
     @ApiModelProperty(value = "The maximum number of workflows that should be started simultaneiously.")\r
     @Column(name = "concurrency_limit")\r
-    private int concurrencyLimit;\r
+    private Integer concurrencyLimit;\r
 \r
     @ApiModelProperty(value = "Expected duration of a successful workflow execution.")\r
     @Column(name = "normal_duration_in_secs")\r
-    private int normalDurationInSecs;\r
+    private Integer normalDurationInSecs;\r
 \r
     @ApiModelProperty(\r
             value = "The name of the schedule optimization policy used by the change management schedule optimizer.")\r
@@ -121,11 +122,11 @@ public class ChangeManagementGroup implements Serializable {
 \r
     public ChangeManagementGroup() {}\r
 \r
-    public int getId() {\r
+    public Integer getId() {\r
         return this.id;\r
     }\r
 \r
-    public void setId(int id) {\r
+    public void setId(Integer id) {\r
         this.id = id;\r
     }\r
 \r
@@ -161,35 +162,35 @@ public class ChangeManagementGroup implements Serializable {
 \r
     public void setStartTime(String startTime) {}\r
 \r
-    public int getSchedulesId() {\r
+    public Integer getSchedulesId() {\r
         return schedulesId;\r
     }\r
 \r
-    public void setSchedulesId(int schedulesId) {\r
+    public void setSchedulesId(Integer schedulesId) {\r
         this.schedulesId = schedulesId;\r
     }\r
 \r
-    public int getAdditionalDurationInSecs() {\r
+    public Integer getAdditionalDurationInSecs() {\r
         return additionalDurationInSecs;\r
     }\r
 \r
-    public void setAdditionalDurationInSecs(int additionalDurationInSecs) {\r
+    public void setAdditionalDurationInSecs(Integer additionalDurationInSecs) {\r
         this.additionalDurationInSecs = additionalDurationInSecs;\r
     }\r
 \r
-    public int getConcurrencyLimit() {\r
+    public Integer getConcurrencyLimit() {\r
         return concurrencyLimit;\r
     }\r
 \r
-    public void setConcurrencyLimit(int concurrencyLimit) {\r
+    public void setConcurrencyLimit(Integer concurrencyLimit) {\r
         this.concurrencyLimit = concurrencyLimit;\r
     }\r
 \r
-    public int getNormalDurationInSecs() {\r
+    public Integer getNormalDurationInSecs() {\r
         return normalDurationInSecs;\r
     }\r
 \r
-    public void setNormalDurationInSecs(int normalDurationInSecs) {\r
+    public void setNormalDurationInSecs(Integer normalDurationInSecs) {\r
         this.normalDurationInSecs = normalDurationInSecs;\r
     }\r
 \r
index 779e8ca..9690290 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
+ * Copyright Â© 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright Â© 2018 IBM.\r
  * \r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -35,6 +35,7 @@ import java.io.Serializable;
 import javax.persistence.Column;\r
 import javax.persistence.Entity;\r
 import javax.persistence.GeneratedValue;\r
+import javax.persistence.GenerationType;\r
 import javax.persistence.Id;\r
 import javax.persistence.Lob;\r
 import javax.persistence.NamedQuery;\r
@@ -60,7 +61,7 @@ public class ChangeManagementSchedule implements Serializable {
 \r
     @JsonIgnore\r
     @Id\r
-    @GeneratedValue\r
+    @GeneratedValue(strategy=GenerationType.IDENTITY)\r
     private Integer id;\r
 \r
     @ApiModelProperty(value = "TM Change Id")\r
@@ -108,7 +109,7 @@ public class ChangeManagementSchedule implements Serializable {
 \r
     @Column(name = "change_management_groups_id")\r
     @JsonIgnore\r
-    private int changeManagementGroupsId;\r
+    private Integer changeManagementGroupsId;\r
 \r
     @JsonIgnore\r
     @Column(name = "dispatch_time")\r
@@ -161,11 +162,11 @@ public class ChangeManagementSchedule implements Serializable {
 \r
     public ChangeManagementSchedule() {}\r
 \r
-    public int getId() {\r
+    public Integer getId() {\r
         return this.id;\r
     }\r
 \r
-    public void setId(int id) {\r
+    public void setId(Integer id) {\r
         this.id = id;\r
     }\r
 \r
@@ -217,11 +218,11 @@ public class ChangeManagementSchedule implements Serializable {
         this.tmChangeId = tmChangeId;\r
     }\r
 \r
-    public int getChangeManagementGroupsId() {\r
+    public Integer getChangeManagementGroupsId() {\r
         return changeManagementGroupsId;\r
     }\r
 \r
-    public void setChangeManagementGroupsId(int changeManagementGroupsId) {\r
+    public void setChangeManagementGroupsId(Integer changeManagementGroupsId) {\r
         this.changeManagementGroupsId = changeManagementGroupsId;\r
     }\r
 \r
index f32ff98..fc86964 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
+ * Copyright Â© 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright Â© 2018 IBM.\r
  * \r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -34,6 +34,7 @@ package org.onap.optf.cmso.model;
 import java.io.Serializable;\r
 import javax.persistence.Entity;\r
 import javax.persistence.GeneratedValue;\r
+import javax.persistence.GenerationType;\r
 import javax.persistence.Id;\r
 import javax.persistence.JoinColumn;\r
 import javax.persistence.ManyToOne;\r
@@ -55,8 +56,8 @@ public class DomainData implements Serializable {
 \r
     @JsonIgnore\r
     @Id\r
-    @GeneratedValue\r
-    private int id;\r
+    @GeneratedValue(strategy=GenerationType.IDENTITY)\r
+   private Integer id;\r
 \r
     private String name;\r
 \r
@@ -69,11 +70,11 @@ public class DomainData implements Serializable {
 \r
     public DomainData() {}\r
 \r
-    public int getId() {\r
+    public Integer getId() {\r
         return this.id;\r
     }\r
 \r
-    public void setId(int id) {\r
+    public void setId(Integer id) {\r
         this.id = id;\r
     }\r
 \r
index 3a13563..d6fe4f9 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
+ * Copyright Â© 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright Â© 2018 IBM.\r
  * \r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -38,6 +38,7 @@ import javax.persistence.CascadeType;
 import javax.persistence.Column;\r
 import javax.persistence.Entity;\r
 import javax.persistence.GeneratedValue;\r
+import javax.persistence.GenerationType;\r
 import javax.persistence.Id;\r
 import javax.persistence.Lob;\r
 import javax.persistence.NamedQuery;\r
@@ -63,8 +64,8 @@ public class Schedule implements Serializable {
 \r
     @JsonIgnore\r
     @Id\r
-    @GeneratedValue\r
-    private int id;\r
+    @GeneratedValue(strategy=GenerationType.IDENTITY)\r
+    private Integer id;\r
 \r
     @JsonIgnore\r
     @Column(name = "create_date_time")\r
@@ -93,7 +94,7 @@ public class Schedule implements Serializable {
 \r
     @JsonIgnore\r
     @Column(name = "optimizer_attempts_to_schedule")\r
-    private int optimizerAttemptsToSchedule;\r
+    private Integer optimizerAttemptsToSchedule;\r
 \r
     @JsonIgnore\r
     @Column(name = "optimizer_return_date_time")\r
@@ -159,11 +160,11 @@ public class Schedule implements Serializable {
 \r
     public Schedule() {}\r
 \r
-    public int getId() {\r
+    public Integer getId() {\r
         return this.id;\r
     }\r
 \r
-    public void setId(int id) {\r
+    public void setId(Integer id) {\r
         this.id = id;\r
     }\r
 \r
@@ -307,11 +308,11 @@ public class Schedule implements Serializable {
         return sa;\r
     }\r
 \r
-    public int getOptimizerAttemptsToSchedule() {\r
+    public Integer getOptimizerAttemptsToSchedule() {\r
         return optimizerAttemptsToSchedule;\r
     }\r
 \r
-    public void setOptimizerAttemptsToSchedule(int optimizerAttemptsToSchedule) {\r
+    public void setOptimizerAttemptsToSchedule(Integer optimizerAttemptsToSchedule) {\r
         this.optimizerAttemptsToSchedule = optimizerAttemptsToSchedule;\r
     }\r
 \r
index adfafd1..dee3c42 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
+ * Copyright Â© 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright Â© 2018 IBM.\r
  * \r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -35,6 +35,7 @@ import java.io.Serializable;
 import javax.persistence.Column;\r
 import javax.persistence.Entity;\r
 import javax.persistence.GeneratedValue;\r
+import javax.persistence.GenerationType;\r
 import javax.persistence.Id;\r
 import javax.persistence.JoinColumn;\r
 import javax.persistence.ManyToOne;\r
@@ -59,9 +60,9 @@ public class ScheduleApproval implements Serializable {
     private static final long serialVersionUID = 1L;\r
 \r
     @Id\r
-    @GeneratedValue\r
+    @GeneratedValue(strategy=GenerationType.IDENTITY)\r
     @JsonIgnore\r
-    private int id;\r
+    private Integer id;\r
 \r
     @JsonIgnore\r
     @Column(name = "approval_date_time")\r
@@ -91,11 +92,11 @@ public class ScheduleApproval implements Serializable {
 \r
     public ScheduleApproval() {}\r
 \r
-    public int getId() {\r
+    public Integer getId() {\r
         return this.id;\r
     }\r
 \r
-    public void setId(int id) {\r
+    public void setId(Integer id) {\r
         this.id = id;\r
     }\r
 \r
index 97a96f0..46cb46e 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
+ * Copyright Â© 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright Â© 2018 IBM.\r
  * \r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -34,6 +34,8 @@ package org.onap.optf.cmso.model;
 import java.io.Serializable;\r
 import javax.persistence.Column;\r
 import javax.persistence.Entity;\r
+import javax.persistence.GeneratedValue;\r
+import javax.persistence.GenerationType;\r
 import javax.persistence.Id;\r
 import javax.persistence.Lob;\r
 import javax.persistence.NamedQuery;\r
@@ -54,7 +56,8 @@ public class ScheduleEvent implements Serializable {
     private static final long serialVersionUID = 1L;\r
 \r
     @Id\r
-    private int id;\r
+    @GeneratedValue(strategy=GenerationType.IDENTITY)\r
+    private Integer id;\r
 \r
     private String domain;\r
 \r
@@ -79,17 +82,17 @@ public class ScheduleEvent implements Serializable {
     private String reminderTime;\r
 \r
     @Column(name = "schedules_id")\r
-    private int schedulesId;\r
+    private Integer schedulesId;\r
 \r
     private String status;\r
 \r
     public ScheduleEvent() {}\r
 \r
-    public int getId() {\r
+    public Integer getId() {\r
         return this.id;\r
     }\r
 \r
-    public void setId(int id) {\r
+    public void setId(Integer id) {\r
         this.id = id;\r
     }\r
 \r
@@ -109,11 +112,11 @@ public class ScheduleEvent implements Serializable {
         this.eventText = eventText;\r
     }\r
 \r
-    public int getSchedulesId() {\r
+    public Integer getSchedulesId() {\r
         return this.schedulesId;\r
     }\r
 \r
-    public void setSchedulesId(int schedulesId) {\r
+    public void setSchedulesId(Integer schedulesId) {\r
         this.schedulesId = schedulesId;\r
     }\r
 \r
index 8dbafbc..2e0cfeb 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
+ * Copyright Â© 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright Â© 2018 IBM.\r
  * \r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -91,6 +91,7 @@ public class BaseSchedulerServiceImpl {
                                                         // are 1<=>1 at this\r
                                                         // point.\r
         s.setScheduleName(scheduleMessage.getScheduleName());\r
+        s.setOptimizerAttemptsToSchedule(0);\r
         s.setScheduleInfo(scheduleMessage.getSchedulingInfo().toString());\r
         s.setStatus(CMSStatusEnum.PendingSchedule.toString());\r
         scheduleDAO.save(s);\r
index f994dc8..a3a4ae8 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
+ * Copyright Â© 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright Â© 2018 IBM.\r
  * \r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -80,8 +80,8 @@ public class HealthCheckImpl implements HealthCheck {
 \r
         if (checkInterfaces) {\r
             addToHealthCheckMessage(hc, tmClient.healthCheck());\r
-            addToHealthCheckMessage(hc, sniroClient.healthCheck());\r
             addToHealthCheckMessage(hc, msoStatusClient.healthCheck());\r
+            addToHealthCheckMessage(hc, sniroClient.healthCheck());\r
         }\r
         addToHealthCheckMessage(hc, this.healthCheck());\r
 \r
index 42f282a..8cbe459 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
+ * Copyright Â© 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright Â© 2018 IBM.\r
  * \r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -247,8 +247,8 @@ public class MsoStatusClient {
     public HealthCheckComponent healthCheck() {\r
         Map<String, String> mdcSave = Mdc.save();\r
         String requestId = "healthCheck";\r
-        String url = env.getProperty("so.url");\r
-        String user = env.getProperty("so.user");\r
+        String url = env.getProperty("so.url", "");\r
+        String user = env.getProperty("so.user", "");\r
         String pass = pm.getProperty("so.pass", "");\r
         if (!url.endsWith("/"))\r
             url = url + "/";\r
diff --git a/cmso-service/src/main/resources/META-INF/spring.factories b/cmso-service/src/main/resources/META-INF/spring.factories
new file mode 100644 (file)
index 0000000..5047be8
--- /dev/null
@@ -0,0 +1 @@
+org.springframework.boot.env.EnvironmentPostProcessor=org.onap.optf.cmso.CMSEnvironmentPostProcessor
\ No newline at end of file
index b6239c9..25c5b10 100644 (file)
@@ -36,7 +36,7 @@ info.build.version=@project.version@
 \r
 spring.jersey.type=filter\r
 spring.mvc.urls=swagger,docs,prometheus\r
-server.contextPath=/cmso\r
+server.servlet.context-path=/cmso\r
 \r
 #This property is used to set the Tomcat connector attributes.developers can define multiple attributes separated by comma\r
 #tomcat.connector.attributes=allowTrace-true\r
@@ -53,3 +53,9 @@ server.port=8080
 server.dispatchPort=8089\r
 \r
 kubernetes.namespace=org.onap.optf.cmso\r
+\r
+\r
+com.att.eelf.logging.file=logback.xml\r
+com.att.eelf.logging.path=\r
+\r
+logging.config=\r
index b8f5def..635d6a9 100644 (file)
@@ -2,7 +2,7 @@
   "swagger" : "2.0",
   "info" : {
     "version" : "0.1.0-SNAPSHOT",
-    "title" : "cmso"
+    "title" : "cmso-service"
   },
   "basePath" : "/cmso",
   "paths" : {
diff --git a/cmso-service/src/test/java/org/onap/optf/cmso/service/rs/CMSOServiceImplTest.java b/cmso-service/src/test/java/org/onap/optf/cmso/service/rs/CMSOServiceImplTest.java
deleted file mode 100644 (file)
index b989a73..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
-/*\r
- * Copyright © 2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *         http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- *\r
- * Unless otherwise specified, all documentation contained herein is licensed\r
- * under the Creative Commons License, Attribution 4.0 Intl. (the "License");\r
- * you may not use this documentation except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *         https://creativecommons.org/licenses/by/4.0/\r
- *\r
- * Unless required by applicable law or agreed to in writing, documentation\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
-*/\r
-\r
-package org.onap.optf.cmso.service.rs;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import java.util.HashMap;\r
-import java.util.Map;\r
-import java.util.UUID;\r
-import javax.ws.rs.core.Response;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.junit.runner.RunWith;\r
-import org.onap.optf.cmso.JpaInit;\r
-import org.onap.optf.cmso.JtestHelper;\r
-import org.onap.optf.cmso.common.CMSRequestError;\r
-import org.onap.optf.cmso.service.rs.models.CMSMessage;\r
-import org.springframework.beans.factory.annotation.Autowired;\r
-import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;\r
-import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager;\r
-import org.springframework.test.context.junit4.SpringRunner;\r
-import com.fasterxml.jackson.databind.ObjectMapper;\r
-import scala.collection.mutable.StringBuilder;\r
-\r
-@RunWith(SpringRunner.class)\r
-@DataJpaTest\r
-public class CMSOServiceImplTest {\r
-\r
-    @Autowired\r
-    CMSOService cMSOServiceImpl;\r
-\r
-    @Autowired\r
-    private TestEntityManager entityManager;\r
-\r
-    @Before\r
-    public void setUp() throws Exception {\r
-        JpaInit.init(entityManager);\r
-    }\r
-\r
-    @Test\r
-    public void test_createScheduleRequest() {\r
-        String[] templates = {"changemanagement/MultipleVnfImmediate.json.template",};\r
-        String[] domains = {"ChangeManagement",};\r
-        String[] userIds = {"jf9860",};\r
-        String[] callbackUrls = {"http://localhost:8089/",};\r
-        String[] callbackDatum = {"sdafafadfdasfdsafdsa",};\r
-        String[] workflows = {"Replace", "Update", "NewOne",};\r
-        Integer[] normalDurationInSeeconds = {10,};\r
-        Integer[] additionalDurationInSeeconds = {10,};\r
-        String[] results = {"500:", // {additionalDurationInSeconds=10, workflow=Replace,\r
-                                    // domain=ChangeManagement,\r
-                                    // callbackData=sdafafadfdasfdsafdsa, testid=79e1,\r
-                                    // callbackUrl=http://localhost:8089/,\r
-                                    // uuid=a36b45b9-dff4-45b4-ac6b-2a4f35e179e1, userId=jf9860,\r
-                                    // normalDurationInSeconds=10}\r
-                "500:", // {additionalDurationInSeconds=10, workflow=Update,\r
-                        // domain=ChangeManagement,\r
-                        // callbackData=sdafafadfdasfdsafdsa, testid=c525,\r
-                        // callbackUrl=http://localhost:8089/,\r
-                        // uuid=26b189f7-b075-4013-b487-d938b895c525, userId=jf9860,\r
-                        // normalDurationInSeconds=10}\r
-                "500:", // {additionalDurationInSeconds=10, workflow=NewOne,\r
-                        // domain=ChangeManagement,\r
-                        // callbackData=sdafafadfdasfdsafdsa, testid=8e87,\r
-                        // callbackUrl=http://localhost:8089/,\r
-                        // uuid=4f59b14a-8040-4257-8981-defcb8f38e87, userId=jf9860,\r
-                        // normalDurationInSeconds=10}\r
-        };\r
-\r
-        int i = 0;\r
-        for (String template : templates) {\r
-            for (String domain : domains) {\r
-                for (String userId : userIds) {\r
-                    for (String callbackUrl : callbackUrls) {\r
-                        for (String callbackData : callbackDatum) {\r
-                            for (String workflow : workflows) {\r
-                                for (Integer normalDuration : normalDurationInSeeconds) {\r
-                                    for (Integer additionalDuration : additionalDurationInSeeconds) {\r
-                                        Map<String, String> values = new HashMap<String, String>();\r
-                                        String scheduleId = UUID.randomUUID().toString();\r
-                                        values.put("uuid", scheduleId);\r
-                                        values.put("testid", scheduleId.substring(scheduleId.length() - 4));\r
-                                        values.put("domain", domain);\r
-                                        values.put("userId", userId);\r
-                                        values.put("callbackUrl", callbackUrl);\r
-                                        values.put("callbackData", callbackData);\r
-                                        values.put("workflow", workflow);\r
-                                        values.put("normalDurationInSeconds", normalDuration.toString());\r
-                                        values.put("additionalDurationInSeconds", additionalDuration.toString());\r
-                                        String json = JtestHelper.template(template, values);\r
-                                        ObjectMapper om = new ObjectMapper();\r
-                                        CMSMessage scheduleMessage;\r
-                                        try {\r
-                                            scheduleMessage = om.readValue(json, CMSMessage.class);\r
-                                            MockHttpServletRequest mrequest = new MockHttpServletRequest();\r
-                                            mrequest.url.append(scheduleId);\r
-\r
-                                            Response response = cMSOServiceImpl.createScheduleRequest("v2", scheduleId,\r
-                                                    scheduleMessage, mrequest.request);\r
-\r
-                                            Object result = response.getEntity();\r
-                                            StringBuilder sb = new StringBuilder();\r
-                                            sb.append(response.getStatus()).append(":");\r
-                                            if (result instanceof CMSRequestError) {\r
-                                                String r = result.toString().replaceAll(" : Reason :.*$", "");\r
-                                                sb.append(r.replaceAll(scheduleId, "<uuid>"));\r
-                                            }\r
-                                            // Generate results[] entry\r
-                                            System.out.println("\"" + sb.toString() + "\", //" + values.toString());\r
-\r
-                                            // Debug an assertion\r
-                                            System.out.println(results[i] + ":" + sb.toString());\r
-                                            assertEquals(results[i].equals(sb.toString()), true);\r
-                                            i++;\r
-\r
-                                        } catch (Exception e) {\r
-                                            e.printStackTrace();\r
-                                        }\r
-\r
-                                    }\r
-                                }\r
-                            }\r
-\r
-                        }\r
-                    }\r
-                }\r
-            }\r
-        }\r
-    }\r
-}\r