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=========================================================
21 package org.openecomp.sdc.ci.tests.migration.v1707.preupgrade;
23 import static org.testng.Assert.assertTrue;
25 import java.io.IOException;
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;
34 import com.thinkaurelius.titan.core.TitanVertex;
36 public class AttKeyPropertiesBeforeRenameTest extends ComponentBaseTest {
40 public static TestName name = new TestName();
42 public AttKeyPropertiesBeforeRenameTest() {
43 super(name, AttKeyPropertiesBeforeRenameTest.class.getName());
47 public void verifyAttPropertyKeys() throws Exception {
49 CommonMigrationUtils.assertKeyExists(titanGraph, "attContact");
50 CommonMigrationUtils.assertKeyExists(titanGraph, "attCreator");
51 CommonMigrationUtils.assertKeyExists(titanGraph, "attuid");
52 CommonMigrationUtils.assertKeyExists(titanGraph, "pmatt");
54 CommonMigrationUtils.assertKeyNotExist(titanGraph, "userId");
55 CommonMigrationUtils.assertKeyNotExist(titanGraph, "projectCode");
56 CommonMigrationUtils.assertKeyNotExist(titanGraph, "contactId");
57 CommonMigrationUtils.assertKeyNotExist(titanGraph, "creatorId");
59 saveVerticesWithPropertyKeyToFile("attContact");
60 saveVerticesWithPropertyKeyToFile("attCreator");
61 saveVerticesWithPropertyKeyToFile("attuid");
62 saveVerticesWithPropertyKeyToFile("pmatt");
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);