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);
}
}
use of org.testng.annotations.BeforeTest in project databus by linkedin.
the class TestDbusEventBufferMult method setUpTest.
@BeforeTest
public void setUpTest() throws IOException, InvalidConfigException {
LOG.info("Setting up Test");
PhysicalSourceStaticConfig pStatConf1 = convertToPhysicalSourceConfig(_configSource1).build();
PhysicalSourceStaticConfig pStatConf2 = convertToPhysicalSourceConfig(_configSource2).build();
PhysicalSourceStaticConfig pStatConf3 = convertToPhysicalSourceConfig(_configSource3).build();
_pConfigs = new PhysicalSourceStaticConfig[] { pStatConf1, pStatConf2, pStatConf3 };
// generate testData
int scn = 100;
String srcName = "srcName";
int srcId = 1;
PhysicalSource pS = pStatConf1.getPhysicalSource();
PhysicalPartition pP = pStatConf1.getPhysicalPartition();
_events = new TestDbusEvent[20];
LogicalPartition lP = new LogicalPartition((short) 0);
for (int i = 0; i < _events.length; i++) {
_events[i] = new TestDbusEvent(i, scn, new LogicalSource(srcId, srcName + srcId), pS, pP, lP);
switch(i) {
case 4:
srcId = 2;
break;
case 9:
srcId = 11;
pS = pStatConf2.getPhysicalSource();
pP = pStatConf2.getPhysicalPartition();
break;
case 14:
srcId = 12;
break;
}
if ((i & 1) == 1)
scn++;
}
;
}
use of org.testng.annotations.BeforeTest in project meteo by pierre.
the class TestPublishersCompilerStreamConfig method setUp.
@BeforeTest
public void setUp() {
// Build the following configuration
// {
// "publishers": [
// {
// "name": "OpenTSDB",
// "type": "com.ning.metrics.meteo.publishers.OpenTSDBListener",
// "host": "opentsdb.company.com",
// "port": 4242
// }
// ],
//
// "streams": [
// {
// "name": "TPs of visit",
//
// "sql": [
// "select tp90 from visit output last every 1 second"
// ],
//
// "routes": [
// {
// "name": "OpenTSDB",
// "filters": [ "predict", "tp90" ],
// "timeAttribute": "visit_date"
// }
// ]
// }
// ]
// }
statementsConfig = new StatementsConfig();
final DummyPublisherConfig globalPublisherConfig = new DummyPublisherConfig();
globalPublisherConfig.setName("OpenTSDB");
globalPublisherConfig.setType("com.ning.metrics.meteo.publishers.OpenTSDBListener");
globalPublisherConfig.setHost("opentsdb.company.com");
globalPublisherConfig.setPort(4242);
statementsConfig.setPublishers(Arrays.asList((PublisherConfig) globalPublisherConfig));
final StreamConfig streamConfig = new StreamConfig();
streamConfig.setName("TPs of Visit");
streamConfig.setSql(Arrays.asList("select tp90 from visit output last every 1 second"));
final HashMap<String, Object> localPublisherConfig = new HashMap<String, Object>();
localPublisherConfig.put("name", "OpenTSDB");
localPublisherConfig.put("filters", (Arrays.asList("predict", "tp90")));
localPublisherConfig.put("timeAttribute", "visit_date");
streamConfig.setRoutes(Arrays.<HashMap<String, Object>>asList(localPublisherConfig));
statementsConfig.setStatementConfigs(Arrays.asList(streamConfig));
}
use of org.testng.annotations.BeforeTest in project presto by prestodb.
the class TestCassandraClusteringPredicatesExtractor method setUp.
@BeforeTest
void setUp() throws Exception {
col1 = new CassandraColumnHandle("cassandra", "partitionKey1", 1, CassandraType.BIGINT, null, true, false, false, false);
col2 = new CassandraColumnHandle("cassandra", "clusteringKey1", 2, CassandraType.BIGINT, null, false, true, false, false);
col3 = new CassandraColumnHandle("cassandra", "clusteringKey2", 3, CassandraType.BIGINT, null, false, true, false, false);
col4 = new CassandraColumnHandle("cassandra", "clusteringKe3", 4, CassandraType.BIGINT, null, false, true, false, false);
cassandraTable = new CassandraTable(new CassandraTableHandle("cassandra", "test", "records"), ImmutableList.of(col1, col2, col3, col4));
}
use of org.testng.annotations.BeforeTest in project rest.li by linkedin.
the class TestRestLiD2Integration method init.
@BeforeTest
public void init() {
_loadBalancer = MockLBFactory.createLoadBalancer();
_r2Client = new DynamicClient(_loadBalancer, null);
_restClient = new RestClient(_r2Client, "d2://");
}
Aggregations