From 2eb23f4ac862f700f0abf6f2dc5b9fa662ec9c60 Mon Sep 17 00:00:00 2001 From: "Kuleshov, Elena" Date: Fri, 24 Jan 2020 16:33:39 -0500 Subject: add manual handling to rainy day handling for bbs Initial Manual Handling addition to Rainy Day BB handling. Reenable task API, add task variable setup. TaskTimeout will come from the configuration settings. Update the base path for the APIH manual tasks junit. Additional JUNIT tests for manual handling Add Manual as a primary policy for Change Management BBs. Error handling changes and robot tests for manual handling. Correct failure data retrieval when serviceSubscription is unavailable. Correct failure data retrieval when serviceSubscription is unavailable. Keep WorkflowException when manual pause gets invoked; improved error reporting. Issue-ID: SO-2616 Signed-off-by: Benjamin, Max (mb388a) Change-Id: I98a84c1a489bb7b24b68e567f604aeb074fd7bf9 --- common/src/test/java/org/onap/so/BeansTest.java | 1 - .../onap/so/client/ruby/RubyCheckClientTest.java | 101 --------------------- .../onap/so/client/ruby/beans/RubyBeansTest.java | 55 ----------- 3 files changed, 157 deletions(-) delete mode 100644 common/src/test/java/org/onap/so/client/ruby/RubyCheckClientTest.java delete mode 100644 common/src/test/java/org/onap/so/client/ruby/beans/RubyBeansTest.java (limited to 'common/src/test/java/org') diff --git a/common/src/test/java/org/onap/so/BeansTest.java b/common/src/test/java/org/onap/so/BeansTest.java index 9e8a0184ab..01bdc4db38 100644 --- a/common/src/test/java/org/onap/so/BeansTest.java +++ b/common/src/test/java/org/onap/so/BeansTest.java @@ -63,7 +63,6 @@ public class BeansTest { test("org.onap.so.appc.orchestrator.service.beans"); test("org.onap.so.client.policy.entities"); test("org.onap.so.client.grm.beans"); - test("org.onap.so.client.ruby.beans"); test("org.onap.so.client.sdno.beans"); test("org.onap.so.entity"); test("org.onap.so.serviceinstancebeans"); diff --git a/common/src/test/java/org/onap/so/client/ruby/RubyCheckClientTest.java b/common/src/test/java/org/onap/so/client/ruby/RubyCheckClientTest.java deleted file mode 100644 index 1ca8942ac1..0000000000 --- a/common/src/test/java/org/onap/so/client/ruby/RubyCheckClientTest.java +++ /dev/null @@ -1,101 +0,0 @@ -/*- - * ============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.client.ruby; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.text.ParseException; -import java.time.format.DateTimeFormatter; -import org.junit.Test; -import org.onap.so.client.ruby.beans.Ruby; -import static org.apache.commons.lang3.StringUtils.*; -import com.fasterxml.jackson.databind.ObjectMapper; - -public class RubyCheckClientTest { - private final String fileLocation = "src/test/resources/org/onap/so/client/ruby/create-ticket/"; - private static final String REQUEST_ID = "abc123"; - private static final String SOURCE_NAME = "source-name"; - private static final String TIME = "test-time"; - private static final String REASON = "reason"; - private static final String WORK_FLOW_ID = "work-flow-Id"; - private static final String NOTIFICATION = "notification"; - - - - @Test - public void verifyRubyCreateTicketRequest() throws IOException, ParseException { - String content = this.getJson("create-ticket-request.json"); - ObjectMapper mapper = new ObjectMapper(); - Ruby expected = mapper.readValue(content, Ruby.class); - RubyClient client = new RubyClient(); - RubyClient spy = spy(client); - when(spy.getTime()).thenReturn(TIME); - String actual = spy.buildRequest(REQUEST_ID, SOURCE_NAME, REASON, WORK_FLOW_ID, NOTIFICATION); - assertEquals("payloads are equal", mapper.writeValueAsString(expected), actual); - } - - - @Test - public void verifyTimeFormat() { - RubyClient client = new RubyClient(); - String time = client.getTime(); - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("EEE, dd MMM yyyy HH:mm:ss Z"); - formatter.parse(time); - } - - - @Test - public void verifyReasonCharLimit() throws IOException { - final String reasonLong = repeat("*", 256); - RubyClient client = new RubyClient(); - try { - client.buildRequest(REQUEST_ID, SOURCE_NAME, reasonLong, WORK_FLOW_ID, NOTIFICATION); - fail("Should have thrown IllegalArgumentException but did not!"); - } catch (final IllegalArgumentException e) { - final String msg = "reason exceeds 255 characters"; - assertEquals(msg, e.getMessage()); - } - } - - @Test - public void verifyNotificationCharLimit() throws IOException { - final String notificationLong = repeat("*", 1025); - RubyClient client = new RubyClient(); - try { - client.buildRequest(REQUEST_ID, SOURCE_NAME, REASON, WORK_FLOW_ID, notificationLong); - fail("Should have thrown IllegalArgumentException but did not!"); - } catch (final IllegalArgumentException e) { - final String msg = "notification exceeds 1024 characters"; - assertEquals(msg, e.getMessage()); - } - } - - private String getJson(String filename) throws IOException { - return new String(Files.readAllBytes(Paths.get(fileLocation + filename))); - } - -} - diff --git a/common/src/test/java/org/onap/so/client/ruby/beans/RubyBeansTest.java b/common/src/test/java/org/onap/so/client/ruby/beans/RubyBeansTest.java deleted file mode 100644 index ca80930468..0000000000 --- a/common/src/test/java/org/onap/so/client/ruby/beans/RubyBeansTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 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.client.ruby.beans; - -import org.junit.Test; -import com.openpojo.reflection.PojoClass; -import com.openpojo.reflection.PojoClassFilter; -import com.openpojo.reflection.filters.FilterEnum; -import com.openpojo.reflection.filters.FilterPackageInfo; -import com.openpojo.validation.Validator; -import com.openpojo.validation.ValidatorBuilder; -import com.openpojo.validation.rule.impl.GetterMustExistRule; -import com.openpojo.validation.rule.impl.SetterMustExistRule; -import com.openpojo.validation.test.impl.GetterTester; -import com.openpojo.validation.test.impl.SetterTester; - -public class RubyBeansTest { - - private PojoClassFilter filterTestClasses = new FilterTestClasses(); - - @Test - public void pojoStructure() { - test("org.onap.so.client.ruby.beans"); - } - - private void test(String pojoPackage) { - Validator validator = ValidatorBuilder.create().with(new GetterMustExistRule()).with(new SetterMustExistRule()) - .with(new SetterTester()).with(new GetterTester()).build(); - validator.validate(pojoPackage, new FilterPackageInfo(), new FilterEnum(), filterTestClasses); - } - - private static class FilterTestClasses implements PojoClassFilter { - public boolean include(PojoClass pojoClass) { - return !pojoClass.getSourcePath().contains("/test-classes/"); - } - } -} -- cgit 1.2.3-korg