Commit c79b4fe0 authored by Alicja Reniewicz's avatar Alicja Reniewicz
Browse files

Merge pull request #75 in MEL/integration from rc3.0 to master

* commit 'aa222824':
  startProcessVerifier omits delay check when in simulation mode
  added reslt field to getMetric Names response
  deleted useless fields in simulatedMetricResponse
  deleted useless service
  deleted getDeploymentModel
  changed name dryRun to isSimulation and added this flag inside metasolverDeploymentProcess(in camunda and EMS)
  fixed small bug and renamed dryRun to isSimulation
  changed flow entry feedAndDeploy -> deployProcessPost
  moved simulated metrics from services to interfaces
  added dryRun flag into frontend raml
  changed transformer and added gettinf "dryRun" from execution in camunda
  added new interfaces for endpoints inside adapter and metasolver
parents 41f886b8 aa222824
......@@ -18,6 +18,9 @@ types:
notificationURI:
description: The URI of an endpoint to sent the result of Constraint Problem creation.
type: string
isSimulation:
type: string
description: bool indicating whether application is launched in simulation mode or not
watermark:
type: ApiLib.Watermark
ApplySolutionRequest:
......@@ -34,7 +37,6 @@ types:
type: string
watermark:
type: ApiLib.Watermark
DifferenceRequest:
type: object
properties:
......@@ -47,13 +49,11 @@ types:
currDeploymentInstanceName:
type: string
description: Name of the deployment instance.
DifferenceResponse:
type: object
properties:
diff:
type: Touple[]
Touple:
type: object
properties:
......@@ -63,7 +63,6 @@ types:
value:
description: "details of deployment for component"
type: ToupleValue
ToupleValue:
type: object
properties:
......@@ -76,7 +75,6 @@ types:
toRemain:
description: "instances to remain"
type: InstanceDetails[]
InstanceDetails:
type: object
properties:
......@@ -86,7 +84,6 @@ types:
type:
description: "component type"
type: string
/applicationDeployment:
post:
body:
......@@ -111,4 +108,4 @@ types:
200:
body:
application/json:
type: DifferenceResponse
\ No newline at end of file
type: DifferenceResponse
......@@ -78,6 +78,38 @@ types:
type: ApiLib.NotificationResult
watermark:
type: ApiLib.Watermark
MetricsNamesResponse:
type: object
properties:
metricsNames:
type: string[]
watermark:
type: ApiLib.Watermark
SimulatedMetricValuesRequest:
type: object
properties:
applicationId:
type: string
description: The identifier of the application.
metricValues:
type: KeyValuePair[]
watermark:
type: ApiLib.Watermark
SimulatedMetricValuesResponse:
type: object
properties:
applicationId:
type: string
description: The identifier of the application.
KeyValuePair:
type: object
properties:
key:
description: "key"
type: string
value:
description: "value"
type: string
/constraintProblemEnhancement:
post:
body:
......@@ -110,4 +142,19 @@ types:
200:
body:
application/json:
type: UpdateSolutionResponse
\ No newline at end of file
type: UpdateSolutionResponse
/provideSimulatedMetricValues:
post:
body:
application/json:
type: SimulatedMetricValuesRequest
description: Interface used by simulationHandler to provide him metric values from GUI.
responses:
200:
body:
application/json:
type: SimulatedMetricValuesResponse
description: if succeeded or not
......@@ -23,6 +23,9 @@ types:
type: array
items:
type: NewCloud
isSimulation:
type: string
description: bool indicating whether application is launched in simulation mode or not
watermark:
type: ApiLib.Watermark
DeploymentProcessResponse:
......
......@@ -22,6 +22,9 @@ types:
type: boolean
default: true
description: Flag indicating if new CP model should be generated by the CP-generator (false). By default (true) cp-model will not be generated.
isSimulation:
type: string
description: bool indicating whether application is launched in simulation mode or not
cdoResourcePath:
type: string
description: The path in the CDO server where existing cp-model can be found. Obligatory for useExistingCP=true
......@@ -44,4 +47,4 @@ types:
200:
body:
application/json:
type: DeploymentProcessResponse
\ No newline at end of file
type: DeploymentProcessResponse
......@@ -93,6 +93,9 @@ types:
notificationSubject:
type: string
description: Notification subject that will be used when reporting the CP notification.
isSimulation:
type: string
description: bool indicating whether application is launched in simulation mode or not
watermark:
type: ApiLib.Watermark
SolutionEvaluationRequest:
......
......@@ -236,7 +236,8 @@ http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mul
</flow>
<flow name="deploymentProcess_POST">
<set-variable variableName="vAppName" value="#[json:applicationId]" mimeType="application/json" doc:name="Store application ID" metadata:id="d5b18443-2f8d-4683-90ba-c08fe5e2e233"/>
<set-payload value="{&quot;variables&quot;: {&quot;applicationId&quot; : {&quot;value&quot; : &quot;#[flowVars.vAppName]&quot;, &quot;type&quot;: &quot;String&quot;}, &quot;melodicAuthorizationToken&quot; : {&quot;value&quot; : &quot;#[flowVars.melodicAuthorizationToken]&quot;, &quot;type&quot;: &quot;String&quot;}, &quot;refreshToken&quot; : {&quot;value&quot; : &quot;#[flowVars.refreshToken]&quot;, &quot;type&quot;: &quot;String&quot;}}} " mimeType="application/json" doc:name="Set Payload"/>
<set-variable variableName="isSimulation" value="#[json:isSimulation]" mimeType="application/json" doc:name="Store simulation flag"/>
<set-payload value="{&quot;variables&quot;: {&quot;applicationId&quot; : {&quot;value&quot; : &quot;#[flowVars.vAppName]&quot;, &quot;type&quot;: &quot;String&quot;}, &quot;melodicAuthorizationToken&quot; : {&quot;value&quot; : &quot;#[flowVars.melodicAuthorizationToken]&quot;, &quot;type&quot;: &quot;String&quot;}, &quot;refreshToken&quot; : {&quot;value&quot; : &quot;#[flowVars.refreshToken]&quot;, &quot;type&quot;: &quot;String&quot;}, &quot;isSimulation&quot; : {&quot;value&quot; : &quot;#[flowVars.isSimulation]&quot;, &quot;type&quot;: &quot;String&quot;}}} " mimeType="application/json" doc:name="Set Payload"/>
<set-property propertyName="Content-Type" value="application/json" doc:name="set Content-Type to application/json"/>
<logger message="Payload before call camunda #[message.payloadAs(java.lang.String)]" level="INFO" doc:name="Logger"/>
<http:request config-ref="HTTP_Camunda_configuration" path="/rest/engine/default/process-definition/key/${camunda.deploymentProcess.name}/start" method="POST" sendBodyMode="ALWAYS" doc:name="call Camunda"/>
......@@ -271,9 +272,10 @@ http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mul
</when>
<otherwise>
<set-variable variableName="vAppName" value="#[json:applicationId]" mimeType="application/json" doc:name="Store application ID" metadata:id="d5b18443-2f8d-4683-90ba-c08fe5e2e233"/>
<set-variable variableName="isSimulation" value="#[json:isSimulation]" doc:name="Store isSimulation flag"/>
<set-variable variableName="vUseExistingCP" value="#[json:useExistingCP]" mimeType="application/json" doc:name="Store useExistingCP" metadata:id="d5b18443-2f8d-4683-90ba-c08fe5e2e234"/>
<set-variable variableName="vCdoResourcePath" value="#[json:cdoResourcePath]" mimeType="application/json" doc:name="Store cdoResourcePath" metadata:id="d5b18443-2f8d-4683-90ba-c08fe5e2e235"/>
<set-payload value="{ &quot;variables&quot;: { &quot;applicationId&quot;: { &quot;value&quot;: &quot;#[flowVars.vAppName]&quot;, &quot;type&quot;: &quot;String&quot; }, &quot;useExistingCP&quot;: { &quot;value&quot;: &quot;#[flowVars.vUseExistingCP]&quot;, &quot;type&quot;: &quot;Boolean&quot; }, &quot;cpCdoPath&quot;: { &quot;value&quot;: &quot;#[flowVars.vCdoResourcePath]&quot;, &quot;type&quot;: &quot;String&quot; }, &quot;melodicAuthorizationToken&quot;: { &quot;value&quot;: &quot;#[flowVars.melodicAuthorizationToken]&quot;, &quot;type&quot;: &quot;String&quot; }, &quot;refreshToken&quot;: { &quot;value&quot;: &quot;#[flowVars.refreshToken]&quot;, &quot;type&quot;: &quot;String&quot; } } }" mimeType="application/json" doc:name="Set Payload"/>
<set-payload value="{ &quot;variables&quot;: { &quot;applicationId&quot;: { &quot;value&quot;: &quot;#[flowVars.vAppName]&quot;, &quot;type&quot;: &quot;String&quot; }, &quot;useExistingCP&quot;: { &quot;value&quot;: &quot;#[flowVars.vUseExistingCP]&quot;, &quot;type&quot;: &quot;Boolean&quot; }, &quot;cpCdoPath&quot;: { &quot;value&quot;: &quot;#[flowVars.vCdoResourcePath]&quot;, &quot;type&quot;: &quot;String&quot; }, &quot;melodicAuthorizationToken&quot;: { &quot;value&quot;: &quot;#[flowVars.melodicAuthorizationToken]&quot;, &quot;type&quot;: &quot;String&quot; }, &quot;refreshToken&quot;: { &quot;value&quot;: &quot;#[flowVars.refreshToken]&quot;, &quot;type&quot;: &quot;String&quot; } , &quot;isSimulation&quot;: { &quot;value&quot;: &quot;#[flowVars.isSimulation]&quot;, &quot;type&quot;: &quot;String&quot; } } }" mimeType="application/json" doc:name="Set Payload"/>
<set-property propertyName="Content-Type" value="application/json" doc:name="set Content-Type to application/json"/>
<flow-ref name="LogPayload" doc:name="LogPayload"/>
<http:request config-ref="HTTP_Camunda_configuration" path="/rest/engine/default/process-definition/key/${camunda.deploymentProcess.name}/start" method="POST" sendBodyMode="ALWAYS" doc:name="call Camunda"/>
......
......@@ -14,6 +14,7 @@ public class AdapterTransformer {
eu.melodic.models.interfaces.adapter.ApplicationDeploymentRequestImpl interfaceRequest= new eu.melodic.models.interfaces.adapter.ApplicationDeploymentRequestImpl();
interfaceRequest.setApplicationId(req.getApplicationId());
interfaceRequest.setCdoModelsPath(req.getCdoResourcePath());
interfaceRequest.setIsSimulation(req.getIsSimulation());
interfaceRequest.setNotificationURI("/api/adapter/deploymentNotification/" + req.getProcessId() +"/" + req.getNotificationSubject());
interfaceRequest.setWatermark(req.getWatermark());
......
......@@ -240,7 +240,8 @@ public class ApplicationDeploymentExecutor {
}
log.info("Preparing ApplicationDeploymentRequest...");
ApplicationDeploymentRequest request = prepareApplicationDeploymentRequest(execution.getVariable(APPLICATION_ID_VARIABLE).toString(), execution.getVariable("businessKey").toString(), execution.getVariable("cpCdoPath").toString());
ApplicationDeploymentRequest request = prepareApplicationDeploymentRequest(execution.getVariable(APPLICATION_ID_VARIABLE).toString(),
execution.getVariable("businessKey").toString(), execution.getVariable("cpCdoPath").toString(), execution.getVariable("isSimulation").toString());
log.info("ApplicationDeploymentRequest prepared. Sending...");
sendAuthorizedPOSTRequest(execution, request, "applicationDeployment", execution.getVariable(ACCESS_TOKEN_VARIABLE).toString());
log.info("ApplicationDeploymentRequest sent.");
......@@ -436,12 +437,14 @@ public class ApplicationDeploymentExecutor {
return request;
}
private ApplicationDeploymentRequest prepareApplicationDeploymentRequest(String applicationId, String uuid , String cdoResourcePath) {
private ApplicationDeploymentRequest prepareApplicationDeploymentRequest(String applicationId, String uuid,
String cdoResourcePath, String isSimulation) {
ApplicationDeploymentRequest request = new ApplicationDeploymentRequestImpl();
request.setApplicationId(applicationId);
request.setCdoResourcePath(cdoResourcePath);
request.setNotificationSubject("ApplicationDeploymentNotification");
request.setProcessId(uuid);
request.setIsSimulation(isSimulation);
request.setWatermark(prepareWatermark(uuid));
return request;
}
......
......@@ -56,7 +56,8 @@ public class StartProcessVerifierDelegate implements JavaDelegate {
if (pi !=null){
log.info("There is already running process with ID: " +pi.getProcessInstanceId().toString() + " for application: "+execution.getVariable("applicationId") +". This process shall NOT start.");
execution.setVariable("localStartProcessDecision", "STOP");
} else {
} else if (!Boolean.parseBoolean(execution.getVariable("isSimulation").toString())){
//we don't want to wait if application is launched in simulation mode
log.info("No other running processes for application: "+execution.getVariable("applicationId") + ", check if enough time passed since last process finished.");
Calendar calendar = Calendar.getInstance();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment