2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
20 package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
22 import static org.junit.Assert.assertEquals;
24 import org.junit.Before;
25 import org.junit.Test;
26 import org.onap.so.bpmn.BaseTaskTest;
27 import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
28 import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
29 import org.onap.so.client.exception.BBObjectNotFoundException;
30 import org.onap.so.db.catalog.beans.OrchestrationStatus;
31 import org.springframework.beans.factory.annotation.Autowired;
33 public class AssignNetworkTest extends BaseTaskTest {
36 private AssignNetwork assignNetwork;
38 private L3Network network;
41 public void before() {
42 network = setL3Network();
46 public void networkNotFoundTest() throws Exception {
47 //network status to PRECREATED - when it was NOT found by name
49 network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID,execution.getLookupMap().get(ResourceKey.NETWORK_ID));
50 } catch(BBObjectNotFoundException e) {
53 network.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
54 boolean networkFound = assignNetwork.networkFoundByName(execution);
55 assertEquals(false, networkFound);
59 public void networkFoundTest() throws Exception {
61 network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID,execution.getLookupMap().get(ResourceKey.NETWORK_ID));
62 } catch(BBObjectNotFoundException e) {
64 boolean networkFound = assignNetwork.networkFoundByName(execution);
65 assertEquals(true, networkFound);