Catalog alignment
[sdc.git] / asdctool / src / test / java / org / openecomp / sdc / asdctool / migration / tasks / mig1806 / ForwardPathMigrationTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2019 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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.openecomp.sdc.asdctool.migration.tasks.mig1806;
22
23 import org.hamcrest.core.Is;
24 import org.hamcrest.core.IsNull;
25 import org.junit.Before;
26 import org.junit.Test;
27 import org.mockito.Mock;
28 import org.openecomp.sdc.asdctool.migration.core.DBVersion;
29 import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
30 import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
31 import org.openecomp.sdc.be.model.operations.impl.UserAdminOperation;
32
33 import java.math.BigInteger;
34
35 import static org.junit.Assert.assertThat;
36
37 public class ForwardPathMigrationTest {
38
39     ForwardPathMigration forwardPathMigration = null;
40
41     @Mock
42     JanusGraphDao janusGraphDao;
43
44     @Mock
45     UserAdminOperation userAdminOperation;
46
47     @Mock
48     ToscaOperationFacade toscaOperationFacade;
49
50     @Before
51     public void setUp() throws Exception {
52         forwardPathMigration = new ForwardPathMigration(janusGraphDao, userAdminOperation, toscaOperationFacade);
53     }
54
55     @Test
56     public void testDescription() {
57         assertThat(forwardPathMigration,IsNull.notNullValue());
58         assertThat("remove corrupted forwarding paths ", Is.is(forwardPathMigration.description()));
59     }
60
61     @Test
62     public void testGetVersion() {
63         DBVersion dbVersion = DBVersion.from(BigInteger.valueOf(Version.MAJOR.getValue()), BigInteger.valueOf(Version.MINOR.getValue()));
64         assertThat(dbVersion,Is.is(forwardPathMigration.getVersion()));
65     }
66
67     @Test(expected = NullPointerException.class)
68     public void testMigrate() {
69         assertThat(forwardPathMigration,IsNull.notNullValue());
70         forwardPathMigration.migrate();
71     }
72 }