-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,
<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
# 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))]
{"scheduler" : "dummy", "vtm" : "dummy"},
]
-NODES = "dummy,dummy,dummy,dummy";
+NODES = "node1,node2,node3,node4";
\ No newline at end of file
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 ******************
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}
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}
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}
${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
+++ /dev/null
-*** 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}
###\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
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
<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
<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
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
-/*\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
--- /dev/null
+/*
+ * 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);
+ }
+}
/*\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
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
--- /dev/null
+/*
+ * 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
/*\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
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
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
\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
/*\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
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
\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
\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
\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
/*\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
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
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
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
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
/*\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
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
\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
\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
\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
\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
/*\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
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
\r
@JsonIgnore\r
@Id\r
- @GeneratedValue\r
+ @GeneratedValue(strategy=GenerationType.IDENTITY)\r
private Integer id;\r
\r
@ApiModelProperty(value = "TM Change Id")\r
\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
\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
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
/*\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
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
\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
\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
/*\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
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
\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
\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
\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
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
/*\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
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
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
\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
/*\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
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
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
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
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
/*\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
// 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
/*\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
\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
/*\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
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
--- /dev/null
+org.springframework.boot.env.EnvironmentPostProcessor=org.onap.optf.cmso.CMSEnvironmentPostProcessor
\ No newline at end of file
\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
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
"swagger" : "2.0",
"info" : {
"version" : "0.1.0-SNAPSHOT",
- "title" : "cmso"
+ "title" : "cmso-service"
},
"basePath" : "/cmso",
"paths" : {
+++ /dev/null
-/*\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