org.testng.annotations.BeforeMethod Java Examples

The following examples show how to use org.testng.annotations.BeforeMethod. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestShardMetadataRecordCursor.java    From presto with Apache License 2.0 6 votes vote down vote up
@BeforeMethod
public void setup()
{
    this.dbi = new DBI("jdbc:h2:mem:test" + System.nanoTime() + ThreadLocalRandom.current().nextLong());
    this.dbi.registerMapper(new TableColumn.Mapper(new InternalTypeManager(createTestMetadataManager())));
    this.dummyHandle = dbi.open();
    createTablesWithRetry(dbi);
    this.metadata = new RaptorMetadata(dbi, createShardManager(dbi));

    // Create table
    ConnectorTableMetadata table = tableMetadataBuilder(DEFAULT_TEST_ORDERS)
            .column("orderkey", BIGINT)
            .column("orderdate", DATE)
            .property("temporal_column", "orderdate")
            .build();
    createTable(table);
}
 
Example #2
Source File: TestStreamingAggregationOperator.java    From presto with Apache License 2.0 6 votes vote down vote up
@BeforeMethod
public void setUp()
{
    executor = newCachedThreadPool(daemonThreadsNamed("test-executor-%s"));
    scheduledExecutor = newScheduledThreadPool(2, daemonThreadsNamed("test-scheduledExecutor-%s"));

    driverContext = createTaskContext(executor, scheduledExecutor, TEST_SESSION)
            .addPipelineContext(0, true, true, false)
            .addDriverContext();

    operatorFactory = StreamingAggregationOperator.createOperatorFactory(
            0,
            new PlanNodeId("test"),
            ImmutableList.of(BOOLEAN, VARCHAR, BIGINT),
            ImmutableList.of(VARCHAR),
            ImmutableList.of(1),
            AggregationNode.Step.SINGLE,
            ImmutableList.of(COUNT.bind(ImmutableList.of(0), Optional.empty()),
                    LONG_SUM.bind(ImmutableList.of(2), Optional.empty())),
            new JoinCompiler(createTestMetadataManager()));
}
 
Example #3
Source File: RemoveUnusedAttributesPluginTest.java    From constellation with Apache License 2.0 6 votes vote down vote up
@BeforeMethod
public void setUpMethod() {
    // adding nodes to graph
    vertex1 = graph.addVertex();
    vertex2 = graph.addVertex();
    vertex3 = graph.addVertex();
    vertexAttribute1 = graph.addAttribute(GraphElementType.VERTEX, StringAttributeDescription.ATTRIBUTE_NAME, "test1", "test1 desc.", null, null);
    vertexAttribute2 = graph.addAttribute(GraphElementType.VERTEX, StringAttributeDescription.ATTRIBUTE_NAME, "test2", "test1 desc.", null, null);
    vertexAttribute3 = graph.addAttribute(GraphElementType.VERTEX, StringAttributeDescription.ATTRIBUTE_NAME, "test3", "test1 desc.", null, null);
    // adding transactions to the graph
    transaction1 = graph.addTransaction(vertex1, vertex2, true);
    transaction2 = graph.addTransaction(vertex1, vertex3, true);
    transactionAttribute1 = graph.addAttribute(GraphElementType.TRANSACTION, StringAttributeDescription.ATTRIBUTE_NAME, "test4", "test1 desc.", null, null);
    transactionAttribute2 = graph.addAttribute(GraphElementType.TRANSACTION, StringAttributeDescription.ATTRIBUTE_NAME, "test5", "test1 desc.", null, null);
    transactionAttribute3 = graph.addAttribute(GraphElementType.TRANSACTION, StringAttributeDescription.ATTRIBUTE_NAME, "test6", "test1 desc.", null, null);
}
 
Example #4
Source File: DiceSimilarityPluginNGTest.java    From constellation with Apache License 2.0 6 votes vote down vote up
@BeforeMethod
public void setUpMethod() throws Exception {
    // create an analytic graph
    final Schema schema = SchemaFactoryUtilities.getSchemaFactory(AnalyticSchemaFactory.ANALYTIC_SCHEMA_ID).createSchema();
    graph = new StoreGraph(schema);

    // add attributes
    transactionDiceAttribute = SnaConcept.TransactionAttribute.DICE_SIMILARITY.ensure(graph);
    vertexSelectedAttribute = VisualConcept.VertexAttribute.SELECTED.ensure(graph);

    // add vertices
    vxId0 = graph.addVertex();
    vxId1 = graph.addVertex();
    vxId2 = graph.addVertex();
    vxId3 = graph.addVertex();
    vxId4 = graph.addVertex();

    // add transactions
    txId0 = graph.addTransaction(vxId0, vxId1, true);
    txId1 = graph.addTransaction(vxId1, vxId2, true);
    txId2 = graph.addTransaction(vxId1, vxId3, true);
    txId3 = graph.addTransaction(vxId2, vxId3, true);
    txId4 = graph.addTransaction(vxId3, vxId4, true);
}
 
Example #5
Source File: BetweennessCentralityPluginNGTest.java    From constellation with Apache License 2.0 6 votes vote down vote up
@BeforeMethod
public void setUpMethod() throws Exception {
    // create an analytic graph
    final Schema schema = SchemaFactoryUtilities.getSchemaFactory(AnalyticSchemaFactory.ANALYTIC_SCHEMA_ID).createSchema();
    graph = new StoreGraph(schema);

    // add attributes
    vertexBetweennessAttribute = SnaConcept.VertexAttribute.BETWEENNESS_CENTRALITY.ensure(graph);
    vertexInBetweennessAttribute = SnaConcept.VertexAttribute.IN_BETWEENNESS_CENTRALITY.ensure(graph);
    vertexOutBetweennessAttribute = SnaConcept.VertexAttribute.OUT_BETWEENNESS_CENTRALITY.ensure(graph);
    vertexSelectedAttribute = VisualConcept.VertexAttribute.SELECTED.ensure(graph);

    // add vertices
    vxId0 = graph.addVertex();
    vxId1 = graph.addVertex();
    vxId2 = graph.addVertex();
    vxId3 = graph.addVertex();
    vxId4 = graph.addVertex();

    // add transactions
    txId0 = graph.addTransaction(vxId0, vxId1, true);
    txId1 = graph.addTransaction(vxId1, vxId2, true);
    txId2 = graph.addTransaction(vxId1, vxId3, true);
    txId3 = graph.addTransaction(vxId2, vxId3, true);
    txId4 = graph.addTransaction(vxId3, vxId4, true);
}
 
Example #6
Source File: DegreeCentralityPluginNGTest.java    From constellation with Apache License 2.0 6 votes vote down vote up
@BeforeMethod
public void setUpMethod() throws Exception {
    // create an analytic graph
    final Schema schema = SchemaFactoryUtilities.getSchemaFactory(AnalyticSchemaFactory.ANALYTIC_SCHEMA_ID).createSchema();
    graph = new StoreGraph(schema);

    // add attributes
    vertexDegreeAttribute = SnaConcept.VertexAttribute.DEGREE_CENTRALITY.ensure(graph);
    vertexInDegreeAttribute = SnaConcept.VertexAttribute.IN_DEGREE_CENTRALITY.ensure(graph);
    vertexOutDegreeAttribute = SnaConcept.VertexAttribute.OUT_DEGREE_CENTRALITY.ensure(graph);
    vertexSelectedAttribute = VisualConcept.VertexAttribute.SELECTED.ensure(graph);

    // add vertices
    vxId0 = graph.addVertex();
    vxId1 = graph.addVertex();
    vxId2 = graph.addVertex();
    vxId3 = graph.addVertex();
    vxId4 = graph.addVertex();

    // add transactions
    txId0 = graph.addTransaction(vxId0, vxId1, true);
    txId1 = graph.addTransaction(vxId1, vxId2, true);
    txId2 = graph.addTransaction(vxId1, vxId3, true);
    txId3 = graph.addTransaction(vxId2, vxId3, true);
    txId4 = graph.addTransaction(vxId3, vxId4, true);
}
 
Example #7
Source File: GraphRecordStoreUtilitiesNGTest.java    From constellation with Apache License 2.0 6 votes vote down vote up
/**
 * Create a graph with N_VX vertices and N_TX transactions.
 * <p>
 * Two pairs of vertices are connected by a transaction each, leaving two
 * singleton vertices.
 *
 * @throws Exception
 */
@BeforeMethod
public void setUpMethod() throws Exception {
    graph = new StoreGraph();
    graph.addAttribute(GraphElementType.VERTEX, BooleanAttributeDescription.ATTRIBUTE_NAME, "selected", "", false, null);
    graph.addAttribute(GraphElementType.TRANSACTION, BooleanAttributeDescription.ATTRIBUTE_NAME, "selected", "", false, null);

    vxs = new int[NUMBER_OF_VERTICES];
    for (int i = 0; i < vxs.length; i++) {
        vxs[i] = graph.addVertex();
    }

    txs = new int[NUMBER_OF_TRANSACTIONS];
    txs[0] = graph.addTransaction(vxs[2], vxs[3], true);
    txs[1] = graph.addTransaction(vxs[4], vxs[5], true);
}
 
Example #8
Source File: TestSpatialJoinOperator.java    From presto with Apache License 2.0 6 votes vote down vote up
@BeforeMethod
public void setUp()
{
    // Before/AfterMethod is chosen here because the executor needs to be shutdown
    // after every single test case to terminate outstanding threads, if any.

    // The line below is the same as newCachedThreadPool(daemonThreadsNamed(...)) except RejectionExecutionHandler.
    // RejectionExecutionHandler is set to DiscardPolicy (instead of the default AbortPolicy) here.
    // Otherwise, a large number of RejectedExecutionException will flood logging, resulting in Travis failure.
    executor = new ThreadPoolExecutor(
            0,
            Integer.MAX_VALUE,
            60L,
            SECONDS,
            new SynchronousQueue<>(),
            daemonThreadsNamed("test-executor-%s"),
            new ThreadPoolExecutor.DiscardPolicy());
    scheduledExecutor = newScheduledThreadPool(2, daemonThreadsNamed("test-scheduledExecutor-%s"));
}
 
Example #9
Source File: KatzCentralityPluginNGTest.java    From constellation with Apache License 2.0 6 votes vote down vote up
@BeforeMethod
public void setUpMethod() throws Exception {
    // create an analytic graph
    final Schema schema = SchemaFactoryUtilities.getSchemaFactory(AnalyticSchemaFactory.ANALYTIC_SCHEMA_ID).createSchema();
    graph = new StoreGraph(schema);

    // add attributes
    vertexKatzAttribute = SnaConcept.VertexAttribute.KATZ_CENTRALITY.ensure(graph);

    // add vertices
    vxId0 = graph.addVertex();
    vxId1 = graph.addVertex();
    vxId2 = graph.addVertex();
    vxId3 = graph.addVertex();
    vxId4 = graph.addVertex();

    // add transactions
    txId0 = graph.addTransaction(vxId0, vxId1, true);
    txId1 = graph.addTransaction(vxId1, vxId2, true);
    txId2 = graph.addTransaction(vxId1, vxId3, true);
    txId3 = graph.addTransaction(vxId2, vxId3, true);
    txId4 = graph.addTransaction(vxId3, vxId4, true);
}
 
Example #10
Source File: MatrixUtilitiesNGTest.java    From constellation with Apache License 2.0 6 votes vote down vote up
@BeforeMethod
public void setUpMethod() throws Exception {
    // create an analytic graph
    final Schema schema = SchemaFactoryUtilities.getSchemaFactory(AnalyticSchemaFactory.ANALYTIC_SCHEMA_ID).createSchema();
    graph = new StoreGraph(schema);

    // add vertices
    vxId0 = graph.addVertex();
    vxId1 = graph.addVertex();
    vxId2 = graph.addVertex();
    vxId3 = graph.addVertex();
    vxId4 = graph.addVertex();

    // add transactions
    txId0 = graph.addTransaction(vxId0, vxId1, false);
    txId1 = graph.addTransaction(vxId1, vxId2, false);
    txId2 = graph.addTransaction(vxId1, vxId3, false);
    txId3 = graph.addTransaction(vxId2, vxId3, false);
    txId4 = graph.addTransaction(vxId3, vxId4, false);
}
 
Example #11
Source File: TestCreateSchemaTask.java    From presto with Apache License 2.0 6 votes vote down vote up
@BeforeMethod
public void setUp()
{
    CatalogManager catalogManager = new CatalogManager();
    TransactionManager transactionManager = createTestTransactionManager(catalogManager);
    Catalog testCatalog = createBogusTestingCatalog(CATALOG_NAME);
    catalogManager.registerCatalog(testCatalog);
    SchemaPropertyManager schemaPropertyManager = new SchemaPropertyManager();
    schemaPropertyManager.addProperties(testCatalog.getConnectorCatalogName(), ImmutableList.of());
    testSession = testSessionBuilder()
            .setTransactionId(transactionManager.beginTransaction(false))
            .build();
    metadata = new TestCreateSchemaTask.MockMetadata(
        schemaPropertyManager,
        testCatalog.getConnectorCatalogName());
}
 
Example #12
Source File: TestMarkDistinctOperator.java    From presto with Apache License 2.0 5 votes vote down vote up
@BeforeMethod
public void setUp()
{
    executor = newCachedThreadPool(daemonThreadsNamed("test-executor-%s"));
    scheduledExecutor = newScheduledThreadPool(2, daemonThreadsNamed("test-scheduledExecutor-%s"));
    driverContext = createTaskContext(executor, scheduledExecutor, TEST_SESSION)
            .addPipelineContext(0, true, true, false)
            .addDriverContext();
}
 
Example #13
Source File: AbstractTestPrinterParser.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@BeforeMethod
public void setUp() {
    buf = new StringBuilder();
    builder = new DateTimeFormatterBuilder();
    dta = ZonedDateTime.of(LocalDateTime.of(2011, 6, 30, 12, 30, 40, 0), ZoneId.of("Europe/Paris"));
    locale = Locale.ENGLISH;
    decimalStyle = DecimalStyle.STANDARD;
}
 
Example #14
Source File: SelectAllNGTest.java    From constellation with Apache License 2.0 5 votes vote down vote up
@BeforeMethod
public void setUpMethod() throws Exception {
    int xAttr, yAttr, zAttr;
    int selectedAttr;

    graph = new StoreGraph();
    attr1 = graph.addAttribute(GraphElementType.VERTEX, StringAttributeDescription.ATTRIBUTE_NAME, "field1", null, null, null);
    attr2 = graph.addAttribute(GraphElementType.VERTEX, StringAttributeDescription.ATTRIBUTE_NAME, "field2", null, null, null);
    attr3 = graph.addAttribute(GraphElementType.VERTEX, StringAttributeDescription.ATTRIBUTE_NAME, "field3", null, null, null);
    attr4 = graph.addAttribute(GraphElementType.VERTEX, IntegerAttributeDescription.ATTRIBUTE_NAME, "field4", null, null, null);
    attr5 = graph.addAttribute(GraphElementType.VERTEX, IntegerAttributeDescription.ATTRIBUTE_NAME, "field5", null, null, null);
    attr6 = graph.addAttribute(GraphElementType.TRANSACTION, StringAttributeDescription.ATTRIBUTE_NAME, "field6", null, null, null);

    xAttr = graph.addAttribute(GraphElementType.VERTEX, FloatAttributeDescription.ATTRIBUTE_NAME, "x", "x", 0.0, null);
    if (xAttr == Graph.NOT_FOUND) {
        fail();
    }

    yAttr = graph.addAttribute(GraphElementType.VERTEX, FloatAttributeDescription.ATTRIBUTE_NAME, "y", "y", 0.0, null);
    if (yAttr == Graph.NOT_FOUND) {
        fail();
    }

    zAttr = graph.addAttribute(GraphElementType.VERTEX, FloatAttributeDescription.ATTRIBUTE_NAME, "z", "z", 0.0, null);
    if (zAttr == Graph.NOT_FOUND) {
        fail();
    }

    selectedAttr = graph.addAttribute(GraphElementType.TRANSACTION, BooleanAttributeDescription.ATTRIBUTE_NAME, "selected", "selected", false, null);
    if (selectedAttr == Graph.NOT_FOUND) {
        fail();
    }

    selectedAttr = graph.addAttribute(GraphElementType.VERTEX, BooleanAttributeDescription.ATTRIBUTE_NAME, "selected", "selected", false, null);
    if (selectedAttr == Graph.NOT_FOUND) {
        fail();
    }
}
 
Example #15
Source File: TestJdbcMetadata.java    From presto with Apache License 2.0 5 votes vote down vote up
@BeforeMethod
public void setUp()
        throws Exception
{
    database = new TestingDatabase();
    metadata = new JdbcMetadata(database.getJdbcClient(), false);
    tableHandle = metadata.getTableHandle(SESSION, new SchemaTableName("example", "numbers"));
}
 
Example #16
Source File: TestFileSingleStreamSpillerFactory.java    From presto with Apache License 2.0 5 votes vote down vote up
@BeforeMethod
public void setUp()
{
    closer = Closer.create();
    executor = MoreExecutors.listeningDecorator(Executors.newCachedThreadPool());
    closer.register(() -> executor.shutdownNow());
    spillPath1 = Files.createTempDir();
    closer.register(() -> deleteRecursively(spillPath1.toPath(), ALLOW_INSECURE));
    spillPath2 = Files.createTempDir();
    closer.register(() -> deleteRecursively(spillPath2.toPath(), ALLOW_INSECURE));
}
 
Example #17
Source File: TestMetadataDao.java    From presto with Apache License 2.0 5 votes vote down vote up
@BeforeMethod
public void setup()
{
    IDBI dbi = new DBI("jdbc:h2:mem:test" + System.nanoTime() + ThreadLocalRandom.current().nextLong());
    dummyHandle = dbi.open();
    dao = dbi.onDemand(MetadataDao.class);
    createTablesWithRetry(dbi);
}
 
Example #18
Source File: TestValueStore.java    From presto with Apache License 2.0 5 votes vote down vote up
@BeforeMethod(alwaysRun = true)
public void setUp()
{
    type = VarcharType.createVarcharType(100);
    BlockBuilder blockBuilder = type.createBlockBuilder(null, 100, 10);
    valueStore = new ValueStore(100, blockBuilder);
    valueStoreSmall = new ValueStore(1, blockBuilder);
    block = BlockAssertions.createStringsBlock("a", "b", "c", "d");
}
 
Example #19
Source File: TestInformationSchemaTableHandle.java    From presto with Apache License 2.0 5 votes vote down vote up
@BeforeMethod
public void startUp()
{
    Injector injector = Guice.createInjector(new JsonModule(), new HandleJsonModule());

    objectMapper = injector.getInstance(ObjectMapper.class);
}
 
Example #20
Source File: CopyGraphUtilitiesNGTest.java    From constellation with Apache License 2.0 5 votes vote down vote up
@BeforeMethod
public void setUpMethod() throws Exception {
    source = new StoreGraph();

    // make the attributes
    metaAttribute1 = source.addAttribute(GraphElementType.META, StringAttributeDescription.ATTRIBUTE_NAME, META_ATTRIBUTE_1_LABEL, "meta1 description", "meta1 default", null);
    metaAttribute2 = source.addAttribute(GraphElementType.META, StringAttributeDescription.ATTRIBUTE_NAME, META_ATTRIBUTE_2_LABEL, "meta2 description", "meta2 default", null);
    graphAttribute1 = source.addAttribute(GraphElementType.GRAPH, StringAttributeDescription.ATTRIBUTE_NAME, GRAPH_ATTRIBUTE_1_LABEL, "graph1 description", "graph1 default", null);
    graphAttribute2 = source.addAttribute(GraphElementType.GRAPH, StringAttributeDescription.ATTRIBUTE_NAME, GRAPH_ATTRIBUTE_2_LABEL, "graph2 description", "graph2 default", null);
    vertexAttribute1 = source.addAttribute(GraphElementType.VERTEX, StringAttributeDescription.ATTRIBUTE_NAME, VERTEX_ATTRIBUTE_1_LABEL, "vertex1 description", "vertex1 default", null);
    vertexAttribute2 = source.addAttribute(GraphElementType.VERTEX, StringAttributeDescription.ATTRIBUTE_NAME, VERTEX_ATTRIBUTE_2_LABEL, "vertex2 description", "vertex2 default", null);
    transactionAttribute1 = source.addAttribute(GraphElementType.TRANSACTION, StringAttributeDescription.ATTRIBUTE_NAME, TRANSACTION_ATTRIBUTE_1_LABEL, "transaction1 description", "transaction1 default", null);
    transactionAttribute2 = source.addAttribute(GraphElementType.TRANSACTION, StringAttributeDescription.ATTRIBUTE_NAME, TRANSACTION_ATTRIBUTE_2_LABEL, "transaction2 description", "transaction2 default", null);
    linkAttribute1 = source.addAttribute(GraphElementType.LINK, StringAttributeDescription.ATTRIBUTE_NAME, LINK_ATTRIBUTE_1_LABEL, "link1 description", "link1 default", null);
    linkAttribute2 = source.addAttribute(GraphElementType.LINK, StringAttributeDescription.ATTRIBUTE_NAME, LINK_ATTRIBUTE_2_LABEL, "link2 description", "link2 default", null);
    edgeAttribute1 = source.addAttribute(GraphElementType.EDGE, StringAttributeDescription.ATTRIBUTE_NAME, EDGE_ATTRIBUTE_1_LABEL, "edge1 description", "edge1 default", null);
    edgeAttribute2 = source.addAttribute(GraphElementType.EDGE, StringAttributeDescription.ATTRIBUTE_NAME, EDGE_ATTRIBUTE_2_LABEL, "edge2 description", "edge2 default", null);

    // add 2 nodes and transactions
    vx0 = source.addVertex();
    vx1 = source.addVertex();
    tx0 = source.addTransaction(vx0, vx1, true);
    tx1 = source.addTransaction(vx1, vx0, true);
    ed0 = source.getEdge(0);
    ed1 = source.getEdge(1);
    lk0 = source.getLink(0);

    // set a value for the 2nd attribute for each type
    source.setStringValue(metaAttribute2, 0, "meta2 custom");
    source.setStringValue(graphAttribute2, 0, "graph2 custom");
    source.setStringValue(vertexAttribute2, vx0, "vertex2 custom vx0");
    source.setStringValue(vertexAttribute2, vx1, "vertex2 custom vx1");
    source.setStringValue(transactionAttribute2, tx0, "transaction2 custom tx0");
    source.setStringValue(transactionAttribute2, tx1, "transaction2 custom tx1");
    source.setStringValue(edgeAttribute2, ed0, "edge2 custom ed0");
    source.setStringValue(edgeAttribute2, ed1, "edge2 custom ed1");
    source.setStringValue(linkAttribute2, lk0, "link2 custom lk0");
}
 
Example #21
Source File: TestSystemMemoryBlocking.java    From presto with Apache License 2.0 5 votes vote down vote up
@BeforeMethod
public void setUp()
{
    executor = newCachedThreadPool(daemonThreadsNamed("test-executor-%s"));
    scheduledExecutor = newScheduledThreadPool(2, daemonThreadsNamed("test-scheduledExecutor-%s"));
    TaskContext taskContext = TestingTaskContext.builder(executor, scheduledExecutor, TEST_SESSION)
            .setQueryMaxMemory(DataSize.valueOf("100MB"))
            .setMemoryPoolSize(DataSize.valueOf("10B"))
            .setQueryId(QUERY_ID)
            .build();
    memoryPool = taskContext.getQueryContext().getMemoryPool();
    driverContext = taskContext
            .addPipelineContext(0, true, true, false)
            .addDriverContext();
}
 
Example #22
Source File: SQLInputImplTests.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@BeforeMethod
@Override
public void setUpMethod() throws Exception {
    map = new HashMap<>();
    impl = new TestSQLDataImpl("TestSQLData");
    typeValues = Arrays.copyOf(TestSQLDataImpl.attributes,
            TestSQLDataImpl.attributes.length);
    hero = new SuperHero(sqlType, "Bruce", "Wayne",
            1939, "Batman");
}
 
Example #23
Source File: TestProgressMonitor.java    From presto with Apache License 2.0 5 votes vote down vote up
@BeforeMethod
public void setup()
        throws IOException
{
    server = new MockWebServer();
    server.start();
}
 
Example #24
Source File: JDBCMessageProcessorTestCase.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
@BeforeMethod(alwaysRun = true)
public void createDatabase() throws SQLException {
    mySqlDatabaseManager.executeUpdate("DROP DATABASE IF EXISTS WSO2SampleDBForAutomation");
    mySqlDatabaseManager.executeUpdate("Create DATABASE WSO2SampleDBForAutomation");
    mySqlDatabaseManager.executeUpdate("USE WSO2SampleDBForAutomation");
    mySqlDatabaseManager.executeUpdate(
            "CREATE TABLE IF NOT EXISTS jdbc_store_table(\n" + "indexId BIGINT( 20 ) NOT NULL auto_increment ,\n"
                    + "msg_id VARCHAR( 200 ) NOT NULL ,\n" + "message BLOB NOT NULL, \n"
                    + "PRIMARY KEY ( indexId )\n" + ")");

}
 
Example #25
Source File: TestDriver.java    From presto with Apache License 2.0 5 votes vote down vote up
@BeforeMethod
public void setUp()
{
    executor = newCachedThreadPool(daemonThreadsNamed("test-executor-%s"));
    scheduledExecutor = newScheduledThreadPool(2, daemonThreadsNamed("test-scheduledExecutor-%s"));

    driverContext = createTaskContext(executor, scheduledExecutor, TEST_SESSION)
            .addPipelineContext(0, true, true, false)
            .addDriverContext();
}
 
Example #26
Source File: ConstellationAbstractMarkerNGTest.java    From constellation with Apache License 2.0 5 votes vote down vote up
@BeforeMethod
public void setUpMethod() {
    this.locationA = new Location(-1.234f, 567.890f);
    this.locationB = new Location(-2.345f, 678.901f);
    this.locationC = new Location(-3.456f, 789.012f);
    this.point = new ConstellationPointMarker(locationA);
    this.line = new ConstellationLineMarker(Arrays.asList(locationA, locationB));
}
 
Example #27
Source File: KafkaTopicConsumerManagerTest.java    From kop with Apache License 2.0 5 votes vote down vote up
@BeforeMethod
@Override
protected void setup() throws Exception {
    super.internalSetup();
    // super class already created clusters and tenants
    admin.namespaces().createNamespace("public/default");
    admin.namespaces().setNamespaceReplicationClusters("public/default", Sets.newHashSet("test"));
    admin.namespaces().setRetention("public/default",
        new RetentionPolicies(20, 100));

    ProtocolHandler handler = pulsar.getProtocolHandlers().protocol("kafka");
    GroupCoordinator groupCoordinator = ((KafkaProtocolHandler) handler).getGroupCoordinator();

    kafkaRequestHandler = new KafkaRequestHandler(
        pulsar,
        (KafkaServiceConfiguration) conf,
        groupCoordinator,
        false);

    ChannelHandlerContext mockCtx = mock(ChannelHandlerContext.class);
    Channel mockChannel = mock(Channel.class);
    doReturn(mockChannel).when(mockCtx).channel();
    kafkaRequestHandler.ctx = mockCtx;

    serviceAddress = new InetSocketAddress(pulsar.getBindAddress(), kafkaBrokerPort);

    kafkaTopicManager = new KafkaTopicManager(kafkaRequestHandler);
}
 
Example #28
Source File: AnnotationConfigTransactionalTestNGSpringContextTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@BeforeMethod
void setUp() throws Exception {
	numSetUpCalls++;
	if (inTransaction()) {
		numSetUpCallsInTransaction++;
	}
	assertNumRowsInPersonTable((inTransaction() ? 2 : 1), "before a test method");
}
 
Example #29
Source File: CommonNeighboursPluginNGTest.java    From constellation with Apache License 2.0 5 votes vote down vote up
@BeforeMethod
public void setUpMethod() throws Exception {
    // create an analytic graph
    final Schema schema = SchemaFactoryUtilities.getSchemaFactory(AnalyticSchemaFactory.ANALYTIC_SCHEMA_ID).createSchema();
    graph = new StoreGraph(schema);

    // add attributes
    transactionCNAttribute = SnaConcept.TransactionAttribute.COMMON_NEIGHBOURS.ensure(graph);
    vertexSelectedAttribute = VisualConcept.VertexAttribute.SELECTED.ensure(graph);

    // add vertices
    vxId0 = graph.addVertex();
    vxId1 = graph.addVertex();
    vxId2 = graph.addVertex();
    vxId3 = graph.addVertex();
    vxId4 = graph.addVertex();

    // add transactions
    graph.addTransaction(vxId0, vxId1, true);
    graph.addTransaction(vxId0, vxId2, true);
    graph.addTransaction(vxId0, vxId3, true);
    graph.addTransaction(vxId0, vxId4, true);
    graph.addTransaction(vxId1, vxId2, true);
    graph.addTransaction(vxId1, vxId3, true);
    graph.addTransaction(vxId1, vxId4, true);
    graph.addTransaction(vxId2, vxId3, true);
    graph.addTransaction(vxId2, vxId4, true);
    graph.addTransaction(vxId3, vxId4, true);
}
 
Example #30
Source File: TestJdbcWarnings.java    From presto with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("JDBCResourceOpenedButNotSafelyClosed")
@BeforeMethod
public void setup()
        throws Exception
{
    connection = createConnection();
    statement = connection.createStatement();
    executor = newCachedThreadPool(daemonThreadsNamed("test-%s"));
}