Search in sources :

Example 1 with BeforeTest

use of org.testng.annotations.BeforeTest in project che by eclipse.

the class ServiceDescriptorTest method setUp.

@BeforeTest
public void setUp() throws Exception {
    DependencySupplierImpl dependencies = new DependencySupplierImpl();
    ResourceBinder resources = new ResourceBinderImpl();
    ProviderBinder providers = new ApplicationProviderBinder();
    EverrestProcessor processor = new EverrestProcessor(new EverrestConfiguration(), dependencies, new RequestHandlerImpl(new RequestDispatcher(resources), providers), null);
    launcher = new ResourceLauncher(processor);
    processor.addApplication(new Deployer());
    ApplicationContext.setCurrent(anApplicationContext().withProviders(providers).build());
    System.out.println("initialized");
}
Also used : ApplicationProviderBinder(org.everrest.core.impl.ApplicationProviderBinder) ProviderBinder(org.everrest.core.impl.ProviderBinder) DependencySupplierImpl(org.everrest.core.tools.DependencySupplierImpl) ApplicationProviderBinder(org.everrest.core.impl.ApplicationProviderBinder) EverrestConfiguration(org.everrest.core.impl.EverrestConfiguration) RequestHandlerImpl(org.everrest.core.impl.RequestHandlerImpl) ResourceBinderImpl(org.everrest.core.impl.ResourceBinderImpl) ResourceBinder(org.everrest.core.ResourceBinder) EverrestProcessor(org.everrest.core.impl.EverrestProcessor) ResourceLauncher(org.everrest.core.tools.ResourceLauncher) RequestDispatcher(org.everrest.core.impl.RequestDispatcher) BeforeTest(org.testng.annotations.BeforeTest)

Example 2 with BeforeTest

use of org.testng.annotations.BeforeTest in project pinot by linkedin.

the class ScheduledRequestHandlerTest method setupTestMethod.

@BeforeTest
public void setupTestMethod() {
    serverMetrics = new ServerMetrics(new MetricsRegistry());
    channelHandlerContext = mock(ChannelHandlerContext.class, RETURNS_DEEP_STUBS);
    when(channelHandlerContext.channel().remoteAddress()).thenAnswer(new Answer<InetSocketAddress>() {

        @Override
        public InetSocketAddress answer(InvocationOnMock invocationOnMock) throws Throwable {
            return new InetSocketAddress("localhost", 60000);
        }
    });
    queryScheduler = mock(QueryScheduler.class);
    queryExecutor = new ServerQueryExecutorV1Impl();
}
Also used : MetricsRegistry(com.yammer.metrics.core.MetricsRegistry) QueryScheduler(com.linkedin.pinot.core.query.scheduler.QueryScheduler) InetSocketAddress(java.net.InetSocketAddress) InvocationOnMock(org.mockito.invocation.InvocationOnMock) ServerQueryExecutorV1Impl(com.linkedin.pinot.core.query.executor.ServerQueryExecutorV1Impl) ServerMetrics(com.linkedin.pinot.common.metrics.ServerMetrics) ChannelHandlerContext(io.netty.channel.ChannelHandlerContext) BeforeTest(org.testng.annotations.BeforeTest)

Example 3 with BeforeTest

use of org.testng.annotations.BeforeTest in project pinot by linkedin.

the class TimeBoundaryServiceTest method beforeTest.

@BeforeTest
public void beforeTest() {
    _zookeeperInstance = ZkStarter.startLocalZkServer();
    _zkClient = new ZkClient(StringUtil.join("/", StringUtils.chomp(ZkStarter.DEFAULT_ZK_STR, "/")), ZkClient.DEFAULT_SESSION_TIMEOUT, ZkClient.DEFAULT_CONNECTION_TIMEOUT, new ZNRecordSerializer());
    String helixClusterName = "TestTimeBoundaryService";
    _zkClient.deleteRecursive("/" + helixClusterName + "/PROPERTYSTORE");
    _zkClient.createPersistent("/" + helixClusterName + "/PROPERTYSTORE", true);
    _propertyStore = new ZkHelixPropertyStore<ZNRecord>(new ZkBaseDataAccessor<ZNRecord>(_zkClient), "/" + helixClusterName + "/PROPERTYSTORE", null);
}
Also used : ZkClient(org.apache.helix.manager.zk.ZkClient) ZkBaseDataAccessor(org.apache.helix.manager.zk.ZkBaseDataAccessor) ZNRecord(org.apache.helix.ZNRecord) ZNRecordSerializer(org.apache.helix.manager.zk.ZNRecordSerializer) BeforeTest(org.testng.annotations.BeforeTest)

Example 4 with BeforeTest

use of org.testng.annotations.BeforeTest in project pinot by linkedin.

the class DerivedSchemaGenerationTest method setup.

@BeforeTest
public void setup() throws IOException {
    inputSchema = new Schema.Parser().parse(ClassLoader.getSystemResourceAsStream(AVRO_SCHEMA));
    props = new Properties();
    props.setProperty(ThirdEyeConfigProperties.THIRDEYE_TABLE_NAME.toString(), "collection");
    props.setProperty(ThirdEyeConfigProperties.THIRDEYE_DIMENSION_NAMES.toString(), "d1,d2,d3");
    props.setProperty(ThirdEyeConfigProperties.THIRDEYE_METRIC_NAMES.toString(), "m1,m2");
    props.setProperty(ThirdEyeConfigProperties.THIRDEYE_METRIC_TYPES.toString(), "INT,INT");
    props.setProperty(ThirdEyeConfigProperties.THIRDEYE_TIMECOLUMN_NAME.toString(), "hoursSinceEpoch");
}
Also used : ThirdEyeConfigProperties(com.linkedin.thirdeye.hadoop.config.ThirdEyeConfigProperties) Properties(java.util.Properties) BeforeTest(org.testng.annotations.BeforeTest)

Example 5 with BeforeTest

use of org.testng.annotations.BeforeTest in project rest.li by linkedin.

the class TestData method setup.

@BeforeTest
public void setup() {
    referenceList1.add(RL1_BOOLEAN_INDEX, RL1_BOOLEAN_VALUE);
    referenceList1.add(RL1_INTEGER_INDEX, RL1_INTEGER_VALUE);
    referenceList1.add(RL1_LONG_INDEX, RL1_LONG_VALUE);
    referenceList1.add(RL1_FLOAT_INDEX, RL1_FLOAT_VALUE);
    referenceList1.add(RL1_DOUBLE_INDEX, RL1_DOUBLE_VALUE);
    referenceList1.add(RL1_STRING_INDEX, RL1_STRING_VALUE);
    referenceList1.add(RL1_BYTES_INDEX, RL1_BYTES_VALUE);
    referenceMap1.put(RM1_BOOLEAN_KEY, RM1_BOOLEAN_VALUE);
    referenceMap1.put(RM1_INTEGER_KEY, RM1_INTEGER_VALUE);
    referenceMap1.put(RM1_LONG_KEY, RM1_LONG_VALUE);
    referenceMap1.put(RM1_FLOAT_KEY, RM1_FLOAT_VALUE);
    referenceMap1.put(RM1_DOUBLE_KEY, RM1_DOUBLE_VALUE);
    referenceMap1.put(RM1_STRING_KEY, RM1_STRING_VALUE);
    referenceMap1.put(RM1_BYTES_KEY, RM1_BYTES_VALUE);
    illegalObjects.add(new AtomicInteger(-13));
    illegalObjects.add(new AtomicLong(-13));
    illegalObjects.add(new BigDecimal(13));
    illegalObjects.add(new BigInteger("13"));
    illegalObjects.add(new Byte("13"));
    illegalObjects.add(new Short("13"));
    illegalObjects.add(new ArrayList<Object>());
    illegalObjects.add(new HashMap<String, String>());
    illegalObjects.add(new HashSet<String>());
    for (Object o : illegalObjects) {
        illegalMap.put("Illegal-" + o.getClass().getName(), o);
    }
    referenceDataMap1.putAll(referenceMap1);
    DataMap map1_1 = new DataMap(referenceMap1);
    DataList list1_1 = new DataList(referenceList1);
    referenceDataMap1.put("map1_1", map1_1);
    referenceDataMap1.put("list1_1", list1_1);
    referenceDataMap1.put("map1_2", new DataMap());
    referenceDataMap1.put("list1_2", new DataList());
    referenceDataMap1.makeReadOnly();
    referenceDataList1.addAll(referenceList1);
    referenceDataList1.add(0, new DataList(referenceList1));
    referenceDataList1.add(1, new DataMap(referenceMap1));
    referenceDataList1.makeReadOnly();
    inputs.put("Reference DataMap1", referenceDataMap1);
    {
        DataMap map1 = new DataMap();
        for (int i = 0; i < 100; ++i) {
            String key = "key_" + i;
            map1.put(key, new Boolean(i % 2 == 1));
        }
        inputs.put("Map of 100 booleans", map1);
    }
    {
        DataMap map1 = new DataMap();
        DataList list1 = new DataList();
        map1.put("list", list1);
        for (int i = 0; i < 100; ++i) {
            list1.add(new Integer(i));
        }
        inputs.put("List of 100 32-bit integers", map1);
    }
    {
        DataMap map1 = new DataMap();
        DataList list1 = new DataList();
        map1.put("list", list1);
        for (int i = 0; i < 100; ++i) {
            list1.add(new Double(i + 0.5));
        }
        inputs.put("List of 100 doubles", map1);
    }
    {
        DataMap map1 = new DataMap();
        for (int i = 0; i < 100; ++i) {
            String key = "key_" + i;
            map1.put(key, "12345678901234567890");
        }
        inputs.put("Map of 100 20-character strings", map1);
    }
    {
        DataMap map1 = new DataMap();
        for (int i = 0; i < 100; ++i) {
            String key = "key_" + i;
            map1.put(key, new Integer(i));
        }
        inputs.put("Map of 100 32-bit integers", map1);
    }
    {
        DataMap map1 = new DataMap();
        for (int i = 0; i < 100; ++i) {
            String key = "key_" + i;
            map1.put(key, new Double(i + 0.5));
        }
        inputs.put("Map of 100 doubles", map1);
    }
    {
        DataMap map1 = new DataMap();
        DataList list1 = new DataList();
        map1.put("list", list1);
        for (int i = 0; i < 100; ++i) {
            list1.add("12345678901234567890");
        }
        inputs.put("List of 100 20-character strings", list1);
        inputs.put("Map containing list of 100 20-character strings", map1);
    }
    {
        DataMap map1 = new DataMap();
        DataList list1 = new DataList();
        map1.put("list", list1);
        for (int i = 0; i < 100; ++i) {
            list1.add(ByteString.copyAvroString("12345678901234567890", false));
        }
        inputs.put("List of 100 20-byte bytes", list1);
        inputs.put("Map containing list of 100 20-byte bytes", map1);
    }
    {
        DataMap map1 = new DataMap();
        DataMap map11 = new DataMap();
        DataList list11 = new DataList();
        map1.put("map11", map11);
        map1.put("list11", list11);
        inputs.put("Map with empty map and list", map1);
    }
    {
        DataMap dataMap = new DataMap();
        dataMap.put("test", "Fourscore and seven years ago our fathers brought forth on this continent " + "a new nation, conceived in liberty and dedicated to the proposition that all men are created " + "equal. Now we are engaged in a great civil war, testing whether that nation or any nation so " + "conceived and so dedicated can long endure. We are met on a great battlefield of that war. " + "We have come to dedicate a portion of that field as a final resting-place for those who here " + "gave their lives that that nation might live. It is altogether fitting and proper that we " + "should do this. But in a larger sense, we cannot dedicate, we cannot consecrate, we cannot " + "hallow this ground. The brave men, living and dead who struggled here have consecrated it " + "far above our poor power to add or detract. The world will little note nor long remember " + "what we say here, but it can never forget what they did here. It is for us the living rather " + "to be dedicated here to the unfinished work which they who fought here have thus far so " + "nobly advanced. It is rather for us to be here dedicated to the great task remaining before " + "us--that from these honored dead we take increased devotion to that cause for which they " + "gave the last full measure of devotion--that we here highly resolve that these dead shall " + "not have died in vain, that this nation under God shall have a new birth of freedom, and " + "that government of the people, by the people, for the people shall not perish from the earth.");
        inputs.put("Map of long string", dataMap);
    }
    {
        DataMap mapOfStrings = new DataMap();
        ArrayList<Integer> lengths = new ArrayList<Integer>();
        for (int stringLength = 0; stringLength < 1024; stringLength += 113) {
            lengths.add(stringLength);
        }
        for (int stringLength = 1024; stringLength < (Short.MAX_VALUE * 4); stringLength *= 2) {
            lengths.add(stringLength);
        }
        for (int stringLength : lengths) {
            DataMap dataMap = new DataMap();
            StringBuilder stringBuilder = new StringBuilder(stringLength);
            char character = 32;
            for (int pos = 0; pos < stringLength; pos++) {
                if (character > 16384)
                    character = 32;
                stringBuilder.append(character);
                character += 3;
            }
            // out.println("" + stringLength + " : " + (int) character);
            String key = "test" + stringLength;
            String value = stringBuilder.toString();
            dataMap.put(key, value);
            mapOfStrings.put(key, value);
            inputs.put("Map of " + stringLength + " character string", dataMap);
        }
        inputs.put("Map of variable length strings", mapOfStrings);
    }
}
Also used : ArrayList(java.util.ArrayList) TestUtil.dataMapFromString(com.linkedin.data.TestUtil.dataMapFromString) BigDecimal(java.math.BigDecimal) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) BigInteger(java.math.BigInteger) AtomicLong(java.util.concurrent.atomic.AtomicLong) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) BigInteger(java.math.BigInteger) BeforeTest(org.testng.annotations.BeforeTest)

Aggregations

BeforeTest (org.testng.annotations.BeforeTest)136 Parameters (org.testng.annotations.Parameters)16 DatabaseConfiguration (com.google.refine.extension.database.DatabaseConfiguration)11 HashMap (java.util.HashMap)9 File (java.io.File)8 CommandManager (com.sun.identity.cli.CommandManager)6 Path (java.nio.file.Path)6 ArrayList (java.util.ArrayList)5 HashSet (java.util.HashSet)5 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)4 Injector (com.google.inject.Injector)4 PinotHelixResourceManager (com.linkedin.pinot.controller.helix.core.PinotHelixResourceManager)4 Annotation (java.lang.annotation.Annotation)4 URL (java.net.URL)4 Series (com.axibase.tsd.api.model.series.Series)3 AbstractTableConfig (com.linkedin.pinot.common.config.AbstractTableConfig)3 IntegrationTestContext (com.sequenceiq.it.IntegrationTestContext)3 WorkUnitState (org.apache.gobblin.configuration.WorkUnitState)3 SSOException (com.iplanet.sso.SSOException)2 Schema (com.linkedin.pinot.common.data.Schema)2