/** * ============LICENSE_START======================================================= * org.onap.aai * ================================================================================ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============LICENSE_END========================================================= */ package org.onap.aai.stress; import java.util.HashSet; import java.util.Set; import org.apache.commons.lang3.RandomStringUtils; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.janusgraph.core.JanusGraphTransaction; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import org.onap.aai.AAISetup; import org.onap.aai.dbmap.AAIGraph; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.test.annotation.DirtiesContext; @Ignore("Run this only to test indexes limit") @DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS) public class IndexStressTest extends AAISetup { private static final Logger LOGGER = LoggerFactory.getLogger(IndexStressTest.class); @Before public void setup(){ AAIGraph.getInstance().getGraph(); } @Test public void testIndexStress(){ JanusGraphTransaction tx = AAIGraph.getInstance().getGraph().newTransaction(); GraphTraversalSource g = tx.traversal(); Set linkNameSet = new HashSet<>(); Set aaiUriSet = new HashSet<>(); int TOTAL_LINKS = 101000; for(int i = 0; i uniqueKeys){ while(true) { String data = RandomStringUtils.randomAlphabetic(20); if (!uniqueKeys.contains(data)){ uniqueKeys.add(data); return data; } } } }