Java Code Examples for org.testng.annotations.BeforeMethod

The following examples show how to use org.testng.annotations.BeforeMethod. These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: presto   Source File: TestCreateSchemaTask.java    License: 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 2
Source Project: presto   Source File: TestSpatialJoinOperator.java    License: 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 3
@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
/**
 * 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 5
Source Project: presto   Source File: TestShardMetadataRecordCursor.java    License: 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 6
Source Project: constellation   Source File: DiceSimilarityPluginNGTest.java    License: 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 7
Source Project: presto   Source File: TestStreamingAggregationOperator.java    License: 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 8
@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 9
@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 10
Source Project: constellation   Source File: KatzCentralityPluginNGTest.java    License: 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 11
Source Project: constellation   Source File: MatrixUtilitiesNGTest.java    License: 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 12
@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 13
@BeforeMethod
void setUp() {
	numSetUpCalls++;
	if (inTransaction()) {
		numSetUpCallsInTransaction++;
	}
	assertNumRowsInPersonTable((inTransaction() ? 2 : 1), "before a test method");
}
 
Example 14
Source Project: presto   Source File: TestMetadataDao.java    License: 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 15
Source Project: constellation   Source File: SelectAllNGTest.java    License: 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 16
Source Project: presto   Source File: TestRaptorConnector.java    License: Apache License 2.0 5 votes vote down vote up
@BeforeMethod
public void setup()
{
    TypeManager typeManager = new InternalTypeManager(createTestMetadataManager());
    DBI dbi = new DBI("jdbc:h2:mem:test" + System.nanoTime() + ThreadLocalRandom.current().nextLong());
    dbi.registerMapper(new TableColumn.Mapper(typeManager));
    dummyHandle = dbi.open();
    metadataDao = dbi.onDemand(MetadataDao.class);
    createTablesWithRetry(dbi);
    dataDir = Files.createTempDir();

    RaptorConnectorId connectorId = new RaptorConnectorId("test");
    NodeManager nodeManager = new TestingNodeManager();
    NodeSupplier nodeSupplier = nodeManager::getWorkerNodes;
    ShardManager shardManager = createShardManager(dbi);
    StorageManager storageManager = createOrcStorageManager(dbi, dataDir);
    StorageManagerConfig config = new StorageManagerConfig();
    connector = new RaptorConnector(
            new LifeCycleManager(ImmutableList.of(), null),
            new TestingNodeManager(),
            new RaptorMetadataFactory(dbi, shardManager),
            new RaptorSplitManager(connectorId, nodeSupplier, shardManager, false),
            new RaptorPageSourceProvider(storageManager),
            new RaptorPageSinkProvider(storageManager,
                    new PagesIndexPageSorter(new PagesIndex.TestingFactory(false)),
                    new TemporalFunction(DateTimeZone.forID("America/Los_Angeles")),
                    config),
            new RaptorNodePartitioningProvider(nodeSupplier),
            new RaptorSessionProperties(config),
            new RaptorTableProperties(typeManager),
            ImmutableSet.of(),
            new AllowAllAccessControl(),
            dbi);
}
 
Example 17
@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 18
@BeforeMethod
@Override
public void setUpMethod() throws Exception {
    results = new Vector();
    impl = new TestSQLDataImpl("TestSQLData");
    typeValues = Arrays.copyOf(TestSQLDataImpl.attributes,
            TestSQLDataImpl.attributes.length);
    hero = new SuperHero(sqlType, "Bruce", "Wayne", 1939, "Batman");
    outImpl = new SQLOutputImpl(results, map);
}
 
Example 19
Source Project: constellation   Source File: CopyGraphUtilitiesNGTest.java    License: 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 20
@BeforeMethod
@Override
public void setUpMethod() throws Exception {
    results = new Vector();
    impl = new TestSQLDataImpl("TestSQLData");
    typeValues = Arrays.copyOf(TestSQLDataImpl.attributes,
            TestSQLDataImpl.attributes.length);
    hero = new SuperHero(sqlType, "Bruce", "Wayne", 1939, "Batman");
    outImpl = new SQLOutputImpl(results, map);
}
 
Example 21
Source Project: presto   Source File: TestSystemMemoryBlocking.java    License: 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
@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
@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 24
Source Project: presto   Source File: TestJdbcWarnings.java    License: 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"));
}
 
Example 25
@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 26
@BeforeMethod
void setUp() throws Exception {
	numSetUpCalls++;
	if (inTransaction()) {
		numSetUpCallsInTransaction++;
	}
	assertNumRowsInPersonTable((inTransaction() ? 2 : 1), "before a test method");
}
 
Example 27
Source Project: kop   Source File: KafkaTopicConsumerManagerTest.java    License: 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 Project: presto   Source File: TestDriver.java    License: 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 29
Source Project: presto   Source File: TestProgressMonitor.java    License: Apache License 2.0 5 votes vote down vote up
@BeforeMethod
public void setup()
        throws IOException
{
    server = new MockWebServer();
    server.start();
}
 
Example 30
Source Project: presto   Source File: TestInformationSchemaTableHandle.java    License: 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);
}