From 82821f8a31e5f98c27dced51f1bba0fc6637d598 Mon Sep 17 00:00:00 2001 From: Constantin Date: Mon, 14 Jun 2010 11:27:05 +0200 Subject: changed build system of java/ folder from makefile to ant (big compilation time improvement) --- java/src/rasj/test/testMArrays.java | 871 ++++++++++++++++++++++++++++++++++++ 1 file changed, 871 insertions(+) create mode 100644 java/src/rasj/test/testMArrays.java (limited to 'java/src/rasj/test/testMArrays.java') diff --git a/java/src/rasj/test/testMArrays.java b/java/src/rasj/test/testMArrays.java new file mode 100644 index 0000000..272ece1 --- /dev/null +++ b/java/src/rasj/test/testMArrays.java @@ -0,0 +1,871 @@ +package rasj.test; + +/* +* This file is part of rasdaman community. +* +* Rasdaman community is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Rasdaman community is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with rasdaman community. If not, see . +* +* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / +rasdaman GmbH. +* +* For more information please see +* or contact Peter Baumann via . +*/ +/** *********************************************************** + *
+ *
+ * PURPOSE: class for testing special MArrays
+ *
+ *
+ *
+ * COMMENTS:
+ *
+ * 
+ *********************************************************** */ + +import java.io.*; +import java.net.*; +import rasj.clientcommhttp.*; +import rasj.odmg.*; +import org.odmg.*; +import rasj.*; +import java.util.*; + +/** + * class for testing special MArrays + * for testing please enable test data output in toString method of RASGMArray + * @version $$ + */ +public class testMArrays +{ + public static void main(String[] args) + { + String serv = "localhost"; + String base = "RASBASE"; + String coll = "test"; + + for (int i=args.length-1; i>=0; i--) + { + //System.out.println(args[i]); + if (args[i].equals("-server")) + serv = args[i+1]; + if (args[i].equals("-database")) + base = args[i+1]; + if (args[i].equals("-collection")) + coll = args[i+1]; + } + //System.out.println(server+base+coll); + testMArrays marrayTest = new testMArrays(serv); + + } + + public testMArrays(String server) + { + DBag resultBag = null; + Object result = null; + Transaction myTa = null; + Database myDb = null; + OQLQuery myQu = null; + + boolean equal = false; + + try + { + System.out.println("### Testing MArrays: ..."); + Implementation myApp = new RasImplementation("http://"+server+":7001"); + myDb = myApp.newDatabase(); + + System.out.println("Opening database ..."); + myDb.open("RASBASE", Database.OPEN_READ_WRITE); + myTa = myApp.newTransaction(); + + int width, height, len; + width = 18; + height = 18; + len = (width+1)*(height+1); + RasMInterval domain = new RasMInterval("[0:"+width+",0:"+height+"]"); + RasMInterval domain2 = new RasMInterval("[1:3,1:3]"); + RasStorageLayout stl = new RasStorageLayout(); + stl.setTileSize(128); + + + /** + * test the GMArray + */ + System.out.println("\n\n### Testing GMArray with OID: ################################################"); + myQu = myApp.newOQLQuery(); + + myQu.create("drop collection test"); + myTa.begin(); + try + { + resultBag = (DBag)myQu.execute(); + myTa.commit(); + //System.out.println("collection dropped"); + } + catch(ODMGException e) + { + myTa.abort(); + System.err.println("Collection test does not exist: " + e.getMessage()); + } + + myQu.create("create collection test GreySet"); + RasGMArray mddConst = new RasGMArray(domain, 1, stl); + //RasGMArray mddConst = new RasGMArray(domain, 1); + byte[] data = new byte[len]; + mddConst.setObjectTypeName("GreyImage"); + + // test: get new OID from the server for GMArray and insert + System.out.println("new OID from server: " + myApp.getObjectId(mddConst)); + + for(int j = 0; j < data.length; j++) + data[j] = (byte)j; + + mddConst.setArray(data); + /* + System.out.println("\nbyte array: "); + for(int j=0; j