summaryrefslogtreecommitdiff
path: root/qadevOOo/tests/java/mod/_streams
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-06-09 08:52:12 +0200
committerNoel Grandin <noel@peralex.com>2015-06-09 11:34:31 +0200
commit2a0dda3dfb37f0cb69842f7d569c253d82f53713 (patch)
tree7a762c2fa22651cefb68021250a3fad8811e0f06 /qadevOOo/tests/java/mod/_streams
parent60f8dd78fa3f19e8bed867f7f5926fcf9a8d8e67 (diff)
remove some unnecessary exception wrapping in the Java tests
Modify createTestEnvironment so that it throws Exception. This is appropriate for unit testing. The wrapping adds no value and the calling method already has a catch(Exception) to handle anything. Change-Id: I430a414f63d2cbfc3b65ecfde0285509265e5192
Diffstat (limited to 'qadevOOo/tests/java/mod/_streams')
-rw-r--r--qadevOOo/tests/java/mod/_streams/uno/DataInputStream.java50
-rw-r--r--qadevOOo/tests/java/mod/_streams/uno/DataOutputStream.java18
-rw-r--r--qadevOOo/tests/java/mod/_streams/uno/MarkableInputStream.java18
-rw-r--r--qadevOOo/tests/java/mod/_streams/uno/MarkableOutputStream.java24
-rw-r--r--qadevOOo/tests/java/mod/_streams/uno/ObjectInputStream.java34
-rw-r--r--qadevOOo/tests/java/mod/_streams/uno/ObjectOutputStream.java42
-rw-r--r--qadevOOo/tests/java/mod/_streams/uno/Pipe.java14
-rw-r--r--qadevOOo/tests/java/mod/_streams/uno/Pump.java15
8 files changed, 76 insertions, 139 deletions
diff --git a/qadevOOo/tests/java/mod/_streams/uno/DataInputStream.java b/qadevOOo/tests/java/mod/_streams/uno/DataInputStream.java
index 96106c8156bc..a1c4a49d9bfc 100644
--- a/qadevOOo/tests/java/mod/_streams/uno/DataInputStream.java
+++ b/qadevOOo/tests/java/mod/_streams/uno/DataInputStream.java
@@ -26,9 +26,10 @@ import com.sun.star.io.XOutputStream;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XInterface;
+
import java.io.PrintWriter;
import java.util.ArrayList;
-import lib.StatusException;
+
import lib.TestCase;
import lib.TestEnvironment;
import lib.TestParameters;
@@ -78,17 +79,12 @@ public class DataInputStream extends TestCase {
* </ul>
*/
@Override
- protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+ protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception {
Object oInterface = null;
XMultiServiceFactory xMSF = Param.getMSF();
- try {
- oInterface = xMSF.createInstance("com.sun.star.io.DataInputStream");
- } catch(com.sun.star.uno.Exception e) {
- e.printStackTrace(log);
- throw new StatusException("Couldn't create instance", e);
- }
+ oInterface = xMSF.createInstance("com.sun.star.io.DataInputStream");
XInterface oObj = (XInterface) oInterface;
@@ -96,26 +92,14 @@ public class DataInputStream extends TestCase {
// DataInputStream created through the Pipe
XActiveDataSink xDataSink = UnoRuntime.queryInterface(XActiveDataSink.class, oObj);
- XInterface oPipe = null;
- try {
- oPipe = (XInterface)
- xMSF.createInstance("com.sun.star.io.Pipe");
- } catch(com.sun.star.uno.Exception e) {
- e.printStackTrace(log);
- throw new StatusException("Couldn't create instance", e);
- }
+ XInterface oPipe = (XInterface)
+ xMSF.createInstance("com.sun.star.io.Pipe");
XInputStream xPipeInput = UnoRuntime.queryInterface(XInputStream.class, oPipe);
XOutputStream xPipeOutput = UnoRuntime.queryInterface(XOutputStream.class, oPipe);
- XInterface oDataOutput = null;
- try {
- oDataOutput = (XInterface)
+ XInterface oDataOutput = (XInterface)
xMSF.createInstance("com.sun.star.io.DataOutputStream");
- } catch(com.sun.star.uno.Exception e) {
- e.printStackTrace(log);
- throw new StatusException("Couldn't create instance", e);
- }
XDataOutputStream xDataOutput = UnoRuntime.queryInterface(XDataOutputStream.class, oDataOutput) ;
XActiveDataSource xDataSource = UnoRuntime.queryInterface(XActiveDataSource.class, oDataOutput) ;
@@ -137,27 +121,13 @@ public class DataInputStream extends TestCase {
byte[] byteData = new byte[] {
1, 2, 3, 4, 5, 6, 7, 8 } ;
- // createing a connectable object for XConnectable interface
- XInterface xConnect = null;
- try {
- xConnect = (XInterface)xMSF.createInstance(
+ // creating a connectable object for XConnectable interface
+ XInterface xConnect = (XInterface)xMSF.createInstance(
"com.sun.star.io.DataInputStream") ;
- } catch (Exception e) {
- log.println("Can't create DataInputStream");
- e.printStackTrace(log);
- throw new StatusException("Can't create DataInputStream", e);
- }
// creating an input stream to set in XActiveDataSink
- XInterface oDataInput = null;
- try {
- oDataInput = (XInterface) xMSF.createInstance(
+ XInterface oDataInput = (XInterface) xMSF.createInstance(
"com.sun.star.io.Pipe" );
- } catch (com.sun.star.uno.Exception e) {
- log.println("Can't create new in stream") ;
- e.printStackTrace(log) ;
- throw new StatusException("Can't create input stream", e) ;
- }
log.println("creating a new environment for object");
diff --git a/qadevOOo/tests/java/mod/_streams/uno/DataOutputStream.java b/qadevOOo/tests/java/mod/_streams/uno/DataOutputStream.java
index d4024ea4a1c8..fad95930a81d 100644
--- a/qadevOOo/tests/java/mod/_streams/uno/DataOutputStream.java
+++ b/qadevOOo/tests/java/mod/_streams/uno/DataOutputStream.java
@@ -25,9 +25,10 @@ import com.sun.star.io.XOutputStream;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XInterface;
+
import java.io.PrintWriter;
import java.util.ArrayList;
-import lib.StatusException;
+
import lib.TestCase;
import lib.TestEnvironment;
import lib.TestParameters;
@@ -75,22 +76,17 @@ public class DataOutputStream extends TestCase {
* </ul>
*/
@Override
- protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+ protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception {
XInterface oObj = null;
Object oInterface = null;
XInterface oPipe = null;
XMultiServiceFactory xMSF = null ;
- try {
- xMSF = Param.getMSF();
- oInterface = xMSF.createInstance
- ("com.sun.star.io.DataOutputStream");
- oPipe = (XInterface)xMSF.createInstance("com.sun.star.io.Pipe");
- } catch(com.sun.star.uno.Exception e) {
- e.printStackTrace(log);
- throw new StatusException("Couldn't create instance", e);
- }
+ xMSF = Param.getMSF();
+ oInterface = xMSF.createInstance
+ ("com.sun.star.io.DataOutputStream");
+ oPipe = (XInterface)xMSF.createInstance("com.sun.star.io.Pipe");
oObj = (XInterface) oInterface;
diff --git a/qadevOOo/tests/java/mod/_streams/uno/MarkableInputStream.java b/qadevOOo/tests/java/mod/_streams/uno/MarkableInputStream.java
index 27ef1259fab8..30f0202a18f5 100644
--- a/qadevOOo/tests/java/mod/_streams/uno/MarkableInputStream.java
+++ b/qadevOOo/tests/java/mod/_streams/uno/MarkableInputStream.java
@@ -25,8 +25,9 @@ import com.sun.star.io.XOutputStream;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XInterface;
+
import java.io.PrintWriter;
-import lib.StatusException;
+
import lib.TestCase;
import lib.TestEnvironment;
import lib.TestParameters;
@@ -79,7 +80,7 @@ public class MarkableInputStream extends TestCase {
* @see com.sun.star.io.MarkableOutputStream
*/
@Override
- protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+ protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception {
XMultiServiceFactory xMSF = Param.getMSF();
@@ -87,15 +88,10 @@ public class MarkableInputStream extends TestCase {
Object mostream = null;
Object mistream = null;
Object xConnect = null;
- try {
- aPipe = xMSF.createInstance("com.sun.star.io.Pipe");
- mistream = xMSF.createInstance("com.sun.star.io.MarkableInputStream");
- mostream = xMSF.createInstance("com.sun.star.io.MarkableOutputStream");
- xConnect = xMSF.createInstance("com.sun.star.io.DataInputStream");
- } catch(com.sun.star.uno.Exception e) {
- e.printStackTrace(log);
- throw new StatusException("Couldn't create instance", e) ;
- }
+ aPipe = xMSF.createInstance("com.sun.star.io.Pipe");
+ mistream = xMSF.createInstance("com.sun.star.io.MarkableInputStream");
+ mostream = xMSF.createInstance("com.sun.star.io.MarkableOutputStream");
+ xConnect = xMSF.createInstance("com.sun.star.io.DataInputStream");
// Creating construction :
// MarkableOutputStream -> Pipe -> MarkableInputStream
diff --git a/qadevOOo/tests/java/mod/_streams/uno/MarkableOutputStream.java b/qadevOOo/tests/java/mod/_streams/uno/MarkableOutputStream.java
index 487721ba5d6e..f08b20f175c3 100644
--- a/qadevOOo/tests/java/mod/_streams/uno/MarkableOutputStream.java
+++ b/qadevOOo/tests/java/mod/_streams/uno/MarkableOutputStream.java
@@ -25,9 +25,10 @@ import com.sun.star.io.XOutputStream;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XInterface;
+
import java.io.PrintWriter;
import java.util.ArrayList;
-import lib.StatusException;
+
import lib.TestCase;
import lib.TestEnvironment;
import lib.TestParameters;
@@ -85,7 +86,7 @@ public class MarkableOutputStream extends TestCase {
* @see com.sun.star.io.MarkableOutputStream
*/
@Override
- protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+ protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception {
XInterface oObj = null;
@@ -95,18 +96,13 @@ public class MarkableOutputStream extends TestCase {
Object mistream = null;
XInterface aConnect;
- try {
- aPipe = xMSF.createInstance("com.sun.star.io.Pipe");
- mistream = xMSF.createInstance
- ("com.sun.star.io.MarkableInputStream");
- mostream = xMSF.createInstance
- ("com.sun.star.io.MarkableOutputStream");
- aConnect = (XInterface)xMSF.createInstance
- ("com.sun.star.io.DataOutputStream");
- } catch(com.sun.star.uno.Exception e) {
- e.printStackTrace(log);
- throw new StatusException("Couldn't create instance", e) ;
- }
+ aPipe = xMSF.createInstance("com.sun.star.io.Pipe");
+ mistream = xMSF.createInstance
+ ("com.sun.star.io.MarkableInputStream");
+ mostream = xMSF.createInstance
+ ("com.sun.star.io.MarkableOutputStream");
+ aConnect = (XInterface)xMSF.createInstance
+ ("com.sun.star.io.DataOutputStream");
// Creating construction :
// MarkableOutputStream -> Pipe -> MarkableInputStream
diff --git a/qadevOOo/tests/java/mod/_streams/uno/ObjectInputStream.java b/qadevOOo/tests/java/mod/_streams/uno/ObjectInputStream.java
index 60f86033ce92..00038f7ecc95 100644
--- a/qadevOOo/tests/java/mod/_streams/uno/ObjectInputStream.java
+++ b/qadevOOo/tests/java/mod/_streams/uno/ObjectInputStream.java
@@ -31,8 +31,10 @@ import com.sun.star.registry.XImplementationRegistration;
import com.sun.star.registry.XSimpleRegistry;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XInterface;
+
import java.io.PrintWriter;
import java.util.ArrayList;
+
import lib.StatusException;
import lib.TestCase;
import lib.TestEnvironment;
@@ -169,7 +171,7 @@ public class ObjectInputStream extends TestCase {
* @see com.sun.star.cmp.PersistObject
*/
@Override
- protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+ protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception {
System.out.println("create TestEnvironment started.");
XMultiServiceFactory xMSF = Param.getMSF();
@@ -179,24 +181,18 @@ public class ObjectInputStream extends TestCase {
Object mistream = null;
Object istream = null;
Object xConnect = null;
- try {
- istream = xMSF.createInstance
- ("com.sun.star.io.ObjectInputStream");
- ostream = xMSF.createInstance
- ("com.sun.star.io.ObjectOutputStream");
- aPipe = xMSF.createInstance
- ("com.sun.star.io.Pipe");
- mistream = xMSF.createInstance
- ("com.sun.star.io.MarkableInputStream");
- mostream = xMSF.createInstance
- ("com.sun.star.io.MarkableOutputStream");
- xConnect = xMSF.createInstance
- ("com.sun.star.io.DataInputStream") ;
-
- } catch( com.sun.star.uno.Exception e ) {
- e.printStackTrace(log);
- throw new StatusException("Couldn't create instance", e);
- }
+ istream = xMSF.createInstance
+ ("com.sun.star.io.ObjectInputStream");
+ ostream = xMSF.createInstance
+ ("com.sun.star.io.ObjectOutputStream");
+ aPipe = xMSF.createInstance
+ ("com.sun.star.io.Pipe");
+ mistream = xMSF.createInstance
+ ("com.sun.star.io.MarkableInputStream");
+ mostream = xMSF.createInstance
+ ("com.sun.star.io.MarkableOutputStream");
+ xConnect = xMSF.createInstance
+ ("com.sun.star.io.DataInputStream") ;
// Creating construction :
// ObjectOutputStream -> MarkableOutputStream -> Pipe ->
// -> MarkableInputStream -> ObjectInputStream
diff --git a/qadevOOo/tests/java/mod/_streams/uno/ObjectOutputStream.java b/qadevOOo/tests/java/mod/_streams/uno/ObjectOutputStream.java
index 8bb6383579d2..9bfd1e944103 100644
--- a/qadevOOo/tests/java/mod/_streams/uno/ObjectOutputStream.java
+++ b/qadevOOo/tests/java/mod/_streams/uno/ObjectOutputStream.java
@@ -31,8 +31,10 @@ import com.sun.star.registry.XImplementationRegistration;
import com.sun.star.registry.XSimpleRegistry;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XInterface;
+
import java.io.PrintWriter;
import java.util.ArrayList;
+
import lib.StatusException;
import lib.TestCase;
import lib.TestEnvironment;
@@ -161,7 +163,7 @@ public class ObjectOutputStream extends TestCase {
* @see com.sun.star.cmp.PersistObject
*/
@Override
- protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+ protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception {
XInterface oObj = null;
@@ -174,22 +176,17 @@ public class ObjectOutputStream extends TestCase {
XInterface aConnect = null;
Object minstream = null;
- try {
- ostream = xMSF.createInstance
- ( "com.sun.star.io.ObjectOutputStream" );
- istream = xMSF.createInstance
- ("com.sun.star.io.ObjectInputStream");
- aPipe = xMSF.createInstance("com.sun.star.io.Pipe");
- mostream = xMSF.createInstance
- ("com.sun.star.io.MarkableOutputStream");
- aConnect = (XInterface)xMSF.createInstance
- ("com.sun.star.io.DataInputStream");
- minstream = xMSF.createInstance
- ("com.sun.star.io.MarkableInputStream");
- } catch( com.sun.star.uno.Exception e ) {
- e.printStackTrace(log);
- throw new StatusException("Couldn't create instance", e);
- }
+ ostream = xMSF.createInstance
+ ( "com.sun.star.io.ObjectOutputStream" );
+ istream = xMSF.createInstance
+ ("com.sun.star.io.ObjectInputStream");
+ aPipe = xMSF.createInstance("com.sun.star.io.Pipe");
+ mostream = xMSF.createInstance
+ ("com.sun.star.io.MarkableOutputStream");
+ aConnect = (XInterface)xMSF.createInstance
+ ("com.sun.star.io.DataInputStream");
+ minstream = xMSF.createInstance
+ ("com.sun.star.io.MarkableInputStream");
// creating the pipe where object has to be written to
XActiveDataSource xdSo = UnoRuntime.queryInterface(XActiveDataSource.class, ostream);
@@ -215,14 +212,9 @@ public class ObjectOutputStream extends TestCase {
// creating Persistent object which has to be written
XPersistObject xPersObj = null ;
- try {
- Object oPersObj = xMSF.createInstance
- ("com.sun.star.cmp.PersistObject");
- xPersObj = UnoRuntime.queryInterface(XPersistObject.class, oPersObj);
- } catch (com.sun.star.uno.Exception e) {
- e.printStackTrace(log);
- throw new StatusException("Can't write persist object.", e) ;
- }
+ Object oPersObj = xMSF.createInstance
+ ("com.sun.star.cmp.PersistObject");
+ xPersObj = UnoRuntime.queryInterface(XPersistObject.class, oPersObj);
oObj = oStream;
diff --git a/qadevOOo/tests/java/mod/_streams/uno/Pipe.java b/qadevOOo/tests/java/mod/_streams/uno/Pipe.java
index c90df923ab45..96c4891a1f6f 100644
--- a/qadevOOo/tests/java/mod/_streams/uno/Pipe.java
+++ b/qadevOOo/tests/java/mod/_streams/uno/Pipe.java
@@ -22,8 +22,9 @@ import com.sun.star.io.XInputStream;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XInterface;
+
import java.io.PrintWriter;
-import lib.StatusException;
+
import lib.TestCase;
import lib.TestEnvironment;
import lib.TestParameters;
@@ -57,18 +58,13 @@ public class Pipe extends TestCase {
* @see com.sun.star.io.Pipe
*/
@Override
- protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+ protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception {
XInterface oObj = null;
Object oInterface = null;
- try {
- XMultiServiceFactory xMSF = Param.getMSF();
- oInterface = xMSF.createInstance( "com.sun.star.io.Pipe" );
- } catch(com.sun.star.uno.Exception e) {
- e.printStackTrace(log);
- throw new StatusException("Couldn't create instance", e);
- }
+ XMultiServiceFactory xMSF = Param.getMSF();
+ oInterface = xMSF.createInstance( "com.sun.star.io.Pipe" );
oObj = (XInterface) oInterface;
diff --git a/qadevOOo/tests/java/mod/_streams/uno/Pump.java b/qadevOOo/tests/java/mod/_streams/uno/Pump.java
index 6deae46d2429..85669fbcc3fd 100644
--- a/qadevOOo/tests/java/mod/_streams/uno/Pump.java
+++ b/qadevOOo/tests/java/mod/_streams/uno/Pump.java
@@ -26,8 +26,9 @@ import com.sun.star.io.XOutputStream;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XInterface;
+
import java.io.PrintWriter;
-import lib.StatusException;
+
import lib.TestCase;
import lib.TestEnvironment;
import lib.TestParameters;
@@ -65,21 +66,15 @@ public class Pump extends TestCase {
* @see com.sun.star.io.Pump
*/
@Override
- protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+ protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception {
Object oInterface = null;
XMultiServiceFactory xMSF = Param.getMSF();
XInterface oPipe;
// creating an instance of stm.Pump
- try {
- oInterface = xMSF.createInstance( "com.sun.star.io.Pump" );
- oPipe = (XInterface) xMSF.createInstance( "com.sun.star.io.Pipe" );
- } catch (com.sun.star.uno.Exception e) {
- e.printStackTrace(log);
- throw new StatusException("Can't create the needed objects.", e) ;
- }
-
+ oInterface = xMSF.createInstance( "com.sun.star.io.Pump" );
+ oPipe = (XInterface) xMSF.createInstance( "com.sun.star.io.Pipe" );
XInterface oObj = (XInterface) oInterface;