From 3732da89dda106bcf4d59c428737b67be42d7022 Mon Sep 17 00:00:00 2001 From: Elena Kuleshov Date: Wed, 19 Sep 2018 14:07:11 -0400 Subject: Deployment script for Activities Deployment script for activities to WorkflowDesigner and activities specs. Change-Id: I7474805ccf5c8ab0e0a7a43b785de02a29649e2e Issue-ID: SO-840 Signed-off-by: Elena Kuleshov --- .../bpmn/activity/DeployActivitySpecsTest.java | 62 ++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecsTest.java (limited to 'bpmn/so-bpmn-building-blocks/src/test') diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecsTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecsTest.java new file mode 100644 index 0000000000..77146593ba --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecsTest.java @@ -0,0 +1,62 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.bpmn.activity; + +import static org.junit.Assert.*; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.apache.http.HttpResponse; +import org.apache.http.ProtocolVersion; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.message.BasicHttpResponse; +import org.junit.Test; + +public class DeployActivitySpecsTest { + private static final String RESULT_STRING = "HTTP/1.1 404 "; + private static final String HOSTNAME = "http://localhost:8080"; + + @Test + public void DeployActivitySpecsMain_Test() throws Exception { + ProtocolVersion protocolVersion = new ProtocolVersion("", 1, 1); + HttpResponse response = new BasicHttpResponse(protocolVersion, 1, ""); + response.setStatusCode(404); + response.setStatusLine(protocolVersion, 1, ""); + HttpClient clientMock = mock(HttpClient.class); + when(clientMock.execute(any(HttpPost.class))).thenReturn(response); + String[] args = new String[] {HOSTNAME}; + DeployActivitySpecs.main(args); + } + + @Test + public void DeployActivitySpec_Test() throws Exception { + ProtocolVersion protocolVersion = new ProtocolVersion("", 1, 1); + HttpResponse response = new BasicHttpResponse(protocolVersion, 1, ""); + response.setStatusCode(404); + response.setStatusLine(protocolVersion, 1, ""); + HttpClient clientMock = mock(HttpClient.class); + when(clientMock.execute(any(HttpPost.class))).thenReturn(response); ; + String result = DeployActivitySpecs.deployActivitySpec(HOSTNAME, "VNFQuiesceTrafficActivitySpec.json"); + assertEquals(result, RESULT_STRING); + } +} -- cgit 1.2.3-korg