Fix for radio buttons
[sdc.git] / asdc-tests / src / main / java / org / openecomp / sdc / ci / tests / migration / v1707 / preupgrade / AttKeyPropertiesBeforeRenameTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
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
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.ci.tests.migration.v1707.preupgrade;
22
23 import static org.testng.Assert.assertTrue;
24
25 import java.io.IOException;
26
27 import org.junit.Rule;
28 import org.junit.rules.TestName;
29 import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
30 import org.openecomp.sdc.ci.tests.migration.v1707.CommonMigrationUtils;
31 import org.openecomp.sdc.ci.tests.utils.graph.GraphFileUtils;
32 import org.testng.annotations.Test;
33
34 import com.thinkaurelius.titan.core.TitanVertex;
35
36 public class AttKeyPropertiesBeforeRenameTest extends ComponentBaseTest {
37
38
39     @Rule
40     public static TestName name = new TestName();
41
42     public AttKeyPropertiesBeforeRenameTest() {
43         super(name, AttKeyPropertiesBeforeRenameTest.class.getName());
44     }
45
46     @Test
47     public void verifyAttPropertyKeys() throws Exception {
48         initGraph();
49         CommonMigrationUtils.assertKeyExists(titanGraph, "attContact");
50         CommonMigrationUtils.assertKeyExists(titanGraph, "attCreator");
51         CommonMigrationUtils.assertKeyExists(titanGraph, "attuid");
52         CommonMigrationUtils.assertKeyExists(titanGraph, "pmatt");
53
54         CommonMigrationUtils.assertKeyNotExist(titanGraph, "userId");
55         CommonMigrationUtils.assertKeyNotExist(titanGraph, "projectCode");
56         CommonMigrationUtils.assertKeyNotExist(titanGraph, "contactId");
57         CommonMigrationUtils.assertKeyNotExist(titanGraph, "creatorId");
58
59         saveVerticesWithPropertyKeyToFile("attContact");
60         saveVerticesWithPropertyKeyToFile("attCreator");
61         saveVerticesWithPropertyKeyToFile("attuid");
62         saveVerticesWithPropertyKeyToFile("pmatt");
63     }
64
65     private void saveVerticesWithPropertyKeyToFile(String propertyKey) throws IOException {
66         Iterable<TitanVertex> vertices = titanGraph.query().has(propertyKey).vertices();
67         assertTrue(vertices.iterator().hasNext());
68         GraphFileUtils.writeVerticesUIDToFile(propertyKey, vertices);
69     }
70 }