/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * 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
+ * ============LICENSE_START======================================================= Copyright (C) 2019 Nordix
+ * Foundation. ================================================================================ 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.
+ * 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.
*
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
+ * SPDX-License-Identifier: Apache-2.0 ============LICENSE_END=========================================================
*/
package org.onap.so.bpmn.infrastructure.pnf.delegate;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_INSTANCE_NAME;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SERVICE_MODEL_INFO;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SKIP_POST_INSTANTIATION_CONFIGURATION;
-
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {CatalogDbClient.class, ExceptionBuilder.class, ConfigCheckerDelegate.class,
- ProcessEngineConfiguration.class})
+ ProcessEngineConfiguration.class})
public class ConfigCheckerDelegateTest {
private static String TEST_PROCESS_KEY = "processKey1";
/**
* Service model info json.
*/
- private static String TEST_SERVICE_MODEL_INFO = "{\n"
- + " \"modelType\":\"service\",\n"
- + " \"modelInvariantUuid\":\"539b7a2f-9524-4dbf-9eee-f2e05521df3f\",\n"
- + " \"modelInvariantId\":\"539b7a2f-9524-4dbf-9eee-f2e05521df3f\",\n"
- + " \"modelUuid\":\"f2daaac6-5017-4e1e-96c8-6a27dfbe1421\",\n"
- + " \"modelName\":\"PNF_demo_resource\",\n"
- + " \"modelVersion\":\"1.0\"\n"
- + " }";
+ private static String TEST_SERVICE_MODEL_INFO = "{\n" + " \"modelType\":\"service\",\n"
+ + " \"modelInvariantUuid\":\"539b7a2f-9524-4dbf-9eee-f2e05521df3f\",\n"
+ + " \"modelInvariantId\":\"539b7a2f-9524-4dbf-9eee-f2e05521df3f\",\n"
+ + " \"modelUuid\":\"f2daaac6-5017-4e1e-96c8-6a27dfbe1421\",\n"
+ + " \"modelName\":\"PNF_demo_resource\",\n" + " \"modelVersion\":\"1.0\"\n" + " }";
/**
* Testing model UUID, should be the same as specified in the TEST_SERVICE_MODEL_INFO.
List<PnfResourceCustomization> pnfResourceCustomizations = new ArrayList<>();
pnfResourceCustomizations.add(buildPnfResourceCustomization());
given(catalogDbClient.getPnfResourceCustomizationByModelUuid(TEST_MODEL_UUID))
- .willReturn(pnfResourceCustomizations);
+ .willReturn(pnfResourceCustomizations);
execution.setVariable("testProcessKey", TEST_PROCESS_KEY);
execution.setVariable(SERVICE_MODEL_INFO, TEST_SERVICE_MODEL_INFO);
}
@Test
public void testExecution_EmptyPnfResourceCustomization_exceptionThrown() {
given(catalogDbClient.getPnfResourceCustomizationByModelUuid("f2daaac6-5017-4e1e-96c8-6a27dfbe1421"))
- .willReturn(Collections.EMPTY_LIST);
+ .willReturn(Collections.EMPTY_LIST);
assertThatThrownBy(() -> configCheckerDelegate.execute(execution)).isInstanceOf(BpmnError.class);
assertThat(execution.getVariable("WorkflowExceptionErrorMessage")).asString()
- .contains("Unable to find the PNF resource customizations of model service UUID")
- .contains("f2daaac6-5017-4e1e-96c8-6a27dfbe1421");
+ .contains("Unable to find the PNF resource customizations of model service UUID")
+ .contains("f2daaac6-5017-4e1e-96c8-6a27dfbe1421");
assertThat(execution.getVariable("WorkflowException")).isInstanceOf(WorkflowException.class);
}
execution.removeVariable("serviceModelInfo");
assertThatThrownBy(() -> configCheckerDelegate.execute(execution)).isInstanceOf(BpmnError.class);
assertThat(execution.getVariable("WorkflowExceptionErrorMessage")).asString()
- .contains("Unable to find parameter serviceModelInfo");
+ .contains("Unable to find parameter serviceModelInfo");
assertThat(execution.getVariable("WorkflowException")).isInstanceOf(WorkflowException.class);
}
-}
\ No newline at end of file
+}