Search in sources :

Example 1 with JavaClassForTest

use of org.voltdb.sysprocs.UpdateCore.JavaClassForTest in project voltdb by VoltDB.

the class TestMockUpdateApplicationCatalog method setUp.

@Override
public void setUp() throws Exception {
    TPCCProjectBuilder builder = new TPCCProjectBuilder();
    builder.addDefaultSchema();
    builder.addDefaultPartitioning();
    boolean success = builder.compile(Configuration.getPathToCatalogForTest("catalogupdate-cluster-base.jar"), 1, 1, 0);
    assert (success);
    MiscUtils.copyFile(builder.getPathToDeployment(), Configuration.getPathToCatalogForTest("catalogupdate-cluster-base.xml"));
    m_config = new VoltDB.Configuration();
    m_config.m_pathToCatalog = Configuration.getPathToCatalogForTest("catalogupdate-cluster-base.jar");
    m_config.m_pathToDeployment = Configuration.getPathToCatalogForTest("catalogupdate-cluster-base.xml");
    m_localServer = new ServerThread(m_config);
    m_localServer.start();
    m_localServer.waitForInitialization();
    builder = new TPCCProjectBuilder();
    builder.addDefaultSchema();
    builder.addDefaultPartitioning();
    builder.addProcedures(BASEPROCS);
    success = builder.compile(Configuration.getPathToCatalogForTest("catalogupdate-cluster-expanded.jar"), 1, 1, 0);
    assert (success);
    JavaClassForTest testClass = Mockito.mock(JavaClassForTest.class);
    Mockito.when(testClass.forName(Matchers.anyString(), Matchers.anyBoolean(), Mockito.any(ClassLoader.class))).thenThrow(new UnsupportedClassVersionError("Unsupported major.minor version 52.0"));
    UpdateCore.setJavaClassForTest(testClass);
    assertEquals(OperationMode.RUNNING, VoltDB.instance().getMode());
    m_client = ClientFactory.createClient();
    m_client.createConnection("localhost:" + m_config.m_adminPort);
}
Also used : VoltDB(org.voltdb.VoltDB) Configuration(org.voltdb.VoltDB.Configuration) ServerThread(org.voltdb.ServerThread) JavaClassForTest(org.voltdb.sysprocs.UpdateCore.JavaClassForTest) TPCCProjectBuilder(org.voltdb.benchmark.tpcc.TPCCProjectBuilder)

Aggregations

ServerThread (org.voltdb.ServerThread)1 VoltDB (org.voltdb.VoltDB)1 Configuration (org.voltdb.VoltDB.Configuration)1 TPCCProjectBuilder (org.voltdb.benchmark.tpcc.TPCCProjectBuilder)1 JavaClassForTest (org.voltdb.sysprocs.UpdateCore.JavaClassForTest)1