@Override public int run(String[] args) { java.io.PrintWriter out = getWriter(); InitialPrx initial = AllTests.allTests(this, false, out); initial.shutdown(); return 0; }
@SuppressWarnings("serial") public void testExample() throws Exception { if (!AllTests.isSetup()) { return; } Job job = getJob(); VerticaInputFormat.setInput(job, "select * from mrsource"); job.waitForCompletion(true); job = getJob(); VerticaInputFormat.setInput( job, "select * from mrsource where key = ?", "select distinct key from mrsource"); job.waitForCompletion(true); job = getJob(); Collection<List<Object>> params = new HashSet<List<Object>>() {}; List<Object> param = new ArrayList<Object>(); param.add(new Integer(0)); params.add(param); VerticaInputFormat.setInput(job, "select * from mrsource where key = ?", params); job.waitForCompletion(true); job = getJob(); VerticaInputFormat.setInput(job, "select * from mrsource where key = ?", "0", "1", "2"); job.waitForCompletion(true); VerticaOutputFormat.optimize(job.getConfiguration()); }
@Override public int run(String[] args) { Ice.Communicator communicator = communicator(); ChecksumPrx checksum = AllTests.allTests(communicator, false, getWriter()); checksum.shutdown(); return 0; }
@Override String runTest() throws Exception { client testPlayer = AllTests.getTestPlayerClient(); testPlayer.getInventoryHandler().removeAllEquipment(); testPlayer.getInventoryHandler().removeAllItems(); testPlayer.getInventoryHandler().addItem(4153); int expected = 4; int itemId = 4151; for (int i = 0; i < expected; i++) { testPlayer.getInventoryHandler().addItem(itemId); } int count = testPlayer.getInventoryHandler().itemAmount(4151); if (count != expected) return "Inventory Handler calculated wrong item amount: Expected " + expected + ". Actual: " + count; testPlayer.getInventoryHandler().removeAllEquipment(); testPlayer.getInventoryHandler().removeAllItems(); return null; }
@Override public int run(String[] args) { Ice.Communicator communicator = communicator(); TestIntfPrx test = AllTests.allTests(communicator, false, getWriter()); test.shutdown(); return 0; }
public void tearDown() { try { Connection con = AllTests.getConnection(); Statement st = con.createStatement(); st.execute("drop table " + table); st.close(); } catch (Throwable e) { // e.printStackTrace(); } }
public Job getJob() throws IOException { Configuration conf = new Configuration(true); Cluster cluster = new Cluster(conf); Job job = Job.getInstance(cluster); conf = job.getConfiguration(); conf.set("mapreduce.job.tracker", "local"); job.setJarByClass(TestExample.class); job.setJobName("vertica test"); job.setOutputKeyClass(Text.class); job.setOutputValueClass(VerticaRecord.class); job.setInputFormatClass(VerticaInputFormat.class); job.setOutputFormatClass(VerticaOutputFormat.class); job.setMapOutputKeyClass(Text.class); job.setMapOutputValueClass(DoubleWritable.class); job.setMapperClass(Map.class); job.setReducerClass(Reduce.class); VerticaOutputFormat.setOutput( job, "mrtarget", true, "a int", "b boolean", "c char(1)", "d date", "f float", "t timestamp", "v varchar", "z varbinary"); VerticaConfiguration.configureVertica( conf, new String[] {AllTests.getHostname()}, AllTests.getDatabase(), AllTests.getUsername(), AllTests.getPassword()); return job; }
@Override public int run(String[] args) { com.zeroc.Ice.Communicator communicator = communicator(); AllTests.allTests(communicator); // // Shutdown the IceBox server. // com.zeroc.Ice.ProcessPrx.uncheckedCast( communicator.stringToProxy("DemoIceBox/admin -f Process:default -p 9996")) .shutdown(); return 0; }
public void setUp() { tearDown(); try { Connection con = AllTests.getConnection(); Statement st = con.createStatement(); st.execute( "create table " + table + "(a " + testValue.dataType + ", b " + testValue.dataType + ")"); st.close(); PreparedStatement pr = con.prepareStatement("INSERT into " + table + "(a,b) Values(?,?)"); pr.setObject(1, testValue.small); pr.setObject(2, testValue.large); pr.execute(); pr.setObject(1, testValue.small); pr.setObject(2, testValue.small); pr.execute(); pr.setObject(1, testValue.large); pr.setObject(2, testValue.large); pr.execute(); pr.setObject(1, testValue.large); pr.setObject(2, testValue.small); pr.execute(); pr.setObject(1, null); pr.setObject(2, testValue.small); pr.execute(); pr.setObject(1, testValue.small); pr.setObject(2, null); pr.execute(); pr.setObject(1, null); pr.setObject(2, null); pr.execute(); pr.close(); } catch (Throwable e) { e.printStackTrace(); } }
@Override String runTest() throws Exception { client testPlayer = AllTests.getTestPlayerClient(); testPlayer.getInventoryHandler().removeAllEquipment(); testPlayer.getInventoryHandler().removeAllItems(); for (int i = 0; i < testPlayer.playerEquipment.length; i++) { if (testPlayer.playerEquipment[i] > 0) return "On " + testPlayer.playerName + ", playerEquipment in slot " + i + " is " + testPlayer.playerEquipment[i] + "\n It should be 0."; } return null; }
public void runTest() throws Exception { Connection con = AllTests.getConnection(); Statement st = con.createStatement(); ResultSet rs; rs = st.executeQuery("Select * from " + table + " where 1 = 0"); assertFalse("To many rows", rs.next()); rs = st.executeQuery("Select * from " + table + " where a = b"); assertTrue("To few rows", rs.next()); assertEqualsObject("Values not equals", rs.getObject(1), rs.getObject(2), false); assertTrue("To few rows", rs.next()); assertEqualsObject("Values not equals", rs.getObject(1), rs.getObject(2), false); assertFalse("To many rows", rs.next()); rs = st.executeQuery("Select * from " + table + " where a <= b and b <= a"); assertTrue("To few rows", rs.next()); assertEqualsObject("Values not equals", rs.getObject(1), rs.getObject(2), false); assertTrue("To few rows", rs.next()); assertEqualsObject("Values not equals", rs.getObject(1), rs.getObject(2), false); assertFalse("To many rows", rs.next()); rs = st.executeQuery("Select * from " + table + " where (a > (b))"); assertTrue("To few rows", rs.next()); assertFalse("To many rows", rs.next()); rs = st.executeQuery("Select * from " + table + " where a >= b"); assertTrue("To few rows", rs.next()); assertTrue("To few rows", rs.next()); assertTrue("To few rows", rs.next()); assertFalse("To many rows", rs.next()); rs = st.executeQuery("Select * from " + table + " where not (a >= b)"); assertTrue("To few rows", rs.next()); assertTrue("To few rows", rs.next()); assertTrue("To few rows", rs.next()); assertTrue("To few rows", rs.next()); assertFalse("To many rows", rs.next()); rs = st.executeQuery("Select * from " + table + " where a < b"); assertTrue("To few rows", rs.next()); assertFalse("To many rows", rs.next()); rs = st.executeQuery("Select * from " + table + " where a < b or a>b"); assertTrue("To few rows", rs.next()); assertTrue("To few rows", rs.next()); assertFalse("To many rows", rs.next()); rs = st.executeQuery("Select * from " + table + " where a <= b"); assertTrue("To few rows", rs.next()); assertTrue("To few rows", rs.next()); assertTrue("To few rows", rs.next()); assertFalse("To many rows", rs.next()); rs = st.executeQuery("Select * from " + table + " where a <> b"); assertTrue("To few rows", rs.next()); assertTrue("To few rows", rs.next()); assertFalse("To many rows", rs.next()); PreparedStatement pr = con.prepareStatement("Select * from " + table + " where a between ? and ?"); pr.setObject(1, testValue.small); pr.setObject(2, testValue.large); rs = pr.executeQuery(); assertTrue("To few rows", rs.next()); assertTrue("To few rows", rs.next()); assertTrue("To few rows", rs.next()); assertTrue("To few rows", rs.next()); assertTrue("To few rows", rs.next()); assertFalse("To many rows", rs.next()); pr.close(); pr = con.prepareStatement("Select * from " + table + " where a not between ? and ?"); pr.setObject(1, testValue.small); pr.setObject(2, testValue.large); rs = pr.executeQuery(); assertTrue("To few rows", rs.next()); assertTrue("To few rows", rs.next()); assertFalse("To many rows", rs.next()); pr.close(); pr = con.prepareStatement("Select * from " + table + " where a in(?,?)"); pr.setObject(1, testValue.small); pr.setObject(2, testValue.large); rs = pr.executeQuery(); assertTrue("To few rows", rs.next()); assertTrue("To few rows", rs.next()); assertTrue("To few rows", rs.next()); assertTrue("To few rows", rs.next()); assertTrue("To few rows", rs.next()); assertFalse("To many rows", rs.next()); pr.close(); pr = con.prepareStatement("Select * from " + table + " where a not in(?,?)"); pr.setObject(1, testValue.small); pr.setObject(2, testValue.large); rs = pr.executeQuery(); assertTrue("To few rows", rs.next()); assertTrue("To few rows", rs.next()); assertFalse("To many rows", rs.next()); pr.close(); st.close(); }
@Test public void checkFileContent() { System.out.println("Test12 -SELECT- checkFileContent"); AllTests.fileComparison("12books.txt"); }