Changing license header to Apache for blur-testsuite.
Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/4b32c8e5 Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/4b32c8e5 Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/4b32c8e5 Branch: refs/heads/master Commit: 4b32c8e5f241bd8a4726cc273778f1c4423578dc Parents: 283c6a4 Author: Aaron McCurry <[email protected]> Authored: Sun Sep 2 22:18:57 2012 -0400 Committer: Aaron McCurry <[email protected]> Committed: Sun Sep 2 22:18:57 2012 -0400 ---------------------------------------------------------------------- src/blur-testsuite/pom.xml | 19 + .../blur/testsuite/CreateInsertQueryRepeating.java | 428 +++++++-------- .../nearinfinity/blur/testsuite/CreateTable.java | 20 +- .../nearinfinity/blur/testsuite/DisableTable.java | 18 +- .../nearinfinity/blur/testsuite/EnableTable.java | 18 +- .../nearinfinity/blur/testsuite/ListTables.java | 18 +- .../com/nearinfinity/blur/testsuite/LoadData.java | 18 +- .../nearinfinity/blur/testsuite/LoadDataAsync.java | 16 + .../blur/testsuite/LoadDataAsyncContinuously.java | 16 + .../blur/testsuite/LoadDataContinuously.java | 16 + .../nearinfinity/blur/testsuite/OptimizeTable.java | 16 + .../blur/testsuite/RandomSearchTable.java | 16 + .../testsuite/RandomSearchTableContinuously.java | 22 +- .../testsuite/RapidlyCreateAndDeleteTables.java | 16 + .../nearinfinity/blur/testsuite/RemoveTable.java | 18 +- 15 files changed, 449 insertions(+), 226 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/4b32c8e5/src/blur-testsuite/pom.xml ---------------------------------------------------------------------- diff --git a/src/blur-testsuite/pom.xml b/src/blur-testsuite/pom.xml index c5085fd..fe1264f 100644 --- a/src/blur-testsuite/pom.xml +++ b/src/blur-testsuite/pom.xml @@ -1,3 +1,22 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <parent> http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/4b32c8e5/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/CreateInsertQueryRepeating.java ---------------------------------------------------------------------- diff --git a/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/CreateInsertQueryRepeating.java b/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/CreateInsertQueryRepeating.java index 96aea40..d751695 100644 --- a/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/CreateInsertQueryRepeating.java +++ b/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/CreateInsertQueryRepeating.java @@ -1,5 +1,21 @@ package com.nearinfinity.blur.testsuite; +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import java.io.IOException; import java.text.DecimalFormat; import java.util.ArrayList; @@ -23,223 +39,203 @@ import com.nearinfinity.blur.thrift.generated.TableDescriptor; import static com.nearinfinity.blur.utils.BlurUtil.*; /** - * Tests alot of things, mainly connecting to a blur cluster and slamming a bunch - * of rows in before querying for them. I like to use it as a load test. - * @author gman - * + * Tests a lot of things, mainly connecting to a blur cluster and slamming a + * bunch of rows in before querying for them. I like to use it as a load test. + * */ public class CreateInsertQueryRepeating { - private DecimalFormat df = new DecimalFormat("#,###,000.00"); - private static final char[] symbols = new char[36]; - - static { - for (int idx = 0; idx < 10; ++idx) - symbols[idx] = (char) ('0' + idx); - for (int idx = 10; idx < 36; ++idx) - symbols[idx] = (char) ('a' + idx - 10); - } - - private String table = "test1"; - private String host = "localhost"; - private Iface client = null; - - public CreateInsertQueryRepeating(String host, String table) throws BlurException, TException, IOException { - this.host = host; - this.table = table; - - //init - String connectionStr = host + ":40010"; - String cluster = "default"; - client = BlurClient.getClient(connectionStr); - - List<String> clusterList = client.shardClusterList(); - if(clusterList != null && clusterList.size() > 0) - cluster = clusterList.get(0); - else - throw new IOException("cannot find a cluster to use :("); - - System.out.println("using cluster: " + cluster); - - List<String> tableList = client.tableList(); - if (tableList == null || !tableList.contains(table)) - createTable(client, table, cluster); - else - System.out.println("table existed, did not create."); - } - - private final Random random = new Random(); - - public String randomString(int length) { - char[] buf = new char[length]; - - for (int idx = 0; idx < buf.length; ++idx) - buf[idx] = symbols[random.nextInt(symbols.length)]; - return new String(buf); - } - - public void getClusters(Iface client) { - try { - List<String> shardClusterList = client.shardClusterList(); - for (String cluster : shardClusterList) - System.out.println("cluster: " + cluster); - } catch (BlurException e) { - e.printStackTrace(); - } catch (TException e) { - e.printStackTrace(); - } - } - - public void createTable(Iface client, String tableName, String cluster) throws BlurException, TException { - TableDescriptor td = new TableDescriptor(); - td.analyzerDefinition = new AnalyzerDefinition(); - - td.name = tableName; - // TODO: doc doesnt say required, yet it barfs without it? - td.cluster = cluster == null ? "default" : cluster; - //auto enable table - td.isEnabled = true; - - //1 shard per server :) - td.shardCount = client.shardServerList(cluster).size(); - td.readOnly = false; - // TODO: hardcodes bad, assuming NN on same node as BC - td.tableUri = "hdfs://" + host + ":8020/" + tableName; - client.createTable(td); - System.out.println("table created"); - } - - /** - * @param args - * @throws TException - * @throws BlurException - * @throws IOException - */ - public static void main(String[] args) throws BlurException, TException, IOException { - String host = "localhost"; - String table = "test1"; - - if(args != null) { - if(args.length >= 1) - host = args[0]; - if(args.length == 2) - table = args[1]; - } - - CreateInsertQueryRepeating test = new CreateInsertQueryRepeating(host, table); - -// System.out.println("Testing joins real quick"); -// test.testJoin(); -// System.out.println("test done"); - - System.out.println("Starting load"); - test.loadupTable(100); - System.out.println("Finshed load"); - - System.out.println("query time!"); - test.queryTable(50000); - System.out.println("query done!"); - - System.exit(0); - } - - @SuppressWarnings("unused") - private void testJoin() throws BlurException, TException { - RowMutation mutation = new RowMutation(); - mutation.table = table; - mutation.waitToBeVisible = true; - mutation.rowId = "row1"; - mutation.addToRecordMutations(newRecordMutation("cf1", - "recordid1", newColumn("col1","value1"))); - mutation.addToRecordMutations(newRecordMutation("cf1", - "recordid2", newColumn("col2","value2"))); - mutation.rowMutationType = RowMutationType.REPLACE_ROW; - client.mutate(mutation); - - List<String> joinTest = new ArrayList<String>(); - joinTest.add("+cf1.col1:value1"); - joinTest.add("+cf1.col2:value2"); - joinTest.add("+cf1.col1:value1 +cf1.col2:value2"); - joinTest.add("+(+cf1.col1:value1 nocf.nofield:somevalue) +(+cf1.col2.value2 nocf.nofield:somevalue)"); - joinTest.add("+(+cf1.col1:value1) +(cf1.bla:bla +cf1.col2.value2)"); - - for(String q : joinTest) - System.out.println(q + " hits: " + hits(client,table, q, true)); - } - - private static long hits(Iface client, String table, String queryStr, boolean superQuery) throws BlurException, TException { - BlurQuery bq = new BlurQuery(); - SimpleQuery sq = new SimpleQuery(); - sq.queryStr = queryStr; - sq.superQueryOn = superQuery; - bq.simpleQuery = sq; - BlurResults query = client.query(table, bq); - return query.totalResults; - } - - // really only useful against the table that was filled via loadupTable - public void queryTable(int times) throws BlurException, TException { - long start = System.currentTimeMillis(); - BlurQuery bq = new BlurQuery(); - bq.fetch = 10; - for (int i = 1; i <= times; i++) { - SimpleQuery sq = new SimpleQuery(); - sq.queryStr = "numberField:" + random.nextInt(1000); - sq.superQueryOn = true; - bq.simpleQuery = sq; - client.query(table, bq); - if (i % 1000 == 0) { - System.out - .println("queries: " - + i - + " times " - + df.format((i / ((System.currentTimeMillis() - - start + 0.0)/1000))) + " queries/s"); - } - } - System.out - .println("queries: " - + times - + " times " - + df.format((times / ((System.currentTimeMillis() - - start + 0.0)/1000))) + " queries/s"); - - } - - public void loadupTable(int rows) throws BlurException, TException, IOException { - - long start = System.currentTimeMillis(); - - long buildTotal = 0; - RowMutation mutation = new RowMutation(); - - for (int i = 1; i <= rows; i++) { - long buildStart = System.currentTimeMillis(); - mutation.clear(); - mutation.table = table; - mutation.waitToBeVisible = false; - mutation.rowId = UUID.randomUUID().toString(); - mutation.addToRecordMutations(newRecordMutation("test", - "test-" + i, - newColumn("uuidField", UUID.randomUUID().toString()), - newColumn("numberField", i + ""), - newColumn("fatTextField",randomString(1000)))); - mutation.rowMutationType = RowMutationType.REPLACE_ROW; - - if (i % 50 == 0) { - System.out.println("loaded: " + i + " around " - + df.format((i / ((System.currentTimeMillis() - start+0.0)/1000) )) - + " rows/s"); - System.out.println("Total time: " + (System.currentTimeMillis()-start+0.0)/1000 + - " Build time: " + ((buildTotal/1000)+0.0) + " " + buildTotal); - } - - buildTotal += System.currentTimeMillis() - buildStart; - - client.mutate(mutation); - - } - System.out.println("loaded: " + rows + " around " - + df.format((rows / ((System.currentTimeMillis() - start+0.0)/1000))) + " rows/s"); - } + private DecimalFormat df = new DecimalFormat("#,###,000.00"); + private static final char[] symbols = new char[36]; + + static { + for (int idx = 0; idx < 10; ++idx) + symbols[idx] = (char) ('0' + idx); + for (int idx = 10; idx < 36; ++idx) + symbols[idx] = (char) ('a' + idx - 10); + } + + private String table = "test1"; + private String host = "localhost"; + private Iface client = null; + + public CreateInsertQueryRepeating(String host, String table) throws BlurException, TException, IOException { + this.host = host; + this.table = table; + + // init + String connectionStr = host + ":40010"; + String cluster = "default"; + client = BlurClient.getClient(connectionStr); + + List<String> clusterList = client.shardClusterList(); + if (clusterList != null && clusterList.size() > 0) + cluster = clusterList.get(0); + else + throw new IOException("cannot find a cluster to use :("); + + System.out.println("using cluster: " + cluster); + + List<String> tableList = client.tableList(); + if (tableList == null || !tableList.contains(table)) + createTable(client, table, cluster); + else + System.out.println("table existed, did not create."); + } + + private final Random random = new Random(); + + public String randomString(int length) { + char[] buf = new char[length]; + + for (int idx = 0; idx < buf.length; ++idx) + buf[idx] = symbols[random.nextInt(symbols.length)]; + return new String(buf); + } + + public void getClusters(Iface client) { + try { + List<String> shardClusterList = client.shardClusterList(); + for (String cluster : shardClusterList) + System.out.println("cluster: " + cluster); + } catch (BlurException e) { + e.printStackTrace(); + } catch (TException e) { + e.printStackTrace(); + } + } + + public void createTable(Iface client, String tableName, String cluster) throws BlurException, TException { + TableDescriptor td = new TableDescriptor(); + td.analyzerDefinition = new AnalyzerDefinition(); + + td.name = tableName; + // TODO: doc doesnt say required, yet it barfs without it? + td.cluster = cluster == null ? "default" : cluster; + // auto enable table + td.isEnabled = true; + + // 1 shard per server :) + td.shardCount = client.shardServerList(cluster).size(); + td.readOnly = false; + // TODO: hardcodes bad, assuming NN on same node as BC + td.tableUri = "hdfs://" + host + ":8020/" + tableName; + client.createTable(td); + System.out.println("table created"); + } + + /** + * @param args + * @throws TException + * @throws BlurException + * @throws IOException + */ + public static void main(String[] args) throws BlurException, TException, IOException { + String host = "localhost"; + String table = "test1"; + + if (args != null) { + if (args.length >= 1) + host = args[0]; + if (args.length == 2) + table = args[1]; + } + + CreateInsertQueryRepeating test = new CreateInsertQueryRepeating(host, table); + + // System.out.println("Testing joins real quick"); + // test.testJoin(); + // System.out.println("test done"); + + System.out.println("Starting load"); + test.loadupTable(100); + System.out.println("Finshed load"); + + System.out.println("query time!"); + test.queryTable(50000); + System.out.println("query done!"); + + System.exit(0); + } + + @SuppressWarnings("unused") + private void testJoin() throws BlurException, TException { + RowMutation mutation = new RowMutation(); + mutation.table = table; + mutation.waitToBeVisible = true; + mutation.rowId = "row1"; + mutation.addToRecordMutations(newRecordMutation("cf1", "recordid1", newColumn("col1", "value1"))); + mutation.addToRecordMutations(newRecordMutation("cf1", "recordid2", newColumn("col2", "value2"))); + mutation.rowMutationType = RowMutationType.REPLACE_ROW; + client.mutate(mutation); + + List<String> joinTest = new ArrayList<String>(); + joinTest.add("+cf1.col1:value1"); + joinTest.add("+cf1.col2:value2"); + joinTest.add("+cf1.col1:value1 +cf1.col2:value2"); + joinTest.add("+(+cf1.col1:value1 nocf.nofield:somevalue) +(+cf1.col2.value2 nocf.nofield:somevalue)"); + joinTest.add("+(+cf1.col1:value1) +(cf1.bla:bla +cf1.col2.value2)"); + + for (String q : joinTest) + System.out.println(q + " hits: " + hits(client, table, q, true)); + } + + private static long hits(Iface client, String table, String queryStr, boolean superQuery) throws BlurException, TException { + BlurQuery bq = new BlurQuery(); + SimpleQuery sq = new SimpleQuery(); + sq.queryStr = queryStr; + sq.superQueryOn = superQuery; + bq.simpleQuery = sq; + BlurResults query = client.query(table, bq); + return query.totalResults; + } + + // really only useful against the table that was filled via loadupTable + public void queryTable(int times) throws BlurException, TException { + long start = System.currentTimeMillis(); + BlurQuery bq = new BlurQuery(); + bq.fetch = 10; + for (int i = 1; i <= times; i++) { + SimpleQuery sq = new SimpleQuery(); + sq.queryStr = "numberField:" + random.nextInt(1000); + sq.superQueryOn = true; + bq.simpleQuery = sq; + client.query(table, bq); + if (i % 1000 == 0) { + System.out.println("queries: " + i + " times " + df.format((i / ((System.currentTimeMillis() - start + 0.0) / 1000))) + " queries/s"); + } + } + System.out.println("queries: " + times + " times " + df.format((times / ((System.currentTimeMillis() - start + 0.0) / 1000))) + " queries/s"); + + } + + public void loadupTable(int rows) throws BlurException, TException, IOException { + + long start = System.currentTimeMillis(); + + long buildTotal = 0; + RowMutation mutation = new RowMutation(); + + for (int i = 1; i <= rows; i++) { + long buildStart = System.currentTimeMillis(); + mutation.clear(); + mutation.table = table; + mutation.waitToBeVisible = false; + mutation.rowId = UUID.randomUUID().toString(); + mutation.addToRecordMutations(newRecordMutation("test", "test-" + i, newColumn("uuidField", UUID.randomUUID().toString()), newColumn("numberField", i + ""), + newColumn("fatTextField", randomString(1000)))); + mutation.rowMutationType = RowMutationType.REPLACE_ROW; + + if (i % 50 == 0) { + System.out.println("loaded: " + i + " around " + df.format((i / ((System.currentTimeMillis() - start + 0.0) / 1000))) + " rows/s"); + System.out.println("Total time: " + (System.currentTimeMillis() - start + 0.0) / 1000 + " Build time: " + ((buildTotal / 1000) + 0.0) + " " + buildTotal); + } + + buildTotal += System.currentTimeMillis() - buildStart; + + client.mutate(mutation); + + } + System.out.println("loaded: " + rows + " around " + df.format((rows / ((System.currentTimeMillis() - start + 0.0) / 1000))) + " rows/s"); + } } http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/4b32c8e5/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/CreateTable.java ---------------------------------------------------------------------- diff --git a/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/CreateTable.java b/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/CreateTable.java index 067982b..41f33a8 100644 --- a/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/CreateTable.java +++ b/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/CreateTable.java @@ -1,5 +1,21 @@ package com.nearinfinity.blur.testsuite; +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import java.io.IOException; import org.apache.thrift.TException; @@ -18,13 +34,13 @@ public class CreateTable { final String tableName = args[2]; int shardCount = Integer.parseInt(args[3]); String uri = args[4]; - + final TableDescriptor tableDescriptor = new TableDescriptor(); tableDescriptor.analyzerDefinition = new AnalyzerDefinition(); tableDescriptor.cluster = cluster; tableDescriptor.name = tableName; tableDescriptor.readOnly = false; - + tableDescriptor.shardCount = shardCount; tableDescriptor.tableUri = uri; http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/4b32c8e5/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/DisableTable.java ---------------------------------------------------------------------- diff --git a/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/DisableTable.java b/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/DisableTable.java index f6fe2de..4f8ce0e 100644 --- a/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/DisableTable.java +++ b/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/DisableTable.java @@ -1,5 +1,21 @@ package com.nearinfinity.blur.testsuite; +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import java.io.IOException; import org.apache.thrift.TException; @@ -13,7 +29,7 @@ public class DisableTable { public static void main(String[] args) throws BlurException, TException, IOException { String connectionStr = args[0]; final String tableName = args[1]; - + Iface client = BlurClient.getClient(connectionStr); client.disableTable(tableName); } http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/4b32c8e5/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/EnableTable.java ---------------------------------------------------------------------- diff --git a/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/EnableTable.java b/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/EnableTable.java index cf8b555..d348cae 100644 --- a/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/EnableTable.java +++ b/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/EnableTable.java @@ -1,5 +1,21 @@ package com.nearinfinity.blur.testsuite; +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import java.io.IOException; import org.apache.thrift.TException; @@ -13,7 +29,7 @@ public class EnableTable { public static void main(String[] args) throws BlurException, TException, IOException { String connectionStr = args[0]; final String tableName = args[1]; - + Iface client = BlurClient.getClient(connectionStr); client.enableTable(tableName); } http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/4b32c8e5/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/ListTables.java ---------------------------------------------------------------------- diff --git a/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/ListTables.java b/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/ListTables.java index c1df03b..e5befe1 100644 --- a/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/ListTables.java +++ b/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/ListTables.java @@ -1,5 +1,21 @@ package com.nearinfinity.blur.testsuite; +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import java.io.IOException; import org.apache.thrift.TException; @@ -12,7 +28,7 @@ public class ListTables { public static void main(String[] args) throws BlurException, TException, IOException { String connectionStr = args[0]; - + Iface client = BlurClient.getClient(connectionStr); System.out.println(client.tableList()); } http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/4b32c8e5/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/LoadData.java ---------------------------------------------------------------------- diff --git a/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/LoadData.java b/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/LoadData.java index 0743a9a..477f71f 100644 --- a/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/LoadData.java +++ b/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/LoadData.java @@ -1,5 +1,21 @@ package com.nearinfinity.blur.testsuite; +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; @@ -44,7 +60,7 @@ public class LoadData { System.out.println("Rows indexed [" + i + "] at [" + rate + "/s]"); count = 0; } - + Iface client = BlurClient.getClient(args[0]); RowMutation mutation = new RowMutation(); mutation.setTable(table); http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/4b32c8e5/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/LoadDataAsync.java ---------------------------------------------------------------------- diff --git a/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/LoadDataAsync.java b/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/LoadDataAsync.java index 7a0b442..29e9c0b 100644 --- a/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/LoadDataAsync.java +++ b/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/LoadDataAsync.java @@ -1,5 +1,21 @@ package com.nearinfinity.blur.testsuite; +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/4b32c8e5/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/LoadDataAsyncContinuously.java ---------------------------------------------------------------------- diff --git a/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/LoadDataAsyncContinuously.java b/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/LoadDataAsyncContinuously.java index 8e68486..af8e5f7 100644 --- a/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/LoadDataAsyncContinuously.java +++ b/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/LoadDataAsyncContinuously.java @@ -1,5 +1,21 @@ package com.nearinfinity.blur.testsuite; +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/4b32c8e5/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/LoadDataContinuously.java ---------------------------------------------------------------------- diff --git a/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/LoadDataContinuously.java b/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/LoadDataContinuously.java index ff5a5a7..e723e20 100644 --- a/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/LoadDataContinuously.java +++ b/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/LoadDataContinuously.java @@ -1,5 +1,21 @@ package com.nearinfinity.blur.testsuite; +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import java.io.BufferedReader; import java.io.FileInputStream; import java.io.IOException; http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/4b32c8e5/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/OptimizeTable.java ---------------------------------------------------------------------- diff --git a/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/OptimizeTable.java b/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/OptimizeTable.java index 5fd0953..33fb0de 100644 --- a/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/OptimizeTable.java +++ b/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/OptimizeTable.java @@ -1,5 +1,21 @@ package com.nearinfinity.blur.testsuite; +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import java.io.IOException; import org.apache.thrift.TException; http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/4b32c8e5/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/RandomSearchTable.java ---------------------------------------------------------------------- diff --git a/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/RandomSearchTable.java b/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/RandomSearchTable.java index 191e0bd..4927136 100644 --- a/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/RandomSearchTable.java +++ b/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/RandomSearchTable.java @@ -1,5 +1,21 @@ package com.nearinfinity.blur.testsuite; +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import java.io.IOException; import java.util.ArrayList; import java.util.Collections; http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/4b32c8e5/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/RandomSearchTableContinuously.java ---------------------------------------------------------------------- diff --git a/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/RandomSearchTableContinuously.java b/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/RandomSearchTableContinuously.java index 9486fcc..37fa697 100644 --- a/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/RandomSearchTableContinuously.java +++ b/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/RandomSearchTableContinuously.java @@ -1,5 +1,21 @@ package com.nearinfinity.blur.testsuite; +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import java.io.IOException; import java.util.ArrayList; import java.util.Collections; @@ -60,13 +76,13 @@ public class RandomSearchTableContinuously { double avgRate = i / avgSeconds; double rate = count / seconds; double responseTimeAvg = (responseTime / (double) count) / 1000000.0; - System.out.println(System.currentTimeMillis() + "," + i + "," + responseTimeAvg + "," + rate + "," + avgRate + "," + resultCount + "," + getCount(client,tableName)); + System.out.println(System.currentTimeMillis() + "," + i + "," + responseTimeAvg + "," + rate + "," + avgRate + "," + resultCount + "," + getCount(client, tableName)); s = now; responseTime = 0; count = 0; resultCount = 0; } - + builder.setLength(0); String query = generateQuery(builder, random, sampleOfTerms, numberOfTermsPerQuery); final BlurQuery blurQuery = new BlurQuery(); @@ -75,7 +91,7 @@ public class RandomSearchTableContinuously { blurQuery.cacheResult = false; blurQuery.selector = new Selector(); long qs = System.nanoTime(); - + BlurResults results = client.query(tableName, blurQuery); long qe = System.nanoTime(); resultCount += results.totalResults; http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/4b32c8e5/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/RapidlyCreateAndDeleteTables.java ---------------------------------------------------------------------- diff --git a/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/RapidlyCreateAndDeleteTables.java b/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/RapidlyCreateAndDeleteTables.java index 6182985..e10cbd9 100644 --- a/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/RapidlyCreateAndDeleteTables.java +++ b/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/RapidlyCreateAndDeleteTables.java @@ -1,5 +1,21 @@ package com.nearinfinity.blur.testsuite; +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import static com.nearinfinity.blur.utils.BlurUtil.newColumn; import static com.nearinfinity.blur.utils.BlurUtil.newRecordMutation; http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/4b32c8e5/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/RemoveTable.java ---------------------------------------------------------------------- diff --git a/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/RemoveTable.java b/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/RemoveTable.java index 74bb213..d667218 100644 --- a/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/RemoveTable.java +++ b/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/RemoveTable.java @@ -1,5 +1,21 @@ package com.nearinfinity.blur.testsuite; +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import java.io.IOException; import org.apache.thrift.TException; @@ -13,7 +29,7 @@ public class RemoveTable { public static void main(String[] args) throws BlurException, TException, IOException { String connectionStr = args[0]; final String tableName = args[1]; - + Iface client = BlurClient.getClient(connectionStr); client.removeTable(tableName, true); }
