Package com.orientechnologies.orient.test.database.speed

Source Code of com.orientechnologies.orient.test.database.speed.LocalCreateVertexSpeedTest

/*
*
*  *  Copyright 2014 Orient Technologies LTD (info(at)orientechnologies.com)
*  *
*  *  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.
*  *
*  * For more information: http://www.orientechnologies.com
*/
package com.orientechnologies.orient.test.database.speed;

import com.orientechnologies.orient.core.Orient;
import com.orientechnologies.orient.core.config.OGlobalConfiguration;
import com.orientechnologies.orient.core.intent.OIntentMassiveInsert;
import com.orientechnologies.orient.test.database.base.OrientMonoThreadTest;
import com.tinkerpop.blueprints.impls.orient.OrientBaseGraph;
import com.tinkerpop.blueprints.impls.orient.OrientGraphFactory;
import org.testng.annotations.Test;

import java.util.Date;

@Test
public class LocalCreateVertexSpeedTest extends OrientMonoThreadTest {
  private OrientBaseGraph database;
  private Date            date = new Date();

  public LocalCreateVertexSpeedTest() throws InstantiationException, IllegalAccessException {
    super(1000000);
  }

  @Test(enabled = false)
  public static void main(String[] iArgs) throws InstantiationException, IllegalAccessException {
    OGlobalConfiguration.USE_WAL.setValue(false);
    LocalCreateVertexSpeedTest test = new LocalCreateVertexSpeedTest();
    test.data.go(test);
  }

  @Override
  @Test(enabled = false)
  public void init() {
    final OrientGraphFactory factory = new OrientGraphFactory(System.getProperty("url"));
    factory.setStandardElementConstraints(false);

    if (factory.exists())
      factory.drop();

    database = factory.getNoTx();

    database.createVertexType("Account");

    database.getRawGraph().declareIntent(new OIntentMassiveInsert());
  }

  @Override
  @Test(enabled = false)
  public void cycle() {
    database.addVertex("class:Account", "id", data.getCyclesDone(), "name", "Luca", "surname", "Garulli", "birthDate", date, "salary",
        3000f + data.getCyclesDone());

    if (data.getCyclesDone() == data.getCycles() - 1)
      database.commit();
  }

  @Override
  @Test(enabled = false)
  public void deinit() {
    System.out.println(Orient.instance().getProfiler().dump());

    if (database != null)
      database.shutdown();
    super.deinit();
}
}
TOP

Related Classes of com.orientechnologies.orient.test.database.speed.LocalCreateVertexSpeedTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.