1 package org.openecomp.sdc.ci.tests.migration.v1707.preupgrade;
3 import com.thinkaurelius.titan.core.TitanVertex;
5 import org.junit.rules.TestName;
6 import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
7 import org.openecomp.sdc.ci.tests.migration.v1707.CommonMigrationUtils;
8 import org.openecomp.sdc.ci.tests.utils.graph.GraphFileUtils;
9 import org.testng.annotations.Test;
11 import java.io.IOException;
13 import static org.testng.Assert.assertTrue;
15 public class AttKeyPropertiesBeforeRenameTest extends ComponentBaseTest {
19 public static TestName name = new TestName();
21 public AttKeyPropertiesBeforeRenameTest() {
22 super(name, AttKeyPropertiesBeforeRenameTest.class.getName());
26 public void verifyAttPropertyKeys() throws Exception {
28 CommonMigrationUtils.assertKeyExists(titanGraph, "attContact");
29 CommonMigrationUtils.assertKeyExists(titanGraph, "attCreator");
30 CommonMigrationUtils.assertKeyExists(titanGraph, "attuid");
31 CommonMigrationUtils.assertKeyExists(titanGraph, "pmatt");
33 CommonMigrationUtils.assertKeyNotExist(titanGraph, "userId");
34 CommonMigrationUtils.assertKeyNotExist(titanGraph, "projectCode");
35 CommonMigrationUtils.assertKeyNotExist(titanGraph, "contactId");
36 CommonMigrationUtils.assertKeyNotExist(titanGraph, "creatorId");
38 saveVerticesWithPropertyKeyToFile("attContact");
39 saveVerticesWithPropertyKeyToFile("attCreator");
40 saveVerticesWithPropertyKeyToFile("attuid");
41 saveVerticesWithPropertyKeyToFile("pmatt");
44 private void saveVerticesWithPropertyKeyToFile(String propertyKey) throws IOException {
45 Iterable<TitanVertex> vertices = titanGraph.query().has(propertyKey).vertices();
46 assertTrue(vertices.iterator().hasNext());
47 GraphFileUtils.writeVerticesUIDToFile(propertyKey, vertices);