diff options
526 files changed, 5296 insertions, 12641 deletions
diff --git a/dbaccess/qa/complex/dbaccess/RowSet.java b/dbaccess/qa/complex/dbaccess/RowSet.java index 6baee75b7674..297469b476da 100644 --- a/dbaccess/qa/complex/dbaccess/RowSet.java +++ b/dbaccess/qa/complex/dbaccess/RowSet.java @@ -17,7 +17,6 @@ */ package complex.dbaccess; -import com.sun.star.beans.PropertyVetoException; import com.sun.star.beans.UnknownPropertyException; import com.sun.star.beans.XPropertySet; import com.sun.star.container.XIndexAccess; diff --git a/qadevOOo/runner/lib/TestCase.java b/qadevOOo/runner/lib/TestCase.java index ebe175d485f5..3a3d7e9c9467 100644 --- a/qadevOOo/runner/lib/TestCase.java +++ b/qadevOOo/runner/lib/TestCase.java @@ -157,7 +157,7 @@ public abstract class TestCase { * @see #getTestEnvironment */ protected abstract TestEnvironment createTestEnvironment( - TestParameters tParam, PrintWriter log ); + TestParameters tParam, PrintWriter log ) throws Exception; /** * @return the name of the object diff --git a/qadevOOo/tests/java/mod/_acceptor/Acceptor.java b/qadevOOo/tests/java/mod/_acceptor/Acceptor.java index 0a2a04e4092d..662212c07faa 100644 --- a/qadevOOo/tests/java/mod/_acceptor/Acceptor.java +++ b/qadevOOo/tests/java/mod/_acceptor/Acceptor.java @@ -20,7 +20,6 @@ package mod._acceptor; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -76,18 +75,14 @@ public class Acceptor extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log ) throws StatusException { + TestParameters Param, PrintWriter log ) throws Exception { XInterface oObj = null; XInterface acceptor = null; - try { - acceptor = (XInterface) - Param.getMSF().createInstance - ("com.sun.star.connection.Acceptor"); - } catch (com.sun.star.uno.Exception e) { - throw new StatusException("Can't create object environment", e) ; - } + acceptor = (XInterface) + Param.getMSF().createInstance + ("com.sun.star.connection.Acceptor"); // select the port curPort = utils.getNextFreePort(basePort); diff --git a/qadevOOo/tests/java/mod/_acceptor/uno/Acceptor.java b/qadevOOo/tests/java/mod/_acceptor/uno/Acceptor.java index 8648ad5ac0ad..b73c31a9f7fa 100644 --- a/qadevOOo/tests/java/mod/_acceptor/uno/Acceptor.java +++ b/qadevOOo/tests/java/mod/_acceptor/uno/Acceptor.java @@ -20,7 +20,6 @@ package mod._acceptor.uno; import com.sun.star.uno.XInterface; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -71,25 +70,17 @@ public class Acceptor extends TestCase { * <ul> */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { - XInterface oObj = null; - XInterface acceptor = null; - - try { - acceptor = (XInterface) - Param.getMSF().createInstance - ("com.sun.star.connection.Acceptor"); - } catch (com.sun.star.uno.Exception e) { - throw new StatusException("Can't create object environment", e) ; - } + XInterface acceptor = (XInterface) + Param.getMSF().createInstance + ("com.sun.star.connection.Acceptor"); // select the port curPort = utils.getNextFreePort(basePort); log.println("Choose Port nr: " + curPort); - oObj = acceptor; - TestEnvironment tEnv = new TestEnvironment(oObj) ; + TestEnvironment tEnv = new TestEnvironment(acceptor) ; // adding connection string as relation tEnv.addObjRelation("XAcceptor.connectStr", diff --git a/qadevOOo/tests/java/mod/_adabas/ODriver.java b/qadevOOo/tests/java/mod/_adabas/ODriver.java index 0f3b56ea42e4..2ac7ecdadd6d 100644 --- a/qadevOOo/tests/java/mod/_adabas/ODriver.java +++ b/qadevOOo/tests/java/mod/_adabas/ODriver.java @@ -59,16 +59,10 @@ public class ODriver extends TestCase { * </ul> */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { - XInterface oObj = null; - - try { - oObj = (XInterface)Param.getMSF(). - createInstance("com.sun.star.comp.sdbcx.adabas.ODriver"); - } catch (com.sun.star.uno.Exception e) { - throw new StatusException(e, Status.failed("Couldn't create object")); - } + XInterface oObj = (XInterface)Param.getMSF(). + createInstance("com.sun.star.comp.sdbcx.adabas.ODriver"); log.println("creating a new environment for object"); TestEnvironment tEnv = new TestEnvironment(oObj); diff --git a/qadevOOo/tests/java/mod/_ado/ODriver.java b/qadevOOo/tests/java/mod/_ado/ODriver.java index 7e5518c81141..ef1cfc748ed4 100644 --- a/qadevOOo/tests/java/mod/_ado/ODriver.java +++ b/qadevOOo/tests/java/mod/_ado/ODriver.java @@ -58,16 +58,10 @@ public class ODriver extends TestCase { * </ul> */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { - XInterface oObj = null; - - try { - oObj = (XInterface)Param.getMSF(). - createInstance("com.sun.star.comp.sdbc.ado.ODriver"); - } catch (com.sun.star.uno.Exception e) { - throw new StatusException(e, Status.failed("Couldn't create object")); - } + XInterface oObj = (XInterface)Param.getMSF(). + createInstance("com.sun.star.comp.sdbc.ado.ODriver"); log.println("creating a new environment for object"); TestEnvironment tEnv = new TestEnvironment(oObj); diff --git a/qadevOOo/tests/java/mod/_basctl/AccessibleShape.java b/qadevOOo/tests/java/mod/_basctl/AccessibleShape.java index daac55ca402f..103dca483f3f 100644 --- a/qadevOOo/tests/java/mod/_basctl/AccessibleShape.java +++ b/qadevOOo/tests/java/mod/_basctl/AccessibleShape.java @@ -35,7 +35,6 @@ import com.sun.star.text.XTextDocument; 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; @@ -64,7 +63,7 @@ public class AccessibleShape extends TestCase { } @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF(); log.println( "creating a test environment" ); String aURL=utils.getFullTestURL("basDialog.odt"); @@ -74,37 +73,27 @@ public class AccessibleShape extends TestCase { XDispatchProvider xDPP = UnoRuntime.queryInterface(XDispatchProvider.class, xFrame); log.println( "opening the basic dialog editor" ); - try { - Object o = xMSF.createInstance("com.sun.star.frame.DispatchHelper"); - XDispatchHelper xDPH = UnoRuntime.queryInterface(XDispatchHelper.class, o); - PropertyValue[] aArgs = new PropertyValue[4]; - aArgs[0] = new PropertyValue(); - aArgs[0].Name = "Document"; - aArgs[0].Value = aURL; - aArgs[1] = new PropertyValue(); - aArgs[1].Name = "LibName"; - aArgs[1].Value = "basctl"; - aArgs[2] = new PropertyValue(); - aArgs[2].Name = "Name"; - aArgs[2].Value = "Dialog1"; - aArgs[3] = new PropertyValue(); - aArgs[3].Name = "Type"; - aArgs[3].Value = "Dialog"; - xDPH.executeDispatch(xDPP, ".uno:BasicIDEAppear", "", 0, aArgs); - } catch (Exception e) { - throw new StatusException("Couldn't open Basic Dialog",e); - } + Object o = xMSF.createInstance("com.sun.star.frame.DispatchHelper"); + XDispatchHelper xDPH = UnoRuntime.queryInterface(XDispatchHelper.class, o); + PropertyValue[] aArgs = new PropertyValue[4]; + aArgs[0] = new PropertyValue(); + aArgs[0].Name = "Document"; + aArgs[0].Value = aURL; + aArgs[1] = new PropertyValue(); + aArgs[1].Name = "LibName"; + aArgs[1].Value = "basctl"; + aArgs[2] = new PropertyValue(); + aArgs[2].Name = "Name"; + aArgs[2].Value = "Dialog1"; + aArgs[3] = new PropertyValue(); + aArgs[3].Name = "Type"; + aArgs[3].Value = "Dialog"; + xDPH.executeDispatch(xDPP, ".uno:BasicIDEAppear", "", 0, aArgs); utils.pause(3000); - try { - oObj = (XInterface) tParam.getMSF().createInstance - ("com.sun.star.awt.Toolkit") ; - } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't get toolkit"); - e.printStackTrace(log); - throw new StatusException("Couldn't get toolkit", e ); - } + oObj = (XInterface) tParam.getMSF().createInstance + ("com.sun.star.awt.Toolkit") ; final XWindow basicIDE = xFrame.getContainerWindow(); diff --git a/qadevOOo/tests/java/mod/_brdgfctr/BridgeFactory.java b/qadevOOo/tests/java/mod/_brdgfctr/BridgeFactory.java index fafddfbb7351..5cc1c492ac97 100644 --- a/qadevOOo/tests/java/mod/_brdgfctr/BridgeFactory.java +++ b/qadevOOo/tests/java/mod/_brdgfctr/BridgeFactory.java @@ -68,16 +68,10 @@ public class BridgeFactory extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log ) throws StatusException { + TestParameters Param, PrintWriter log ) throws Exception { - XInterface oObj = null ; - - try { - oObj = (XInterface) Param.getMSF().createInstance + XInterface oObj = (XInterface) Param.getMSF().createInstance ("com.sun.star.bridge.BridgeFactory") ; - } catch (com.sun.star.uno.Exception e) { - throw new StatusException("Can't create object environment", e) ; - } if (oObj == null) throw new StatusException("Can't create service", diff --git a/qadevOOo/tests/java/mod/_bridgefac/uno/BridgeFactory.java b/qadevOOo/tests/java/mod/_bridgefac/uno/BridgeFactory.java index 337da35657e4..f4d11486007c 100644 --- a/qadevOOo/tests/java/mod/_bridgefac/uno/BridgeFactory.java +++ b/qadevOOo/tests/java/mod/_bridgefac/uno/BridgeFactory.java @@ -65,17 +65,11 @@ public class BridgeFactory extends TestCase { * service as object to be tested. */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { - XInterface oObj = null ; - - try { - oObj = (XInterface) + XInterface oObj = (XInterface) Param.getMSF().createInstance ("com.sun.star.bridge.BridgeFactory") ; - } catch (com.sun.star.uno.Exception e) { - throw new StatusException("Can't create object environment", e) ; - } if (oObj == null) throw new StatusException("Can't create service", diff --git a/qadevOOo/tests/java/mod/_cached/CachedContentResultSetFactory.java b/qadevOOo/tests/java/mod/_cached/CachedContentResultSetFactory.java index 4596c7fb54fd..d2a2dbc1251c 100644 --- a/qadevOOo/tests/java/mod/_cached/CachedContentResultSetFactory.java +++ b/qadevOOo/tests/java/mod/_cached/CachedContentResultSetFactory.java @@ -79,89 +79,71 @@ public class CachedContentResultSetFactory extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { - XInterface oObj = null; - Object oInterface = null; + throws Exception { XMultiServiceFactory xMSF = Param.getMSF(); - try { - oInterface = xMSF.createInstance + Object oInterface = xMSF.createInstance ( "com.sun.star.ucb.CachedContentResultSetFactory" ); - - // adding one child container - } - catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } - - oObj = (XInterface) oInterface; + XInterface oObj = (XInterface) oInterface; TestEnvironment tEnv = new TestEnvironment( oObj ); // creating relation for XCachedContentResultSetFactory XResultSet resSetStub = null ; - try { - Object oUCB = xMSF.createInstanceWithArguments - ("com.sun.star.ucb.UniversalContentBroker", - new Object[0]) ; - - XContentIdentifierFactory ciFac = UnoRuntime.queryInterface(XContentIdentifierFactory.class, oUCB) ; - - String url = util.utils.getFullTestURL("SwXTextEmbeddedObject.sxw") ; - String escUrl = "" ; - - // In base URL of a JAR file in content URL all directory - // separators ('/') must be replaced with escape symbol '%2F'. - int idx = url.indexOf("/") ; - int lastIdx = -1 ; - while (idx >= 0) { - escUrl += url.substring(lastIdx + 1, idx) + "%2F" ; - lastIdx = idx ; - idx = url.indexOf("/", idx + 1) ; - } - escUrl += url.substring(lastIdx + 1) ; - String cntUrl = "vnd.sun.star.pkg://" + escUrl + "/" ; - - XContentIdentifier CI = ciFac.createContentIdentifier(cntUrl) ; + Object oUCB = xMSF.createInstanceWithArguments + ("com.sun.star.ucb.UniversalContentBroker", + new Object[0]) ; + + XContentIdentifierFactory ciFac = UnoRuntime.queryInterface(XContentIdentifierFactory.class, oUCB) ; + + String url = util.utils.getFullTestURL("SwXTextEmbeddedObject.sxw") ; + String escUrl = "" ; + + // In base URL of a JAR file in content URL all directory + // separators ('/') must be replaced with escape symbol '%2F'. + int idx = url.indexOf("/") ; + int lastIdx = -1 ; + while (idx >= 0) { + escUrl += url.substring(lastIdx + 1, idx) + "%2F" ; + lastIdx = idx ; + idx = url.indexOf("/", idx + 1) ; + } + escUrl += url.substring(lastIdx + 1) ; + String cntUrl = "vnd.sun.star.pkg://" + escUrl + "/" ; - XContentProvider cntProv = UnoRuntime.queryInterface(XContentProvider.class, oUCB) ; + XContentIdentifier CI = ciFac.createContentIdentifier(cntUrl) ; - XContent cnt = cntProv.queryContent(CI) ; + XContentProvider cntProv = UnoRuntime.queryInterface(XContentProvider.class, oUCB) ; - XCommandProcessor cmdProc = UnoRuntime.queryInterface(XCommandProcessor.class, cnt) ; + XContent cnt = cntProv.queryContent(CI) ; - Property prop = new Property() ; - prop.Name = "Title" ; + XCommandProcessor cmdProc = UnoRuntime.queryInterface(XCommandProcessor.class, cnt) ; - Command cmd = new Command("open", -1, new OpenCommandArgument2 - (OpenMode.ALL, 10000, null, new Property[] {prop}, - new NumberedSortingInfo[0])) ; + Property prop = new Property() ; + prop.Name = "Title" ; - XDynamicResultSet dynResSet = null; - try { - dynResSet = (XDynamicResultSet) - AnyConverter.toObject(new Type(XDynamicResultSet.class), - cmdProc.execute(cmd, 0, null)); - } catch (com.sun.star.lang.IllegalArgumentException iae) { - throw new StatusException("Couldn't convert Any ",iae); - } + Command cmd = new Command("open", -1, new OpenCommandArgument2 + (OpenMode.ALL, 10000, null, new Property[] {prop}, + new NumberedSortingInfo[0])) ; - XResultSet resSet = dynResSet.getStaticResultSet() ; + XDynamicResultSet dynResSet = null; + try { + dynResSet = (XDynamicResultSet) + AnyConverter.toObject(new Type(XDynamicResultSet.class), + cmdProc.execute(cmd, 0, null)); + } catch (com.sun.star.lang.IllegalArgumentException iae) { + throw new StatusException("Couldn't convert Any ",iae); + } - Object oStubFactory = xMSF.createInstance - ("com.sun.star.ucb.CachedContentResultSetStubFactory") ; + XResultSet resSet = dynResSet.getStaticResultSet() ; - XCachedContentResultSetStubFactory xStubFactory = - UnoRuntime.queryInterface - (XCachedContentResultSetStubFactory.class, oStubFactory) ; + Object oStubFactory = xMSF.createInstance + ("com.sun.star.ucb.CachedContentResultSetStubFactory") ; - resSetStub = xStubFactory.createCachedContentResultSetStub(resSet) ; + XCachedContentResultSetStubFactory xStubFactory = + UnoRuntime.queryInterface + (XCachedContentResultSetStubFactory.class, oStubFactory) ; - } catch (com.sun.star.uno.Exception e) { - log.println("Can't create relation." ); - e.printStackTrace(log) ; - throw new StatusException( "Can't create relation", e ); - } + resSetStub = xStubFactory.createCachedContentResultSetStub(resSet) ; tEnv.addObjRelation("CachedContentResultSetStub", resSetStub) ; diff --git a/qadevOOo/tests/java/mod/_cached/CachedContentResultSetStubFactory.java b/qadevOOo/tests/java/mod/_cached/CachedContentResultSetStubFactory.java index 42d3c9a65635..8dd3b159185c 100644 --- a/qadevOOo/tests/java/mod/_cached/CachedContentResultSetStubFactory.java +++ b/qadevOOo/tests/java/mod/_cached/CachedContentResultSetStubFactory.java @@ -77,82 +77,64 @@ public class CachedContentResultSetStubFactory extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { - XInterface oObj = null; - Object oInterface = null; + throws Exception { XMultiServiceFactory xMSF = Param.getMSF(); - try { - oInterface = xMSF.createInstance + Object oInterface = xMSF.createInstance ( "com.sun.star.ucb.CachedContentResultSetStubFactory" ); - - // adding one child container - } - catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } - - oObj = (XInterface) oInterface; + XInterface oObj = (XInterface) oInterface; TestEnvironment tEnv = new TestEnvironment( oObj ); // creating relation for XCachedContentResultSetStubFactory XResultSet resSet = null ; + Object oUCB = xMSF.createInstanceWithArguments + ("com.sun.star.ucb.UniversalContentBroker", + new Object[0]) ; + + XContentIdentifierFactory ciFac = UnoRuntime.queryInterface(XContentIdentifierFactory.class, oUCB) ; + + String url = util.utils.getFullTestURL("SwXTextEmbeddedObject.sxw") ; + String escUrl = "" ; + + // In base URL of a JAR file in content URL all directory + // separators ('/') must be replaced with escape symbol '%2F'. + int idx = url.indexOf("/") ; + int lastIdx = -1 ; + while (idx >= 0) { + escUrl += url.substring(lastIdx + 1, idx) + "%2F" ; + lastIdx = idx ; + idx = url.indexOf("/", idx + 1) ; + } + escUrl += url.substring(lastIdx + 1) ; + String cntUrl = "vnd.sun.star.pkg://" + escUrl + "/" ; + log.println("Getting Content of '" + cntUrl + "'") ; + + XContentIdentifier CI = ciFac.createContentIdentifier(cntUrl) ; + + XContentProvider cntProv = UnoRuntime.queryInterface(XContentProvider.class, oUCB) ; + + XContent cnt = cntProv.queryContent(CI) ; + + XCommandProcessor cmdProc = UnoRuntime.queryInterface(XCommandProcessor.class, cnt) ; + + Property prop = new Property() ; + prop.Name = "Title" ; + + Command cmd = new Command("open", -1, new OpenCommandArgument2 + (OpenMode.ALL, 10000, null, new Property[] {prop}, + new NumberedSortingInfo[0])) ; + + XDynamicResultSet dynResSet = null; try { - Object oUCB = xMSF.createInstanceWithArguments - ("com.sun.star.ucb.UniversalContentBroker", - new Object[0]) ; - - XContentIdentifierFactory ciFac = UnoRuntime.queryInterface(XContentIdentifierFactory.class, oUCB) ; - - String url = util.utils.getFullTestURL("SwXTextEmbeddedObject.sxw") ; - String escUrl = "" ; - - // In base URL of a JAR file in content URL all directory - // separators ('/') must be replaced with escape symbol '%2F'. - int idx = url.indexOf("/") ; - int lastIdx = -1 ; - while (idx >= 0) { - escUrl += url.substring(lastIdx + 1, idx) + "%2F" ; - lastIdx = idx ; - idx = url.indexOf("/", idx + 1) ; - } - escUrl += url.substring(lastIdx + 1) ; - String cntUrl = "vnd.sun.star.pkg://" + escUrl + "/" ; - log.println("Getting Content of '" + cntUrl + "'") ; - - XContentIdentifier CI = ciFac.createContentIdentifier(cntUrl) ; - - XContentProvider cntProv = UnoRuntime.queryInterface(XContentProvider.class, oUCB) ; - - XContent cnt = cntProv.queryContent(CI) ; - - XCommandProcessor cmdProc = UnoRuntime.queryInterface(XCommandProcessor.class, cnt) ; - - Property prop = new Property() ; - prop.Name = "Title" ; - - Command cmd = new Command("open", -1, new OpenCommandArgument2 - (OpenMode.ALL, 10000, null, new Property[] {prop}, - new NumberedSortingInfo[0])) ; - - XDynamicResultSet dynResSet = null; - try { - dynResSet = (XDynamicResultSet) - AnyConverter.toObject(new Type(XDynamicResultSet.class), - cmdProc.execute(cmd, 0, null)); - } catch (com.sun.star.lang.IllegalArgumentException iae) { - throw new StatusException("Couldn't convert Any ",iae); - } - - resSet = dynResSet.getStaticResultSet() ; - - } catch (com.sun.star.uno.Exception e) { - log.println("Can't create relation." ); - e.printStackTrace(log) ; - throw new StatusException( "Can't create relation", e ); + dynResSet = (XDynamicResultSet) + AnyConverter.toObject(new Type(XDynamicResultSet.class), + cmdProc.execute(cmd, 0, null)); + } catch (com.sun.star.lang.IllegalArgumentException iae) { + throw new StatusException("Couldn't convert Any ",iae); } + resSet = dynResSet.getStaticResultSet() ; + tEnv.addObjRelation("ContentResultSet", resSet) ; return tEnv; diff --git a/qadevOOo/tests/java/mod/_cached/CachedDynamicResultSetFactory.java b/qadevOOo/tests/java/mod/_cached/CachedDynamicResultSetFactory.java index c2ba76dcbf04..d2435b99fd17 100644 --- a/qadevOOo/tests/java/mod/_cached/CachedDynamicResultSetFactory.java +++ b/qadevOOo/tests/java/mod/_cached/CachedDynamicResultSetFactory.java @@ -36,7 +36,6 @@ import com.sun.star.uno.XInterface; import com.sun.star.uno.Type; import com.sun.star.uno.AnyConverter; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -77,88 +76,65 @@ public class CachedDynamicResultSetFactory extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { - XInterface oObj = null; - Object oInterface = null; + throws Exception { XMultiServiceFactory xMSF = Param.getMSF(); - try { - oInterface = xMSF.createInstance + Object oInterface = xMSF.createInstance ( "com.sun.star.ucb.CachedDynamicResultSetFactory" ); - - // adding one child container - } - catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } - - oObj = (XInterface) oInterface; + XInterface oObj = (XInterface) oInterface; TestEnvironment tEnv = new TestEnvironment( oObj ); // creating relation for XCachedDynamicResultSetFactory XDynamicResultSet resSetStub = null ; - try { - Object oUCB = xMSF.createInstanceWithArguments - ("com.sun.star.ucb.UniversalContentBroker", - new Object[0]) ; - - XContentIdentifierFactory ciFac = UnoRuntime.queryInterface(XContentIdentifierFactory.class, oUCB) ; - - String url = util.utils.getFullTestURL("SwXTextEmbeddedObject.sxw") ; - String escUrl = "" ; - - // In base URL of a JAR file in content URL all directory - // separators ('/') must be replaced with escape symbol '%2F'. - int idx = url.indexOf("/") ; - int lastIdx = -1 ; - while (idx >= 0) { - escUrl += url.substring(lastIdx + 1, idx) + "%2F" ; - lastIdx = idx ; - idx = url.indexOf("/", idx + 1) ; - } - escUrl += url.substring(lastIdx + 1) ; - String cntUrl = "vnd.sun.star.pkg://" + escUrl + "/" ; - - XContentIdentifier CI = ciFac.createContentIdentifier(cntUrl) ; - - XContentProvider cntProv = UnoRuntime.queryInterface(XContentProvider.class, oUCB) ; - - XContent cnt = cntProv.queryContent(CI) ; - - XCommandProcessor cmdProc = UnoRuntime.queryInterface(XCommandProcessor.class, cnt) ; - - Property prop = new Property() ; - prop.Name = "Title" ; - - Command cmd = new Command("open", -1, new OpenCommandArgument2 - (OpenMode.ALL, 10000, null, new Property[] {prop}, - new NumberedSortingInfo[0])) ; - - XDynamicResultSet dynResSet = null; - try { - dynResSet = (XDynamicResultSet) - AnyConverter.toObject(new Type(XDynamicResultSet.class), - cmdProc.execute(cmd, 0, null)); - } catch (com.sun.star.lang.IllegalArgumentException iae) { - throw new StatusException("Couldn't convert Any ",iae); - } - - Object oStubFactory = xMSF.createInstance - ("com.sun.star.ucb.CachedDynamicResultSetStubFactory") ; - - XCachedDynamicResultSetStubFactory xStubFactory = - UnoRuntime.queryInterface - (XCachedDynamicResultSetStubFactory.class, oStubFactory) ; - - resSetStub = - xStubFactory.createCachedDynamicResultSetStub(dynResSet) ; - - } catch (com.sun.star.uno.Exception e) { - log.println("Can't create relation." ); - e.printStackTrace(log) ; - throw new StatusException( "Can't create relation", e ); + Object oUCB = xMSF.createInstanceWithArguments + ("com.sun.star.ucb.UniversalContentBroker", + new Object[0]) ; + + XContentIdentifierFactory ciFac = UnoRuntime.queryInterface(XContentIdentifierFactory.class, oUCB) ; + + String url = util.utils.getFullTestURL("SwXTextEmbeddedObject.sxw") ; + String escUrl = "" ; + + // In base URL of a JAR file in content URL all directory + // separators ('/') must be replaced with escape symbol '%2F'. + int idx = url.indexOf("/") ; + int lastIdx = -1 ; + while (idx >= 0) { + escUrl += url.substring(lastIdx + 1, idx) + "%2F" ; + lastIdx = idx ; + idx = url.indexOf("/", idx + 1) ; } + escUrl += url.substring(lastIdx + 1) ; + String cntUrl = "vnd.sun.star.pkg://" + escUrl + "/" ; + + XContentIdentifier CI = ciFac.createContentIdentifier(cntUrl) ; + + XContentProvider cntProv = UnoRuntime.queryInterface(XContentProvider.class, oUCB) ; + + XContent cnt = cntProv.queryContent(CI) ; + + XCommandProcessor cmdProc = UnoRuntime.queryInterface(XCommandProcessor.class, cnt) ; + + Property prop = new Property() ; + prop.Name = "Title" ; + + Command cmd = new Command("open", -1, new OpenCommandArgument2 + (OpenMode.ALL, 10000, null, new Property[] {prop}, + new NumberedSortingInfo[0])) ; + + XDynamicResultSet dynResSet = (XDynamicResultSet) + AnyConverter.toObject(new Type(XDynamicResultSet.class), + cmdProc.execute(cmd, 0, null)); + + Object oStubFactory = xMSF.createInstance + ("com.sun.star.ucb.CachedDynamicResultSetStubFactory") ; + + XCachedDynamicResultSetStubFactory xStubFactory = + UnoRuntime.queryInterface + (XCachedDynamicResultSetStubFactory.class, oStubFactory) ; + + resSetStub = + xStubFactory.createCachedDynamicResultSetStub(dynResSet) ; tEnv.addObjRelation("CachedDynamicResultSetStub", resSetStub) ; diff --git a/qadevOOo/tests/java/mod/_cached/CachedDynamicResultSetStubFactory.java b/qadevOOo/tests/java/mod/_cached/CachedDynamicResultSetStubFactory.java index deec8847fc4c..a0245b7250a3 100644 --- a/qadevOOo/tests/java/mod/_cached/CachedDynamicResultSetStubFactory.java +++ b/qadevOOo/tests/java/mod/_cached/CachedDynamicResultSetStubFactory.java @@ -35,7 +35,6 @@ import com.sun.star.uno.XInterface; import com.sun.star.uno.Type; import com.sun.star.uno.AnyConverter; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -74,77 +73,55 @@ public class CachedDynamicResultSetStubFactory extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { - XInterface oObj = null; - Object oInterface = null; + throws Exception { XMultiServiceFactory xMSF = Param.getMSF(); - try { - oInterface = xMSF.createInstance + Object oInterface = xMSF.createInstance ( "com.sun.star.ucb.CachedDynamicResultSetStubFactory" ); - - // adding one child container - } - catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } - - oObj = (XInterface) oInterface; + XInterface oObj = (XInterface) oInterface; TestEnvironment tEnv = new TestEnvironment( oObj ); // creating relation for XCachedDynamicResultSetStubFactory XDynamicResultSet dynResSet = null ; - try { - Object oUCB = xMSF.createInstanceWithArguments - ("com.sun.star.ucb.UniversalContentBroker", - new Object[0]) ; - - XContentIdentifierFactory ciFac = UnoRuntime.queryInterface(XContentIdentifierFactory.class, oUCB) ; - - String url = util.utils.getFullTestURL("SwXTextEmbeddedObject.sxw") ; - String escUrl = "" ; - - // In base URL of a JAR file in content URL all directory - // separators ('/') must be replaced with escape symbol '%2F'. - int idx = url.indexOf("/") ; - int lastIdx = -1 ; - while (idx >= 0) { - escUrl += url.substring(lastIdx + 1, idx) + "%2F" ; - lastIdx = idx ; - idx = url.indexOf("/", idx + 1) ; - } - escUrl += url.substring(lastIdx + 1) ; - String cntUrl = "vnd.sun.star.pkg://" + escUrl + "/" ; - - XContentIdentifier CI = ciFac.createContentIdentifier(cntUrl) ; - - XContentProvider cntProv = UnoRuntime.queryInterface(XContentProvider.class, oUCB) ; - - XContent cnt = cntProv.queryContent(CI) ; - - XCommandProcessor cmdProc = UnoRuntime.queryInterface(XCommandProcessor.class, cnt) ; - - Property prop = new Property() ; - prop.Name = "Title" ; - - Command cmd = new Command("open", -1, new OpenCommandArgument2 - (OpenMode.ALL, 10000, null, new Property[] {prop}, - new NumberedSortingInfo[0])) ; - - try { - dynResSet = (XDynamicResultSet) - AnyConverter.toObject(new Type(XDynamicResultSet.class), - cmdProc.execute(cmd, 0, null)); - } catch (com.sun.star.lang.IllegalArgumentException iae) { - throw new StatusException("Couldn't convert Any ",iae); - } - - } catch (com.sun.star.uno.Exception e) { - log.println("Can't create relation." ); - e.printStackTrace(log) ; - throw new StatusException( "Can't create relation", e ); + Object oUCB = xMSF.createInstanceWithArguments + ("com.sun.star.ucb.UniversalContentBroker", + new Object[0]) ; + + XContentIdentifierFactory ciFac = UnoRuntime.queryInterface(XContentIdentifierFactory.class, oUCB) ; + + String url = util.utils.getFullTestURL("SwXTextEmbeddedObject.sxw") ; + String escUrl = "" ; + + // In base URL of a JAR file in content URL all directory + // separators ('/') must be replaced with escape symbol '%2F'. + int idx = url.indexOf("/") ; + int lastIdx = -1 ; + while (idx >= 0) { + escUrl += url.substring(lastIdx + 1, idx) + "%2F" ; + lastIdx = idx ; + idx = url.indexOf("/", idx + 1) ; } + escUrl += url.substring(lastIdx + 1) ; + String cntUrl = "vnd.sun.star.pkg://" + escUrl + "/" ; + + XContentIdentifier CI = ciFac.createContentIdentifier(cntUrl) ; + + XContentProvider cntProv = UnoRuntime.queryInterface(XContentProvider.class, oUCB) ; + + XContent cnt = cntProv.queryContent(CI) ; + + XCommandProcessor cmdProc = UnoRuntime.queryInterface(XCommandProcessor.class, cnt) ; + + Property prop = new Property() ; + prop.Name = "Title" ; + + Command cmd = new Command("open", -1, new OpenCommandArgument2 + (OpenMode.ALL, 10000, null, new Property[] {prop}, + new NumberedSortingInfo[0])) ; + + dynResSet = (XDynamicResultSet) + AnyConverter.toObject(new Type(XDynamicResultSet.class), + cmdProc.execute(cmd, 0, null)); tEnv.addObjRelation("DynamicResultSet", dynResSet) ; diff --git a/qadevOOo/tests/java/mod/_cmdmail/SimpleCommandMail.java b/qadevOOo/tests/java/mod/_cmdmail/SimpleCommandMail.java index 5988517fefa0..046557645305 100644 --- a/qadevOOo/tests/java/mod/_cmdmail/SimpleCommandMail.java +++ b/qadevOOo/tests/java/mod/_cmdmail/SimpleCommandMail.java @@ -20,7 +20,6 @@ package mod._cmdmail; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -33,23 +32,13 @@ public class SimpleCommandMail extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { - XInterface oObj = null; - Object oInterface = null; - - try { - XMultiServiceFactory xMSF = Param.getMSF(); - oInterface = xMSF.createInstance + throws Exception { + XMultiServiceFactory xMSF = Param.getMSF(); + Object oInterface = xMSF.createInstance ( "com.sun.star.comp.system.SimpleCommandMail" ); - if (oInterface == null) log.println("!!! NULL !!!") ; - } - catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } - - oObj = (XInterface) oInterface; + if (oInterface == null) log.println("!!! NULL !!!") ; + XInterface oObj = (XInterface) oInterface; log.println("ImplementationName: "+util.utils.getImplName(oObj)); diff --git a/qadevOOo/tests/java/mod/_cnt/ChaosContentProvider.java b/qadevOOo/tests/java/mod/_cnt/ChaosContentProvider.java index b2f60ed1e265..3d8338077452 100644 --- a/qadevOOo/tests/java/mod/_cnt/ChaosContentProvider.java +++ b/qadevOOo/tests/java/mod/_cnt/ChaosContentProvider.java @@ -20,7 +20,6 @@ package mod._cnt; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -66,24 +65,13 @@ public class ChaosContentProvider extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { - XInterface oObj = null; - Object oInterface = null; + throws Exception { XMultiServiceFactory xMSF = Param.getMSF(); - Object cntFactory = null ; - - try { - oInterface = xMSF.createInstance + Object oInterface = xMSF.createInstance ( "com.sun.star.ucb.ChaosContentProvider" ); - cntFactory = xMSF.createInstance + Object cntFactory = xMSF.createInstance ( "com.sun.star.comp.ucb.UniversalContentBroker" ); - } - catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } - - oObj = (XInterface) oInterface; + XInterface oObj = (XInterface) oInterface; TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_cnt/CntUnoDataContainer.java b/qadevOOo/tests/java/mod/_cnt/CntUnoDataContainer.java index ee7aebf4e19b..8fc8cd0d9143 100644 --- a/qadevOOo/tests/java/mod/_cnt/CntUnoDataContainer.java +++ b/qadevOOo/tests/java/mod/_cnt/CntUnoDataContainer.java @@ -20,7 +20,6 @@ package mod._cnt; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -79,37 +78,27 @@ public class CntUnoDataContainer extends TestCase { */ @Override protected TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) { - XInterface oObj = null; - Object oInterface = null; + TestParameters Param, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = Param.getMSF(); - Object relationContainer = null ; - Object xIn = null; - try { - oInterface = xMSF.createInstance - ( "com.sun.star.ucb.DataContainer" ); + Object oInterface = xMSF.createInstance + ( "com.sun.star.ucb.DataContainer" ); - // adding one child container - XIndexContainer xIC = UnoRuntime.queryInterface - (XIndexContainer.class, oInterface) ; + // adding one child container + XIndexContainer xIC = UnoRuntime.queryInterface + (XIndexContainer.class, oInterface) ; - Object child = xMSF.createInstance - ( "com.sun.star.ucb.DataContainer" ); - xIC.insertByIndex(0, child) ; + Object child = xMSF.createInstance + ( "com.sun.star.ucb.DataContainer" ); + xIC.insertByIndex(0, child) ; - relationContainer = xMSF.createInstance - ( "com.sun.star.ucb.DataContainer" ); + Object relationContainer = xMSF.createInstance + ( "com.sun.star.ucb.DataContainer" ); - xIn = xMSF.createInstance - ( "com.sun.star.io.DataInputStream" ); - } - catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } + Object xIn = xMSF.createInstance + ( "com.sun.star.io.DataInputStream" ); - oObj = (XInterface) oInterface; + XInterface oObj = (XInterface) oInterface; TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_cnt/PropertyMatcherFactory.java b/qadevOOo/tests/java/mod/_cnt/PropertyMatcherFactory.java index 61ada8c2acd5..93807fe5f486 100644 --- a/qadevOOo/tests/java/mod/_cnt/PropertyMatcherFactory.java +++ b/qadevOOo/tests/java/mod/_cnt/PropertyMatcherFactory.java @@ -20,7 +20,6 @@ package mod._cnt; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -51,23 +50,11 @@ public class PropertyMatcherFactory extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { - XInterface oObj = null; - Object oInterface = null; + throws Exception { XMultiServiceFactory xMSF = Param.getMSF(); - - - try { - oInterface = xMSF.createInstance - ( "com.sun.star.ucb.PropertyMatcherFactory" ); - - } - catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } - - oObj = (XInterface) oInterface; + Object oInterface = xMSF.createInstance + ( "com.sun.star.ucb.PropertyMatcherFactory" ); + XInterface oObj = (XInterface) oInterface; TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_configmgr/ConfigurationProvider.java b/qadevOOo/tests/java/mod/_configmgr/ConfigurationProvider.java index df544e398a1b..dc114804e5c7 100644 --- a/qadevOOo/tests/java/mod/_configmgr/ConfigurationProvider.java +++ b/qadevOOo/tests/java/mod/_configmgr/ConfigurationProvider.java @@ -29,20 +29,16 @@ public final class ConfigurationProvider extends TestCase { @Override protected TestEnvironment createTestEnvironment( - TestParameters tParam, PrintWriter log) + TestParameters tParam, PrintWriter log) throws Exception { // Create a non-default ConfigurationProvider instance, so that testing // its XComponent.dispose does not accidentally dispose the // DefaultProvider: XComponentContext ctxt = tParam.getComponentContext(); - try { return ProviderTestEnvironment.create( ctxt.getServiceManager().createInstanceWithArgumentsAndContext( "com.sun.star.configuration.ConfigurationProvider", new Object[] { new NamedValue("Locale", "*") }, ctxt)); - } catch (com.sun.star.uno.Exception e) { - throw new RuntimeException(e); - } } } diff --git a/qadevOOo/tests/java/mod/_configmgr/DefaultProvider.java b/qadevOOo/tests/java/mod/_configmgr/DefaultProvider.java index fb181d9715e6..2a11a9b51e97 100644 --- a/qadevOOo/tests/java/mod/_configmgr/DefaultProvider.java +++ b/qadevOOo/tests/java/mod/_configmgr/DefaultProvider.java @@ -32,13 +32,9 @@ public final class DefaultProvider extends TestCase { protected TestEnvironment createTestEnvironment( TestParameters tParam, PrintWriter log) { - try { - return ProviderTestEnvironment.create( - AnyConverter.toObject( - XInterface.class, - theDefaultProvider.get(tParam.getComponentContext()))); - } catch (com.sun.star.lang.IllegalArgumentException e) { - throw new RuntimeException(e); - } + return ProviderTestEnvironment.create( + AnyConverter.toObject( + XInterface.class, + theDefaultProvider.get(tParam.getComponentContext()))); } } diff --git a/qadevOOo/tests/java/mod/_connector/uno/Connector.java b/qadevOOo/tests/java/mod/_connector/uno/Connector.java index d6a9d4306963..16ea7497cd8a 100644 --- a/qadevOOo/tests/java/mod/_connector/uno/Connector.java +++ b/qadevOOo/tests/java/mod/_connector/uno/Connector.java @@ -20,7 +20,6 @@ package mod._connector.uno; import com.sun.star.uno.XInterface; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -71,22 +70,13 @@ public class Connector extends TestCase { * Just creates service <code>com.sun.star.connection.Connector</code> */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { - XInterface oObj = null ; + XInterface connector = (XInterface) + Param.getMSF().createInstance + ("com.sun.star.connection.Connector") ; - try { - XInterface connector = (XInterface) - Param.getMSF().createInstance - ("com.sun.star.connection.Connector") ; - - oObj = connector ; - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Can't create object environment", e); - } - - TestEnvironment tEnv = new TestEnvironment(oObj) ; + TestEnvironment tEnv = new TestEnvironment(connector) ; // select the port curPort = utils.getNextFreePort(basePort); diff --git a/qadevOOo/tests/java/mod/_connectr/Connector.java b/qadevOOo/tests/java/mod/_connectr/Connector.java index 4b02ff1bea16..65fce0961cca 100644 --- a/qadevOOo/tests/java/mod/_connectr/Connector.java +++ b/qadevOOo/tests/java/mod/_connectr/Connector.java @@ -20,7 +20,6 @@ package mod._connectr; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -74,22 +73,12 @@ public class Connector extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) throws StatusException { + TestParameters Param, PrintWriter log) throws Exception { + XInterface connector = (XInterface) + Param.getMSF().createInstance + ("com.sun.star.connection.Connector") ; - XInterface oObj = null ; - - try { - XInterface connector = (XInterface) - Param.getMSF().createInstance - ("com.sun.star.connection.Connector") ; - - oObj = connector ; - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Can't create object environment", e); - } - - TestEnvironment tEnv = new TestEnvironment(oObj) ; + TestEnvironment tEnv = new TestEnvironment(connector) ; // select the port curPort = utils.getNextFreePort(basePort); diff --git a/qadevOOo/tests/java/mod/_corefl/CoreReflection.java b/qadevOOo/tests/java/mod/_corefl/CoreReflection.java index 751355473f5f..4363f2f2b335 100644 --- a/qadevOOo/tests/java/mod/_corefl/CoreReflection.java +++ b/qadevOOo/tests/java/mod/_corefl/CoreReflection.java @@ -20,7 +20,6 @@ package mod._corefl; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -54,21 +53,11 @@ public class CoreReflection extends TestCase { */ @Override public TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) throws StatusException { - XInterface oObj = null; - Object oInterface = null; - - try { - XMultiServiceFactory xMSF = Param.getMSF(); - oInterface = xMSF.createInstance + TestParameters Param, PrintWriter log) throws Exception { + XMultiServiceFactory xMSF = Param.getMSF(); + Object oInterface = xMSF.createInstance ("com.sun.star.reflection.CoreReflection"); - } - catch(com.sun.star.uno.Exception e) { - e.printStackTrace(log); - log.println("CoreReflection Service not available" ); - } - - oObj = (XInterface) oInterface; + XInterface oObj = (XInterface) oInterface; log.println( " creating a new environment for CoreReflection object" ); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_corereflection/uno/CoreReflection.java b/qadevOOo/tests/java/mod/_corereflection/uno/CoreReflection.java index 39ea97b75278..029ae3069a5d 100644 --- a/qadevOOo/tests/java/mod/_corereflection/uno/CoreReflection.java +++ b/qadevOOo/tests/java/mod/_corereflection/uno/CoreReflection.java @@ -50,21 +50,12 @@ public class CoreReflection extends TestCase { * Creates <code>com.sun.star.reflection.CoreReflection</code> service. */ @Override - protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { - XInterface oObj = null; - Object oInterface = null; + protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { - try { - XMultiServiceFactory xMSF = Param.getMSF(); - oInterface = xMSF.createInstance - ("com.sun.star.reflection.CoreReflection"); - } - catch(com.sun.star.uno.Exception e) { - e.printStackTrace(log); - log.println("CoreReflection Service not available" ); - } - - oObj = (XInterface) oInterface; + XMultiServiceFactory xMSF = Param.getMSF(); + Object oInterface = xMSF.createInstance + ("com.sun.star.reflection.CoreReflection"); + XInterface oObj = (XInterface) oInterface; log.println( " creating a new environment for CoreReflection object" ); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_cpld/DLLComponentLoader.java b/qadevOOo/tests/java/mod/_cpld/DLLComponentLoader.java index 9b16c4263510..035068a5c60d 100644 --- a/qadevOOo/tests/java/mod/_cpld/DLLComponentLoader.java +++ b/qadevOOo/tests/java/mod/_cpld/DLLComponentLoader.java @@ -66,20 +66,12 @@ public class DLLComponentLoader extends TestCase { */ @Override protected TestEnvironment createTestEnvironment - (TestParameters Param, PrintWriter log) { - XInterface oObj = null; - Object oInterface = null; + (TestParameters Param, PrintWriter log) throws Exception { - try { - XMultiServiceFactory xMSF = Param.getMSF(); - oInterface = xMSF.createInstance - ( "com.sun.star.comp.stoc.DLLComponentLoader" ); - } - catch( Exception e ) { - log.println("DLLComponentLoader Service not available" ); - } - - oObj = (XInterface) oInterface; + XMultiServiceFactory xMSF = Param.getMSF(); + Object oInterface = xMSF.createInstance + ( "com.sun.star.comp.stoc.DLLComponentLoader" ); + XInterface oObj = (XInterface) oInterface; log.println( " creating a new environment for DLLComponentLoader object" ); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_dbaccess/ConnectionLineAccessibility.java b/qadevOOo/tests/java/mod/_dbaccess/ConnectionLineAccessibility.java index bfffdfd7ce3c..2025e9beb85b 100644 --- a/qadevOOo/tests/java/mod/_dbaccess/ConnectionLineAccessibility.java +++ b/qadevOOo/tests/java/mod/_dbaccess/ConnectionLineAccessibility.java @@ -94,7 +94,7 @@ public class ConnectionLineAccessibility extends TestCase */ @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) + PrintWriter log) throws Exception { XInterface oObj = null; @@ -102,21 +102,10 @@ public class ConnectionLineAccessibility extends TestCase Object newQuery = null; XStorable store = null; - try - { - Param.getMSF() - .createInstance("com.sun.star.sdb.DatabaseContext"); - oDBSource = Param.getMSF() - .createInstance("com.sun.star.sdb.DataSource"); - newQuery = Param.getMSF() - .createInstance("com.sun.star.sdb.QueryDefinition"); - Param.getMSF() - .createInstance("com.sun.star.awt.Toolkit"); - } - catch (com.sun.star.uno.Exception e) - { - throw new StatusException(e, Status.failed("Couldn't create instance")); - } + Param.getMSF().createInstance("com.sun.star.sdb.DatabaseContext"); + oDBSource = Param.getMSF().createInstance("com.sun.star.sdb.DataSource"); + newQuery = Param.getMSF().createInstance("com.sun.star.sdb.QueryDefinition"); + Param.getMSF().createInstance("com.sun.star.awt.Toolkit"); String mysqlURL = (String) Param.get("mysql.url"); @@ -146,49 +135,19 @@ public class ConnectionLineAccessibility extends TestCase XPropertySet propSetDBSource = UnoRuntime.queryInterface( XPropertySet.class, oDBSource); - try - { - propSetDBSource.setPropertyValue("URL", mysqlURL); - propSetDBSource.setPropertyValue("Info", info); - } - catch (com.sun.star.lang.WrappedTargetException e) - { - throw new StatusException(e, Status.failed( - "Couldn't set property value")); - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - throw new StatusException(e, Status.failed( - "Couldn't set property value")); - } - catch (com.sun.star.beans.PropertyVetoException e) - { - throw new StatusException(e, Status.failed( - "Couldn't set property value")); - } - catch (com.sun.star.beans.UnknownPropertyException e) - { - throw new StatusException(e, Status.failed( - "Couldn't set property value")); - } + propSetDBSource.setPropertyValue("URL", mysqlURL); + propSetDBSource.setPropertyValue("Info", info); - try - { - log.println("writing database file ..."); - XDocumentDataSource xDDS = UnoRuntime.queryInterface(XDocumentDataSource.class, oDBSource); - store = UnoRuntime.queryInterface(XStorable.class, - xDDS.getDatabaseDocument()); - - aFile = utils.getOfficeTemp(Param.getMSF())+"ConnectionLine.odb"; - log.println("... filename will be "+aFile); - store.storeAsURL(aFile,new PropertyValue[] - {}); - log.println("... done"); - } - catch (com.sun.star.uno.Exception e) - { - throw new StatusException(e, Status.failed("Couldn't register object")); - } + log.println("writing database file ..."); + XDocumentDataSource xDDS = UnoRuntime.queryInterface(XDocumentDataSource.class, oDBSource); + store = UnoRuntime.queryInterface(XStorable.class, + xDDS.getDatabaseDocument()); + + aFile = utils.getOfficeTemp(Param.getMSF())+"ConnectionLine.odb"; + log.println("... filename will be "+aFile); + store.storeAsURL(aFile,new PropertyValue[] + {}); + log.println("... done"); isolConnection = UnoRuntime.queryInterface( XIsolatedConnection.class, @@ -215,8 +174,6 @@ public class ConnectionLineAccessibility extends TestCase } catch (com.sun.star.sdbc.SQLException e) { - try - { util.utils.pause(1500); connection = isolConnection.getIsolatedConnection(user, password); @@ -227,11 +184,6 @@ public class ConnectionLineAccessibility extends TestCase col_name1 + " int)"); statement.executeUpdate("create table " + tbl_name2 + " (" + col_name2 + " int)"); - } - catch (com.sun.star.sdbc.SQLException e2) - { - throw new StatusException(e2, Status.failed("SQLException")); - } } XQueryDefinitionsSupplier querySuppl = UnoRuntime.queryInterface( @@ -243,65 +195,19 @@ public class ConnectionLineAccessibility extends TestCase XPropertySet queryProp = UnoRuntime.queryInterface( XPropertySet.class, newQuery); - try - { - final String query = "select * from " + tbl_name1 + ", " + - tbl_name2 + " where " + tbl_name1 + "." + - col_name1 + "=" + tbl_name2 + "." + - col_name2; - queryProp.setPropertyValue("Command", query); - } - catch (com.sun.star.lang.WrappedTargetException e) - { - throw new StatusException(e, Status.failed( - "Couldn't set property value")); - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - throw new StatusException(e, Status.failed( - "Couldn't set property value")); - } - catch (com.sun.star.beans.PropertyVetoException e) - { - throw new StatusException(e, Status.failed( - "Couldn't set property value")); - } - catch (com.sun.star.beans.UnknownPropertyException e) - { - throw new StatusException(e, Status.failed( - "Couldn't set property value")); - } + final String query = "select * from " + tbl_name1 + ", " + + tbl_name2 + " where " + tbl_name1 + "." + + col_name1 + "=" + tbl_name2 + "." + + col_name2; + queryProp.setPropertyValue("Command", query); XNameContainer queryContainer = UnoRuntime.queryInterface( XNameContainer.class, defContainer); - try - { - queryContainer.insertByName("Query1", newQuery); - store.store(); - connection.close(); - } - catch (com.sun.star.lang.WrappedTargetException e) - { - throw new StatusException(e, Status.failed("Couldn't insert query")); - } - catch (com.sun.star.container.ElementExistException e) - { - throw new StatusException(e, Status.failed("Couldn't insert query")); - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - throw new StatusException(e, Status.failed("Couldn't insert query")); - } - catch (com.sun.star.io.IOException e) - { - throw new StatusException(e, Status.failed("Couldn't insert query")); - } - catch (com.sun.star.sdbc.SQLException e) - { - throw new StatusException(e, Status.failed("Couldn't insert query")); - } + queryContainer.insertByName("Query1", newQuery); + store.store(); + connection.close(); PropertyValue[] loadProps = new PropertyValue[3]; loadProps[0] = new PropertyValue(); diff --git a/qadevOOo/tests/java/mod/_dbaccess/DBContentLoader.java b/qadevOOo/tests/java/mod/_dbaccess/DBContentLoader.java index 924270d6d373..b37389759991 100644 --- a/qadevOOo/tests/java/mod/_dbaccess/DBContentLoader.java +++ b/qadevOOo/tests/java/mod/_dbaccess/DBContentLoader.java @@ -20,8 +20,6 @@ package mod._dbaccess; import java.io.PrintWriter; -import lib.Status; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -64,35 +62,18 @@ public class DBContentLoader extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { - XInterface oObj = null; - Object oInterface = null ; + throws Exception { - //now get the OButtonControl - try { - oInterface = Param.getMSF().createInstance - ("com.sun.star.sdb.ContentLoader") ; - } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't get service"); - e.printStackTrace(log); - throw new StatusException("Couldn't get GridControl", e ); - } - - if (oInterface == null) { - log.println("Service wasn't created") ; - throw new StatusException(Status.failed("Service wasn't created")) ; - } - - oObj = (XInterface) oInterface ; + Object oInterface = Param.getMSF().createInstance + ("com.sun.star.sdb.ContentLoader"); + XInterface oObj = (XInterface) oInterface ; log.println("ImplementationName " + util.utils.getImplName(oObj)); log.println( "creating a new environment for object" ); TestEnvironment tEnv = new TestEnvironment( oObj ); // adding relation for XFrameLoader - tEnv.addObjRelation("FrameLoader.URL", - ".component:DB/DataSourceBrowser") ; - + tEnv.addObjRelation("FrameLoader.URL", ".component:DB/DataSourceBrowser") ; return tEnv; } // finish method getTestEnvironment diff --git a/qadevOOo/tests/java/mod/_dbaccess/JoinViewAccessibility.java b/qadevOOo/tests/java/mod/_dbaccess/JoinViewAccessibility.java index 4d944239d6e0..aef85b40e771 100644 --- a/qadevOOo/tests/java/mod/_dbaccess/JoinViewAccessibility.java +++ b/qadevOOo/tests/java/mod/_dbaccess/JoinViewAccessibility.java @@ -93,7 +93,7 @@ public class JoinViewAccessibility extends TestCase { */ @Override protected TestEnvironment createTestEnvironment (TestParameters Param, - PrintWriter log) + PrintWriter log) throws Exception { XInterface oObj = null; @@ -101,20 +101,12 @@ public class JoinViewAccessibility extends TestCase { Object newQuery = null; XStorable store = null; - try - { - Param.getMSF () - .createInstance ("com.sun.star.sdb.DatabaseContext"); - oDBSource = Param.getMSF () - .createInstance ("com.sun.star.sdb.DataSource"); - newQuery = Param.getMSF () - .createInstance ("com.sun.star.sdb.QueryDefinition"); - Param.getMSF () - .createInstance ("com.sun.star.awt.Toolkit"); - } catch (com.sun.star.uno.Exception e) - { - throw new StatusException(e, Status.failed ("Couldn't create instance")); - } + Param.getMSF().createInstance("com.sun.star.sdb.DatabaseContext"); + oDBSource = Param.getMSF() + .createInstance("com.sun.star.sdb.DataSource"); + newQuery = Param.getMSF().createInstance( + "com.sun.star.sdb.QueryDefinition"); + Param.getMSF().createInstance("com.sun.star.awt.Toolkit"); String mysqlURL = (String) Param.get ("mysql.url"); @@ -144,39 +136,18 @@ public class JoinViewAccessibility extends TestCase { XPropertySet propSetDBSource = UnoRuntime.queryInterface ( XPropertySet.class, oDBSource); - try - { - propSetDBSource.setPropertyValue ("URL", mysqlURL); - propSetDBSource.setPropertyValue ("Info", info); - } catch (com.sun.star.lang.WrappedTargetException e) - { - throw new StatusException(e, Status.failed("Couldn't set property value")); - } catch (com.sun.star.lang.IllegalArgumentException e) - { - throw new StatusException(e, Status.failed("Couldn't set property value")); - } catch (com.sun.star.beans.PropertyVetoException e) - { - throw new StatusException(e, Status.failed("Couldn't set property value")); - } catch (com.sun.star.beans.UnknownPropertyException e) - { - throw new StatusException(e, Status.failed("Couldn't set property value")); - } + propSetDBSource.setPropertyValue ("URL", mysqlURL); + propSetDBSource.setPropertyValue ("Info", info); - try - { - log.println ("writing database file ..."); - XDocumentDataSource xDDS = UnoRuntime.queryInterface(XDocumentDataSource.class, oDBSource); - store = UnoRuntime.queryInterface(XStorable.class, - xDDS.getDatabaseDocument()); - aFile = utils.getOfficeTemp (Param.getMSF ())+"JoinView.odb"; - log.println ("... filename will be "+aFile); - store.storeAsURL (aFile,new PropertyValue[] - {}); - log.println ("... done"); - } catch (com.sun.star.uno.Exception e) - { - throw new StatusException(e, Status.failed ("Couldn't register object")); - } + log.println ("writing database file ..."); + XDocumentDataSource xDDS = UnoRuntime.queryInterface(XDocumentDataSource.class, oDBSource); + store = UnoRuntime.queryInterface(XStorable.class, + xDDS.getDatabaseDocument()); + aFile = utils.getOfficeTemp (Param.getMSF ())+"JoinView.odb"; + log.println ("... filename will be "+aFile); + store.storeAsURL (aFile,new PropertyValue[] + {}); + log.println ("... done"); isolConnection = UnoRuntime.queryInterface ( XIsolatedConnection.class, @@ -202,22 +173,16 @@ public class JoinViewAccessibility extends TestCase { col_name2 + " int)"); } catch (com.sun.star.sdbc.SQLException e) { - try - { - util.utils.pause(1500); - connection = isolConnection.getIsolatedConnection (user, - password); - statement = connection.createStatement (); - statement.executeUpdate ("drop table if exists " + tbl_name1); - statement.executeUpdate ("drop table if exists " + tbl_name2); - statement.executeUpdate ("create table " + tbl_name1 + " (" + - col_name1 + " int)"); - statement.executeUpdate ("create table " + tbl_name2 + " (" + - col_name2 + " int)"); - } catch (com.sun.star.sdbc.SQLException e2) - { - throw new StatusException(e, Status.failed ("SQLException")); - } + util.utils.pause(1500); + connection = isolConnection.getIsolatedConnection (user, + password); + statement = connection.createStatement (); + statement.executeUpdate ("drop table if exists " + tbl_name1); + statement.executeUpdate ("drop table if exists " + tbl_name2); + statement.executeUpdate ("create table " + tbl_name1 + " (" + + col_name1 + " int)"); + statement.executeUpdate ("create table " + tbl_name2 + " (" + + col_name2 + " int)"); } XQueryDefinitionsSupplier querySuppl = UnoRuntime.queryInterface ( @@ -229,52 +194,19 @@ public class JoinViewAccessibility extends TestCase { XPropertySet queryProp = UnoRuntime.queryInterface ( XPropertySet.class, newQuery); - try - { - final String query = "select * from " + tbl_name1 + ", " + - tbl_name2 + " where " + tbl_name1 + "." + - col_name1 + "=" + tbl_name2 + "." + - col_name2; - queryProp.setPropertyValue ("Command", query); - } catch (com.sun.star.lang.WrappedTargetException e) - { - throw new StatusException(e, Status.failed("Couldn't set property value")); - } catch (com.sun.star.lang.IllegalArgumentException e) - { - throw new StatusException(e, Status.failed("Couldn't set property value")); - } catch (com.sun.star.beans.PropertyVetoException e) - { - throw new StatusException(e, Status.failed("Couldn't set property value")); - } catch (com.sun.star.beans.UnknownPropertyException e) - { - throw new StatusException(e, Status.failed("Couldn't set property value")); - } + final String query = "select * from " + tbl_name1 + ", " + + tbl_name2 + " where " + tbl_name1 + "." + + col_name1 + "=" + tbl_name2 + "." + + col_name2; + queryProp.setPropertyValue ("Command", query); XNameContainer queryContainer = UnoRuntime.queryInterface ( XNameContainer.class, defContainer); - try - { - queryContainer.insertByName ("Query1", newQuery); - store.store (); - connection.close (); - } catch (com.sun.star.lang.WrappedTargetException e) - { - throw new StatusException(e, Status.failed ("Couldn't insert query")); - } catch (com.sun.star.container.ElementExistException e) - { - throw new StatusException(e, Status.failed ("Couldn't insert query")); - } catch (com.sun.star.lang.IllegalArgumentException e) - { - throw new StatusException(e, Status.failed ("Couldn't insert query")); - } catch (com.sun.star.io.IOException e) - { - throw new StatusException(e, Status.failed ("Couldn't insert query")); - } catch (com.sun.star.sdbc.SQLException e) - { - throw new StatusException(e, Status.failed ("Couldn't insert query")); - } + queryContainer.insertByName ("Query1", newQuery); + store.store (); + connection.close (); PropertyValue[] loadProps = new PropertyValue[3]; loadProps[0] = new PropertyValue (); diff --git a/qadevOOo/tests/java/mod/_dbaccess/OCommandDefinition.java b/qadevOOo/tests/java/mod/_dbaccess/OCommandDefinition.java index 537e81751f42..895df264f055 100644 --- a/qadevOOo/tests/java/mod/_dbaccess/OCommandDefinition.java +++ b/qadevOOo/tests/java/mod/_dbaccess/OCommandDefinition.java @@ -20,8 +20,6 @@ package mod._dbaccess; import java.io.PrintWriter; -import lib.Status; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -53,26 +51,10 @@ public class OCommandDefinition extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { - XInterface oObj = null; - Object oInterface = null; - XMultiServiceFactory xMSF = null ; - - try { - xMSF = Param.getMSF(); - oInterface = xMSF.createInstance( "com.sun.star.sdb.QueryDefinition" ); - } - catch( com.sun.star.uno.Exception e ) { - log.println("Service not available" ); - throw new StatusException("Service not available", e) ; - } - - if (oInterface == null) { - log.println("Service wasn't created") ; - throw new StatusException(Status.failed("Service wasn't created")) ; - } - - oObj = (XInterface) oInterface; + throws Exception { + XMultiServiceFactory xMSF = Param.getMSF(); + Object oInterface = xMSF.createInstance( "com.sun.star.sdb.QueryDefinition" ); + XInterface oObj = (XInterface) oInterface; log.println( " creating a new environment for object" ); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_dbaccess/ODatabaseContext.java b/qadevOOo/tests/java/mod/_dbaccess/ODatabaseContext.java index 163ce0e45014..ab5d55e8992a 100644 --- a/qadevOOo/tests/java/mod/_dbaccess/ODatabaseContext.java +++ b/qadevOOo/tests/java/mod/_dbaccess/ODatabaseContext.java @@ -21,8 +21,6 @@ package mod._dbaccess; import com.sun.star.beans.PropertyValue; import java.io.PrintWriter; -import lib.Status; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -80,59 +78,35 @@ public class ODatabaseContext extends TestCase { * </ul> */ @Override - protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { - XInterface oObj = null; - Object oInterface = null; - XMultiServiceFactory xMSF = null ; - - try { - xMSF = Param.getMSF(); - oInterface = xMSF.createInstance( "com.sun.star.sdb.DatabaseContext" ); - } - catch( com.sun.star.uno.Exception e ) { - log.println("Service not available" ); - throw new StatusException("Service not available", e) ; - } - - if (oInterface == null) { - log.println("Service wasn't created") ; - throw new StatusException(Status.failed("Service wasn't created")) ; - } - - oObj = (XInterface) oInterface; + protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { + XMultiServiceFactory xMSF = Param.getMSF(); + Object oInterface = xMSF.createInstance( "com.sun.star.sdb.DatabaseContext" ); + XInterface oObj = (XInterface) oInterface; log.println( " creating a new environment for object" ); TestEnvironment tEnv = new TestEnvironment( oObj ); // adding obj relation for XNamingService - try { - xMSF = Param.getMSF(); - oInterface = xMSF.createInstance( "com.sun.star.sdb.DataSource" ); + oInterface = xMSF.createInstance( "com.sun.star.sdb.DataSource" ); - XPropertySet xDSProps = UnoRuntime.queryInterface(XPropertySet.class, oInterface) ; + XPropertySet xDSProps = UnoRuntime.queryInterface(XPropertySet.class, oInterface) ; - xDSProps.setPropertyValue("URL", "sdbc:dbase:file:///.") ; + xDSProps.setPropertyValue("URL", "sdbc:dbase:file:///.") ; - XDocumentDataSource xDDS = UnoRuntime.queryInterface(XDocumentDataSource.class, oInterface); - XStorable store = UnoRuntime.queryInterface(XStorable.class, - xDDS.getDatabaseDocument ()); - String aFile = utils.getOfficeTemp (Param.getMSF ())+"DatabaseContext.odb"; - log.println("store to '" + aFile + "'"); - store.storeAsURL(aFile,new PropertyValue[]{}); + XDocumentDataSource xDDS = UnoRuntime.queryInterface(XDocumentDataSource.class, oInterface); + XStorable store = UnoRuntime.queryInterface(XStorable.class, + xDDS.getDatabaseDocument ()); + String aFile = utils.getOfficeTemp (Param.getMSF ())+"DatabaseContext.odb"; + log.println("store to '" + aFile + "'"); + store.storeAsURL(aFile,new PropertyValue[]{}); - tEnv.addObjRelation("XNamingService.RegisterObject", oInterface) ; + tEnv.addObjRelation("XNamingService.RegisterObject", oInterface) ; - tEnv.addObjRelation("INSTANCE", oInterface); + tEnv.addObjRelation("INSTANCE", oInterface); - tEnv.addObjRelation("XContainer.Container", - UnoRuntime.queryInterface( - XNamingService.class, oObj)); - - } catch (com.sun.star.uno.Exception e) { - throw new StatusException("Can't create object relation", e) ; - } catch (NullPointerException e) { - throw new StatusException("Can't create object relation", e) ; - } + tEnv.addObjRelation("XContainer.Container", + UnoRuntime.queryInterface( + XNamingService.class, oObj)); return tEnv; } // finish method getTestEnvironment diff --git a/qadevOOo/tests/java/mod/_dbaccess/ODatabaseSource.java b/qadevOOo/tests/java/mod/_dbaccess/ODatabaseSource.java index 22fb02231acc..aa20c34e58fb 100644 --- a/qadevOOo/tests/java/mod/_dbaccess/ODatabaseSource.java +++ b/qadevOOo/tests/java/mod/_dbaccess/ODatabaseSource.java @@ -19,8 +19,6 @@ package mod._dbaccess; import com.sun.star.beans.PropertyValue; -import com.sun.star.beans.PropertyVetoException; -import com.sun.star.beans.UnknownPropertyException; import com.sun.star.beans.XPropertySet; import com.sun.star.frame.XStorable; @@ -37,9 +35,6 @@ import lib.TestParameters; import util.DesktopTools; import util.utils; -import com.sun.star.io.IOException; -import com.sun.star.lang.IllegalArgumentException; -import com.sun.star.lang.WrappedTargetException; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.sdb.XOfficeDatabaseDocument; import com.sun.star.task.XInteractionHandler; @@ -116,23 +111,9 @@ public class ODatabaseSource extends TestCase { * @see com.sun.star.sdb.DataSource */ @Override - protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { - XInterface oObj = null; - Object oInterface = null; - XMultiServiceFactory xMSF = null ; - - xMSF = Param.getMSF(); - try{ - oInterface = xMSF.createInstance( "com.sun.star.sdb.DatabaseContext" ); - - if (oInterface == null) - throw new StatusException("Could not get service 'com.sun.star.sdb.DatabaseContext'", new Exception()); - - }catch( Exception e ) { - log.println("Could not get service 'com.sun.star.sdb.DatabaseContext'" ); - e.printStackTrace (); - throw new StatusException("Service not available", e) ; - } + protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { + XMultiServiceFactory xMSF = Param.getMSF(); + Object oInterface = xMSF.createInstance( "com.sun.star.sdb.DatabaseContext" ); XNamingService xDBContextNameServ = UnoRuntime.queryInterface(XNamingService.class, oInterface) ; @@ -141,41 +122,23 @@ public class ODatabaseSource extends TestCase { tmpDatabaseUrl = "sdbc:dbase:file:///" + tmpDatabaseUrl ; - try{ - XInterface oDatabaseDoc = (XInterface) xMSF.createInstance - ("com.sun.star.sdb.OfficeDatabaseDocument") ; + XInterface oDatabaseDoc = (XInterface) xMSF.createInstance + ("com.sun.star.sdb.OfficeDatabaseDocument") ; - if (oDatabaseDoc == null) - throw new StatusException("Could not get service 'com.sun.star.sdb.OfficeDatabaseDocument'", new Exception()); + if (oDatabaseDoc == null) + throw new StatusException("Could not get service 'com.sun.star.sdb.OfficeDatabaseDocument'", new Exception()); - xDBDoc = UnoRuntime.queryInterface( - XOfficeDatabaseDocument.class, - oDatabaseDoc); - } - catch( Exception e ) { - log.println("Could not get service 'com.sun.star.sdb.OfficeDatabaseDocument'" ); - e.printStackTrace (); - throw new StatusException("Service not available", e) ; - } - - oObj = xDBDoc.getDataSource(); + xDBDoc = UnoRuntime.queryInterface( + XOfficeDatabaseDocument.class, + oDatabaseDoc); + XInterface oObj = xDBDoc.getDataSource(); log.println("ImplementationName: " + utils.getImplName(oObj)); // Creating new DBase data source in the TEMP directory XPropertySet xSrcProp = UnoRuntime.queryInterface(XPropertySet.class, oObj); - try{ - xSrcProp.setPropertyValue("URL", tmpDatabaseUrl) ; - } catch ( UnknownPropertyException e){ - throw new StatusException("Could not set property 'URL' ", e) ; - } catch ( PropertyVetoException e){ - throw new StatusException("Could not set property 'URL' ", e) ; - } catch ( IllegalArgumentException e){ - throw new StatusException("Could not set property 'URL' ", e) ; - } catch ( WrappedTargetException e){ - throw new StatusException("Could not set property 'URL' ", e) ; - } + xSrcProp.setPropertyValue("URL", tmpDatabaseUrl) ; String databaseName = "NewDatabaseSource" + uniqueSuffix ; @@ -189,34 +152,16 @@ public class ODatabaseSource extends TestCase { // registering source in DatabaseContext XStorable store = UnoRuntime.queryInterface(XStorable.class, xDBDoc); String aFile = utils.getOfficeTemp (Param.getMSF ())+"DataSource.odb"; - try{ - store.storeAsURL(aFile,new PropertyValue[]{}); - } catch (IOException e){ - log.println("Could not store datasource 'aFile'" ); - e.printStackTrace (); - throw new StatusException("Could not save ", e) ; - } + store.storeAsURL(aFile,new PropertyValue[]{}); - try{ - xDBContextNameServ.registerObject(databaseName, oObj) ; - } catch (Exception e){ - log.println("Could not register data source" ); - e.printStackTrace (); - throw new StatusException("Could not register ", e) ; - } + xDBContextNameServ.registerObject(databaseName, oObj) ; log.println( " creating a new environment for object" ); TestEnvironment tEnv = new TestEnvironment( oObj ); // adding obj relation for interface XCompletedConnection - Object handler = null ; - try { - handler = Param.getMSF().createInstance + Object handler = Param.getMSF().createInstance ("com.sun.star.sdb.InteractionHandler") ; - } catch (Exception e) { - log.println("Relation for XCompletedConnection wasn't created") ; - e.printStackTrace(log) ; - } // dbase does not need user and password tEnv.addObjRelation("UserAndPassword", new String[]{"",""}) ; diff --git a/qadevOOo/tests/java/mod/_dbaccess/ODatasourceAdministrationDialog.java b/qadevOOo/tests/java/mod/_dbaccess/ODatasourceAdministrationDialog.java index 52cd1d06da08..d229d3eb90f1 100644 --- a/qadevOOo/tests/java/mod/_dbaccess/ODatasourceAdministrationDialog.java +++ b/qadevOOo/tests/java/mod/_dbaccess/ODatasourceAdministrationDialog.java @@ -20,8 +20,6 @@ package mod._dbaccess; import java.io.PrintWriter; -import lib.Status; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -62,24 +60,10 @@ public class ODatasourceAdministrationDialog extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { - XInterface oObj = null; - Object oInterface = null; - - try { - oInterface = Param.getMSF().createInstance - ("com.sun.star.sdb.DatasourceAdministrationDialog" ); - } catch( com.sun.star.uno.Exception e ) { - log.println("Service not available" ); - throw new StatusException("Service not available", e) ; - } - - if (oInterface == null) { - log.println("Service wasn't created") ; - throw new StatusException(Status.failed("Service wasn't created")) ; - } - - oObj = (XInterface) oInterface; + throws Exception { + Object oInterface = Param.getMSF().createInstance + ("com.sun.star.sdb.DatasourceAdministrationDialog" ); + XInterface oObj = (XInterface) oInterface; log.println( " creating a new environment for object" ); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_dbaccess/ODatasourceBrowser.java b/qadevOOo/tests/java/mod/_dbaccess/ODatasourceBrowser.java index 616c04b94b7b..b6b6cc0a35e9 100644 --- a/qadevOOo/tests/java/mod/_dbaccess/ODatasourceBrowser.java +++ b/qadevOOo/tests/java/mod/_dbaccess/ODatasourceBrowser.java @@ -19,7 +19,6 @@ package mod._dbaccess; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -175,7 +174,7 @@ public class ODatasourceBrowser extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { log.println("creating a test environment"); if (xTextDoc != null) { @@ -195,14 +194,8 @@ public class ODatasourceBrowser extends TestCase { // get a soffice factory object SOfficeFactory SOF = SOfficeFactory.getFactory((Param.getMSF())); - try { - log.println("creating a text document"); - xTextDoc = SOF.createTextDoc(null); - } catch (com.sun.star.uno.Exception e) { - // Some exception occurs.FAILED - e.printStackTrace(log); - throw new StatusException("Couldn't create document", e); - } + log.println("creating a text document"); + xTextDoc = SOF.createTextDoc(null); util.utils.pause(5000); @@ -253,15 +246,9 @@ public class ODatasourceBrowser extends TestCase { param3.Value = "biblio"; params[2] = param3; - try { - XInitialization xInit = UnoRuntime.queryInterface( - XInitialization.class, oObj); - xInit.initialize(params); - } catch (com.sun.star.uno.Exception e) { - // Some exception occurs.FAILED - e.printStackTrace(log); - throw new StatusException("Couldn't initialize document", e); - } + XInitialization xInit = UnoRuntime.queryInterface( + XInitialization.class, oObj); + xInit.initialize(params); util.utils.pause(5000); diff --git a/qadevOOo/tests/java/mod/_dbaccess/OInteractionHandler.java b/qadevOOo/tests/java/mod/_dbaccess/OInteractionHandler.java index 5641c924dd9c..a5ec54f9e414 100644 --- a/qadevOOo/tests/java/mod/_dbaccess/OInteractionHandler.java +++ b/qadevOOo/tests/java/mod/_dbaccess/OInteractionHandler.java @@ -20,8 +20,6 @@ package mod._dbaccess; import java.io.PrintWriter; -import lib.Status; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -75,26 +73,10 @@ public class OInteractionHandler extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { - XInterface oObj = null; - Object oInterface = null; - - try { - oInterface = Param.getMSF().createInstance( - "com.sun.star.sdb.InteractionHandler" ); - - } - catch( com.sun.star.uno.Exception e ) { - log.println("Service not available" ); - throw new StatusException("Service not available", e) ; - } - - if (oInterface == null) { - log.println("Service wasn't created") ; - throw new StatusException(Status.failed("Service wasn't created")) ; - } - - oObj = (XInterface) oInterface; + throws Exception { + Object oInterface = Param.getMSF().createInstance( + "com.sun.star.sdb.InteractionHandler" ); + XInterface oObj = (XInterface) oInterface; log.println( " creating a new environment for object" ); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_dbaccess/OQueryDesign.java b/qadevOOo/tests/java/mod/_dbaccess/OQueryDesign.java index 255b7f9d1668..d310dfd6feb4 100644 --- a/qadevOOo/tests/java/mod/_dbaccess/OQueryDesign.java +++ b/qadevOOo/tests/java/mod/_dbaccess/OQueryDesign.java @@ -17,9 +17,6 @@ */ package mod._dbaccess; -import com.sun.star.container.NoSuchElementException; -import com.sun.star.lang.WrappedTargetException; -import com.sun.star.sdbc.SQLException; import com.sun.star.sdbc.XConnection; import com.sun.star.uno.Exception; import java.io.PrintWriter; @@ -67,7 +64,7 @@ public class OQueryDesign extends TestCase { } @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { log.println( "creating a test environment" ); @@ -78,45 +75,22 @@ public class OQueryDesign extends TestCase { XDispatch getting = null; XMultiServiceFactory xMSF = Param.getMSF(); - XNameAccess xNameAccess = null; + XNameAccess xNameAccess = null; - // we use the first datasource - XDataSource xDS = null; - try { - xNameAccess = UnoRuntime.queryInterface( - XNameAccess.class, - xMSF.createInstance("com.sun.star.sdb.DatabaseContext")); - } catch (Exception ex) { - ex.printStackTrace( log ); - throw new StatusException( "Could not get Databasecontext", ex ); - } - try { - xDS = UnoRuntime.queryInterface( - XDataSource.class, xNameAccess.getByName( "Bibliography" )); - } catch (NoSuchElementException ex) { - ex.printStackTrace( log ); - throw new StatusException( "Could not get XDataSource", ex ); - } catch (WrappedTargetException ex) { - ex.printStackTrace( log ); - throw new StatusException( "Could not get XDataSource", ex ); - } - try { - xNameAccess = UnoRuntime.queryInterface( - XNameAccess.class, - xMSF.createInstance("com.sun.star.sdb.DatabaseContext")); - } catch (Exception ex) { - ex.printStackTrace( log ); - throw new StatusException( "Could not get DatabaseConext", ex ); - } + // we use the first datasource + XDataSource xDS = null; + xNameAccess = UnoRuntime.queryInterface( + XNameAccess.class, + xMSF.createInstance("com.sun.star.sdb.DatabaseContext")); + xDS = UnoRuntime.queryInterface( + XDataSource.class, xNameAccess.getByName( "Bibliography" )); + xNameAccess = UnoRuntime.queryInterface( + XNameAccess.class, + xMSF.createInstance("com.sun.star.sdb.DatabaseContext")); - log.println("check XMultiServiceFactory"); + log.println("check XMultiServiceFactory"); - try { - xConn = xDS.getConnection("", ""); - } catch (SQLException ex) { - ex.printStackTrace( log ); - throw new StatusException( "Could not get XConnection", ex ); - } + xConn = xDS.getConnection("", ""); log.println( "opening QueryDesign" ); URL the_url = new URL(); @@ -138,38 +112,20 @@ public class OQueryDesign extends TestCase { util.utils.pause(5000); - Object oDBC = null; - - try { - oDBC = xMSF.createInstance( "com.sun.star.sdb.DatabaseContext" ); - } - catch( com.sun.star.uno.Exception e ) { - throw new StatusException("Could not instantiate DatabaseContext", e) ; - } + Object oDBC = xMSF.createInstance( "com.sun.star.sdb.DatabaseContext" ); Object oDataSource = null; - try{ - XNameAccess xNA = UnoRuntime.queryInterface(XNameAccess.class, oDBC); - oDataSource = xNA.getByName(sDataSourceName); - } catch ( com.sun.star.container.NoSuchElementException e){ - throw new StatusException("could not get '" + sDataSourceName + "'" , e) ; - } catch ( com.sun.star.lang.WrappedTargetException e){ - throw new StatusException("could not get '" + sDataSourceName + "'" , e) ; - } + XNameAccess xNA = UnoRuntime.queryInterface(XNameAccess.class, oDBC); + oDataSource = xNA.getByName(sDataSourceName); UnoRuntime.queryInterface(XDocumentDataSource.class, oDataSource); xFrame = DesktopTools.getCurrentFrame(xMSF); - SOfficeFactory SOF = null; + SOfficeFactory SOF = null; SOF = SOfficeFactory.getFactory( xMSF ); - try { - log.println( "creating a textdocument" ); - xTextDoc = SOF.createTextDoc( null ); - } catch ( com.sun.star.uno.Exception e ) { - e.printStackTrace( log ); - throw new StatusException( "Could not create document", e ); - } + log.println( "creating a textdocument" ); + xTextDoc = SOF.createTextDoc( null ); XModel xDocMod = UnoRuntime.queryInterface(XModel.class, xTextDoc); diff --git a/qadevOOo/tests/java/mod/_dbaccess/ORowSet.java b/qadevOOo/tests/java/mod/_dbaccess/ORowSet.java index f92516b37f78..594f0f570b3f 100644 --- a/qadevOOo/tests/java/mod/_dbaccess/ORowSet.java +++ b/qadevOOo/tests/java/mod/_dbaccess/ORowSet.java @@ -22,7 +22,6 @@ import ifc.sdb._XCompletedExecution; import java.io.PrintWriter; import java.util.ArrayList; -import lib.Status; import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; @@ -242,7 +241,7 @@ public class ORowSet extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) + PrintWriter log) throws Exception { XMultiServiceFactory orb = Param.getMSF(); uniqueSuffix++; @@ -251,27 +250,14 @@ public class ORowSet extends TestCase { //initialize test table if (isMySQLDB) { - try - { - DBTools.DataSourceInfo legacyDescriptor = dbTools.newDataSourceInfo(); - legacyDescriptor.Name = srcInf.Name; - legacyDescriptor.User = srcInf.User; - legacyDescriptor.Password = srcInf.Password; - legacyDescriptor.Info = srcInf.Info; - legacyDescriptor.URL = srcInf.URL; - legacyDescriptor.IsPasswordRequired = srcInf.IsPasswordRequired; - dbTools.initTestTableUsingJDBC(tableName, legacyDescriptor); - } - catch(java.sql.SQLException e) - { - throw new StatusException(e, Status.failed("Couldn't " + - " init test table. SQLException...")); - } - catch(java.lang.ClassNotFoundException e) - { - throw new StatusException(e, Status.failed("Couldn't " + - "register mysql driver")); - } + DBTools.DataSourceInfo legacyDescriptor = dbTools.newDataSourceInfo(); + legacyDescriptor.Name = srcInf.Name; + legacyDescriptor.User = srcInf.User; + legacyDescriptor.Password = srcInf.Password; + legacyDescriptor.Info = srcInf.Info; + legacyDescriptor.URL = srcInf.URL; + legacyDescriptor.IsPasswordRequired = srcInf.IsPasswordRequired; + dbTools.initTestTableUsingJDBC(tableName, legacyDescriptor); } else { @@ -398,19 +384,12 @@ public class ORowSet extends TestCase { // Adding relation for XCompletedExecution tEnv.addObjRelation( "InteractionHandlerChecker", new InteractionHandlerImpl() ); - try - { - String sqlCommand = isMySQLDB - ? "SELECT Column0 FROM soffice_test_table WHERE ( ( Column0 = :param1 ) )" - : "SELECT \"_TEXT\" FROM \"" + tableName + "\" WHERE ( ( \"_TEXT\" = :param1 ) )"; - rowSetProps.setPropertyValue( "DataSourceName", dbSourceName ); - rowSetProps.setPropertyValue( "Command", sqlCommand ); - rowSetProps.setPropertyValue( "CommandType", Integer.valueOf(CommandType.COMMAND) ); - } - catch(Exception e) - { - throw new StatusException( "setting up the RowSet with a parametrized command failed", e ); - } + String sqlCommand = isMySQLDB + ? "SELECT Column0 FROM soffice_test_table WHERE ( ( Column0 = :param1 ) )" + : "SELECT \"_TEXT\" FROM \"" + tableName + "\" WHERE ( ( \"_TEXT\" = :param1 ) )"; + rowSetProps.setPropertyValue( "DataSourceName", dbSourceName ); + rowSetProps.setPropertyValue( "Command", sqlCommand ); + rowSetProps.setPropertyValue( "CommandType", Integer.valueOf(CommandType.COMMAND) ); // Adding relation for XParameters ifc test tEnv.addObjRelation( "XParameters.ParamValues", new ArrayList<String>() ); @@ -464,20 +443,6 @@ public class ORowSet extends TestCase { return tEnv; } - catch(com.sun.star.uno.Exception e) - { - log.println( "couldn't set up test environment:" ); - e.printStackTrace(log); - try - { - if ( m_connection != null ) - m_connection.close(); - } - catch(Exception ex) - { - } - throw new StatusException( "couldn't set up test environment", e ); - } finally { if (!envCreatedOK) diff --git a/qadevOOo/tests/java/mod/_dbaccess/OSQLMessageDialog.java b/qadevOOo/tests/java/mod/_dbaccess/OSQLMessageDialog.java index daddd830c0d5..0d1d65914b48 100644 --- a/qadevOOo/tests/java/mod/_dbaccess/OSQLMessageDialog.java +++ b/qadevOOo/tests/java/mod/_dbaccess/OSQLMessageDialog.java @@ -20,8 +20,6 @@ package mod._dbaccess; import java.io.PrintWriter; -import lib.Status; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -31,7 +29,8 @@ import com.sun.star.uno.XInterface; /** * Test for object which is represented by service - * <code>com.sun.star.sdb.ErrorMessageDialog</code>. <p> + * <code>com.sun.star.sdb.ErrorMessageDialog</code>. + * <p> * Object implements the following interfaces : * <ul> * <li> <code>com::sun::star::lang::XInitialization</code></li> @@ -57,88 +56,59 @@ public class OSQLMessageDialog extends TestCase { * Creating a TestEnvironment for the interfaces to be tested. * * Creates an instance of the service - * <code>com.sun.star.sdb.ErrorMessageDialog</code>. - * Object relations created : + * <code>com.sun.star.sdb.ErrorMessageDialog</code>. Object relations + * created : * <ul> - * <li> <code>'ERR1', 'ERR2'</code> for - * {@link ifc.sdb._ErrorMessageDialog} </li> + * <li> <code>'ERR1', 'ERR2'</code> for {@link ifc.sdb._ErrorMessageDialog}</li> * </ul> */ @Override - public TestEnvironment createTestEnvironment( TestParameters Param, - PrintWriter log ) throws StatusException { + public TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) throws Exception { XInterface oObj = null; Object oInterface = null; Object err1 = null; Object err2 = null; - try { - oInterface = Param.getMSF().createInstance( - "com.sun.star.sdb.ErrorMessageDialog" ); + oInterface = Param.getMSF().createInstance( + "com.sun.star.sdb.ErrorMessageDialog"); - err1 = new com.sun.star.sdbc.SQLException("err1"); - err2 = new com.sun.star.sdbc.SQLException("err2"); - } - catch( com.sun.star.uno.Exception e ) { - log.println("Service not available" ); - throw new StatusException("Service not available", e) ; - } - - if (oInterface == null) { - log.println("Service wasn't created") ; - throw new StatusException(Status.failed("Service wasn't created")) ; - } + err1 = new com.sun.star.sdbc.SQLException("err1"); + err2 = new com.sun.star.sdbc.SQLException("err2"); oObj = (XInterface) oInterface; // create XWindow for Object relations... - com.sun.star.awt.XToolkit xToolkit = null; - - try{ - xToolkit = UnoRuntime.queryInterface( - com.sun.star.awt.XToolkit.class, - Param.getMSF().createInstance("com.sun.star.awt.Toolkit") ); - } catch (com.sun.star.uno.Exception e){ - log.println("could not create instacne of 'com.sun.star.awt.Toolkit'" ); - throw new StatusException("could not create instacne of 'com.sun.star.awt.Toolkit'", e) ; - } + com.sun.star.awt.XToolkit xToolkit = UnoRuntime.queryInterface( + com.sun.star.awt.XToolkit.class, + Param.getMSF().createInstance("com.sun.star.awt.Toolkit")); // Describe the properties of the container window. - com.sun.star.awt.WindowDescriptor aDescriptor = - new com.sun.star.awt.WindowDescriptor(); - - aDescriptor.Type = com.sun.star.awt.WindowClass.TOP ; - aDescriptor.WindowServiceName = "window" ; - aDescriptor.ParentIndex = -1; - aDescriptor.Parent = null; - aDescriptor.Bounds = new com.sun.star.awt.Rectangle(0,0,0,0); - - aDescriptor.WindowAttributes = - com.sun.star.awt.WindowAttribute.BORDER | - com.sun.star.awt.WindowAttribute.MOVEABLE | - com.sun.star.awt.WindowAttribute.SIZEABLE | - com.sun.star.awt.WindowAttribute.CLOSEABLE ; + com.sun.star.awt.WindowDescriptor aDescriptor = new com.sun.star.awt.WindowDescriptor(); - com.sun.star.awt.XWindowPeer xPeer = null; - try{ + aDescriptor.Type = com.sun.star.awt.WindowClass.TOP; + aDescriptor.WindowServiceName = "window"; + aDescriptor.ParentIndex = -1; + aDescriptor.Parent = null; + aDescriptor.Bounds = new com.sun.star.awt.Rectangle(0, 0, 0, 0); - xPeer = xToolkit.createWindow(aDescriptor) ; + aDescriptor.WindowAttributes = com.sun.star.awt.WindowAttribute.BORDER + | com.sun.star.awt.WindowAttribute.MOVEABLE + | com.sun.star.awt.WindowAttribute.SIZEABLE + | com.sun.star.awt.WindowAttribute.CLOSEABLE; - } catch (com.sun.star.lang.IllegalArgumentException e){ - log.println("could not create window" ); - throw new StatusException("could not create window", e) ; - } + com.sun.star.awt.XWindowPeer xPeer = xToolkit.createWindow(aDescriptor); - com.sun.star.awt.XWindow xWindow = UnoRuntime.queryInterface ( - com.sun.star.awt.XWindow .class, xPeer); + com.sun.star.awt.XWindow xWindow = UnoRuntime.queryInterface( + com.sun.star.awt.XWindow.class, xPeer); - log.println( " creating a new environment for object" ); - TestEnvironment tEnv = new TestEnvironment( oObj ); + log.println(" creating a new environment for object"); + TestEnvironment tEnv = new TestEnvironment(oObj); log.println("add ObjectRelations err1 and err2 for 'ErrorMessageDialog'"); - tEnv.addObjRelation("ERR1",err1); - tEnv.addObjRelation("ERR2",err2); + tEnv.addObjRelation("ERR1", err1); + tEnv.addObjRelation("ERR2", err2); tEnv.addObjRelation("ERR_XWindow", xWindow); return tEnv; diff --git a/qadevOOo/tests/java/mod/_dbaccess/OSingleSelectQueryComposer.java b/qadevOOo/tests/java/mod/_dbaccess/OSingleSelectQueryComposer.java index 8cb44b2ad1d2..b3b58b289737 100644 --- a/qadevOOo/tests/java/mod/_dbaccess/OSingleSelectQueryComposer.java +++ b/qadevOOo/tests/java/mod/_dbaccess/OSingleSelectQueryComposer.java @@ -44,47 +44,50 @@ import com.sun.star.uno.XInterface; /** * Test for object which is represented by service - * <code>com.sun.star.sdb.DataSource</code>. <p> + * <code>com.sun.star.sdb.DataSource</code>. + * <p> * * Object implements the following interfaces : * <ul> - * <li> <code>com::sun::star::sdbc::RowSet</code></li> - * <li> <code>com::sun::star::sdbcx::XRowLocate</code></li> - * <li> <code>com::sun::star::sdbc::XResultSetUpdate</code></li> - * <li> <code>com::sun::star::util::XCancellable</code></li> - * <li> <code>com::sun::star::sdbc::XParameters</code></li> - * <li> <code>com::sun::star::sdbc::XResultSetMetaDataSupplier</code></li> - * <li> <code>com::sun::star::sdbcx::XDeleteRows</code></li> - * <li> <code>com::sun::star::sdbc::XCloseable</code></li> - * <li> <code>com::sun::star::sdbcx::XColumnsSupplier</code></li> - * <li> <code>com::sun::star::sdb::XResultSetAccess</code></li> - * <li> <code>com::sun::star::sdbc::XResultSet</code></li> - * <li> <code>com::sun::star::sdbc::XColumnLocate</code></li> - * <li> <code>com::sun::star::sdbc::XRowSet</code></li> - * <li> <code>com::sun::star::sdb::RowSet</code></li> - * <li> <code>com::sun::star::sdbc::XRowUpdate</code></li> - * <li> <code>com::sun::star::sdb::XRowSetApproveBroadcaster</code></li> - * <li> <code>com::sun::star::beans::XPropertySet</code></li> - * <li> <code>com::sun::star::sdbc::XRow</code></li> - * <li> <code>com::sun::star::sdbc::XWarningsSupplier</code></li> - * <li> <code>com::sun::star::lang::XComponent</code></li> - * <li> <code>com::sun::star::sdbcx::ResultSet</code></li> - * <li> <code>com::sun::star::sdbc::ResultSet</code></li> - * </ul> <p> + * <li> <code>com::sun::star::sdbc::RowSet</code></li> + * <li> <code>com::sun::star::sdbcx::XRowLocate</code></li> + * <li> <code>com::sun::star::sdbc::XResultSetUpdate</code></li> + * <li> <code>com::sun::star::util::XCancellable</code></li> + * <li> <code>com::sun::star::sdbc::XParameters</code></li> + * <li> <code>com::sun::star::sdbc::XResultSetMetaDataSupplier</code></li> + * <li> <code>com::sun::star::sdbcx::XDeleteRows</code></li> + * <li> <code>com::sun::star::sdbc::XCloseable</code></li> + * <li> <code>com::sun::star::sdbcx::XColumnsSupplier</code></li> + * <li> <code>com::sun::star::sdb::XResultSetAccess</code></li> + * <li> <code>com::sun::star::sdbc::XResultSet</code></li> + * <li> <code>com::sun::star::sdbc::XColumnLocate</code></li> + * <li> <code>com::sun::star::sdbc::XRowSet</code></li> + * <li> <code>com::sun::star::sdb::RowSet</code></li> + * <li> <code>com::sun::star::sdbc::XRowUpdate</code></li> + * <li> <code>com::sun::star::sdb::XRowSetApproveBroadcaster</code></li> + * <li> <code>com::sun::star::beans::XPropertySet</code></li> + * <li> <code>com::sun::star::sdbc::XRow</code></li> + * <li> <code>com::sun::star::sdbc::XWarningsSupplier</code></li> + * <li> <code>com::sun::star::lang::XComponent</code></li> + * <li> <code>com::sun::star::sdbcx::ResultSet</code></li> + * <li> <code>com::sun::star::sdbc::ResultSet</code></li> + * </ul> + * <p> * The following files used by this test : * <ul> - * <li><b> TestDB/TestDB.dbf </b> : the database file with some - * predefined fields described in <code>util.DBTools</code>. - * The copy of this file is always made in temp directory for - * testing purposes.</li> - * </ul> <p> + * <li><b> TestDB/TestDB.dbf </b> : the database file with some predefined + * fields described in <code>util.DBTools</code>. The copy of this file is + * always made in temp directory for testing purposes.</li> + * </ul> + * <p> * The following parameters in ini-file used by this test: * <ul> - * <li><code>test.db.url</code> - URL to MySQL database. - * For example: <code>mysql://mercury:3306/api_current</code></li> - * <li><code>test.db.user</code> - user for MySQL database</li> - * <li><code>test.db.password</code> - password for MySQL database</li> - * </ul><p> + * <li><code>test.db.url</code> - URL to MySQL database. For example: + * <code>mysql://mercury:3306/api_current</code></li> + * <li><code>test.db.user</code> - user for MySQL database</li> + * <li><code>test.db.password</code> - password for MySQL database</li> + * </ul> + * <p> * * @see com.sun.star.sdbc.RowSet * @see com.sun.star.sdbcx.XRowLocate @@ -139,10 +142,9 @@ public class OSingleSelectQueryComposer extends TestCase { protected final static String dbSourceName = "OSingleSelectQueryComposerDataSource"; public XConnection conn = null; - @Override - protected void initialize ( TestParameters Param, PrintWriter log) - throws StatusException { + protected void initialize(TestParameters Param, PrintWriter log) + throws StatusException { } @@ -167,103 +169,90 @@ public class OSingleSelectQueryComposer extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; Object oInterface = null; - XMultiServiceFactory xMSF = null ; - try { - xMSF = Param.getMSF(); - - XNameAccess xNameAccess = UnoRuntime.queryInterface( - XNameAccess.class, - xMSF.createInstance("com.sun.star.sdb.DatabaseContext")); - // we use the first datasource - XDataSource xDS = UnoRuntime.queryInterface( - XDataSource.class, xNameAccess.getByName( "Bibliography" )); - - log.println("check XMultiServiceFactory"); - XMultiServiceFactory xConn = UnoRuntime.queryInterface(XMultiServiceFactory.class, - xDS.getConnection("", "")); - - log.println("check getAvailableServiceNames"); - String[] sServiceNames = xConn.getAvailableServiceNames(); - if (! sServiceNames[0].equals("com.sun.star.sdb.SingleSelectQueryComposer")) - { - log.println("Service 'SingleSelectQueryComposer' not supported"); - } - - oInterface = xConn.createInstance( sServiceNames[0]); - - if (oInterface == null) { - log.println("Service wasn't created") ; - throw new StatusException("Service wasn't created", - new NullPointerException()) ; - } + XMultiServiceFactory xMSF = null; + xMSF = Param.getMSF(); + + XNameAccess xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, + xMSF.createInstance("com.sun.star.sdb.DatabaseContext")); + // we use the first datasource + XDataSource xDS = UnoRuntime.queryInterface(XDataSource.class, + xNameAccess.getByName("Bibliography")); + + log.println("check XMultiServiceFactory"); + XMultiServiceFactory xConn = UnoRuntime.queryInterface( + XMultiServiceFactory.class, xDS.getConnection("", "")); + + log.println("check getAvailableServiceNames"); + String[] sServiceNames = xConn.getAvailableServiceNames(); + if (!sServiceNames[0] + .equals("com.sun.star.sdb.SingleSelectQueryComposer")) { + log.println("Service 'SingleSelectQueryComposer' not supported"); + } - Object oRowSet = xMSF.createInstance("com.sun.star.sdb.RowSet") ; + oInterface = xConn.createInstance(sServiceNames[0]); + Object oRowSet = xMSF.createInstance("com.sun.star.sdb.RowSet"); - XPropertySet xSetProp = UnoRuntime.queryInterface - (XPropertySet.class, oRowSet) ; + XPropertySet xSetProp = UnoRuntime.queryInterface(XPropertySet.class, + oRowSet); - xSetProp.setPropertyValue("DataSourceName", "Bibliography") ; - xSetProp.setPropertyValue("Command", "biblio") ; - xSetProp.setPropertyValue("CommandType", - Integer.valueOf(CommandType.TABLE)) ; + xSetProp.setPropertyValue("DataSourceName", "Bibliography"); + xSetProp.setPropertyValue("Command", "biblio"); + xSetProp.setPropertyValue("CommandType", + Integer.valueOf(CommandType.TABLE)); - com.sun.star.sdbc.XRowSet xORowSet = UnoRuntime.queryInterface(com.sun.star.sdbc.XRowSet.class, - oRowSet) ; + com.sun.star.sdbc.XRowSet xORowSet = UnoRuntime.queryInterface( + com.sun.star.sdbc.XRowSet.class, oRowSet); - xORowSet.execute() ; + xORowSet.execute(); - XColumnsSupplier xColSup = UnoRuntime.queryInterface(XColumnsSupplier.class, oRowSet); + XColumnsSupplier xColSup = UnoRuntime.queryInterface( + XColumnsSupplier.class, oRowSet); - XNameAccess xCols = xColSup.getColumns(); + XNameAccess xCols = xColSup.getColumns(); - XPropertySet xCol = (XPropertySet) AnyConverter.toObject( - new Type(XPropertySet.class), - xCols.getByName(xCols.getElementNames()[0])); + XPropertySet xCol = (XPropertySet) AnyConverter.toObject(new Type( + XPropertySet.class), + xCols.getByName(xCols.getElementNames()[0])); - XSingleSelectQueryAnalyzer xQueryAna = UnoRuntime.queryInterface(XSingleSelectQueryAnalyzer.class, - oInterface); + XSingleSelectQueryAnalyzer xQueryAna = UnoRuntime.queryInterface( + XSingleSelectQueryAnalyzer.class, oInterface); - // XSingleSelectQueryComposer - XSingleSelectQueryComposer xComposer = UnoRuntime.queryInterface(XSingleSelectQueryComposer.class, - xQueryAna); - xQueryAna.setQuery("SELECT * FROM \"biblio\""); + // XSingleSelectQueryComposer + XSingleSelectQueryComposer xComposer = UnoRuntime.queryInterface( + XSingleSelectQueryComposer.class, xQueryAna); + xQueryAna.setQuery("SELECT * FROM \"biblio\""); - oObj = (XInterface) oInterface; - log.println("ImplementationName: " + utils.getImplName(oObj)); + oObj = (XInterface) oInterface; + log.println("ImplementationName: " + utils.getImplName(oObj)); - log.println( " creating a new environment for object" ); - TestEnvironment tEnv = new TestEnvironment( oObj ); + log.println(" creating a new environment for object"); + TestEnvironment tEnv = new TestEnvironment(oObj); - // for XSingleSelectQueryAnalyzer - tEnv.addObjRelation("xComposer", xComposer); + // for XSingleSelectQueryAnalyzer + tEnv.addObjRelation("xComposer", xComposer); - // for XSingleSelectQueryComposer - tEnv.addObjRelation("xQueryAna", xQueryAna); + // for XSingleSelectQueryComposer + tEnv.addObjRelation("xQueryAna", xQueryAna); - tEnv.addObjRelation("xProp", xCol); - tEnv.addObjRelation("colName", xCols.getElementNames()[0]); + tEnv.addObjRelation("xProp", xCol); + tEnv.addObjRelation("colName", xCols.getElementNames()[0]); - XResultSet xResultSet = UnoRuntime.queryInterface(XResultSet.class, oRowSet); - tEnv.addObjRelation("xResultSet", xResultSet); + XResultSet xResultSet = UnoRuntime.queryInterface(XResultSet.class, + oRowSet); + tEnv.addObjRelation("xResultSet", xResultSet); - return tEnv; - - } catch(com.sun.star.uno.Exception e) { - log.println("Can't create object" ); - e.printStackTrace(log) ; - throw new StatusException("Can't create object", e) ; - } + return tEnv; } // finish method getTestEnvironment /** - * Closes connection of <code>RowSet</code> instance created. - */ + * Closes connection of <code>RowSet</code> instance created. + */ @Override - protected void cleanup( TestParameters Param, PrintWriter log) { + protected void cleanup(TestParameters Param, PrintWriter log) { } } diff --git a/qadevOOo/tests/java/mod/_dbaccess/SbaXGridControl.java b/qadevOOo/tests/java/mod/_dbaccess/SbaXGridControl.java index b6215103d5d2..6554dc15380e 100644 --- a/qadevOOo/tests/java/mod/_dbaccess/SbaXGridControl.java +++ b/qadevOOo/tests/java/mod/_dbaccess/SbaXGridControl.java @@ -228,7 +228,7 @@ public class SbaXGridControl extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; XWindowPeer the_win = null; XToolkit the_kit = null; @@ -254,63 +254,33 @@ public class SbaXGridControl extends TestCase { XControlAccess.class, xTextDoc.getCurrentController()); - try { - columns = UnoRuntime.queryInterface( - XGridColumnFactory.class, the_Model); - aControl = columns.createColumn("TextField"); - aControl.setPropertyValue("DataField", "Identifier"); - aControl.setPropertyValue("Label", "Identifier"); - aControl2 = columns.createColumn("TextField"); - aControl2.setPropertyValue("DataField", "Publisher"); - aControl2.setPropertyValue("Label", "Publisher"); - aControl3 = columns.createColumn("TextField"); - aControl3.setPropertyValue("DataField", "Author"); - aControl3.setPropertyValue("Label", "Author"); - aControl4 = columns.createColumn("TextField"); - aControl4.setPropertyValue("DataField", "Title"); - aControl4.setPropertyValue("Label", "Title"); - } catch (com.sun.star.lang.IllegalArgumentException e) { - // Some exception occurs.FAILED - log.println("!!! Couldn't create instance : " + e); - throw new StatusException("Can't create column instances.", e); - } catch (com.sun.star.lang.WrappedTargetException e) { - // Some exception occurs.FAILED - log.println("!!! Couldn't create instance : " + e); - throw new StatusException("Can't create column instances.", e); - } catch (com.sun.star.beans.PropertyVetoException e) { - // Some exception occurs.FAILED - log.println("!!! Couldn't create instance : " + e); - throw new StatusException("Can't create column instances.", e); - } catch (com.sun.star.beans.UnknownPropertyException e) { - // Some exception occurs.FAILED - log.println("!!! Couldn't create instance : " + e); - throw new StatusException("Can't create column instances.", e); - } + columns = UnoRuntime.queryInterface( + XGridColumnFactory.class, the_Model); + aControl = columns.createColumn("TextField"); + aControl.setPropertyValue("DataField", "Identifier"); + aControl.setPropertyValue("Label", "Identifier"); + aControl2 = columns.createColumn("TextField"); + aControl2.setPropertyValue("DataField", "Publisher"); + aControl2.setPropertyValue("Label", "Publisher"); + aControl3 = columns.createColumn("TextField"); + aControl3.setPropertyValue("DataField", "Author"); + aControl3.setPropertyValue("Label", "Author"); + aControl4 = columns.createColumn("TextField"); + aControl4.setPropertyValue("DataField", "Title"); + aControl4.setPropertyValue("Label", "Title"); XNameContainer aContainer = UnoRuntime.queryInterface( XNameContainer.class, the_Model); - try { - aContainer.insertByName("First", aControl); - aContainer.insertByName("Second", aControl2); - } catch (com.sun.star.uno.Exception e) { - log.println("!!! Could't insert column Instance"); - e.printStackTrace(log); - throw new StatusException("Can't insert columns", e); - } + aContainer.insertByName("First", aControl); + aContainer.insertByName("Second", aControl2); //now get the OGridControl - try { - oObj = the_access.getControl(the_Model); - the_win = the_access.getControl(the_Model).getPeer(); - the_kit = the_win.getToolkit(); - aDevice = the_kit.createScreenCompatibleDevice(200, 200); - aGraphic = aDevice.createGraphics(); - } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't get GridControl"); - e.printStackTrace(log); - throw new StatusException("Couldn't get GridControl", e); - } + oObj = the_access.getControl(the_Model); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); // creating another window @@ -331,14 +301,8 @@ public class SbaXGridControl extends TestCase { XWindow win = null; Object cntrl = null; - try { - cntrl = the_access.getControl(the_Model); - win = UnoRuntime.queryInterface(XWindow.class, cntrl); - } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't get Control"); - e.printStackTrace(log); - throw new StatusException("Couldn't get Control", e); - } + cntrl = the_access.getControl(the_Model); + win = UnoRuntime.queryInterface(XWindow.class, cntrl); log.println("creating a new environment for object"); diff --git a/qadevOOo/tests/java/mod/_dbaccess/TableWindowAccessibility.java b/qadevOOo/tests/java/mod/_dbaccess/TableWindowAccessibility.java index b7c5513b2145..d48bd9009042 100644 --- a/qadevOOo/tests/java/mod/_dbaccess/TableWindowAccessibility.java +++ b/qadevOOo/tests/java/mod/_dbaccess/TableWindowAccessibility.java @@ -52,23 +52,24 @@ import java.awt.event.InputEvent; import util.DesktopTools; import util.utils; - /** -* Object implements the following interfaces : -* <ul> -* <li><code>::com::sun::star::accessibility::XAccessible</code></li> -* <li><code>::com::sun::star::accessibility::XAccessibleContext -* </code></li> -* <li><code>::com::sun::star::accessibility::XAccessibleEventBroadcaster -* </code></li> -* </ul><p> -* @see com.sun.star.accessibility.XAccessible -* @see com.sun.star.accessibility.XAccessibleContext -* @see com.sun.star.accessibility.XAccessibleEventBroadcaster -* @see ifc.accessibility._XAccessible -* @see ifc.accessibility._XAccessibleContext -* @see ifc.accessibility._XAccessibleEventBroadcaster -*/ + * Object implements the following interfaces : + * <ul> + * <li><code>::com::sun::star::accessibility::XAccessible</code></li> + * <li><code>::com::sun::star::accessibility::XAccessibleContext + * </code></li> + * <li><code>::com::sun::star::accessibility::XAccessibleEventBroadcaster + * </code></li> + * </ul> + * <p> + * + * @see com.sun.star.accessibility.XAccessible + * @see com.sun.star.accessibility.XAccessibleContext + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + * @see ifc.accessibility._XAccessible + * @see ifc.accessibility._XAccessibleContext + * @see ifc.accessibility._XAccessibleEventBroadcaster + */ public class TableWindowAccessibility extends TestCase { XWindow xWindow = null; Object oDBSource = null; @@ -77,57 +78,52 @@ public class TableWindowAccessibility extends TestCase { XIsolatedConnection isolConnection = null; XComponent QueryComponent = null; String user = ""; - String password=""; + String password = ""; /** - * Creates a new DataSource and stores it. - * Creates a connection and using it - * creates two tables in database. - * Creates a new query and adds it to DefinitionContainer. - * Opens the QueryComponent.with loadComponentFromURL - * and gets the object with the role PANEL and the implementation - * name that contains TabelViewAccessibility - * @param Param test parameters - * @param log writer to log information while testing + * Creates a new DataSource and stores it. Creates a connection and using it + * creates two tables in database. Creates a new query and adds it to + * DefinitionContainer. Opens the QueryComponent.with loadComponentFromURL + * and gets the object with the role PANEL and the implementation name that + * contains TabelViewAccessibility + * + * @param Param + * test parameters + * @param log + * writer to log information while testing * @return * @throws StatusException * @see TestEnvironment */ @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; Object oDBSource = null; Object newQuery = null; XStorable store = null; - try { - Param.getMSF() - .createInstance("com.sun.star.sdb.DatabaseContext"); - oDBSource = Param.getMSF() - .createInstance("com.sun.star.sdb.DataSource"); - newQuery = Param.getMSF() - .createInstance("com.sun.star.sdb.QueryDefinition"); - Param.getMSF() - .createInstance("com.sun.star.awt.Toolkit"); - } catch (com.sun.star.uno.Exception e) { - throw new StatusException(e, Status.failed("Couldn't create instance")); - } + Param.getMSF().createInstance("com.sun.star.sdb.DatabaseContext"); + oDBSource = Param.getMSF() + .createInstance("com.sun.star.sdb.DataSource"); + newQuery = Param.getMSF().createInstance( + "com.sun.star.sdb.QueryDefinition"); + Param.getMSF().createInstance("com.sun.star.awt.Toolkit"); String mysqlURL = (String) Param.get("mysql.url"); if (mysqlURL == null) { - throw new StatusException(Status.failed( - "Couldn't get 'mysql.url' from ini-file")); + throw new StatusException( + Status.failed("Couldn't get 'mysql.url' from ini-file")); } user = (String) Param.get("jdbc.user"); password = (String) Param.get("jdbc.password"); if ((user == null) || (password == null)) { - throw new StatusException(Status.failed( - "Couldn't get 'jdbc.user' or 'jdbc.password' from ini-file")); + throw new StatusException( + Status.failed("Couldn't get 'jdbc.user' or 'jdbc.password' from ini-file")); } PropertyValue[] info = new PropertyValue[2]; @@ -139,37 +135,23 @@ public class TableWindowAccessibility extends TestCase { info[1].Value = password; XPropertySet propSetDBSource = UnoRuntime.queryInterface( - XPropertySet.class, oDBSource); + XPropertySet.class, oDBSource); - try { - propSetDBSource.setPropertyValue("URL", mysqlURL); - propSetDBSource.setPropertyValue("Info", info); - } catch (com.sun.star.lang.WrappedTargetException e) { - throw new StatusException(e, Status.failed("Couldn't set property value")); - } catch (com.sun.star.lang.IllegalArgumentException e) { - throw new StatusException(e, Status.failed("Couldn't set property value")); - } catch (com.sun.star.beans.PropertyVetoException e) { - throw new StatusException(e, Status.failed("Couldn't set property value")); - } catch (com.sun.star.beans.UnknownPropertyException e) { - throw new StatusException(e, Status.failed("Couldn't set property value")); - } + propSetDBSource.setPropertyValue("URL", mysqlURL); + propSetDBSource.setPropertyValue("Info", info); - try { - log.println ("writing database file ..."); - XDocumentDataSource xDDS = UnoRuntime.queryInterface(XDocumentDataSource.class, oDBSource); - store = UnoRuntime.queryInterface(XStorable.class, - xDDS.getDatabaseDocument()); - aFile = utils.getOfficeTemp (Param.getMSF ())+"TableWindow.odb"; - log.println("... filename will be "+aFile); - store.storeAsURL(aFile,new PropertyValue[]{}); - log.println("... done"); - } catch (com.sun.star.uno.Exception e) { - throw new StatusException(e, Status.failed("Couldn't register object")); - } + log.println("writing database file ..."); + XDocumentDataSource xDDS = UnoRuntime.queryInterface( + XDocumentDataSource.class, oDBSource); + store = UnoRuntime.queryInterface(XStorable.class, + xDDS.getDatabaseDocument()); + aFile = utils.getOfficeTemp(Param.getMSF()) + "TableWindow.odb"; + log.println("... filename will be " + aFile); + store.storeAsURL(aFile, new PropertyValue[] {}); + log.println("... done"); - isolConnection = UnoRuntime.queryInterface( - XIsolatedConnection.class, - oDBSource); + isolConnection = UnoRuntime.queryInterface(XIsolatedConnection.class, + oDBSource); XConnection connection = null; XStatement statement = null; @@ -184,71 +166,41 @@ public class TableWindowAccessibility extends TestCase { statement = connection.createStatement(); statement.executeUpdate("drop table if exists " + tbl_name1); statement.executeUpdate("drop table if exists " + tbl_name2); - statement.executeUpdate("create table " + tbl_name1 + " (" + - col_name1 + " int)"); - statement.executeUpdate("create table " + tbl_name2 + " (" + - col_name2 + " int)"); + statement.executeUpdate("create table " + tbl_name1 + " (" + + col_name1 + " int)"); + statement.executeUpdate("create table " + tbl_name2 + " (" + + col_name2 + " int)"); } catch (com.sun.star.sdbc.SQLException e) { - try { - util.utils.pause(1500); - connection = isolConnection.getIsolatedConnection(user, - password); - statement = connection.createStatement(); - statement.executeUpdate("drop table if exists " + tbl_name1); - statement.executeUpdate("drop table if exists " + tbl_name2); - statement.executeUpdate("create table " + tbl_name1 + " (" + - col_name1 + " int)"); - statement.executeUpdate("create table " + tbl_name2 + " (" + - col_name2 + " int)"); - } catch (com.sun.star.sdbc.SQLException e2) { - throw new StatusException(e2, Status.failed("SQLException")); - } + util.utils.pause(1500); + connection = isolConnection.getIsolatedConnection(user, password); + statement = connection.createStatement(); + statement.executeUpdate("drop table if exists " + tbl_name1); + statement.executeUpdate("drop table if exists " + tbl_name2); + statement.executeUpdate("create table " + tbl_name1 + " (" + + col_name1 + " int)"); + statement.executeUpdate("create table " + tbl_name2 + " (" + + col_name2 + " int)"); } XQueryDefinitionsSupplier querySuppl = UnoRuntime.queryInterface( - XQueryDefinitionsSupplier.class, - oDBSource); + XQueryDefinitionsSupplier.class, oDBSource); XNameAccess defContainer = querySuppl.getQueryDefinitions(); - XPropertySet queryProp = UnoRuntime.queryInterface( - XPropertySet.class, newQuery); + XPropertySet queryProp = UnoRuntime.queryInterface(XPropertySet.class, + newQuery); - try { - final String query = "select * from " + tbl_name1 + ", " + - tbl_name2 + " where " + tbl_name1 + "." + - col_name1 + "=" + tbl_name2 + "." + - col_name2; - queryProp.setPropertyValue("Command", query); - } catch (com.sun.star.lang.WrappedTargetException e) { - throw new StatusException(e, Status.failed("Couldn't set property value")); - } catch (com.sun.star.lang.IllegalArgumentException e) { - throw new StatusException(e, Status.failed("Couldn't set property value")); - } catch (com.sun.star.beans.PropertyVetoException e) { - throw new StatusException(e, Status.failed("Couldn't set property value")); - } catch (com.sun.star.beans.UnknownPropertyException e) { - throw new StatusException(e, Status.failed("Couldn't set property value")); - } + final String query = "select * from " + tbl_name1 + ", " + tbl_name2 + + " where " + tbl_name1 + "." + col_name1 + "=" + tbl_name2 + + "." + col_name2; + queryProp.setPropertyValue("Command", query); XNameContainer queryContainer = UnoRuntime.queryInterface( - XNameContainer.class, - defContainer); + XNameContainer.class, defContainer); - try { - queryContainer.insertByName("Query1", newQuery); - store.store(); - connection.close (); - } catch (com.sun.star.lang.WrappedTargetException e) { - throw new StatusException(e, Status.failed("Couldn't insert query")); - } catch (com.sun.star.container.ElementExistException e) { - throw new StatusException(e, Status.failed("Couldn't insert query")); - } catch (com.sun.star.lang.IllegalArgumentException e) { - throw new StatusException(e, Status.failed("Couldn't insert query")); - } catch (com.sun.star.io.IOException e) { - throw new StatusException(e, Status.failed("Couldn't insert query")); - } catch (com.sun.star.sdbc.SQLException e) { - throw new StatusException(e, Status.failed("Couldn't insert query")); - } + queryContainer.insertByName("Query1", newQuery); + store.store(); + connection.close(); PropertyValue[] loadProps = new PropertyValue[3]; loadProps[0] = new PropertyValue(); @@ -263,17 +215,19 @@ public class TableWindowAccessibility extends TestCase { loadProps[2].Name = "DataSource"; loadProps[2].Value = oDBSource; - QueryComponent = DesktopTools.loadDoc(Param.getMSF (),".component:DB/QueryDesign",loadProps); + QueryComponent = DesktopTools.loadDoc(Param.getMSF(), + ".component:DB/QueryDesign", loadProps); - xWindow = UnoRuntime.queryInterface(XModel.class, QueryComponent). - getCurrentController().getFrame().getContainerWindow(); + xWindow = UnoRuntime.queryInterface(XModel.class, QueryComponent) + .getCurrentController().getFrame().getContainerWindow(); XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); - AccessibilityTools.printAccessibleTree (log,xRoot, Param.getBool(util.PropertyName.DEBUG_IS_ACTIVE)); + AccessibilityTools.printAccessibleTree(log, xRoot, + Param.getBool(util.PropertyName.DEBUG_IS_ACTIVE)); - oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.PANEL, "", - "TableWindowAccessibility"); + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, + AccessibleRole.PANEL, "", "TableWindowAccessibility"); log.println("ImplementationName " + util.utils.getImplName(oObj)); @@ -284,26 +238,25 @@ public class TableWindowAccessibility extends TestCase { util.utils.pause(1500); XAccessibleComponent accComp = UnoRuntime.queryInterface( - XAccessibleComponent.class, - oObj); - - - final Point point = accComp.getLocationOnScreen(); - - tEnv.addObjRelation("EventProducer", - new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { - public void fireEvent() { - try { - Robot rob = new Robot(); - rob.mouseMove(point.X + 2, point.Y + 7); - rob.mousePress(InputEvent.BUTTON1_MASK); - rob.mouseMove(point.X + 400, point.Y); - rob.mouseRelease (InputEvent.BUTTON1_MASK); - } catch (java.awt.AWTException e) { - System.out.println("desired child doesn't exist"); - } - } - }); + XAccessibleComponent.class, oObj); + + final Point point = accComp.getLocationOnScreen(); + + tEnv.addObjRelation( + "EventProducer", + new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { + public void fireEvent() { + try { + Robot rob = new Robot(); + rob.mouseMove(point.X + 2, point.Y + 7); + rob.mousePress(InputEvent.BUTTON1_MASK); + rob.mouseMove(point.X + 400, point.Y); + rob.mouseRelease(InputEvent.BUTTON1_MASK); + } catch (java.awt.AWTException e) { + System.out.println("desired child doesn't exist"); + } + } + }); return tEnv; } // finish method getTestEnvironment @@ -313,21 +266,22 @@ public class TableWindowAccessibility extends TestCase { */ @Override protected void cleanup(TestParameters Param, PrintWriter log) { - try - { - - log.println ("closing QueryComponent ..."); - DesktopTools.closeDoc (QueryComponent); - log.println ("... done"); - XMultiServiceFactory xMSF = Param.getMSF (); - Object sfa = xMSF.createInstance ("com.sun.star.comp.ucb.SimpleFileAccess"); - XSimpleFileAccess xSFA = UnoRuntime.queryInterface (XSimpleFileAccess.class, sfa); - log.println ("deleting database file"); - xSFA.kill (aFile); - log.println ("Could delete file "+aFile+": "+!xSFA.exists (aFile)); - } catch (Exception e) - { - e.printStackTrace (); + try { + + log.println("closing QueryComponent ..."); + DesktopTools.closeDoc(QueryComponent); + log.println("... done"); + XMultiServiceFactory xMSF = Param.getMSF(); + Object sfa = xMSF + .createInstance("com.sun.star.comp.ucb.SimpleFileAccess"); + XSimpleFileAccess xSFA = UnoRuntime.queryInterface( + XSimpleFileAccess.class, sfa); + log.println("deleting database file"); + xSFA.kill(aFile); + log.println("Could delete file " + aFile + ": " + + !xSFA.exists(aFile)); + } catch (Exception e) { + e.printStackTrace(); } } } diff --git a/qadevOOo/tests/java/mod/_dbpool/OConnectionPool.java b/qadevOOo/tests/java/mod/_dbpool/OConnectionPool.java index 468d97966523..5e0d6517d3cc 100644 --- a/qadevOOo/tests/java/mod/_dbpool/OConnectionPool.java +++ b/qadevOOo/tests/java/mod/_dbpool/OConnectionPool.java @@ -43,17 +43,13 @@ import com.sun.star.uno.XInterface; */ public class OConnectionPool extends TestCase { @Override - protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = Param.getMSF(); XInterface oObj = null; - try { - oObj = (XInterface) - xMSF.createInstance("com.sun.star.sdbc.ConnectionPool"); - } catch(com.sun.star.uno.Exception e) { - throw new StatusException(e, Status.failed("Couldn't create instance")); - } + oObj = (XInterface) + xMSF.createInstance("com.sun.star.sdbc.ConnectionPool"); log.println("creating a new environment for object"); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_dtrans/generic.java b/qadevOOo/tests/java/mod/_dtrans/generic.java index 1d5d26bf190c..a14d3a04acc8 100644 --- a/qadevOOo/tests/java/mod/_dtrans/generic.java +++ b/qadevOOo/tests/java/mod/_dtrans/generic.java @@ -20,7 +20,6 @@ package mod._dtrans; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -30,7 +29,8 @@ import com.sun.star.uno.XInterface; /** * Test for object which is represented by service - * <code>com.sun.star.comp.datatransfer.generic</code>. <p> + * <code>com.sun.star.comp.datatransfer.generic</code>. + * <p> */ public class generic extends TestCase { @@ -40,30 +40,21 @@ public class generic extends TestCase { * <code>com.sun.star.comp.datatransfer.generic</code>. */ @Override - protected synchronized TestEnvironment createTestEnvironment - (TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment( + TestParameters Param, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = Param.getMSF(); - XInterface oObj = null; - - try { - oObj = (XInterface) xMSF.createInstance - ("com.sun.star.datatransfer.clipboard.GenericClipboard"); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Unexpected exception", e); - } + XInterface oObj = (XInterface) xMSF + .createInstance("com.sun.star.datatransfer.clipboard.GenericClipboard"); if (oObj == null) { - log.println("[ERROR!] System type is *nix, unable to create object..."); - } + log.println("[ERROR!] System type is *nix, unable to create object..."); + } String Iname = util.utils.getImplName(oObj); - log.println("Implementation Name: "+Iname); + log.println("Implementation Name: " + Iname); TestEnvironment tEnv = new TestEnvironment(oObj); return tEnv; } - } - diff --git a/qadevOOo/tests/java/mod/_dynamicloader/Dynamic.java b/qadevOOo/tests/java/mod/_dynamicloader/Dynamic.java index 942c38ccdad5..f022f0762767 100644 --- a/qadevOOo/tests/java/mod/_dynamicloader/Dynamic.java +++ b/qadevOOo/tests/java/mod/_dynamicloader/Dynamic.java @@ -20,7 +20,6 @@ package mod._dynamicloader; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -54,23 +53,10 @@ public class Dynamic extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { - XInterface oObj = null; - Object oInterface = null; - - try { - XMultiServiceFactory xMSF = Param.getMSF(); - oInterface = xMSF.createInstance( "com.sun.star.loader.Dynamic" ); - } - catch( com.sun.star.uno.Exception e ) { - log.println("Service not available" ); - throw new StatusException("Can't create service", e) ; - } - - if (oInterface == null) - log.println("Service wasn't created") ; - - oObj = (XInterface) oInterface; + throws Exception { + XMultiServiceFactory xMSF = Param.getMSF(); + Object oInterface = xMSF.createInstance( "com.sun.star.loader.Dynamic" ); + XInterface oObj = (XInterface) oInterface; log.println( " creating a new environment for object" ); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_file/calc/ODriver.java b/qadevOOo/tests/java/mod/_file/calc/ODriver.java index 8f595d792bf6..906651c40e90 100644 --- a/qadevOOo/tests/java/mod/_file/calc/ODriver.java +++ b/qadevOOo/tests/java/mod/_file/calc/ODriver.java @@ -62,16 +62,10 @@ public class ODriver extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log ) throws StatusException { + TestParameters Param, PrintWriter log ) throws Exception { - XInterface oObj = null; - - try { - oObj = (XInterface)Param.getMSF().createInstance( - "com.sun.star.comp.sdbc.calc.ODriver"); - } catch (com.sun.star.uno.Exception e) { - throw new StatusException(e, Status.failed("Couldn't create object")); - } + XInterface oObj = (XInterface)Param.getMSF().createInstance( + "com.sun.star.comp.sdbc.calc.ODriver"); log.println("creating a new environment for calc.ODriver object"); TestEnvironment tEnv = new TestEnvironment(oObj); diff --git a/qadevOOo/tests/java/mod/_file/dbase/ODriver.java b/qadevOOo/tests/java/mod/_file/dbase/ODriver.java index d317bcaace75..a954931a3d84 100644 --- a/qadevOOo/tests/java/mod/_file/dbase/ODriver.java +++ b/qadevOOo/tests/java/mod/_file/dbase/ODriver.java @@ -61,16 +61,10 @@ public class ODriver extends TestCase { * </ul> */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { - XInterface oObj = null; - - try { - oObj = (XInterface)Param.getMSF().createInstance( + XInterface oObj = (XInterface)Param.getMSF().createInstance( "com.sun.star.comp.sdbc.dbase.ODriver"); - } catch (com.sun.star.uno.Exception e) { - throw new StatusException(e, Status.failed("Couldn't create object")); - } log.println("creating a new environment for dbase.ODriver object"); TestEnvironment tEnv = new TestEnvironment(oObj); diff --git a/qadevOOo/tests/java/mod/_file/flat/ODriver.java b/qadevOOo/tests/java/mod/_file/flat/ODriver.java index ca8fbb1a8179..c667ef28ff01 100644 --- a/qadevOOo/tests/java/mod/_file/flat/ODriver.java +++ b/qadevOOo/tests/java/mod/_file/flat/ODriver.java @@ -59,16 +59,10 @@ public class ODriver extends TestCase { * </ul> */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { - XInterface oObj = null; - - try { - oObj = (XInterface)Param.getMSF().createInstance( - "com.sun.star.comp.sdbc.flat.ODriver"); - } catch (com.sun.star.uno.Exception e) { - throw new StatusException(e, Status.failed("Couldn't create object")); - } + XInterface oObj = (XInterface)Param.getMSF().createInstance( + "com.sun.star.comp.sdbc.flat.ODriver"); log.println("creating a new environment for flat.ODriver object"); TestEnvironment tEnv = new TestEnvironment(oObj); diff --git a/qadevOOo/tests/java/mod/_fileacc/SimpleFileAccess.java b/qadevOOo/tests/java/mod/_fileacc/SimpleFileAccess.java index 31779f4440a6..2abff7ee6a3c 100644 --- a/qadevOOo/tests/java/mod/_fileacc/SimpleFileAccess.java +++ b/qadevOOo/tests/java/mod/_fileacc/SimpleFileAccess.java @@ -20,7 +20,6 @@ package mod._fileacc; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -50,21 +49,13 @@ public class SimpleFileAccess extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { - XInterface oObj = null; - Object oInterface = null; - Object oIH = null; + throws Exception { - try { - XMultiServiceFactory xMSF = Param.getMSF(); - oInterface = xMSF.createInstance - ("com.sun.star.comp.ucb.SimpleFileAccess"); - oIH = xMSF.createInstance("com.sun.star.sdb.InteractionHandler"); - } catch( com.sun.star.uno.Exception e ) { - log.println("SimpleFileAccess Service not available" ); - } - - oObj = (XInterface) oInterface; + XMultiServiceFactory xMSF = Param.getMSF(); + Object oInterface = xMSF.createInstance + ("com.sun.star.comp.ucb.SimpleFileAccess"); + Object oIH = xMSF.createInstance("com.sun.star.sdb.InteractionHandler"); + XInterface oObj = (XInterface) oInterface; log.println( " creating a new environment for CoreReflection object" ); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_fop/FolderPicker.java b/qadevOOo/tests/java/mod/_fop/FolderPicker.java index 09e6b90cc29c..3405319e2316 100644 --- a/qadevOOo/tests/java/mod/_fop/FolderPicker.java +++ b/qadevOOo/tests/java/mod/_fop/FolderPicker.java @@ -20,7 +20,6 @@ package mod._fop; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -66,24 +65,11 @@ public class FolderPicker extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { - XInterface oObj = null; - Object oInterface = null; + throws Exception { XMultiServiceFactory xMSF = Param.getMSF(); - - - try { - oInterface = xMSF.createInstance + Object oInterface = xMSF.createInstance ( "com.sun.star.ui.dialogs.FolderPicker" ); - - // adding one child container - } - catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } - - oObj = (XInterface) oInterface; + XInterface oObj = (XInterface) oInterface; TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_forms/GenericModelTest.java b/qadevOOo/tests/java/mod/_forms/GenericModelTest.java index 67b4f7eb7c0b..98320140b1f0 100644 --- a/qadevOOo/tests/java/mod/_forms/GenericModelTest.java +++ b/qadevOOo/tests/java/mod/_forms/GenericModelTest.java @@ -369,53 +369,40 @@ public class GenericModelTest extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; XControlShape aShape = null; XMultiServiceFactory xMSF = Param.getMSF(); - try{ - log.println("adding contol shape '" + m_kindOfControl + "'"); - aShape = FormTools.createControlShape(m_xTextDoc, 3000, - 4500, 15000, 10000, - m_kindOfControl); - } catch (Exception e){ - e.printStackTrace(log); - throw new StatusException("Couldn't create following control shape (m_kindOfControl): '" + - m_kindOfControl + "': ", e); - - } + log.println("adding contol shape '" + m_kindOfControl + "'"); + aShape = FormTools.createControlShape(m_xTextDoc, 3000, + 4500, 15000, 10000, + m_kindOfControl); WriterTools.getDrawPage(m_xTextDoc).add(aShape); oObj = aShape.getControl(); log.println("Implementation name: " + util.utils.getImplName(oObj)); - try { - String sourceTestDB = utils.getFullURL(utils.getFullTestDocName("TestDB/testDB.dbf")); - String destTestDB = utils.getOfficeTemp(xMSF); - destTestDB = utils.getFullURL(destTestDB + "testDB.dbf"); + String sourceTestDB = utils.getFullURL(utils.getFullTestDocName("TestDB/testDB.dbf")); + String destTestDB = utils.getOfficeTemp(xMSF); + destTestDB = utils.getFullURL(destTestDB + "testDB.dbf"); - log.println("copy '"+sourceTestDB + "' -> '" + destTestDB + "'"); - utils.copyFile(xMSF, sourceTestDB, destTestDB); + log.println("copy '"+sourceTestDB + "' -> '" + destTestDB + "'"); + utils.copyFile(xMSF, sourceTestDB, destTestDB); - m_dbTools = new DBTools( xMSF ); - String tmpDir = utils.getOfficeTemp((xMSF)); + m_dbTools = new DBTools( xMSF ); + String tmpDir = utils.getOfficeTemp((xMSF)); - DBTools.DataSourceInfo srcInf = m_dbTools.newDataSourceInfo(); - srcInf.URL = "sdbc:dbase:" + DBTools.dirToUrl(tmpDir); - log.println("data source: " + srcInf.URL); + DBTools.DataSourceInfo srcInf = m_dbTools.newDataSourceInfo(); + srcInf.URL = "sdbc:dbase:" + DBTools.dirToUrl(tmpDir); + log.println("data source: " + srcInf.URL); - m_dbSrc = srcInf.getDataSourceService(); - m_dbTools.reRegisterDB(m_dbSourceName, m_dbSrc); + m_dbSrc = srcInf.getDataSourceService(); + m_dbTools.reRegisterDB(m_dbSourceName, m_dbSrc); - m_XFormLoader = FormTools.bindForm(m_xTextDoc, m_dbSourceName, - m_TestDB); - } catch (com.sun.star.uno.Exception e) { - log.println("!!! Can't access TestDB !!!"); - e.printStackTrace(log); - throw new StatusException("Can't access TestDB", e); - } + m_XFormLoader = FormTools.bindForm(m_xTextDoc, m_dbSourceName, + m_TestDB); log.println("creating a new environment for object"); @@ -433,29 +420,12 @@ public class GenericModelTest extends TestCase { int i = 0; NamedValue prop = null; - try { - for (i = 0; i < m_propertiesToSet.size(); i++){ - prop = m_propertiesToSet.get(i); + for (i = 0; i < m_propertiesToSet.size(); i++){ + prop = m_propertiesToSet.get(i); - log.println("setting property: '"+prop.Name+"' to value '"+prop.Value.toString()+"'"); + log.println("setting property: '"+prop.Name+"' to value '"+prop.Value.toString()+"'"); - m_XPS.setPropertyValue(prop.Name, prop.Value); - } - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't set property '" + prop.Name + "': ", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't set property '" + prop.Name + "': ", e); - } catch (com.sun.star.beans.PropertyVetoException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't set property '" + prop.Name + "': ", e); - } catch (com.sun.star.beans.UnknownPropertyException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't set property '" + prop.Name + "': ", e); - } catch (java.lang.ClassCastException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get property on index '" + i + "': ", e); + m_XPS.setPropertyValue(prop.Name, prop.Value); } // added LabelControl for 'DataAwareControlModel' @@ -467,7 +437,7 @@ public class GenericModelTest extends TestCase { // adding relation for XUpdateBroadcaster m_XCtrl = oObj; - tEnv.addObjRelation("XUpdateBroadcaster.Checker", + tEnv.addObjRelation("XUpdateBroadcaster.Checker", new Checker(m_XFormLoader, m_XPS, m_XCtrl, m_ChangePropertyName, m_ChangePropertyValue)); // adding relation for DataAwareControlModel service diff --git a/qadevOOo/tests/java/mod/_forms/OButtonControl.java b/qadevOOo/tests/java/mod/_forms/OButtonControl.java index ea9fe395a550..9d604830bf4a 100644 --- a/qadevOOo/tests/java/mod/_forms/OButtonControl.java +++ b/qadevOOo/tests/java/mod/_forms/OButtonControl.java @@ -145,7 +145,7 @@ public class OButtonControl extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; XWindowPeer the_win = null; XToolkit the_kit = null; @@ -176,18 +176,12 @@ public class OButtonControl extends TestCase { xTextDoc.getCurrentController()); //now get the OButtonControl - try { - oObj = the_access.getControl(the_Model); - aControl = the_access.getControl(the_Model2); - the_win = the_access.getControl(the_Model).getPeer(); - the_kit = the_win.getToolkit(); - aDevice = the_kit.createScreenCompatibleDevice(200, 200); - aGraphic = aDevice.createGraphics(); - } catch (com.sun.star.container.NoSuchElementException e) { - log.println("Couldn't get OButtonControl"); - e.printStackTrace(log); - throw new StatusException("Couldn't get OButtonControl", e); - } + oObj = the_access.getControl(the_Model); + aControl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); log.println("creating a new environment for OButtonControl object"); diff --git a/qadevOOo/tests/java/mod/_forms/OButtonModel.java b/qadevOOo/tests/java/mod/_forms/OButtonModel.java index 2365ac47bb4d..791378206e73 100644 --- a/qadevOOo/tests/java/mod/_forms/OButtonModel.java +++ b/qadevOOo/tests/java/mod/_forms/OButtonModel.java @@ -19,7 +19,6 @@ package mod._forms; import java.io.PrintWriter; -import lib.TestEnvironment; import lib.TestParameters; /** @@ -104,16 +103,4 @@ public class OButtonModel extends GenericModelTest { } - /** - * calls <CODE>createTestEnvironment()</CODE> from it's super class - * @param Param the test parameter - * @param log the log writer - * @return lib.TestEnvironment - */ - @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { - return super.createTestEnvironment(Param, log); - } - } // finish class OButtonModelold diff --git a/qadevOOo/tests/java/mod/_forms/OCheckBoxControl.java b/qadevOOo/tests/java/mod/_forms/OCheckBoxControl.java index 64be708cf28c..1b477d4059be 100644 --- a/qadevOOo/tests/java/mod/_forms/OCheckBoxControl.java +++ b/qadevOOo/tests/java/mod/_forms/OCheckBoxControl.java @@ -155,7 +155,7 @@ public class OCheckBoxControl extends TestCase { * </ul> */ @Override - protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; XWindowPeer the_win = null; XToolkit the_kit = null; @@ -182,18 +182,12 @@ public class OCheckBoxControl extends TestCase { XControlAccess.class,xTextDoc.getCurrentController()); //now get the OButtonControl - try { - oObj = the_access.getControl(the_Model); - aControl = the_access.getControl(the_Model2); - the_win = the_access.getControl(the_Model).getPeer(); - the_kit = the_win.getToolkit(); - aDevice = the_kit.createScreenCompatibleDevice(200,200); - aGraphic = aDevice.createGraphics(); - } catch (com.sun.star.container.NoSuchElementException e) { - log.println("Couldn't get OCheckBoxControl"); - e.printStackTrace(log); - throw new StatusException("Couldn't get OCheckBoxControl", e ); - } + oObj = the_access.getControl(the_Model); + aControl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200,200); + aGraphic = aDevice.createGraphics(); log.println( "creating a new environment for OCheckBoxControl object" ); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_forms/OCheckBoxModel.java b/qadevOOo/tests/java/mod/_forms/OCheckBoxModel.java index aaf241180351..da579f86343f 100644 --- a/qadevOOo/tests/java/mod/_forms/OCheckBoxModel.java +++ b/qadevOOo/tests/java/mod/_forms/OCheckBoxModel.java @@ -19,7 +19,6 @@ package mod._forms; import java.io.PrintWriter; -import lib.TestEnvironment; import lib.TestParameters; @@ -118,16 +117,5 @@ public class OCheckBoxModel extends GenericModelTest { } - /** - * calls <CODE>createTestEnvironment()</CODE> from it's super class - * @param Param the test parameter - * @param log the log writer - * @return lib.TestEnvironment - */ - @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { - return super.createTestEnvironment(Param, log); - } } // finish class OCheckBoxModel diff --git a/qadevOOo/tests/java/mod/_forms/OComboBoxControl.java b/qadevOOo/tests/java/mod/_forms/OComboBoxControl.java index 43b755ed87dc..a740b136df7b 100644 --- a/qadevOOo/tests/java/mod/_forms/OComboBoxControl.java +++ b/qadevOOo/tests/java/mod/_forms/OComboBoxControl.java @@ -157,7 +157,7 @@ public class OComboBoxControl extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; XWindowPeer the_win = null; XToolkit the_kit = null; @@ -188,18 +188,12 @@ public class OComboBoxControl extends TestCase { xTextDoc.getCurrentController()); //now get the OButtonControl - try { - oObj = the_access.getControl(the_Model); - aControl = the_access.getControl(the_Model2); - the_win = the_access.getControl(the_Model).getPeer(); - the_kit = the_win.getToolkit(); - aDevice = the_kit.createScreenCompatibleDevice(200, 200); - aGraphic = aDevice.createGraphics(); - } catch (com.sun.star.container.NoSuchElementException e) { - log.println("Couldn't get OCheckBoxControl"); - e.printStackTrace(log); - throw new StatusException("Couldn't get OComboBoxControl", e); - } + oObj = the_access.getControl(the_Model); + aControl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); log.println("creating a new environment for OComboBoxControl object"); diff --git a/qadevOOo/tests/java/mod/_forms/OComboBoxModel.java b/qadevOOo/tests/java/mod/_forms/OComboBoxModel.java index 524a95e0d245..571ba1baeaaf 100644 --- a/qadevOOo/tests/java/mod/_forms/OComboBoxModel.java +++ b/qadevOOo/tests/java/mod/_forms/OComboBoxModel.java @@ -19,7 +19,6 @@ package mod._forms; import com.sun.star.beans.NamedValue; import java.io.PrintWriter; -import lib.TestEnvironment; import lib.TestParameters; import util.DBTools; @@ -133,16 +132,4 @@ public class OComboBoxModel extends GenericModelTest { } - /** - * calls <CODE>createTestEnvironment()</CODE> from it's super class - * @param Param the test parameter - * @param log the log writer - * @return lib.TestEnvironment - */ - @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { - return super.createTestEnvironment(Param, log); - } - } // finish class OComboBoxModel diff --git a/qadevOOo/tests/java/mod/_forms/OCurrencyControl.java b/qadevOOo/tests/java/mod/_forms/OCurrencyControl.java index d0d5dc1e4328..9f3d82843f23 100644 --- a/qadevOOo/tests/java/mod/_forms/OCurrencyControl.java +++ b/qadevOOo/tests/java/mod/_forms/OCurrencyControl.java @@ -160,7 +160,7 @@ public class OCurrencyControl extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; XWindowPeer the_win = null; XToolkit the_kit = null; @@ -191,18 +191,12 @@ public class OCurrencyControl extends TestCase { xTextDoc.getCurrentController()); //now get the OCurrencyControl - try { - oObj = the_access.getControl(the_Model); - aControl = the_access.getControl(the_Model2); - the_win = the_access.getControl(the_Model).getPeer(); - the_kit = the_win.getToolkit(); - aDevice = the_kit.createScreenCompatibleDevice(200, 200); - aGraphic = aDevice.createGraphics(); - } catch (com.sun.star.container.NoSuchElementException e) { - log.println("Couldn't get OCurrencyControl"); - e.printStackTrace(log); - throw new StatusException("Couldn't get OCurrencyControl", e); - } + oObj = the_access.getControl(the_Model); + aControl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); log.println("creating a new environment for OCurrencyControl object"); diff --git a/qadevOOo/tests/java/mod/_forms/OCurrencyModel.java b/qadevOOo/tests/java/mod/_forms/OCurrencyModel.java index baa141119876..9e54e481aa77 100644 --- a/qadevOOo/tests/java/mod/_forms/OCurrencyModel.java +++ b/qadevOOo/tests/java/mod/_forms/OCurrencyModel.java @@ -19,7 +19,6 @@ package mod._forms; import com.sun.star.beans.NamedValue; import java.io.PrintWriter; -import lib.TestEnvironment; import lib.TestParameters; @@ -129,15 +128,4 @@ public class OCurrencyModel extends GenericModelTest { } - /** - * calls <CODE>createTestEnvironment()</CODE> from it's super class - * @param Param the test parameter - * @param log the log writer - * @return lib.TestEnvironment - */ - @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { - return super.createTestEnvironment(Param, log); - } } // finish class OCurrencyModel diff --git a/qadevOOo/tests/java/mod/_forms/ODatabaseForm.java b/qadevOOo/tests/java/mod/_forms/ODatabaseForm.java index fcaf12b492c6..7a7e6b3af2d1 100644 --- a/qadevOOo/tests/java/mod/_forms/ODatabaseForm.java +++ b/qadevOOo/tests/java/mod/_forms/ODatabaseForm.java @@ -22,7 +22,6 @@ import ifc.sdb._XCompletedExecution; import java.io.PrintWriter; import java.util.ArrayList; -import lib.Status; import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; @@ -307,7 +306,7 @@ public class ODatabaseForm extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { if (xTextDoc != null) { try { XCloseable closer = UnoRuntime.queryInterface( @@ -327,13 +326,7 @@ public class ODatabaseForm extends TestCase { //initialize test table if (isMySQLDB) { - try { - dbTools.initTestTableUsingJDBC(tableName, srcInf); - } catch (java.sql.SQLException e) { - throw new StatusException(e, Status.failed("Couldn't " + " init test table. SQLException...")); - } catch (java.lang.ClassNotFoundException e) { - throw new StatusException(e, Status.failed("Couldn't " + "register mysql driver")); - } + dbTools.initTestTableUsingJDBC(tableName, srcInf); } XInterface oObj = null; @@ -368,15 +361,8 @@ public class ODatabaseForm extends TestCase { XLoadable formLoader = null; - try { - formLoader = FormTools.bindForm(xTextDoc, "MyForm", dbSourceName, - tableName); - } catch (com.sun.star.uno.Exception e) { - log.println("Cann't bind the form to source '" + dbSourceName + - "', table '" + tableName + "' :"); - e.printStackTrace(log); - throw new StatusException("Cann't bind a form", e); - } + formLoader = FormTools.bindForm(xTextDoc, "MyForm", dbSourceName, + tableName); // DEBUG @@ -489,14 +475,8 @@ public class ODatabaseForm extends TestCase { XControl cntrl = null; //now get the OEditControl - try { - cntrl = the_access.getControl(the_Model); - log.println(cntrl.getClass().getName()); - } catch (com.sun.star.container.NoSuchElementException e) { - log.println("Couldn't get OEditControl"); - e.printStackTrace(log); - throw new StatusException("Couldn't get OEditControl", e); - } + cntrl = the_access.getControl(the_Model); + log.println(cntrl.getClass().getName()); XResultSet the_set = UnoRuntime.queryInterface( XResultSet.class, oObj); diff --git a/qadevOOo/tests/java/mod/_forms/ODateControl.java b/qadevOOo/tests/java/mod/_forms/ODateControl.java index af54d68f7af1..c8a233391919 100644 --- a/qadevOOo/tests/java/mod/_forms/ODateControl.java +++ b/qadevOOo/tests/java/mod/_forms/ODateControl.java @@ -156,7 +156,7 @@ public class ODateControl extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; Object anotherCtrl = null; XWindowPeer the_win = null; @@ -187,18 +187,12 @@ public class ODateControl extends TestCase { xTextDoc.getCurrentController()); //now get the ODateControl - try { - oObj = the_access.getControl(the_Model); - anotherCtrl = the_access.getControl(the_Model2); - the_win = the_access.getControl(the_Model).getPeer(); - the_kit = the_win.getToolkit(); - aDevice = the_kit.createScreenCompatibleDevice(200, 200); - aGraphic = aDevice.createGraphics(); - } catch (com.sun.star.container.NoSuchElementException e) { - log.println("Couldn't get ODateControl"); - e.printStackTrace(log); - throw new StatusException("Couldn't get ODateControl", e); - } + oObj = the_access.getControl(the_Model); + anotherCtrl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); log.println("creating a new environment for ODateControl object"); diff --git a/qadevOOo/tests/java/mod/_forms/ODateModel.java b/qadevOOo/tests/java/mod/_forms/ODateModel.java index 15a17095c931..aad8154c5343 100644 --- a/qadevOOo/tests/java/mod/_forms/ODateModel.java +++ b/qadevOOo/tests/java/mod/_forms/ODateModel.java @@ -20,7 +20,6 @@ package mod._forms; import com.sun.star.beans.NamedValue; import java.io.PrintWriter; -import lib.TestEnvironment; import lib.TestParameters; import util.DBTools; @@ -148,16 +147,4 @@ public class ODateModel extends GenericModelTest { } - - /** - * calls <CODE>createTestEnvironment()</CODE> from it's super class - * @param Param the test parameter - * @param log the log writer - * @return lib.TestEnvironment - */ - @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { - return super.createTestEnvironment(Param, log); - } } // finish class ODateModel diff --git a/qadevOOo/tests/java/mod/_forms/OEditControl.java b/qadevOOo/tests/java/mod/_forms/OEditControl.java index 8e032e39e472..f3f06ce276e9 100644 --- a/qadevOOo/tests/java/mod/_forms/OEditControl.java +++ b/qadevOOo/tests/java/mod/_forms/OEditControl.java @@ -166,7 +166,7 @@ public class OEditControl extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; XControl aControl = null; XWindowPeer the_win = null; @@ -197,18 +197,12 @@ public class OEditControl extends TestCase { xTextDoc.getCurrentController()); //now get the OEditControl - try { - oObj = the_access.getControl(the_Model); - aControl = the_access.getControl(the_Model2); - the_win = the_access.getControl(the_Model).getPeer(); - the_kit = the_win.getToolkit(); - aDevice = the_kit.createScreenCompatibleDevice(200, 200); - aGraphic = aDevice.createGraphics(); - } catch (com.sun.star.container.NoSuchElementException e) { - log.println("Couldn't get OEditControl"); - e.printStackTrace(log); - throw new StatusException("Couldn't get OEditControl", e); - } + oObj = the_access.getControl(the_Model); + aControl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); log.println("creating a new environment for OEditControl object"); diff --git a/qadevOOo/tests/java/mod/_forms/OEditModel.java b/qadevOOo/tests/java/mod/_forms/OEditModel.java index d020d3acc75b..3a9bec8f93c1 100644 --- a/qadevOOo/tests/java/mod/_forms/OEditModel.java +++ b/qadevOOo/tests/java/mod/_forms/OEditModel.java @@ -20,7 +20,6 @@ package mod._forms; import com.sun.star.beans.NamedValue; import java.io.PrintWriter; -import lib.TestEnvironment; import lib.TestParameters; import util.DBTools; @@ -140,15 +139,4 @@ public class OEditModel extends GenericModelTest { super.m_ChangePropertyName = "Text"; } - /** - * calls <CODE>createTestEnvironment()</CODE> from it's super class - * @param Param the test parameter - * @param log the log writer - * @return lib.TestEnvironment - */ - @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { - return super.createTestEnvironment(Param, log); - } } // finish class OEditModel diff --git a/qadevOOo/tests/java/mod/_forms/OFileControlModel.java b/qadevOOo/tests/java/mod/_forms/OFileControlModel.java index c7064d3dfbaf..05e54558b1b9 100644 --- a/qadevOOo/tests/java/mod/_forms/OFileControlModel.java +++ b/qadevOOo/tests/java/mod/_forms/OFileControlModel.java @@ -136,7 +136,7 @@ public class OFileControlModel extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; @@ -158,24 +158,20 @@ public class OFileControlModel extends TestCase { XMultiServiceFactory.class, xDrawDoc); - try { - Object oInt = oDocMSF.createInstance( - "com.sun.star.drawing.ControlShape"); - Object aCon = oDocMSF.createInstance( - "com.sun.star.form.component." + objName); - aControl = UnoRuntime.queryInterface( - XControlModel.class, aCon); - aShape = UnoRuntime.queryInterface( - XControlShape.class, oInt); - size.Height = 1500; - size.Width = 3000; - position.X = 1000; - position.Y = 1000; - aShape.setSize(size); - aShape.setPosition(position); - } catch (com.sun.star.uno.Exception e) { - throw new StatusException(e, Status.failed("Can't create component")); - } + Object oInt = oDocMSF.createInstance( + "com.sun.star.drawing.ControlShape"); + Object aCon = oDocMSF.createInstance( + "com.sun.star.form.component." + objName); + aControl = UnoRuntime.queryInterface( + XControlModel.class, aCon); + aShape = UnoRuntime.queryInterface( + XControlShape.class, oInt); + size.Height = 1500; + size.Width = 3000; + position.X = 1000; + position.Y = 1000; + aShape.setSize(size); + aShape.setPosition(position); aShape.setControl(aControl); diff --git a/qadevOOo/tests/java/mod/_forms/OFixedTextModel.java b/qadevOOo/tests/java/mod/_forms/OFixedTextModel.java index 95ef1bba203c..754df511b4c7 100644 --- a/qadevOOo/tests/java/mod/_forms/OFixedTextModel.java +++ b/qadevOOo/tests/java/mod/_forms/OFixedTextModel.java @@ -19,7 +19,6 @@ package mod._forms; import java.io.PrintWriter; -import lib.TestEnvironment; import lib.TestParameters; @@ -97,16 +96,4 @@ public class OFixedTextModel extends GenericModelTest { } - /** - * calls <CODE>createTestEnvironment()</CODE> from it's super class - * @param Param the test parameter - * @param log the log writer - * @return lib.TestEnvironment - */ - @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { - return super.createTestEnvironment(Param, log); - } - } // finish class OFixedTextModel diff --git a/qadevOOo/tests/java/mod/_forms/OFormattedControl.java b/qadevOOo/tests/java/mod/_forms/OFormattedControl.java index 9400c2283e71..cb812c5a73d7 100644 --- a/qadevOOo/tests/java/mod/_forms/OFormattedControl.java +++ b/qadevOOo/tests/java/mod/_forms/OFormattedControl.java @@ -153,7 +153,7 @@ public class OFormattedControl extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; Object anotherCtrl = null; XWindowPeer the_win = null; @@ -184,18 +184,12 @@ public class OFormattedControl extends TestCase { xTextDoc.getCurrentController()); //now get the OFormattedControl - try { - oObj = the_access.getControl(the_Model); - anotherCtrl = the_access.getControl(the_Model2); - the_win = the_access.getControl(the_Model).getPeer(); - the_kit = the_win.getToolkit(); - aDevice = the_kit.createScreenCompatibleDevice(200, 200); - aGraphic = aDevice.createGraphics(); - } catch (com.sun.star.container.NoSuchElementException e) { - log.println("Couldn't get OFormattedControl"); - e.printStackTrace(log); - throw new StatusException("Couldn't get OFormattedControl", e); - } + oObj = the_access.getControl(the_Model); + anotherCtrl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); log.println("creating a new environment for OFormattedControl object"); diff --git a/qadevOOo/tests/java/mod/_forms/OFormattedFieldWrapper.java b/qadevOOo/tests/java/mod/_forms/OFormattedFieldWrapper.java index e55f6d282b31..2223ebcf881a 100644 --- a/qadevOOo/tests/java/mod/_forms/OFormattedFieldWrapper.java +++ b/qadevOOo/tests/java/mod/_forms/OFormattedFieldWrapper.java @@ -20,7 +20,6 @@ package mod._forms; import com.sun.star.beans.NamedValue; import java.io.PrintWriter; -import lib.TestEnvironment; import lib.TestParameters; import util.DBTools; @@ -133,15 +132,4 @@ public class OFormattedFieldWrapper extends GenericModelTest { } - /** - * calls <CODE>createTestEnvironment()</CODE> from it's super class - * @param Param the test parameter - * @param log the log writer - * @return lib.TestEnvironment - */ - @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { - return super.createTestEnvironment(Param, log); - } } // finish class OFormattedFieldWrapper diff --git a/qadevOOo/tests/java/mod/_forms/OGridControlModel.java b/qadevOOo/tests/java/mod/_forms/OGridControlModel.java index 3804bbe20fa0..4b27c4844326 100644 --- a/qadevOOo/tests/java/mod/_forms/OGridControlModel.java +++ b/qadevOOo/tests/java/mod/_forms/OGridControlModel.java @@ -161,7 +161,7 @@ public class OGridControlModel extends GenericModelTest { */ @Override protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { TestEnvironment tEnv = super.createTestEnvironment(Param, log); XInterface oObj = tEnv.getTestObject(); @@ -172,39 +172,19 @@ public class OGridControlModel extends GenericModelTest { XPropertySet aControl4 = null; XPropertySet aControl5 = null; - try { - XGridColumnFactory columns = UnoRuntime.queryInterface( - XGridColumnFactory.class, oObj); - aControl = columns.createColumn("TextField"); - aControl2 = columns.createColumn("DateField"); - aControl3 = columns.createColumn("TextField"); - aControl4 = columns.createColumn("TextField"); - aControl5 = columns.createColumn("TextField"); - } catch (com.sun.star.lang.IllegalArgumentException e) { - // Some exception occurs.FAILED - log.println("!!! Couldn't create instance : " + e); - throw new StatusException("Can't create column instances.", e); - } + XGridColumnFactory columns = UnoRuntime.queryInterface( + XGridColumnFactory.class, oObj); + aControl = columns.createColumn("TextField"); + aControl2 = columns.createColumn("DateField"); + aControl3 = columns.createColumn("TextField"); + aControl4 = columns.createColumn("TextField"); + aControl5 = columns.createColumn("TextField"); XNameContainer aContainer = UnoRuntime.queryInterface( XNameContainer.class, oObj); - try { - aContainer.insertByName("First", aControl); - aContainer.insertByName("Second", aControl2); - } catch (com.sun.star.lang.WrappedTargetException e) { - log.println("!!! Could't insert column Instance"); - e.printStackTrace(log); - throw new StatusException("Can't insert columns", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - log.println("!!! Could't insert column Instance"); - e.printStackTrace(log); - throw new StatusException("Can't insert columns", e); - } catch (com.sun.star.container.ElementExistException e) { - log.println("!!! Could't insert column Instance"); - e.printStackTrace(log); - throw new StatusException("Can't insert columns", e); - } + aContainer.insertByName("First", aControl); + aContainer.insertByName("Second", aControl2); //Relations for XSelectionSupplier tEnv.addObjRelation("Selections", new Object[] { aControl, aControl2 }); @@ -302,7 +282,7 @@ class OGridControlModelold extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; XInterface oInstance = null; XPropertySet aControl = null; @@ -325,39 +305,19 @@ class OGridControlModelold extends TestCase { TestEnvironment tEnv = new TestEnvironment(oObj); - try { - columns = UnoRuntime.queryInterface( - XGridColumnFactory.class, oObj); - aControl = columns.createColumn("TextField"); - aControl2 = columns.createColumn("DateField"); - aControl3 = columns.createColumn("TextField"); - aControl4 = columns.createColumn("TextField"); - columns.createColumn("TextField"); - } catch (com.sun.star.lang.IllegalArgumentException e) { - // Some exception occurs.FAILED - log.println("!!! Couldn't create instance : " + e); - throw new StatusException("Can't create column instances.", e); - } + columns = UnoRuntime.queryInterface( + XGridColumnFactory.class, oObj); + aControl = columns.createColumn("TextField"); + aControl2 = columns.createColumn("DateField"); + aControl3 = columns.createColumn("TextField"); + aControl4 = columns.createColumn("TextField"); + columns.createColumn("TextField"); XNameContainer aContainer = UnoRuntime.queryInterface( XNameContainer.class, oObj); - try { - aContainer.insertByName("First", aControl); - aContainer.insertByName("Second", aControl2); - } catch (com.sun.star.lang.WrappedTargetException e) { - log.println("!!! Could't insert column Instance"); - e.printStackTrace(log); - throw new StatusException("Can't insert columns", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - log.println("!!! Could't insert column Instance"); - e.printStackTrace(log); - throw new StatusException("Can't insert columns", e); - } catch (com.sun.star.container.ElementExistException e) { - log.println("!!! Could't insert column Instance"); - e.printStackTrace(log); - throw new StatusException("Can't insert columns", e); - } + aContainer.insertByName("First", aControl); + aContainer.insertByName("Second", aControl2); //Relations for XSelectionSupplier tEnv.addObjRelation("Selections", new Object[] { aControl, aControl2 }); @@ -373,16 +333,11 @@ class OGridControlModelold extends TestCase { // INSTANCEn : _XNameContainer; _XNameReplace log.println("adding INSTANCEn as obj relation to environment"); - try { - for (int n = 1; n < (3 * THRCNT + 1); n++) { - log.println("adding INSTANCE" + n + - " as obj relation to environment"); - oInstance = columns.createColumn("TextField"); - tEnv.addObjRelation("INSTANCE" + n, oInstance); - } - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Can't create 'INSTANCEn' relations", e); + for (int n = 1; n < (3 * THRCNT + 1); n++) { + log.println("adding INSTANCE" + n + + " as obj relation to environment"); + oInstance = columns.createColumn("TextField"); + tEnv.addObjRelation("INSTANCE" + n, oInstance); } diff --git a/qadevOOo/tests/java/mod/_forms/OGroupBoxControl.java b/qadevOOo/tests/java/mod/_forms/OGroupBoxControl.java index 06688dcc5e6b..0423dddb32d1 100644 --- a/qadevOOo/tests/java/mod/_forms/OGroupBoxControl.java +++ b/qadevOOo/tests/java/mod/_forms/OGroupBoxControl.java @@ -135,7 +135,7 @@ public class OGroupBoxControl extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; Object anotherCtrl = null; XWindowPeer the_win = null; @@ -166,18 +166,12 @@ public class OGroupBoxControl extends TestCase { xTextDoc.getCurrentController()); //now get the OGroupBoxControl - try { - oObj = the_access.getControl(the_Model); - anotherCtrl = the_access.getControl(the_Model2); - the_win = the_access.getControl(the_Model).getPeer(); - the_kit = the_win.getToolkit(); - aDevice = the_kit.createScreenCompatibleDevice(200, 200); - aGraphic = aDevice.createGraphics(); - } catch (com.sun.star.container.NoSuchElementException e) { - log.println("Couldn't get OGroupBoxControl"); - e.printStackTrace(log); - throw new StatusException("Couldn't get OGroupBoxControl", e); - } + oObj = the_access.getControl(the_Model); + anotherCtrl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); log.println("creating a new environment for OGroupBoxControl object"); diff --git a/qadevOOo/tests/java/mod/_forms/OGroupBoxModel.java b/qadevOOo/tests/java/mod/_forms/OGroupBoxModel.java index d175977d3f04..75de4dc0cb4e 100644 --- a/qadevOOo/tests/java/mod/_forms/OGroupBoxModel.java +++ b/qadevOOo/tests/java/mod/_forms/OGroupBoxModel.java @@ -19,7 +19,6 @@ package mod._forms; import java.io.PrintWriter; -import lib.TestEnvironment; import lib.TestParameters; @@ -97,16 +96,4 @@ public class OGroupBoxModel extends GenericModelTest { super.m_ChangePropertyName = "Text"; } - /** - * calls <CODE>createTestEnvironment()</CODE> from it's super class - * @param Param the test parameter - * @param log the log writer - * @return lib.TestEnvironment - */ - @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { - return super.createTestEnvironment(Param, log); - } - } // finish class OGroupBoxModel diff --git a/qadevOOo/tests/java/mod/_forms/OHiddenModel.java b/qadevOOo/tests/java/mod/_forms/OHiddenModel.java index 81b194e2f41d..aa6bf87cf001 100644 --- a/qadevOOo/tests/java/mod/_forms/OHiddenModel.java +++ b/qadevOOo/tests/java/mod/_forms/OHiddenModel.java @@ -134,7 +134,7 @@ public class OHiddenModel extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; @@ -147,34 +147,20 @@ public class OHiddenModel extends TestCase { String objName = "HiddenControl"; XInterface ctrl = SOF.createControl(xDrawDoc, objName); - try { - XDrawPage oDP = DrawTools.getDrawPage(xDrawDoc, 0); + XDrawPage oDP = DrawTools.getDrawPage(xDrawDoc, 0); - XNameContainer nc = FormTools.getForms(oDP); - FormTools.insertForm(xDrawDoc, nc, "OHiddenModelForm"); + XNameContainer nc = FormTools.getForms(oDP); + FormTools.insertForm(xDrawDoc, nc, "OHiddenModelForm"); - Object frm = nc.getByName("OHiddenModelForm"); + Object frm = nc.getByName("OHiddenModelForm"); - XNameContainer frmNC = UnoRuntime.queryInterface( - XNameContainer.class, frm); + XNameContainer frmNC = UnoRuntime.queryInterface( + XNameContainer.class, frm); - frmNC.insertByName("OHiddenModel", ctrl); - oObj = (XInterface) AnyConverter.toObject( - new Type(XInterface.class), - frmNC.getByName("OHiddenModel")); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Can't create and add control", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Can't create and add control", e); - } catch (com.sun.star.container.NoSuchElementException e) { - e.printStackTrace(log); - throw new StatusException("Can't create and add control", e); - } catch (com.sun.star.container.ElementExistException e) { - e.printStackTrace(log); - throw new StatusException("Can't create and add control", e); - } + frmNC.insertByName("OHiddenModel", ctrl); + oObj = (XInterface) AnyConverter.toObject( + new Type(XInterface.class), + frmNC.getByName("OHiddenModel")); log.println("creating a new environment for drawpage object"); diff --git a/qadevOOo/tests/java/mod/_forms/OImageButtonControl.java b/qadevOOo/tests/java/mod/_forms/OImageButtonControl.java index ec143bdafb1a..bb7ce361b836 100644 --- a/qadevOOo/tests/java/mod/_forms/OImageButtonControl.java +++ b/qadevOOo/tests/java/mod/_forms/OImageButtonControl.java @@ -140,7 +140,7 @@ public class OImageButtonControl extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; Object anotherCtrl = null; XWindowPeer the_win = null; @@ -171,18 +171,12 @@ public class OImageButtonControl extends TestCase { xTextDoc.getCurrentController()); //now get the OImageButtonControl - try { - oObj = the_access.getControl(the_Model); - anotherCtrl = the_access.getControl(the_Model2); - the_win = the_access.getControl(the_Model).getPeer(); - the_kit = the_win.getToolkit(); - aDevice = the_kit.createScreenCompatibleDevice(200, 200); - aGraphic = aDevice.createGraphics(); - } catch (com.sun.star.container.NoSuchElementException e) { - log.println("Couldn't get OImageButtonControl"); - e.printStackTrace(log); - throw new StatusException("Couldn't get OImageButtonControl", e); - } + oObj = the_access.getControl(the_Model); + anotherCtrl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); log.println( "creating a new environment for OImageButtonControl object"); diff --git a/qadevOOo/tests/java/mod/_forms/OImageButtonModel.java b/qadevOOo/tests/java/mod/_forms/OImageButtonModel.java index 21d5f7a7a3b3..15294202e11e 100644 --- a/qadevOOo/tests/java/mod/_forms/OImageButtonModel.java +++ b/qadevOOo/tests/java/mod/_forms/OImageButtonModel.java @@ -18,7 +18,6 @@ package mod._forms; import java.io.PrintWriter; -import lib.TestEnvironment; import lib.TestParameters; /** @@ -101,16 +100,4 @@ public class OImageButtonModel extends GenericModelTest { } - /** - * calls <CODE>createTestEnvironment()</CODE> from it's super class - * @param Param the test parameter - * @param log the log writer - * @return lib.TestEnvironment - */ - @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { - return super.createTestEnvironment(Param, log); - } - } // finish class OImageButtonModel diff --git a/qadevOOo/tests/java/mod/_forms/OImageControlControl.java b/qadevOOo/tests/java/mod/_forms/OImageControlControl.java index aa700ce29c2f..e76af7e202de 100644 --- a/qadevOOo/tests/java/mod/_forms/OImageControlControl.java +++ b/qadevOOo/tests/java/mod/_forms/OImageControlControl.java @@ -141,7 +141,7 @@ public class OImageControlControl extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; XWindowPeer the_win = null; XToolkit the_kit = null; @@ -172,18 +172,12 @@ public class OImageControlControl extends TestCase { xTextDoc.getCurrentController()); //now get the OImageControlControl - try { - oObj = the_access.getControl(the_Model); - the_win = the_access.getControl(the_Model).getPeer(); - aControl = the_access.getControl(the_Model2); - the_kit = the_win.getToolkit(); - aDevice = the_kit.createScreenCompatibleDevice(200, 200); - aGraphic = aDevice.createGraphics(); - } catch (com.sun.star.container.NoSuchElementException e) { - log.println("Couldn't get OImageControlControl"); - e.printStackTrace(log); - throw new StatusException("Couldn't get OImageControlControl", e); - } + oObj = the_access.getControl(the_Model); + the_win = the_access.getControl(the_Model).getPeer(); + aControl = the_access.getControl(the_Model2); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); log.println( "creating a new environment for OImageControlControl object"); diff --git a/qadevOOo/tests/java/mod/_forms/OImageControlModel.java b/qadevOOo/tests/java/mod/_forms/OImageControlModel.java index 8014f9a4a2d1..fabfde66c7c6 100644 --- a/qadevOOo/tests/java/mod/_forms/OImageControlModel.java +++ b/qadevOOo/tests/java/mod/_forms/OImageControlModel.java @@ -20,7 +20,6 @@ package mod._forms; import com.sun.star.beans.NamedValue; import java.io.PrintWriter; -import lib.TestEnvironment; import lib.TestParameters; import util.DBTools; @@ -132,15 +131,4 @@ public class OImageControlModel extends GenericModelTest { } - /** - * calls <CODE>createTestEnvironment()</CODE> from it's super class - * @param Param the test parameter - * @param log the log writer - * @return lib.TestEnvironment - */ - @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { - return super.createTestEnvironment(Param, log); - } } // finish class OImageControlModel diff --git a/qadevOOo/tests/java/mod/_forms/OListBoxControl.java b/qadevOOo/tests/java/mod/_forms/OListBoxControl.java index c0862484ba58..cd422b7fbf09 100644 --- a/qadevOOo/tests/java/mod/_forms/OListBoxControl.java +++ b/qadevOOo/tests/java/mod/_forms/OListBoxControl.java @@ -76,7 +76,7 @@ public class OListBoxControl extends TestCase { } @Override - protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; Object anotherCtrl = null ; XWindowPeer the_win = null; @@ -103,18 +103,12 @@ public class OListBoxControl extends TestCase { XControlAccess.class,xTextDoc.getCurrentController()); //now get the OListBoxControl - try { - oObj = the_access.getControl(the_Model); - anotherCtrl = the_access.getControl(the_Model2); - the_win = the_access.getControl(the_Model).getPeer(); - the_kit = the_win.getToolkit(); - aDevice = the_kit.createScreenCompatibleDevice(200,200); - aGraphic = aDevice.createGraphics(); - } catch (Exception e) { - log.println("Couldn't get OListBoxControl"); - e.printStackTrace(log); - throw new StatusException("Couldn't get OListBoxControl", e ); - } + oObj = the_access.getControl(the_Model); + anotherCtrl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200,200); + aGraphic = aDevice.createGraphics(); log.println( "creating a new environment for OListBoxControl object" ); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_forms/OListBoxModel.java b/qadevOOo/tests/java/mod/_forms/OListBoxModel.java index 160ea8cbe3e4..7a8bfeb475e5 100644 --- a/qadevOOo/tests/java/mod/_forms/OListBoxModel.java +++ b/qadevOOo/tests/java/mod/_forms/OListBoxModel.java @@ -25,7 +25,6 @@ import com.sun.star.form.XLoadable; import com.sun.star.sdbc.SQLException; import com.sun.star.sdbc.XResultSetUpdate; -import com.sun.star.uno.Exception; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XInterface; import ifc.form._XUpdateBroadcaster.UpdateChecker; @@ -165,7 +164,7 @@ public class OListBoxModel extends GenericModelTest { */ @Override protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { TestEnvironment tEnv = super.createTestEnvironment(Param, log); tEnv.addObjRelation("XUpdateBroadcaster.Checker", @@ -187,7 +186,7 @@ public class OListBoxModel extends GenericModelTest { this.ChangePropertyName=ChangePropertyName; } - public void update() throws Exception { + public void update() throws com.sun.star.uno.Exception { if (!formLoaderF.isLoaded()) { formLoaderF.load(); } @@ -206,7 +205,7 @@ public class OListBoxModel extends GenericModelTest { update.updateRow(); } - public boolean wasCommited() throws Exception { + public boolean wasCommited() throws com.sun.star.uno.Exception { formLoaderF.reload(); short[] getS = (short[]) ps.getPropertyValue(ChangePropertyName); diff --git a/qadevOOo/tests/java/mod/_forms/ONavigationBarControl.java b/qadevOOo/tests/java/mod/_forms/ONavigationBarControl.java index 837fb706caef..a1e2d2aa219a 100644 --- a/qadevOOo/tests/java/mod/_forms/ONavigationBarControl.java +++ b/qadevOOo/tests/java/mod/_forms/ONavigationBarControl.java @@ -102,7 +102,7 @@ public class ONavigationBarControl extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; XWindowPeer the_win = null; XToolkit the_kit = null; @@ -133,18 +133,12 @@ public class ONavigationBarControl extends TestCase { xTextDoc.getCurrentController()); //now get the OButtonControl - try { - oObj = the_access.getControl(the_Model); - aControl = the_access.getControl(the_Model2); - the_win = the_access.getControl(the_Model).getPeer(); - the_kit = the_win.getToolkit(); - aDevice = the_kit.createScreenCompatibleDevice(200, 200); - aGraphic = aDevice.createGraphics(); - } catch (com.sun.star.container.NoSuchElementException e) { - log.println("Couldn't get ONavigationBarControl"); - e.printStackTrace(log); - throw new StatusException("Couldn't get ONavigationBarControl", e); - } + oObj = the_access.getControl(the_Model); + aControl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); log.println("creating a new environment for ONavigationBarControl object"); diff --git a/qadevOOo/tests/java/mod/_forms/ONavigationBarModel.java b/qadevOOo/tests/java/mod/_forms/ONavigationBarModel.java index 81192481ca65..89b81f6f75aa 100644 --- a/qadevOOo/tests/java/mod/_forms/ONavigationBarModel.java +++ b/qadevOOo/tests/java/mod/_forms/ONavigationBarModel.java @@ -19,7 +19,6 @@ package mod._forms; import java.io.PrintWriter; -import lib.TestEnvironment; import lib.TestParameters; public class ONavigationBarModel extends GenericModelTest { @@ -49,17 +48,5 @@ public class ONavigationBarModel extends GenericModelTest { } - /** - * calls <CODE>createTestEnvironment()</CODE> from it's super class - * @param Param the test parameter - * @param log the log writer - * @return lib.TestEnvironment - */ - @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { - return super.createTestEnvironment(Param, log); - } - } // finish class ONavigationBarModel diff --git a/qadevOOo/tests/java/mod/_forms/ONumericControl.java b/qadevOOo/tests/java/mod/_forms/ONumericControl.java index aa67fb599219..8be65237de4b 100644 --- a/qadevOOo/tests/java/mod/_forms/ONumericControl.java +++ b/qadevOOo/tests/java/mod/_forms/ONumericControl.java @@ -156,7 +156,7 @@ public class ONumericControl extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; Object anotherCtrl = null; XWindowPeer the_win = null; @@ -187,18 +187,12 @@ public class ONumericControl extends TestCase { xTextDoc.getCurrentController()); //now get the ONumericControl - try { - oObj = the_access.getControl(the_Model); - anotherCtrl = the_access.getControl(the_Model2); - the_win = the_access.getControl(the_Model).getPeer(); - the_kit = the_win.getToolkit(); - aDevice = the_kit.createScreenCompatibleDevice(200, 200); - aGraphic = aDevice.createGraphics(); - } catch (com.sun.star.container.NoSuchElementException e) { - log.println("Couldn't get ONumericControl"); - e.printStackTrace(log); - throw new StatusException("Couldn't get ONumericControl", e); - } + oObj = the_access.getControl(the_Model); + anotherCtrl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); log.println("creating a new environment for ONumericControl object"); diff --git a/qadevOOo/tests/java/mod/_forms/ONumericModel.java b/qadevOOo/tests/java/mod/_forms/ONumericModel.java index b8e085c0a4dc..8b6405401f8c 100644 --- a/qadevOOo/tests/java/mod/_forms/ONumericModel.java +++ b/qadevOOo/tests/java/mod/_forms/ONumericModel.java @@ -20,7 +20,6 @@ package mod._forms; import com.sun.star.beans.NamedValue; import java.io.PrintWriter; -import lib.TestEnvironment; import lib.TestParameters; import util.DBTools; @@ -131,15 +130,4 @@ public class ONumericModel extends GenericModelTest { } - /** - * calls <CODE>createTestEnvironment()</CODE> from it's super class - * @param Param the test parameter - * @param log the log writer - * @return lib.TestEnvironment - */ - @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { - return super.createTestEnvironment(Param, log); - } } // finish class ONumericModel diff --git a/qadevOOo/tests/java/mod/_forms/OPatternControl.java b/qadevOOo/tests/java/mod/_forms/OPatternControl.java index 7f8fabeac0bd..4b1f11d927b1 100644 --- a/qadevOOo/tests/java/mod/_forms/OPatternControl.java +++ b/qadevOOo/tests/java/mod/_forms/OPatternControl.java @@ -156,7 +156,7 @@ public class OPatternControl extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; Object anotherCtrl = null; XWindowPeer the_win = null; @@ -187,18 +187,12 @@ public class OPatternControl extends TestCase { xTextDoc.getCurrentController()); //now get the OPatternControl - try { - oObj = the_access.getControl(the_Model); - anotherCtrl = the_access.getControl(the_Model2); - the_win = the_access.getControl(the_Model).getPeer(); - the_kit = the_win.getToolkit(); - aDevice = the_kit.createScreenCompatibleDevice(200, 200); - aGraphic = aDevice.createGraphics(); - } catch (com.sun.star.container.NoSuchElementException e) { - log.println("Couldn't get OPatternControl"); - e.printStackTrace(log); - throw new StatusException("Couldn't get OPatternControl", e); - } + oObj = the_access.getControl(the_Model); + anotherCtrl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); log.println("creating a new environment for OPatternControl object"); diff --git a/qadevOOo/tests/java/mod/_forms/OPatternModel.java b/qadevOOo/tests/java/mod/_forms/OPatternModel.java index 950d66207be5..65039cf2fcc2 100644 --- a/qadevOOo/tests/java/mod/_forms/OPatternModel.java +++ b/qadevOOo/tests/java/mod/_forms/OPatternModel.java @@ -20,7 +20,6 @@ package mod._forms; import com.sun.star.beans.NamedValue; import java.io.PrintWriter; -import lib.TestEnvironment; import lib.TestParameters; import util.DBTools; @@ -136,16 +135,4 @@ public class OPatternModel extends GenericModelTest { } - /** - * calls <CODE>createTestEnvironment()</CODE> from it's super class - * @param Param the test parameter - * @param log the log writer - * @return lib.TestEnvironment - */ - @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { - return super.createTestEnvironment(Param, log); - } - } // finish class OPatternModel diff --git a/qadevOOo/tests/java/mod/_forms/ORadioButtonControl.java b/qadevOOo/tests/java/mod/_forms/ORadioButtonControl.java index 670c10b1b66a..21e358bfc946 100644 --- a/qadevOOo/tests/java/mod/_forms/ORadioButtonControl.java +++ b/qadevOOo/tests/java/mod/_forms/ORadioButtonControl.java @@ -144,7 +144,7 @@ public class ORadioButtonControl extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; XWindowPeer the_win = null; XToolkit the_kit = null; @@ -175,18 +175,12 @@ public class ORadioButtonControl extends TestCase { xTextDoc.getCurrentController()); //now get the ORadioButtonControl - try { - oObj = the_access.getControl(the_Model); - aControl = the_access.getControl(the_Model2); - the_win = the_access.getControl(the_Model).getPeer(); - the_kit = the_win.getToolkit(); - aDevice = the_kit.createScreenCompatibleDevice(200, 200); - aGraphic = aDevice.createGraphics(); - } catch (com.sun.star.container.NoSuchElementException e) { - log.println("Couldn't get ORadioButtonControl"); - e.printStackTrace(log); - throw new StatusException("Couldn't get ORadioButtonControl", e); - } + oObj = the_access.getControl(the_Model); + aControl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); log.println( "creating a new environment for ORadioButtonControl object"); diff --git a/qadevOOo/tests/java/mod/_forms/ORadioButtonModel.java b/qadevOOo/tests/java/mod/_forms/ORadioButtonModel.java index 7794d7f0e24c..14af07ca06f1 100644 --- a/qadevOOo/tests/java/mod/_forms/ORadioButtonModel.java +++ b/qadevOOo/tests/java/mod/_forms/ORadioButtonModel.java @@ -141,7 +141,7 @@ public class ORadioButtonModel extends GenericModelTest { */ @Override protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { TestEnvironment tEnv = super.createTestEnvironment(Param, log); tEnv.addObjRelation("DataAwareControlModel.NewFieldName", DBTools.TST_INT_F); diff --git a/qadevOOo/tests/java/mod/_forms/OTimeControl.java b/qadevOOo/tests/java/mod/_forms/OTimeControl.java index 41fda5679d00..7526f4c6f9f6 100644 --- a/qadevOOo/tests/java/mod/_forms/OTimeControl.java +++ b/qadevOOo/tests/java/mod/_forms/OTimeControl.java @@ -157,7 +157,7 @@ public class OTimeControl extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; XWindowPeer the_win = null; XToolkit the_kit = null; @@ -188,18 +188,12 @@ public class OTimeControl extends TestCase { xTextDoc.getCurrentController()); //now get the OTimeControl - try { - oObj = the_access.getControl(the_Model); - aControl = the_access.getControl(the_Model2); - the_win = the_access.getControl(the_Model).getPeer(); - the_kit = the_win.getToolkit(); - aDevice = the_kit.createScreenCompatibleDevice(200, 200); - aGraphic = aDevice.createGraphics(); - } catch (com.sun.star.container.NoSuchElementException e) { - log.println("Couldn't get OTimeControl"); - e.printStackTrace(log); - throw new StatusException("Couldn't get OTimeControl", e); - } + oObj = the_access.getControl(the_Model); + aControl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); log.println("creating a new environment for OTimeControl object"); diff --git a/qadevOOo/tests/java/mod/_forms/OTimeModel.java b/qadevOOo/tests/java/mod/_forms/OTimeModel.java index 7ffa83c7d510..7bbc5a389a5e 100644 --- a/qadevOOo/tests/java/mod/_forms/OTimeModel.java +++ b/qadevOOo/tests/java/mod/_forms/OTimeModel.java @@ -156,7 +156,7 @@ public class OTimeModel extends GenericModelTest { */ @Override protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { TestEnvironment tEnv = super.createTestEnvironment(Param, log); HashSet<String> exclude = new HashSet<String>(); diff --git a/qadevOOo/tests/java/mod/_fps/FilePicker.java b/qadevOOo/tests/java/mod/_fps/FilePicker.java index 87cbefcf743c..08b8e8734255 100644 --- a/qadevOOo/tests/java/mod/_fps/FilePicker.java +++ b/qadevOOo/tests/java/mod/_fps/FilePicker.java @@ -20,7 +20,6 @@ package mod._fps; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -88,7 +87,7 @@ public class FilePicker extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { + throws Exception { XInterface oObj = null; Object oInterface = null; XMultiServiceFactory xMSF = Param.getMSF(); @@ -97,13 +96,8 @@ public class FilePicker extends TestCase { (com.sun.star.ui.dialogs.TemplateDescription.FILEOPEN_READONLY_VERSION)}; short ctrlId = com.sun.star.ui.dialogs.ExtendedFilePickerElementIds.CHECKBOX_READONLY; - try { - oInterface = xMSF.createInstance - ( "com.sun.star.ui.dialogs.FilePicker" ); - } catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } + oInterface = xMSF.createInstance + ( "com.sun.star.ui.dialogs.FilePicker" ); oObj = (XInterface) oInterface; diff --git a/qadevOOo/tests/java/mod/_fwk/ControlMenuController.java b/qadevOOo/tests/java/mod/_fwk/ControlMenuController.java index 50da47dbd208..f421f88b92ff 100644 --- a/qadevOOo/tests/java/mod/_fwk/ControlMenuController.java +++ b/qadevOOo/tests/java/mod/_fwk/ControlMenuController.java @@ -22,7 +22,6 @@ import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.text.XTextDocument; import com.sun.star.uno.XInterface; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -59,20 +58,11 @@ public class ControlMenuController extends TestCase { * Create test environment. */ @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { - TestEnvironment tEnv = null; + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF(); - try { - oObj = (XInterface)xMSF.createInstance("com.sun.star.comp.framework.ControlMenuController"); - } - catch(com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Could not create object 'ControlMenuController'", e); - } - - + oObj = (XInterface)xMSF.createInstance("com.sun.star.comp.framework.ControlMenuController"); log.println("TestObject: " + utils.getImplName(oObj)); - tEnv = new TestEnvironment(oObj); + TestEnvironment tEnv = new TestEnvironment(oObj); return tEnv; } diff --git a/qadevOOo/tests/java/mod/_fwk/Desktop.java b/qadevOOo/tests/java/mod/_fwk/Desktop.java index 7dfd11386765..89a2ab451c59 100644 --- a/qadevOOo/tests/java/mod/_fwk/Desktop.java +++ b/qadevOOo/tests/java/mod/_fwk/Desktop.java @@ -20,8 +20,6 @@ package mod._fwk; import java.io.PrintWriter; -import lib.Status; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -91,26 +89,16 @@ public class Desktop extends TestCase { * Creates service <code>com.sun.star.frame.Desktop</code>. */ @Override - protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { // get a soffice factory object SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF()); - try { - log.println( "creating a text document" ); - xTextDoc = SOF.createTextDoc(null); - } catch ( com.sun.star.uno.Exception e ) { - throw new StatusException("Couldn't create document", e); - } - - XInterface oObj = null; + log.println( "creating a text document" ); + xTextDoc = SOF.createTextDoc(null); - try { - oObj = (XInterface)Param.getMSF().createInstance( + XInterface oObj = (XInterface)Param.getMSF().createInstance( "com.sun.star.comp.framework.Desktop"); - } catch(com.sun.star.uno.Exception e) { - throw new StatusException(e, Status.failed("Couldn't create instance")); - } TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_fwk/DispatchRecorder.java b/qadevOOo/tests/java/mod/_fwk/DispatchRecorder.java index c610417958e8..b8607a1f173d 100644 --- a/qadevOOo/tests/java/mod/_fwk/DispatchRecorder.java +++ b/qadevOOo/tests/java/mod/_fwk/DispatchRecorder.java @@ -22,7 +22,6 @@ import com.sun.star.beans.PropertyValue; import com.sun.star.frame.XModel; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -67,46 +66,42 @@ public class DispatchRecorder extends TestCase { */ @Override public TestEnvironment createTestEnvironment( TestParameters Param, - PrintWriter log ) throws StatusException { + PrintWriter log ) throws Exception { XInterface oObj = null; XFrame xFrame = null; XDispatchRecorder xDR = null; - try { - SOfficeFactory SOF = SOfficeFactory.getFactory(Param.getMSF()); - oDoc = SOF.createTextDoc(null); - util.utils.pause(1000); - - XModel model = UnoRuntime.queryInterface(XModel.class, oDoc); - xFrame = model.getCurrentController().getFrame(); - - XPropertySet xFramePS = UnoRuntime.queryInterface - (XPropertySet.class, xFrame); - XDispatchRecorderSupplier xDRS = null; - xDRS = (XDispatchRecorderSupplier) AnyConverter.toObject( - new Type(XDispatchRecorderSupplier.class), - xFramePS.getPropertyValue("DispatchRecorderSupplier")); - if (xDRS == null) { - - Object oDRS = Param.getMSF().createInstance( - "com.sun.star.comp.framework.DispatchRecorderSupplier"); - xFramePS.setPropertyValue("DispatchRecorderSupplier", oDRS); - xDRS = UnoRuntime.queryInterface(XDispatchRecorderSupplier.class,oDRS); - } - - xDR = xDRS.getDispatchRecorder(); - if (xDR != null) { - oObj = xDR; - } else { - oObj = (XInterface)Param.getMSF().createInstance( - "com.sun.star.comp.framework.DispatchRecorder"); - xDR = UnoRuntime.queryInterface - (XDispatchRecorder.class, oObj); - xDRS.setDispatchRecorder(xDR); - } - } catch (com.sun.star.uno.Exception e) { - throw new StatusException("Can't create component", e); + SOfficeFactory SOF = SOfficeFactory.getFactory(Param.getMSF()); + oDoc = SOF.createTextDoc(null); + util.utils.pause(1000); + + XModel model = UnoRuntime.queryInterface(XModel.class, oDoc); + xFrame = model.getCurrentController().getFrame(); + + XPropertySet xFramePS = UnoRuntime.queryInterface + (XPropertySet.class, xFrame); + XDispatchRecorderSupplier xDRS = null; + xDRS = (XDispatchRecorderSupplier) AnyConverter.toObject( + new Type(XDispatchRecorderSupplier.class), + xFramePS.getPropertyValue("DispatchRecorderSupplier")); + if (xDRS == null) { + + Object oDRS = Param.getMSF().createInstance( + "com.sun.star.comp.framework.DispatchRecorderSupplier"); + xFramePS.setPropertyValue("DispatchRecorderSupplier", oDRS); + xDRS = UnoRuntime.queryInterface(XDispatchRecorderSupplier.class,oDRS); + } + + xDR = xDRS.getDispatchRecorder(); + if (xDR != null) { + oObj = xDR; + } else { + oObj = (XInterface)Param.getMSF().createInstance( + "com.sun.star.comp.framework.DispatchRecorder"); + xDR = UnoRuntime.queryInterface + (XDispatchRecorder.class, oObj); + xDRS.setDispatchRecorder(xDR); } diff --git a/qadevOOo/tests/java/mod/_fwk/DispatchRecorderSupplier.java b/qadevOOo/tests/java/mod/_fwk/DispatchRecorderSupplier.java index 32e1a3cbc0de..0d2b2d0b495c 100644 --- a/qadevOOo/tests/java/mod/_fwk/DispatchRecorderSupplier.java +++ b/qadevOOo/tests/java/mod/_fwk/DispatchRecorderSupplier.java @@ -20,8 +20,6 @@ package mod._fwk; import java.io.PrintWriter; -import lib.Status; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -45,16 +43,10 @@ public class DispatchRecorderSupplier extends TestCase { */ @Override public TestEnvironment createTestEnvironment( TestParameters Param, - PrintWriter log ) throws StatusException { + PrintWriter log ) throws Exception { - XInterface oObj = null; - - try { - oObj = (XInterface)Param.getMSF().createInstance( + XInterface oObj = (XInterface)Param.getMSF().createInstance( "com.sun.star.comp.framework.DispatchRecorderSupplier"); - } catch(com.sun.star.uno.Exception e) { - throw new StatusException(e, Status.failed("Couldn't create instance")); - } TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_fwk/FontMenuController.java b/qadevOOo/tests/java/mod/_fwk/FontMenuController.java index 755ada50e0aa..3f8d1a687029 100644 --- a/qadevOOo/tests/java/mod/_fwk/FontMenuController.java +++ b/qadevOOo/tests/java/mod/_fwk/FontMenuController.java @@ -21,7 +21,6 @@ package mod._fwk; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.XInterface; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -33,19 +32,12 @@ public class FontMenuController extends TestCase { XInterface oObj = null; @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { - TestEnvironment tEnv = null; + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF(); - try { - oObj = (XInterface)xMSF.createInstance("com.sun.star.comp.framework.FontMenuController"); - } - catch(com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Could not create object 'FontMenuController'", e); - } + oObj = (XInterface)xMSF.createInstance("com.sun.star.comp.framework.FontMenuController"); log.println("TestObject: " + utils.getImplName(oObj)); - tEnv = new TestEnvironment(oObj); + TestEnvironment tEnv = new TestEnvironment(oObj); return tEnv; } diff --git a/qadevOOo/tests/java/mod/_fwk/FontSizeMenuController.java b/qadevOOo/tests/java/mod/_fwk/FontSizeMenuController.java index 934f50b15236..b662b5f07fee 100644 --- a/qadevOOo/tests/java/mod/_fwk/FontSizeMenuController.java +++ b/qadevOOo/tests/java/mod/_fwk/FontSizeMenuController.java @@ -21,31 +21,21 @@ package mod._fwk; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.XInterface; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; import util.utils; -/** - */ public class FontSizeMenuController extends TestCase { XInterface oObj = null; @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { - TestEnvironment tEnv = null; + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF(); - try { - oObj = (XInterface)xMSF.createInstance("com.sun.star.comp.framework.FontSizeMenuController"); - } - catch(com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Could not create object 'FontSizeMenuController'", e); - } + oObj = (XInterface)xMSF.createInstance("com.sun.star.comp.framework.FontSizeMenuController"); log.println("TestObject: " + utils.getImplName(oObj)); - tEnv = new TestEnvironment(oObj); + TestEnvironment tEnv = new TestEnvironment(oObj); return tEnv; } diff --git a/qadevOOo/tests/java/mod/_fwk/FooterMenuController.java b/qadevOOo/tests/java/mod/_fwk/FooterMenuController.java index 5db0ce8273a7..99e9207bd86c 100644 --- a/qadevOOo/tests/java/mod/_fwk/FooterMenuController.java +++ b/qadevOOo/tests/java/mod/_fwk/FooterMenuController.java @@ -21,31 +21,21 @@ package mod._fwk; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.XInterface; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; import util.utils; -/** - */ public class FooterMenuController extends TestCase { XInterface oObj = null; @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { - TestEnvironment tEnv = null; + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF(); - try { - oObj = (XInterface)xMSF.createInstance("com.sun.star.comp.framework.FooterMenuController"); - } - catch(com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Could not create object 'FooterMenuController'", e); - } + oObj = (XInterface)xMSF.createInstance("com.sun.star.comp.framework.FooterMenuController"); log.println("TestObject: " + utils.getImplName(oObj)); - tEnv = new TestEnvironment(oObj); + TestEnvironment tEnv = new TestEnvironment(oObj); return tEnv; } diff --git a/qadevOOo/tests/java/mod/_fwk/FormatMenuController.java b/qadevOOo/tests/java/mod/_fwk/FormatMenuController.java index 4b8e49b6b567..be3cb17d44eb 100644 --- a/qadevOOo/tests/java/mod/_fwk/FormatMenuController.java +++ b/qadevOOo/tests/java/mod/_fwk/FormatMenuController.java @@ -21,31 +21,21 @@ package mod._fwk; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.XInterface; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; import util.utils; -/** - */ public class FormatMenuController extends TestCase { XInterface oObj = null; @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { - TestEnvironment tEnv = null; + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF(); - try { - oObj = (XInterface)xMSF.createInstance("com.sun.star.comp.framework.FormatMenuController"); - } - catch(com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Could not create object 'FormatMenuController'", e); - } + oObj = (XInterface)xMSF.createInstance("com.sun.star.comp.framework.FormatMenuController"); log.println("TestObject: " + utils.getImplName(oObj)); - tEnv = new TestEnvironment(oObj); + TestEnvironment tEnv = new TestEnvironment(oObj); return tEnv; } diff --git a/qadevOOo/tests/java/mod/_fwk/Frame.java b/qadevOOo/tests/java/mod/_fwk/Frame.java index 9ce802c7264b..388176a14275 100644 --- a/qadevOOo/tests/java/mod/_fwk/Frame.java +++ b/qadevOOo/tests/java/mod/_fwk/Frame.java @@ -20,7 +20,6 @@ package mod._fwk; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -63,7 +62,7 @@ public class Frame extends TestCase { */ @Override public TestEnvironment createTestEnvironment( TestParameters Param, - PrintWriter log ) throws StatusException { + PrintWriter log ) throws Exception { XInterface oObj = null; @@ -72,14 +71,8 @@ public class Frame extends TestCase { // get a soffice factory object SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF()); - try { - log.println( "creating a text document" ); - xTextDoc = SOF.createTextDoc(null); - } catch ( com.sun.star.uno.Exception e ) { - // Some exception occurs.FAILED - e.printStackTrace( log ); - throw new StatusException( "Couldn't create document", e ); - } + log.println( "creating a text document" ); + xTextDoc = SOF.createTextDoc(null); frame = xTextDoc.getCurrentController().getFrame(); oObj = UnoRuntime.queryInterface(XInterface.class, frame); diff --git a/qadevOOo/tests/java/mod/_fwk/HeaderMenuController.java b/qadevOOo/tests/java/mod/_fwk/HeaderMenuController.java index fe9c1c69bb2a..16342de71cc8 100644 --- a/qadevOOo/tests/java/mod/_fwk/HeaderMenuController.java +++ b/qadevOOo/tests/java/mod/_fwk/HeaderMenuController.java @@ -21,31 +21,21 @@ package mod._fwk; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.XInterface; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; import util.utils; -/** - */ public class HeaderMenuController extends TestCase { XInterface oObj = null; @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { - TestEnvironment tEnv = null; + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF(); - try { - oObj = (XInterface)xMSF.createInstance("com.sun.star.comp.framework.HeaderMenuController"); - } - catch(com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Could not create object 'HeaderMenuController'", e); - } + oObj = (XInterface)xMSF.createInstance("com.sun.star.comp.framework.HeaderMenuController"); log.println("TestObject: " + utils.getImplName(oObj)); - tEnv = new TestEnvironment(oObj); + TestEnvironment tEnv = new TestEnvironment(oObj); return tEnv; } diff --git a/qadevOOo/tests/java/mod/_fwk/JobExecutor.java b/qadevOOo/tests/java/mod/_fwk/JobExecutor.java index b446c9eab5c9..7cb4ed030b2f 100644 --- a/qadevOOo/tests/java/mod/_fwk/JobExecutor.java +++ b/qadevOOo/tests/java/mod/_fwk/JobExecutor.java @@ -20,7 +20,6 @@ package mod._fwk; import java.io.PrintWriter; -import lib.Status; import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; @@ -197,18 +196,11 @@ public class JobExecutor extends TestCase { * is created. */ @Override - protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { - XInterface oObj = null; - - Object job = null; - try { - oObj = (XInterface)Param.getMSF().createInstance( - "com.sun.star.comp.framework.JobExecutor"); - job = Param.getMSF().createInstance("test.Job"); - } catch(com.sun.star.uno.Exception e) { - throw new StatusException(e, Status.failed("Couldn't create instance")); - } + XInterface oObj = (XInterface)Param.getMSF().createInstance( + "com.sun.star.comp.framework.JobExecutor"); + Object job = Param.getMSF().createInstance("test.Job"); xNamed = UnoRuntime.queryInterface(XNamed.class, job); log.println("Count = " + xNamed.getName()); diff --git a/qadevOOo/tests/java/mod/_fwk/JobHandler.java b/qadevOOo/tests/java/mod/_fwk/JobHandler.java index 31568f65fd15..750a04adf69a 100644 --- a/qadevOOo/tests/java/mod/_fwk/JobHandler.java +++ b/qadevOOo/tests/java/mod/_fwk/JobHandler.java @@ -20,7 +20,6 @@ package mod._fwk; import java.io.PrintWriter; -import lib.Status; import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; @@ -46,7 +45,7 @@ public class JobHandler extends TestCase { */ @Override public TestEnvironment createTestEnvironment( TestParameters Param, - PrintWriter log ) throws StatusException { + PrintWriter log ) throws Exception { boolean serviceRegistered = false; try { @@ -62,14 +61,8 @@ public class JobHandler extends TestCase { throw new StatusException(message, new Exception()); } - XInterface oObj = null; - - try { - oObj = (XInterface)Param.getMSF().createInstance( - "com.sun.star.comp.framework.jobs.JobDispatch"); - } catch(com.sun.star.uno.Exception e) { - throw new StatusException(e, Status.failed("Couldn't create instance")); - } + XInterface oObj = (XInterface)Param.getMSF().createInstance( + "com.sun.star.comp.framework.jobs.JobDispatch"); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_fwk/LayoutManager.java b/qadevOOo/tests/java/mod/_fwk/LayoutManager.java index 6628add8332e..9193fca43bf3 100644 --- a/qadevOOo/tests/java/mod/_fwk/LayoutManager.java +++ b/qadevOOo/tests/java/mod/_fwk/LayoutManager.java @@ -28,7 +28,6 @@ import com.sun.star.text.XText; import com.sun.star.text.XTextCursor; import com.sun.star.text.XTextDocument; import com.sun.star.util.XCloseable; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -72,7 +71,7 @@ public class LayoutManager extends TestCase { * @return The test environment. */ @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { TestEnvironment tEnv = null; XMultiServiceFactory xMSF = tParam.getMSF(); @@ -89,18 +88,8 @@ public class LayoutManager extends TestCase { XFrame xFrame = xTextDoc.getCurrentController().getFrame(); XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class, xFrame); - try { - Object any = xProp.getPropertyValue("LayoutManager"); - xManager = UnoRuntime.queryInterface(XInterface.class, any); - } - catch(com.sun.star.beans.UnknownPropertyException e) { - e.printStackTrace(log); - throw new StatusException("Could not get property 'LayoutManager' from the current frame.", e); - } - catch(com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Could not get property 'LayoutManager' from the current frame.", e); - } + Object any = xProp.getPropertyValue("LayoutManager"); + xManager = UnoRuntime.queryInterface(XInterface.class, any); // just to make sure, it's the right one. log.println("TestObject: " + util.utils.getImplName(xManager)); diff --git a/qadevOOo/tests/java/mod/_fwk/MacrosMenuController.java b/qadevOOo/tests/java/mod/_fwk/MacrosMenuController.java index af13bb9e5e32..e68494417769 100644 --- a/qadevOOo/tests/java/mod/_fwk/MacrosMenuController.java +++ b/qadevOOo/tests/java/mod/_fwk/MacrosMenuController.java @@ -20,32 +20,21 @@ package mod._fwk; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.XInterface; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; import util.utils; -/** - * - */ public class MacrosMenuController extends TestCase{ XInterface oObj = null; @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { - TestEnvironment tEnv = null; + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF(); - try { - oObj = (XInterface)xMSF.createInstance("com.sun.star.comp.framework.MacrosMenuController"); - } - catch(com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Could not create object 'MacrosMenuController'", e); - } + oObj = (XInterface)xMSF.createInstance("com.sun.star.comp.framework.MacrosMenuController"); log.println("TestObject: " + utils.getImplName(oObj)); - tEnv = new TestEnvironment(oObj); + TestEnvironment tEnv = new TestEnvironment(oObj); return tEnv; } diff --git a/qadevOOo/tests/java/mod/_fwk/MailToDispatcher.java b/qadevOOo/tests/java/mod/_fwk/MailToDispatcher.java index 1bdd45a45187..ac04229aadcb 100644 --- a/qadevOOo/tests/java/mod/_fwk/MailToDispatcher.java +++ b/qadevOOo/tests/java/mod/_fwk/MailToDispatcher.java @@ -20,8 +20,6 @@ package mod._fwk; import java.io.PrintWriter; -import lib.Status; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -47,16 +45,10 @@ public class MailToDispatcher extends TestCase { */ @Override public TestEnvironment createTestEnvironment( TestParameters Param, - PrintWriter log ) throws StatusException { + PrintWriter log ) throws Exception { - XInterface oObj = null; - - try { - oObj = (XInterface)Param.getMSF().createInstance( - "com.sun.star.comp.framework.MailToDispatcher"); - } catch(com.sun.star.uno.Exception e) { - throw new StatusException(e, Status.failed("Couldn't create instance")); - } + XInterface oObj = (XInterface)Param.getMSF().createInstance( + "com.sun.star.comp.framework.MailToDispatcher"); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_fwk/MenuBarFactory.java b/qadevOOo/tests/java/mod/_fwk/MenuBarFactory.java index 053e82320196..ff75db88d218 100644 --- a/qadevOOo/tests/java/mod/_fwk/MenuBarFactory.java +++ b/qadevOOo/tests/java/mod/_fwk/MenuBarFactory.java @@ -21,28 +21,19 @@ package mod._fwk; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.XInterface; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; -/** - */ public class MenuBarFactory extends TestCase { XInterface oObj = null; @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { - TestEnvironment tEnv = null; - try { - XMultiServiceFactory xMSF = tParam.getMSF(); - oObj = (XInterface)xMSF.createInstance("com.sun.star.comp.framework.MenuBarFactory"); + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { + XMultiServiceFactory xMSF = tParam.getMSF(); + oObj = (XInterface)xMSF.createInstance("com.sun.star.comp.framework.MenuBarFactory"); - tEnv = new TestEnvironment(oObj); - } - catch(com.sun.star.uno.Exception e) { - throw new StatusException("Cannot create test object 'MenuBarFactory'", e); - } + TestEnvironment tEnv = new TestEnvironment(oObj); return tEnv; } } diff --git a/qadevOOo/tests/java/mod/_fwk/ModuleManager.java b/qadevOOo/tests/java/mod/_fwk/ModuleManager.java index 7979a1a81942..655ef3ffb6b5 100644 --- a/qadevOOo/tests/java/mod/_fwk/ModuleManager.java +++ b/qadevOOo/tests/java/mod/_fwk/ModuleManager.java @@ -66,29 +66,17 @@ public class ModuleManager extends TestCase { */ @Override public TestEnvironment createTestEnvironment( TestParameters Param, - PrintWriter log ) throws StatusException { + PrintWriter log ) throws Exception { - XInterface oObj = null; - - try { - oObj = (XInterface)Param.getMSF().createInstance( - "com.sun.star.comp.framework.ModuleManager"); - } catch(Exception e) { - throw new StatusException(e, Status.failed("Couldn't create instance")); - } + XInterface oObj = (XInterface)Param.getMSF().createInstance( + "com.sun.star.comp.framework.ModuleManager"); // get a soffice factory object SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF()); // get text document interfaces - try { - log.println("creating a text document"); - xTextDoc = SOF.createTextDoc(null); - - } catch (Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create document ", e); - } + log.println("creating a text document"); + xTextDoc = SOF.createTextDoc(null); XModel xTextMode1 = UnoRuntime.queryInterface(XModel.class, xTextDoc); XController xTextController = xTextMode1.getCurrentController(); @@ -96,80 +84,48 @@ public class ModuleManager extends TestCase { // get webdoc interfaces - try { - log.println("creating a web document"); - xWebDoc = SOF.loadDocument("private:factory/swriter/web"); - - } catch (Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create document ", e); - } + log.println("creating a web document"); + xWebDoc = SOF.loadDocument("private:factory/swriter/web"); XModel xWebMode1 = UnoRuntime.queryInterface(XModel.class, xWebDoc); XController xWebController = xWebMode1.getCurrentController(); XFrame xWebFrame = xWebController.getFrame(); // get global document interfaces - try { - log.println("creating a global document"); - xGlobalDoc = SOF.loadDocument("private:factory/swriter/GlobalDocument"); - - } catch (Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create document ", e); - } + log.println("creating a global document"); + xGlobalDoc = SOF.loadDocument("private:factory/swriter/GlobalDocument"); XModel xGlobalMode1 = UnoRuntime.queryInterface(XModel.class, xGlobalDoc); XController xGlobalController = xGlobalMode1.getCurrentController(); XFrame xGlobalFrame = xGlobalController.getFrame(); // get clac interfaces - try { - log.println("creating a spreadsheetdocument"); - xSheetDoc = SOF.createCalcDoc(null); - } catch (Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create document ", e); - } + log.println("creating a spreadsheetdocument"); + xSheetDoc = SOF.createCalcDoc(null); XModel xSheetMode1 = UnoRuntime.queryInterface(XModel.class, xSheetDoc); XController xSheetController = xSheetMode1.getCurrentController(); XFrame xSheetFrame = xSheetController.getFrame(); // get draw interfaces - try { - log.println("creating a draw document"); - xDrawDoc = SOF.createDrawDoc(null); - } catch (Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create document ", e); - } + log.println("creating a draw document"); + xDrawDoc = SOF.createDrawDoc(null); XModel xDrawMode1 = UnoRuntime.queryInterface(XModel.class, xDrawDoc); XController xDrawController = xDrawMode1.getCurrentController(); XFrame xDrawFrame = xDrawController.getFrame(); // get impress interfaces - try { - log.println("creating a impress document"); - xImpressDoc = SOF.createImpressDoc(null); - } catch (Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create document ", e); - } + log.println("creating a impress document"); + xImpressDoc = SOF.createImpressDoc(null); XModel xImpressMode1 = UnoRuntime.queryInterface(XModel.class, xImpressDoc); XController xImpressController = xImpressMode1.getCurrentController(); XFrame xImpressFrame = xImpressController.getFrame(); // get math interfaces - try { - log.println("creating a math document"); - xMathDoc = SOF.createMathDoc(null); - } catch (Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create document ", e); - } + log.println("creating a math document"); + xMathDoc = SOF.createMathDoc(null); XModel xMathMode1 = UnoRuntime.queryInterface(XModel.class, xMathDoc); XController xMathController = xMathMode1.getCurrentController(); diff --git a/qadevOOo/tests/java/mod/_fwk/ModuleUIConfigurationManager.java b/qadevOOo/tests/java/mod/_fwk/ModuleUIConfigurationManager.java index 13dd31170d42..c4a826b49b64 100644 --- a/qadevOOo/tests/java/mod/_fwk/ModuleUIConfigurationManager.java +++ b/qadevOOo/tests/java/mod/_fwk/ModuleUIConfigurationManager.java @@ -34,7 +34,6 @@ import com.sun.star.util.XCloseable; import com.sun.star.ui.ConfigurationEvent; import com.sun.star.ui.XUIConfigurationManager; import ifc.ui._XUIConfigurationManager; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -74,46 +73,40 @@ public class ModuleUIConfigurationManager extends TestCase { * Create environment. */ @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { TestEnvironment tEnv = null; - try { - xMSF = tParam.getMSF(); + xMSF = tParam.getMSF(); - log.println("Creating instance..."); - xTextDoc = WriterTools.createTextDoc(xMSF); + log.println("Creating instance..."); + xTextDoc = WriterTools.createTextDoc(xMSF); - Object o = xMSF.createInstance("com.sun.star.ui.ModuleUIConfigurationManagerSupplier"); - XModuleUIConfigurationManagerSupplier xMUICMS = UnoRuntime.queryInterface(XModuleUIConfigurationManagerSupplier.class, o); + Object o = xMSF.createInstance("com.sun.star.ui.ModuleUIConfigurationManagerSupplier"); + XModuleUIConfigurationManagerSupplier xMUICMS = UnoRuntime.queryInterface(XModuleUIConfigurationManagerSupplier.class, o); - util.dbg.printInterfaces(xMUICMS); - oObj = xMUICMS.getUIConfigurationManager("com.sun.star.text.TextDocument"); + util.dbg.printInterfaces(xMUICMS); + oObj = xMUICMS.getUIConfigurationManager("com.sun.star.text.TextDocument"); - log.println("TestObject: " + utils.getImplName(oObj)); - tEnv = new TestEnvironment(oObj); + log.println("TestObject: " + utils.getImplName(oObj)); + tEnv = new TestEnvironment(oObj); - XNameAccess xMM = UnoRuntime.queryInterface(XNameAccess.class, xMSF.createInstance("com.sun.star.comp.framework.ModuleManager")); - xMM.getElementNames(); + XNameAccess xMM = UnoRuntime.queryInterface(XNameAccess.class, xMSF.createInstance("com.sun.star.comp.framework.ModuleManager")); + xMM.getElementNames(); - // the short cut manager service name - // 2do: correct the service name when it's no longer in - tEnv.addObjRelation("XConfigurationManager.ShortCutManager", - "com.sun.star.ui.ModuleAcceleratorConfiguration"); + // the short cut manager service name + // 2do: correct the service name when it's no longer in + tEnv.addObjRelation("XConfigurationManager.ShortCutManager", + "com.sun.star.ui.ModuleAcceleratorConfiguration"); - // the resourceURL - tEnv.addObjRelation("XModuleUIConfigurationManager.ResourceURL", - "private:resource/menubar/menubar"); - tEnv.addObjRelation("XUIConfiguration.XUIConfigurationListenerImpl", - new ConfigurationListener(log, - UnoRuntime.queryInterface( - XUIConfigurationManager.class, oObj), xMSF)); - tEnv.addObjRelation("XModuleUIConfigurationManagerSupplier.ConfigManagerImplementationName", - "com.sun.star.comp.framework.ModuleUIConfigurationManager"); - } - catch(com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Cannot create test object", e); - } + // the resourceURL + tEnv.addObjRelation("XModuleUIConfigurationManager.ResourceURL", + "private:resource/menubar/menubar"); + tEnv.addObjRelation("XUIConfiguration.XUIConfigurationListenerImpl", + new ConfigurationListener(log, + UnoRuntime.queryInterface( + XUIConfigurationManager.class, oObj), xMSF)); + tEnv.addObjRelation("XModuleUIConfigurationManagerSupplier.ConfigManagerImplementationName", + "com.sun.star.comp.framework.ModuleUIConfigurationManager"); return tEnv; } diff --git a/qadevOOo/tests/java/mod/_fwk/ModuleUIConfigurationManagerSupplier.java b/qadevOOo/tests/java/mod/_fwk/ModuleUIConfigurationManagerSupplier.java index 4f90a3ace534..a43f4d924aff 100644 --- a/qadevOOo/tests/java/mod/_fwk/ModuleUIConfigurationManagerSupplier.java +++ b/qadevOOo/tests/java/mod/_fwk/ModuleUIConfigurationManagerSupplier.java @@ -21,31 +21,21 @@ package mod._fwk; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.XInterface; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; -/** - * - */ public class ModuleUIConfigurationManagerSupplier extends TestCase{ XInterface oObj = null; @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { - TestEnvironment tEnv = null; - try { - XMultiServiceFactory xMSF = tParam.getMSF(); - oObj = (XInterface)xMSF.createInstance("com.sun.star.ui.ModuleUIConfigurationManagerSupplier"); - tEnv = new TestEnvironment(oObj); - tEnv.addObjRelation("XModuleUIConfigurationManagerSupplier.ConfigurationManager", - "com.sun.star.frame.StartModule"); - tEnv.addObjRelation("XModuleUIConfigurationManagerSupplier.ConfigManagerImplementationName", "com.sun.star.comp.framework.ModuleUIConfigurationManager"); - } - catch(com.sun.star.uno.Exception e) { - throw new StatusException("Cannot create test object", e); - } + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { + XMultiServiceFactory xMSF = tParam.getMSF(); + oObj = (XInterface)xMSF.createInstance("com.sun.star.ui.ModuleUIConfigurationManagerSupplier"); + TestEnvironment tEnv = new TestEnvironment(oObj); + tEnv.addObjRelation("XModuleUIConfigurationManagerSupplier.ConfigurationManager", + "com.sun.star.frame.StartModule"); + tEnv.addObjRelation("XModuleUIConfigurationManagerSupplier.ConfigManagerImplementationName", "com.sun.star.comp.framework.ModuleUIConfigurationManager"); return tEnv; } diff --git a/qadevOOo/tests/java/mod/_fwk/ObjectMenuController.java b/qadevOOo/tests/java/mod/_fwk/ObjectMenuController.java index 86e8e1428028..82072e857fe8 100644 --- a/qadevOOo/tests/java/mod/_fwk/ObjectMenuController.java +++ b/qadevOOo/tests/java/mod/_fwk/ObjectMenuController.java @@ -24,7 +24,6 @@ import com.sun.star.uno.XInterface; import java.io.PrintWriter; import com.sun.star.text.XTextDocument; import com.sun.star.util.XCloseable; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -69,19 +68,12 @@ public class ObjectMenuController extends TestCase { * @return The test environment. */ @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { - TestEnvironment tEnv = null; + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF(); - try { - oObj = (XInterface)xMSF.createInstance("com.sun.star.comp.framework.ObjectMenuController"); - } - catch(com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Could not create object 'ControlMenuController'", e); - } + oObj = (XInterface)xMSF.createInstance("com.sun.star.comp.framework.ObjectMenuController"); log.println("TestObject: " + utils.getImplName(oObj)); - tEnv = new TestEnvironment(oObj); + TestEnvironment tEnv = new TestEnvironment(oObj); return tEnv; } } diff --git a/qadevOOo/tests/java/mod/_fwk/PopupMenuControllerFactory.java b/qadevOOo/tests/java/mod/_fwk/PopupMenuControllerFactory.java index 2e8ef4995377..60dee1adf301 100644 --- a/qadevOOo/tests/java/mod/_fwk/PopupMenuControllerFactory.java +++ b/qadevOOo/tests/java/mod/_fwk/PopupMenuControllerFactory.java @@ -27,7 +27,6 @@ import com.sun.star.text.XTextDocument; import com.sun.star.uno.XComponentContext; import com.sun.star.util.XCloseable; import com.sun.star.frame.XUIControllerRegistration; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -66,7 +65,7 @@ public class PopupMenuControllerFactory extends TestCase { * @return The test environment. */ @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { TestEnvironment tEnv = null; XMultiServiceFactory xMSF = tParam.getMSF(); XInterface xInst = null; @@ -76,30 +75,15 @@ public class PopupMenuControllerFactory extends TestCase { xTextDoc = WriterTools.createTextDoc(xMSF); util.dbg.printInterfaces(xTextDoc); - try { - xInst = (XInterface)xMSF.createInstance( - "com.sun.star.comp.framework.PopupMenuControllerFactory"); - } - catch(com.sun.star.uno.Exception e) { - throw new StatusException("Couldn't create test object", e); - } + xInst = (XInterface)xMSF.createInstance( + "com.sun.star.comp.framework.PopupMenuControllerFactory"); log.println("TestObject: " + util.utils.getImplName(xInst)); tEnv = new TestEnvironment(xInst); XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class, xMSF); - try { - Object o = xProp.getPropertyValue("DefaultContext"); - XComponentContext xContext = UnoRuntime.queryInterface(XComponentContext.class, o); - tEnv.addObjRelation("DC", xContext); - } - catch(com.sun.star.beans.UnknownPropertyException e) { - log.println("Cannot get the 'DefaultContext' for XMultiComponentFactory test."); - e.printStackTrace(log); - } - catch(com.sun.star.lang.WrappedTargetException e) { - log.println("Cannot get the 'DefaultContext' for XMultiComponentFactory test."); - e.printStackTrace(log); - } + Object o = xProp.getPropertyValue("DefaultContext"); + XComponentContext xContext = UnoRuntime.queryInterface(XComponentContext.class, o); + tEnv.addObjRelation("DC", xContext); // register one controller, so it can be instantiated XUIControllerRegistration xReg = UnoRuntime.queryInterface(XUIControllerRegistration.class, xInst); diff --git a/qadevOOo/tests/java/mod/_fwk/ServiceHandler.java b/qadevOOo/tests/java/mod/_fwk/ServiceHandler.java index dd488717a308..fdf637161b90 100644 --- a/qadevOOo/tests/java/mod/_fwk/ServiceHandler.java +++ b/qadevOOo/tests/java/mod/_fwk/ServiceHandler.java @@ -20,8 +20,6 @@ package mod._fwk; import java.io.PrintWriter; -import lib.Status; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -47,16 +45,10 @@ public class ServiceHandler extends TestCase { */ @Override public TestEnvironment createTestEnvironment( TestParameters Param, - PrintWriter log ) throws StatusException { + PrintWriter log ) throws Exception { - XInterface oObj = null; - - try { - oObj = (XInterface)Param.getMSF().createInstance( - "com.sun.star.comp.framework.ServiceHandler"); - } catch(com.sun.star.uno.Exception e) { - throw new StatusException(e, Status.failed("Couldn't create instance")); - } + XInterface oObj = (XInterface)Param.getMSF().createInstance( + "com.sun.star.comp.framework.ServiceHandler"); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_fwk/SoundHandler.java b/qadevOOo/tests/java/mod/_fwk/SoundHandler.java index 79985f1bbf8c..04f1fce1dbcc 100644 --- a/qadevOOo/tests/java/mod/_fwk/SoundHandler.java +++ b/qadevOOo/tests/java/mod/_fwk/SoundHandler.java @@ -20,8 +20,6 @@ package mod._fwk; import java.io.PrintWriter; -import lib.Status; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -47,16 +45,10 @@ public class SoundHandler extends TestCase { */ @Override public TestEnvironment createTestEnvironment( TestParameters Param, - PrintWriter log ) throws StatusException { + PrintWriter log ) throws Exception { - XInterface oObj = null; - - try { - oObj = (XInterface)Param.getMSF().createInstance( + XInterface oObj = (XInterface)Param.getMSF().createInstance( "com.sun.star.frame.ContentHandler"); - } catch(com.sun.star.uno.Exception e) { - throw new StatusException(e, Status.failed("Couldn't create instance")); - } TestEnvironment tEnv = new TestEnvironment( oObj ); URL dispURL = utils.parseURL(Param.getMSF(), diff --git a/qadevOOo/tests/java/mod/_fwk/StatusBarControllerFactory.java b/qadevOOo/tests/java/mod/_fwk/StatusBarControllerFactory.java index 4707c79cae76..c3451125e33c 100644 --- a/qadevOOo/tests/java/mod/_fwk/StatusBarControllerFactory.java +++ b/qadevOOo/tests/java/mod/_fwk/StatusBarControllerFactory.java @@ -23,42 +23,23 @@ import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XComponentContext; import com.sun.star.uno.XInterface; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; -/** - */ public class StatusBarControllerFactory extends TestCase { XInterface oObj = null; @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { - TestEnvironment tEnv = null; + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF(); - try { - oObj = (XInterface)xMSF.createInstance("com.sun.star.comp.framework.StatusBarControllerFactory"); + oObj = (XInterface)xMSF.createInstance("com.sun.star.comp.framework.StatusBarControllerFactory"); - tEnv = new TestEnvironment(oObj); - } - catch(com.sun.star.uno.Exception e) { - throw new StatusException("Cannot create test object 'StatusBarControllerFactory'", e); - } + TestEnvironment tEnv = new TestEnvironment(oObj); XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class, xMSF); - try { - Object o = xProp.getPropertyValue("DefaultContext"); - XComponentContext xContext = UnoRuntime.queryInterface(XComponentContext.class, o); - tEnv.addObjRelation("DC", xContext); - } - catch(com.sun.star.beans.UnknownPropertyException e) { - log.println("Cannot get the 'DefaultContext' for XMultiComponentFactory test."); - e.printStackTrace(log); - } - catch(com.sun.star.lang.WrappedTargetException e) { - log.println("Cannot get the 'DefaultContext' for XMultiComponentFactory test."); - e.printStackTrace(log); - } + Object o = xProp.getPropertyValue("DefaultContext"); + XComponentContext xContext = UnoRuntime.queryInterface(XComponentContext.class, o); + tEnv.addObjRelation("DC", xContext); return tEnv; } } diff --git a/qadevOOo/tests/java/mod/_fwk/ToolBarsMenuController.java b/qadevOOo/tests/java/mod/_fwk/ToolBarsMenuController.java index 79e12e149b34..1c88d936c80c 100644 --- a/qadevOOo/tests/java/mod/_fwk/ToolBarsMenuController.java +++ b/qadevOOo/tests/java/mod/_fwk/ToolBarsMenuController.java @@ -21,31 +21,21 @@ package mod._fwk; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.XInterface; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; import util.utils; -/** - */ public class ToolBarsMenuController extends TestCase { XInterface oObj = null; @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { - TestEnvironment tEnv = null; + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF(); - try { - oObj = (XInterface)xMSF.createInstance("com.sun.star.comp.framework.ToolBarsMenuController"); - } - catch(com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Could not create object 'ToolBarsMenuController'", e); - } + oObj = (XInterface)xMSF.createInstance("com.sun.star.comp.framework.ToolBarsMenuController"); log.println("TestObject: " + utils.getImplName(oObj)); - tEnv = new TestEnvironment(oObj); + TestEnvironment tEnv = new TestEnvironment(oObj); return tEnv; } diff --git a/qadevOOo/tests/java/mod/_fwk/UICategoryDescription.java b/qadevOOo/tests/java/mod/_fwk/UICategoryDescription.java index 419adfc9a4ed..fab3759cbe46 100644 --- a/qadevOOo/tests/java/mod/_fwk/UICategoryDescription.java +++ b/qadevOOo/tests/java/mod/_fwk/UICategoryDescription.java @@ -21,31 +21,21 @@ package mod._fwk; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.XInterface; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; import util.utils; -/** - */ public class UICategoryDescription extends TestCase { XInterface oObj = null; @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { - TestEnvironment tEnv = null; + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF(); - try { - oObj = (XInterface)xMSF.createInstance("com.sun.star.comp.framework.UICategoryDescription"); - } - catch(com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Could not create object 'UICategoryDescription'", e); - } + oObj = (XInterface)xMSF.createInstance("com.sun.star.comp.framework.UICategoryDescription"); log.println("TestObject: " + utils.getImplName(oObj)); - tEnv = new TestEnvironment(oObj); + TestEnvironment tEnv = new TestEnvironment(oObj); return tEnv; } diff --git a/qadevOOo/tests/java/mod/_fwk/UICommandDescription.java b/qadevOOo/tests/java/mod/_fwk/UICommandDescription.java index 4b673a218bf9..15e64baf8a09 100644 --- a/qadevOOo/tests/java/mod/_fwk/UICommandDescription.java +++ b/qadevOOo/tests/java/mod/_fwk/UICommandDescription.java @@ -20,7 +20,6 @@ package mod._fwk; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.XInterface; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -30,19 +29,12 @@ public class UICommandDescription extends TestCase { XInterface oObj = null; @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { - TestEnvironment tEnv = null; + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF(); - try { - oObj = (XInterface)xMSF.createInstance("com.sun.star.frame.UICommandDescription"); - } - catch(com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Could not create object 'UICommandDescription'", e); - } + oObj = (XInterface)xMSF.createInstance("com.sun.star.frame.UICommandDescription"); log.println("TestObject: " + utils.getImplName(oObj)); - tEnv = new TestEnvironment(oObj); + TestEnvironment tEnv = new TestEnvironment(oObj); return tEnv; } diff --git a/qadevOOo/tests/java/mod/_fwk/UIElementFactoryManager.java b/qadevOOo/tests/java/mod/_fwk/UIElementFactoryManager.java index 7255a376cd1e..744b979b1d1a 100644 --- a/qadevOOo/tests/java/mod/_fwk/UIElementFactoryManager.java +++ b/qadevOOo/tests/java/mod/_fwk/UIElementFactoryManager.java @@ -24,7 +24,6 @@ import com.sun.star.uno.XInterface; import java.io.PrintWriter; import com.sun.star.text.XTextDocument; import com.sun.star.util.XCloseable; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -69,23 +68,15 @@ public class UIElementFactoryManager extends TestCase { * @return The test environment. */ @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { - TestEnvironment tEnv = null; + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF(); log.println("Creating instance..."); xTextDoc = WriterTools.createTextDoc(xMSF); - try { - oObj = xMSF.createInstance("com.sun.star.ui.UIElementFactoryManager"); - } - catch(com.sun.star.uno.Exception e) { - throw new StatusException("Cannot create test object.", e); - } + oObj = xMSF.createInstance("com.sun.star.ui.UIElementFactoryManager"); log.println("TestObject: " + util.utils.getImplName(oObj)); - tEnv = new TestEnvironment((XInterface)oObj); - - + TestEnvironment tEnv = new TestEnvironment((XInterface)oObj); return tEnv; } } diff --git a/qadevOOo/tests/java/mod/_fwk/URLTransformer.java b/qadevOOo/tests/java/mod/_fwk/URLTransformer.java index 9909cb04a8a6..b46f9f89dcaa 100644 --- a/qadevOOo/tests/java/mod/_fwk/URLTransformer.java +++ b/qadevOOo/tests/java/mod/_fwk/URLTransformer.java @@ -20,8 +20,6 @@ package mod._fwk; import java.io.PrintWriter; -import lib.Status; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -43,17 +41,10 @@ public class URLTransformer extends TestCase { */ @Override public TestEnvironment createTestEnvironment( TestParameters Param, - PrintWriter log ) throws StatusException { - - XInterface oObj = null; - - try { - oObj = (XInterface)Param.getMSF().createInstance( - "com.sun.star.comp.framework.URLTransformer"); - } catch(com.sun.star.uno.Exception e) { - throw new StatusException(e, Status.failed("Couldn't create instance")); - } + PrintWriter log ) throws Exception { + XInterface oObj = (XInterface)Param.getMSF().createInstance( + "com.sun.star.comp.framework.URLTransformer"); TestEnvironment tEnv = new TestEnvironment( oObj ); return tEnv; diff --git a/qadevOOo/tests/java/mod/_fwl/ContentHandlerFactory.java b/qadevOOo/tests/java/mod/_fwl/ContentHandlerFactory.java index fe1125ebbc19..09e40883e43a 100644 --- a/qadevOOo/tests/java/mod/_fwl/ContentHandlerFactory.java +++ b/qadevOOo/tests/java/mod/_fwl/ContentHandlerFactory.java @@ -59,19 +59,13 @@ public class ContentHandlerFactory extends TestCase { */ @Override protected TestEnvironment createTestEnvironment - (TestParameters Param, PrintWriter log) { + (TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; Object oInterface = null ; //now get the OButtonControl - try { - oInterface = Param.getMSF().createInstance - ("com.sun.star.frame.ContentHandlerFactory") ; - } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't get service"); - e.printStackTrace(log); - throw new StatusException("Couldn't get ContentHandlerFactory", e ); - } + oInterface = Param.getMSF().createInstance + ("com.sun.star.frame.ContentHandlerFactory") ; if (oInterface == null) { log.println("Service wasn't created") ; diff --git a/qadevOOo/tests/java/mod/_fwl/FilterFactory.java b/qadevOOo/tests/java/mod/_fwl/FilterFactory.java index d11d731df020..9d21625f331d 100644 --- a/qadevOOo/tests/java/mod/_fwl/FilterFactory.java +++ b/qadevOOo/tests/java/mod/_fwl/FilterFactory.java @@ -21,8 +21,6 @@ package mod._fwl; import java.io.PrintWriter; import java.util.ArrayList; -import lib.Status; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -66,25 +64,10 @@ public class FilterFactory extends TestCase { */ @Override protected TestEnvironment createTestEnvironment - (TestParameters Param, PrintWriter log) { - XInterface oObj = null; - Object oInterface = null ; - - try { - oInterface = Param.getMSF().createInstance - ("com.sun.star.document.FilterFactory") ; - } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't get service"); - e.printStackTrace(log); - throw new StatusException("Couldn't get FilterFactory", e ); - } - - if (oInterface == null) { - log.println("Service wasn't created") ; - throw new StatusException(Status.failed("Service wasn't created")) ; - } - - oObj = (XInterface) oInterface ; + (TestParameters Param, PrintWriter log) throws Exception { + Object oInterface = Param.getMSF().createInstance + ("com.sun.star.document.FilterFactory") ; + XInterface oObj = (XInterface) oInterface ; log.println("ImplName: "+utils.getImplName(oObj)); log.println( "creating a new environment for object" ); @@ -98,15 +81,9 @@ public class FilterFactory extends TestCase { String filterName = filterNames[0]; Object[] instance = null; new PropertyValue(); - try{ - instance = (Object[]) xNA.getByName(filterName); - getPropertyValue - (((PropertyValue[]) instance), "FilterService"); - } catch (com.sun.star.container.NoSuchElementException e){ - throw new StatusException(e, Status.failed("Couldn't get elements from object")); - } catch (com.sun.star.lang.WrappedTargetException e){ - throw new StatusException(e, Status.failed("Couldn't get elements from object")); - } + instance = (Object[]) xNA.getByName(filterName); + getPropertyValue + (((PropertyValue[]) instance), "FilterService"); log.println("adding INSTANCE 1 as obj relation to environment"); @@ -120,15 +97,9 @@ public class FilterFactory extends TestCase { ArrayList<Object[]> vFArgs = new ArrayList<Object[]>(); for (int i = 0; i < filterNames.length; i++) { PropertyValue[] filterProps = null; - try { - System.out.println(filterNames[i]); - filterProps = (PropertyValue[]) - xNA.getByName(filterNames[i]); - } catch (com.sun.star.lang.WrappedTargetException e) { - throw new StatusException("Couldn't create relation", e); - } catch (com.sun.star.container.NoSuchElementException e) { - throw new StatusException("Couldn't create relation", e); - } + System.out.println(filterNames[i]); + filterProps = (PropertyValue[]) + xNA.getByName(filterNames[i]); String filterImpl = (String) getPropertyValueValue (filterProps, "FilterService"); if (filterImpl != null && filterImpl.length() > 0) { diff --git a/qadevOOo/tests/java/mod/_fwl/FrameLoaderFactory.java b/qadevOOo/tests/java/mod/_fwl/FrameLoaderFactory.java index 04c20b3b068d..5beaebdb515a 100644 --- a/qadevOOo/tests/java/mod/_fwl/FrameLoaderFactory.java +++ b/qadevOOo/tests/java/mod/_fwl/FrameLoaderFactory.java @@ -21,8 +21,6 @@ package mod._fwl; import com.sun.star.beans.NamedValue; import java.io.PrintWriter; -import lib.Status; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -59,25 +57,10 @@ public class FrameLoaderFactory extends TestCase { */ @Override protected TestEnvironment createTestEnvironment - (TestParameters Param, PrintWriter log) { - XInterface oObj = null; - Object oInterface = null ; - - try { - oInterface = Param.getMSF().createInstance - ("com.sun.star.frame.FrameLoaderFactory") ; - } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't get service"); - e.printStackTrace(log); - throw new StatusException("Couldn't get FrameLoaderFactory", e ); - } - - if (oInterface == null) { - log.println("Service wasn't created") ; - throw new StatusException(Status.failed("Service wasn't created")) ; - } - - oObj = (XInterface) oInterface ; + (TestParameters Param, PrintWriter log) throws Exception { + Object oInterface = Param.getMSF().createInstance + ("com.sun.star.frame.FrameLoaderFactory") ; + XInterface oObj = (XInterface) oInterface ; log.println("ImplName: "+utils.getImplName(oObj)); log.println( "creating a new environment for object" ); diff --git a/qadevOOo/tests/java/mod/_fwl/PathSettings.java b/qadevOOo/tests/java/mod/_fwl/PathSettings.java index 4d022880d8bd..8e05a6bfb1b3 100644 --- a/qadevOOo/tests/java/mod/_fwl/PathSettings.java +++ b/qadevOOo/tests/java/mod/_fwl/PathSettings.java @@ -30,8 +30,6 @@ import java.io.PrintWriter; import java.util.HashSet; import java.util.Set; -import lib.Status; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -93,24 +91,11 @@ public class PathSettings extends TestCase { */ @Override protected TestEnvironment createTestEnvironment - (TestParameters Param, PrintWriter log) { + (TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; - Object oInterface = null ; - //now get the OButtonControl - try { - oInterface = Param.getMSF().createInstance - ("com.sun.star.comp.framework.PathSettings") ; - } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't get service"); - e.printStackTrace(log); - throw new StatusException("Couldn't get GridControl", e ); - } - - if (oInterface == null) { - log.println("Service wasn't created") ; - throw new StatusException(Status.failed("Service wasn't created")) ; - } + Object oInterface = Param.getMSF().createInstance + ("com.sun.star.comp.framework.PathSettings") ; oObj = (XInterface) oInterface ; log.println("ImplName: "+utils.getImplName(oObj)); diff --git a/qadevOOo/tests/java/mod/_fwl/SubstituteVariables.java b/qadevOOo/tests/java/mod/_fwl/SubstituteVariables.java index e91119426835..f55b33a45bed 100644 --- a/qadevOOo/tests/java/mod/_fwl/SubstituteVariables.java +++ b/qadevOOo/tests/java/mod/_fwl/SubstituteVariables.java @@ -20,8 +20,6 @@ package mod._fwl; import java.io.PrintWriter; -import lib.Status; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -52,26 +50,11 @@ public class SubstituteVariables extends TestCase { */ @Override protected TestEnvironment createTestEnvironment - (TestParameters Param, PrintWriter log) { - XInterface oObj = null; - Object oInterface = null ; - + (TestParameters Param, PrintWriter log) throws Exception { //now get the OButtonControl - try { - oInterface = Param.getMSF().createInstance - ("com.sun.star.util.PathSubstitution") ; - } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't get service"); - e.printStackTrace(log); - throw new StatusException("Couldn't get SubstituteVariables", e ); - } - - if (oInterface == null) { - log.println("Service wasn't created") ; - throw new StatusException(Status.failed("Service wasn't created")) ; - } - - oObj = (XInterface) oInterface ; + Object oInterface = Param.getMSF().createInstance + ("com.sun.star.util.PathSubstitution") ; + XInterface oObj = (XInterface) oInterface ; log.println("ImplName: "+utils.getImplName(oObj)); log.println( "creating a new environment for object" ); diff --git a/qadevOOo/tests/java/mod/_fwl/TypeDetection.java b/qadevOOo/tests/java/mod/_fwl/TypeDetection.java index b356936b19c4..74af3b352efe 100644 --- a/qadevOOo/tests/java/mod/_fwl/TypeDetection.java +++ b/qadevOOo/tests/java/mod/_fwl/TypeDetection.java @@ -22,8 +22,6 @@ import com.sun.star.beans.NamedValue; import com.sun.star.container.XNameAccess; import java.io.PrintWriter; -import lib.Status; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -87,23 +85,12 @@ public class TypeDetection extends TestCase { */ @Override protected TestEnvironment createTestEnvironment - (TestParameters Param, PrintWriter log) { + (TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; Object oInterface = null ; - try { - oInterface = Param.getMSF().createInstance - ("com.sun.star.document.TypeDetection") ; - } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't get service"); - e.printStackTrace(log); - throw new StatusException("Couldn't get TypeDetection", e ); - } - - if (oInterface == null) { - log.println("Service wasn't created") ; - throw new StatusException(Status.failed("Service wasn't created")) ; - } + oInterface = Param.getMSF().createInstance + ("com.sun.star.document.TypeDetection") ; oObj = (XInterface) oInterface ; log.println("ImplName: "+utils.getImplName(oObj)); @@ -116,13 +103,7 @@ public class TypeDetection extends TestCase { String[] elementNames = xNA.getElementNames(); String elementName = elementNames[0]; Object[] instance = null; - try{ - instance = (Object[]) xNA.getByName(elementName); - } catch (com.sun.star.container.NoSuchElementException e){ - throw new StatusException(e, Status.failed("Couldn't get elements from object")); - } catch (com.sun.star.lang.WrappedTargetException e){ - throw new StatusException(e, Status.failed("Couldn't get elements from object")); - } + instance = (Object[]) xNA.getByName(elementName); log.println("adding INSTANCE 1 as obj relation to environment"); @@ -140,22 +121,16 @@ public class TypeDetection extends TestCase { log.println("create text document with bookmarks"); SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF() ); String fileURL = null; - try { - xTextDoc = SOF.createTextDoc( null ); - XInterface xBookMark = SOfficeFactory.createBookmark( xTextDoc ); - SOfficeFactory.insertTextContent( xTextDoc, (XTextContent) xBookMark ); - - fileURL = utils.getOfficeTemp(Param.getMSF() ); - fileURL = fileURL + "bookmarks.oot"; + xTextDoc = SOF.createTextDoc( null ); + XInterface xBookMark = SOfficeFactory.createBookmark( xTextDoc ); + SOfficeFactory.insertTextContent( xTextDoc, (XTextContent) xBookMark ); - XStorable store = UnoRuntime.queryInterface(XStorable.class, xTextDoc); - System.out.println(fileURL); - store.storeToURL(fileURL, new PropertyValue[0]); + fileURL = utils.getOfficeTemp(Param.getMSF() ); + fileURL = fileURL + "bookmarks.oot"; - } catch( com.sun.star.uno.Exception e ) { - e.printStackTrace( log ); - throw new StatusException( "Couldn't create Bookmark", e ); - } + XStorable store = UnoRuntime.queryInterface(XStorable.class, xTextDoc); + System.out.println(fileURL); + store.storeToURL(fileURL, new PropertyValue[0]); tEnv.addObjRelation("XContainerQuery.createSubSetEnumerationByProperties", querySequenze); diff --git a/qadevOOo/tests/java/mod/_i18n/BreakIterator.java b/qadevOOo/tests/java/mod/_i18n/BreakIterator.java index 5c5279b36e28..153a210b5c8b 100644 --- a/qadevOOo/tests/java/mod/_i18n/BreakIterator.java +++ b/qadevOOo/tests/java/mod/_i18n/BreakIterator.java @@ -77,20 +77,10 @@ public class BreakIterator extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { - XInterface oObj = null; - Object oInterface = null; - - try { - XMultiServiceFactory xMSF = Param.getMSF(); - oInterface = xMSF.createInstance( "com.sun.star.i18n.BreakIterator" ); - } - catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } - - oObj = (XInterface) oInterface; + throws Exception { + XMultiServiceFactory xMSF = Param.getMSF(); + Object oInterface = xMSF.createInstance( "com.sun.star.i18n.BreakIterator" ); + XInterface oObj = (XInterface) oInterface; TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_i18n/CalendarImpl.java b/qadevOOo/tests/java/mod/_i18n/CalendarImpl.java index 943f39c49ac7..3c7fdee7b3f7 100644 --- a/qadevOOo/tests/java/mod/_i18n/CalendarImpl.java +++ b/qadevOOo/tests/java/mod/_i18n/CalendarImpl.java @@ -20,7 +20,6 @@ package mod._i18n; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -46,21 +45,11 @@ public class CalendarImpl extends TestCase { */ @Override protected TestEnvironment createTestEnvironment - (TestParameters Param, PrintWriter log) { - XInterface oObj = null; - Object oInterface = null; - - try { - XMultiServiceFactory xMSF = Param.getMSF(); - oInterface = xMSF.createInstance - ( "com.sun.star.i18n.LocaleCalendar" ); - } - catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } - - oObj = (XInterface) oInterface; + (TestParameters Param, PrintWriter log) throws Exception { + XMultiServiceFactory xMSF = Param.getMSF(); + Object oInterface = xMSF.createInstance + ( "com.sun.star.i18n.LocaleCalendar" ); + XInterface oObj = (XInterface) oInterface; TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_i18n/ChapterCollator.java b/qadevOOo/tests/java/mod/_i18n/ChapterCollator.java index 021824e0a101..4a8ecb338b9c 100644 --- a/qadevOOo/tests/java/mod/_i18n/ChapterCollator.java +++ b/qadevOOo/tests/java/mod/_i18n/ChapterCollator.java @@ -20,7 +20,6 @@ package mod._i18n; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -51,21 +50,11 @@ public class ChapterCollator extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { - XInterface oObj = null; - Object oInterface = null; - - try { - XMultiServiceFactory xMSF = Param.getMSF(); - oInterface = xMSF.createInstance - ( "com.sun.star.i18n.ChapterCollator" ); - } - catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } - - oObj = (XInterface) oInterface; + throws Exception { + XMultiServiceFactory xMSF = Param.getMSF(); + Object oInterface = xMSF.createInstance + ( "com.sun.star.i18n.ChapterCollator" ); + XInterface oObj = (XInterface) oInterface; TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_i18n/CharacterClassification.java b/qadevOOo/tests/java/mod/_i18n/CharacterClassification.java index b673c2ec91ff..a2c8b8b6c2ea 100644 --- a/qadevOOo/tests/java/mod/_i18n/CharacterClassification.java +++ b/qadevOOo/tests/java/mod/_i18n/CharacterClassification.java @@ -20,7 +20,6 @@ package mod._i18n; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -53,21 +52,11 @@ public class CharacterClassification extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { - XInterface oObj = null; - Object oInterface = null; - - try { - XMultiServiceFactory xMSF = Param.getMSF(); - oInterface = xMSF.createInstance - ( "com.sun.star.i18n.CharacterClassification" ); - } catch( com.sun.star.uno.Exception e ) { - log.println("CharacterClassification Service not available" ); - throw new StatusException - ( "CharacterClassification Service not available", e ); - } - - oObj = (XInterface) oInterface; + throws Exception { + XMultiServiceFactory xMSF = Param.getMSF(); + Object oInterface = xMSF.createInstance + ( "com.sun.star.i18n.CharacterClassification" ); + XInterface oObj = (XInterface) oInterface; log.println( " creating a new environment for CharacterClassification object" ); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_i18n/Collator.java b/qadevOOo/tests/java/mod/_i18n/Collator.java index f6c7a1b6aa77..6738f807265e 100644 --- a/qadevOOo/tests/java/mod/_i18n/Collator.java +++ b/qadevOOo/tests/java/mod/_i18n/Collator.java @@ -20,7 +20,6 @@ package mod._i18n; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -49,20 +48,10 @@ public class Collator extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { - XInterface oObj = null; - Object oInterface = null; - - try { - XMultiServiceFactory xMSF = Param.getMSF(); - oInterface = xMSF.createInstance( "com.sun.star.i18n.Collator" ); - } - catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } - - oObj = (XInterface) oInterface; + throws Exception { + XMultiServiceFactory xMSF = Param.getMSF(); + Object oInterface = xMSF.createInstance( "com.sun.star.i18n.Collator" ); + XInterface oObj = (XInterface) oInterface; TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_i18n/IndexEntrySupplier.java b/qadevOOo/tests/java/mod/_i18n/IndexEntrySupplier.java index 9e91b5f5db62..f27ed3e43b3e 100644 --- a/qadevOOo/tests/java/mod/_i18n/IndexEntrySupplier.java +++ b/qadevOOo/tests/java/mod/_i18n/IndexEntrySupplier.java @@ -20,7 +20,6 @@ package mod._i18n; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -53,21 +52,11 @@ public class IndexEntrySupplier extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { - XInterface oObj = null; - Object oInterface = null; - - try { - XMultiServiceFactory xMSF = Param.getMSF(); - oInterface = xMSF.createInstance - ( "com.sun.star.i18n.IndexEntrySupplier" ); - } - catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } - - oObj = (XInterface) oInterface; + throws Exception { + XMultiServiceFactory xMSF = Param.getMSF(); + Object oInterface = xMSF.createInstance + ( "com.sun.star.i18n.IndexEntrySupplier" ); + XInterface oObj = (XInterface) oInterface; TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_i18n/LocaleData.java b/qadevOOo/tests/java/mod/_i18n/LocaleData.java index 1ddc70704721..a99fc17a2260 100644 --- a/qadevOOo/tests/java/mod/_i18n/LocaleData.java +++ b/qadevOOo/tests/java/mod/_i18n/LocaleData.java @@ -20,7 +20,6 @@ package mod._i18n; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -53,19 +52,10 @@ public class LocaleData extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { - XInterface oObj = null; - Object oInterface = null; - - try { - XMultiServiceFactory xMSF = Param.getMSF(); - oInterface = xMSF.createInstance( "com.sun.star.i18n.LocaleData" ); - } catch( com.sun.star.uno.Exception e ) { - log.println("LocaleData Service not available" ); - throw new StatusException( "LocaleData Service not available", e ); - } - - oObj = (XInterface) oInterface; + throws Exception { + XMultiServiceFactory xMSF = Param.getMSF(); + Object oInterface = xMSF.createInstance( "com.sun.star.i18n.LocaleData" ); + XInterface oObj = (XInterface) oInterface; log.println( " creating a new environment for LocaleData object" ); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_i18n/NumberFormatCodeMapper.java b/qadevOOo/tests/java/mod/_i18n/NumberFormatCodeMapper.java index f75cd61948cf..92c42ac065d1 100644 --- a/qadevOOo/tests/java/mod/_i18n/NumberFormatCodeMapper.java +++ b/qadevOOo/tests/java/mod/_i18n/NumberFormatCodeMapper.java @@ -20,7 +20,6 @@ package mod._i18n; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -56,22 +55,11 @@ public class NumberFormatCodeMapper extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { - XInterface oObj = null; - Object oInterface = null; - - try { - XMultiServiceFactory xMSF = Param.getMSF(); - oInterface = xMSF.createInstance - ( "com.sun.star.i18n.NumberFormatCodeMapper" ); - } - catch( com.sun.star.uno.Exception e ) { - log.println("NumberFormatCodeMapper Service not available" ); - throw new StatusException - ( "NumberFormatCodeMapper Service not available", e ); - } - - oObj = (XInterface) oInterface; + throws Exception { + XMultiServiceFactory xMSF = Param.getMSF(); + Object oInterface = xMSF.createInstance + ( "com.sun.star.i18n.NumberFormatCodeMapper" ); + XInterface oObj = (XInterface) oInterface; log.println( " creating a new environment for NumberFormatCodeMapper object" ); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_i18n/Transliteration.java b/qadevOOo/tests/java/mod/_i18n/Transliteration.java index d4713e98d264..64a588c432b5 100644 --- a/qadevOOo/tests/java/mod/_i18n/Transliteration.java +++ b/qadevOOo/tests/java/mod/_i18n/Transliteration.java @@ -20,7 +20,6 @@ package mod._i18n; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -49,20 +48,10 @@ public class Transliteration extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { - XInterface oObj = null; - Object oInterface = null; - - try { - XMultiServiceFactory xMSF = Param.getMSF(); - oInterface = xMSF.createInstance( "com.sun.star.i18n.Transliteration" ); - } - catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } - - oObj = (XInterface) oInterface; + throws Exception { + XMultiServiceFactory xMSF = Param.getMSF(); + Object oInterface = xMSF.createInstance( "com.sun.star.i18n.Transliteration" ); + XInterface oObj = (XInterface) oInterface; TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_implreg/uno/ImplementationRegistration.java b/qadevOOo/tests/java/mod/_implreg/uno/ImplementationRegistration.java index b07e10d7698e..4ebdb8ac9188 100644 --- a/qadevOOo/tests/java/mod/_implreg/uno/ImplementationRegistration.java +++ b/qadevOOo/tests/java/mod/_implreg/uno/ImplementationRegistration.java @@ -46,22 +46,11 @@ public class ImplementationRegistration extends TestCase { * <code>com.sun.star.registry.ImplementationRegistration</code>. */ @Override - protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { - XInterface oObj = null; - Object oInterface = null; - - try { - XMultiServiceFactory xMSF = Param.getMSF(); - oInterface = xMSF.createInstance - ( "com.sun.star.registry.ImplementationRegistration" ); - } catch( com.sun.star.uno.Exception e ) { - log.println("Service not available" ); - } - - if (oInterface == null) - log.println("Service wasn't created") ; - - oObj = (XInterface) oInterface; + protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { + XMultiServiceFactory xMSF = Param.getMSF(); + Object oInterface = xMSF.createInstance + ( "com.sun.star.registry.ImplementationRegistration" ); + XInterface oObj = (XInterface) oInterface; log.println( " creating a new environment for object" ); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_impreg/ImplementationRegistration.java b/qadevOOo/tests/java/mod/_impreg/ImplementationRegistration.java index 2418898d5bac..29f843bc920d 100644 --- a/qadevOOo/tests/java/mod/_impreg/ImplementationRegistration.java +++ b/qadevOOo/tests/java/mod/_impreg/ImplementationRegistration.java @@ -20,7 +20,6 @@ package mod._impreg; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -51,22 +50,11 @@ public class ImplementationRegistration extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { - XInterface oObj = null; - Object oInterface = null; - - try { - XMultiServiceFactory xMSF = Param.getMSF(); - oInterface = xMSF.createInstance - ( "com.sun.star.registry.ImplementationRegistration" ); - } catch( com.sun.star.uno.Exception e ) { - log.println("Service not available" ); - } - - if (oInterface == null) - log.println("Service wasn't created") ; - - oObj = (XInterface) oInterface; + throws Exception { + XMultiServiceFactory xMSF = Param.getMSF(); + Object oInterface = xMSF.createInstance + ( "com.sun.star.registry.ImplementationRegistration" ); + XInterface oObj = (XInterface) oInterface; log.println( " creating a new environment for object" ); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_insp/Introspection.java b/qadevOOo/tests/java/mod/_insp/Introspection.java index 174a22ccbd0a..de99047ae07c 100644 --- a/qadevOOo/tests/java/mod/_insp/Introspection.java +++ b/qadevOOo/tests/java/mod/_insp/Introspection.java @@ -20,7 +20,6 @@ package mod._insp; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -50,18 +49,11 @@ public class Introspection extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { - XInterface oObj = null; - Object oInterface = null; - - try { - XMultiServiceFactory xMSF = Param.getMSF(); - oInterface = xMSF.createInstance - ( "com.sun.star.comp.stoc.Introspection" ); - } catch( com.sun.star.uno.Exception e ) { - log.println("Introspection Service not available" ); - } - oObj = (XInterface) oInterface; + throws Exception { + XMultiServiceFactory xMSF = Param.getMSF(); + Object oInterface = xMSF.createInstance + ( "com.sun.star.comp.stoc.Introspection" ); + XInterface oObj = (XInterface) oInterface; log.println( " creating a new environment for Introspection object" ); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_introspection/uno/Introspection.java b/qadevOOo/tests/java/mod/_introspection/uno/Introspection.java index 93d4a2314ae7..3a5e9ae24c99 100644 --- a/qadevOOo/tests/java/mod/_introspection/uno/Introspection.java +++ b/qadevOOo/tests/java/mod/_introspection/uno/Introspection.java @@ -45,18 +45,11 @@ public class Introspection extends TestCase { * Creates service <code>com.sun.star.comp.stoc.Introspection</code>. */ @Override - protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { - XInterface oObj = null; - Object oInterface = null; - - try { - XMultiServiceFactory xMSF = Param.getMSF(); - oInterface = xMSF.createInstance - ( "com.sun.star.comp.stoc.Introspection" ); - } catch( com.sun.star.uno.Exception e ) { - log.println("Introspection Service not available" ); - } - oObj = (XInterface) oInterface; + protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { + XMultiServiceFactory xMSF = Param.getMSF(); + Object oInterface = xMSF.createInstance + ( "com.sun.star.comp.stoc.Introspection" ); + XInterface oObj = (XInterface) oInterface; log.println( " creating a new environment for Introspection object" ); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_inv/Invocation.java b/qadevOOo/tests/java/mod/_inv/Invocation.java index 87cf3875c0fe..0264fef40416 100644 --- a/qadevOOo/tests/java/mod/_inv/Invocation.java +++ b/qadevOOo/tests/java/mod/_inv/Invocation.java @@ -20,7 +20,6 @@ package mod._inv; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -65,34 +64,29 @@ public class Invocation extends TestCase { * </ul> */ @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF(); - try { - XInterface xInt = (XInterface)xMSF.createInstance( - "com.sun.star.script.Invocation"); + XInterface xInt = (XInterface)xMSF.createInstance( + "com.sun.star.script.Invocation"); - TestEnvironment tEnv = new TestEnvironment(xInt); + TestEnvironment tEnv = new TestEnvironment(xInt); - // the createInstance should fail according to the documentation - tEnv.addObjRelation( - "XSingleServiceFactory.createInstance.negative", "true"); + // the createInstance should fail according to the documentation + tEnv.addObjRelation( + "XSingleServiceFactory.createInstance.negative", "true"); - // creating parameters to createInstanceWithArguments - Object[] args = new Object[1]; + // creating parameters to createInstanceWithArguments + Object[] args = new Object[1]; - args[0] = xMSF.createInstance("com.suns.star.io.Pipe"); + args[0] = xMSF.createInstance("com.suns.star.io.Pipe"); - tEnv.addObjRelation( - "XSingleServiceFactory.arguments", args); + tEnv.addObjRelation( + "XSingleServiceFactory.arguments", args); - tEnv.addObjRelation("XSingleServiceFactory.MustSupport", - new Class[] {com.sun.star.script.XInvocation.class}); + tEnv.addObjRelation("XSingleServiceFactory.MustSupport", + new Class[] {com.sun.star.script.XInvocation.class}); - return tEnv; - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Unexpected exception", e); - } + return tEnv; } } diff --git a/qadevOOo/tests/java/mod/_invadp/InvocationAdapterFactory.java b/qadevOOo/tests/java/mod/_invadp/InvocationAdapterFactory.java index 3093183b529d..2817acce14bd 100644 --- a/qadevOOo/tests/java/mod/_invadp/InvocationAdapterFactory.java +++ b/qadevOOo/tests/java/mod/_invadp/InvocationAdapterFactory.java @@ -20,7 +20,6 @@ package mod._invadp; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -49,19 +48,14 @@ public class InvocationAdapterFactory extends TestCase { * <code>com.sun.star.script.InvocationAdapterFactory</code>. */ @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF(); - try { - XInterface xInt = (XInterface)xMSF.createInstance( - "com.sun.star.script.InvocationAdapterFactory"); + XInterface xInt = (XInterface)xMSF.createInstance( + "com.sun.star.script.InvocationAdapterFactory"); - TestEnvironment tEnv = new TestEnvironment(xInt); + TestEnvironment tEnv = new TestEnvironment(xInt); - return tEnv; - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Unexpected exception", e); - } + return tEnv; } } diff --git a/qadevOOo/tests/java/mod/_invocadapt/uno/InvocationAdapterFactory.java b/qadevOOo/tests/java/mod/_invocadapt/uno/InvocationAdapterFactory.java index 3b603060213b..dd9753782846 100644 --- a/qadevOOo/tests/java/mod/_invocadapt/uno/InvocationAdapterFactory.java +++ b/qadevOOo/tests/java/mod/_invocadapt/uno/InvocationAdapterFactory.java @@ -21,7 +21,6 @@ package mod._invocadapt.uno; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.XInterface; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -48,19 +47,14 @@ public class InvocationAdapterFactory extends TestCase { */ @Override protected TestEnvironment createTestEnvironment( - TestParameters tParam, PrintWriter log) { + TestParameters tParam, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF(); - try { - XInterface xInt = (XInterface)xMSF.createInstance( - "com.sun.star.script.InvocationAdapterFactory"); + XInterface xInt = (XInterface)xMSF.createInstance( + "com.sun.star.script.InvocationAdapterFactory"); - TestEnvironment tEnv = new TestEnvironment(xInt); + TestEnvironment tEnv = new TestEnvironment(xInt); - return tEnv; - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Unexpected exception", e); - } + return tEnv; } } diff --git a/qadevOOo/tests/java/mod/_invocation/uno/Invocation.java b/qadevOOo/tests/java/mod/_invocation/uno/Invocation.java index 5c8573b8a499..92c765920fd4 100644 --- a/qadevOOo/tests/java/mod/_invocation/uno/Invocation.java +++ b/qadevOOo/tests/java/mod/_invocation/uno/Invocation.java @@ -21,7 +21,6 @@ package mod._invocation.uno; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.XInterface; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -63,34 +62,29 @@ public class Invocation extends TestCase { * </ul> */ @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF(); - try { - XInterface xInt = (XInterface)xMSF.createInstance( - "com.sun.star.script.Invocation"); + XInterface xInt = (XInterface)xMSF.createInstance( + "com.sun.star.script.Invocation"); - TestEnvironment tEnv = new TestEnvironment(xInt); + TestEnvironment tEnv = new TestEnvironment(xInt); - // the createInstance should fail according to the documentation - tEnv.addObjRelation( - "XSingleServiceFactory.createInstance.negative", "true"); + // the createInstance should fail according to the documentation + tEnv.addObjRelation( + "XSingleServiceFactory.createInstance.negative", "true"); - // creating parameters to createInstanceWithArguments - Object[] args = new Object[1]; + // creating parameters to createInstanceWithArguments + Object[] args = new Object[1]; - args[0] = xMSF.createInstance("com.suns.star.io.Pipe"); + args[0] = xMSF.createInstance("com.suns.star.io.Pipe"); - tEnv.addObjRelation( - "XSingleServiceFactory.arguments", args); + tEnv.addObjRelation( + "XSingleServiceFactory.arguments", args); - tEnv.addObjRelation("XSingleServiceFactory.MustSupport", - new Class[] {com.sun.star.script.XInvocation.class}); + tEnv.addObjRelation("XSingleServiceFactory.MustSupport", + new Class[] {com.sun.star.script.XInvocation.class}); - return tEnv; - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Unexpected exception", e); - } + return tEnv; } } diff --git a/qadevOOo/tests/java/mod/_javaloader/JavaComponentLoader.java b/qadevOOo/tests/java/mod/_javaloader/JavaComponentLoader.java index f74610d989d5..0a40e58ca6b0 100644 --- a/qadevOOo/tests/java/mod/_javaloader/JavaComponentLoader.java +++ b/qadevOOo/tests/java/mod/_javaloader/JavaComponentLoader.java @@ -20,7 +20,6 @@ package mod._javaloader; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -59,20 +58,11 @@ public class JavaComponentLoader extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { - XInterface oObj = null; - Object oInterface = null; - - try { - XMultiServiceFactory xMSF = Param.getMSF(); - oInterface = xMSF.createInstance( - "com.sun.star.comp.stoc.JavaComponentLoader" ); - } - catch( Exception e ) { - log.println("JavaComponentLoader Service not available" ); - } - - oObj = (XInterface) oInterface; + throws Exception { + XMultiServiceFactory xMSF = Param.getMSF(); + Object oInterface = xMSF.createInstance( + "com.sun.star.comp.stoc.JavaComponentLoader" ); + XInterface oObj = (XInterface) oInterface; log.println( " creating a new environment for JavaComponentLoader object" ); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_javaloader/uno/JavaComponentLoader.java b/qadevOOo/tests/java/mod/_javaloader/uno/JavaComponentLoader.java index 289fb0df8f13..99bdeb76af43 100644 --- a/qadevOOo/tests/java/mod/_javaloader/uno/JavaComponentLoader.java +++ b/qadevOOo/tests/java/mod/_javaloader/uno/JavaComponentLoader.java @@ -54,20 +54,12 @@ public class JavaComponentLoader extends TestCase { * </ul> */ @Override - protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { - XInterface oObj = null; - Object oInterface = null; + protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { - try { - XMultiServiceFactory xMSF = Param.getMSF(); - oInterface = xMSF.createInstance( - "com.sun.star.comp.stoc.JavaComponentLoader" ); - } - catch( Exception e ) { - log.println("JavaComponentLoader Service not available" ); - } - - oObj = (XInterface) oInterface; + XMultiServiceFactory xMSF = Param.getMSF(); + Object oInterface = xMSF.createInstance( + "com.sun.star.comp.stoc.JavaComponentLoader" ); + XInterface oObj = (XInterface) oInterface; log.println( " creating a new environment for JavaComponentLoader object" ); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_javavm/uno/JavaVirtualMachine.java b/qadevOOo/tests/java/mod/_javavm/uno/JavaVirtualMachine.java index 4ca77d53729d..b454476365a3 100644 --- a/qadevOOo/tests/java/mod/_javavm/uno/JavaVirtualMachine.java +++ b/qadevOOo/tests/java/mod/_javavm/uno/JavaVirtualMachine.java @@ -21,7 +21,6 @@ package mod._javavm.uno; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.XInterface; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -51,17 +50,12 @@ public class JavaVirtualMachine extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters tParam, - PrintWriter log) { + PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF(); - try { - XInterface xInt = (XInterface)xMSF.createInstance( - "com.sun.star.java.JavaVirtualMachine"); + XInterface xInt = (XInterface)xMSF.createInstance( + "com.sun.star.java.JavaVirtualMachine"); - return new TestEnvironment(xInt); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Unexpected exception", e); - } + return new TestEnvironment(xInt); } } diff --git a/qadevOOo/tests/java/mod/_jdbc/JDBCDriver.java b/qadevOOo/tests/java/mod/_jdbc/JDBCDriver.java index 423d6b17d1e2..f20cb8348404 100644 --- a/qadevOOo/tests/java/mod/_jdbc/JDBCDriver.java +++ b/qadevOOo/tests/java/mod/_jdbc/JDBCDriver.java @@ -57,16 +57,10 @@ public class JDBCDriver extends TestCase { * </ul> */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { - XInterface oObj = null; - - try { - oObj = (XInterface)Param.getMSF().createInstance( - "com.sun.star.comp.sdbc.JDBCDriver"); - } catch (com.sun.star.uno.Exception e) { - throw new StatusException(e, Status.failed("Couldn't create object")); - } + XInterface oObj = (XInterface)Param.getMSF().createInstance( + "com.sun.star.comp.sdbc.JDBCDriver"); log.println("creating a new environment for JDBCDriver object"); TestEnvironment tEnv = new TestEnvironment(oObj); diff --git a/qadevOOo/tests/java/mod/_jen/JavaVirtualMachine.java b/qadevOOo/tests/java/mod/_jen/JavaVirtualMachine.java index 82716a71c9e2..2a27fda8cc5b 100644 --- a/qadevOOo/tests/java/mod/_jen/JavaVirtualMachine.java +++ b/qadevOOo/tests/java/mod/_jen/JavaVirtualMachine.java @@ -20,7 +20,6 @@ package mod._jen; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -53,17 +52,12 @@ public class JavaVirtualMachine extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters tParam, - PrintWriter log) { + PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF(); - try { - XInterface xInt = (XInterface)xMSF.createInstance( - "com.sun.star.java.JavaVirtualMachine"); + XInterface xInt = (XInterface)xMSF.createInstance( + "com.sun.star.java.JavaVirtualMachine"); - return new TestEnvironment(xInt); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Unexpected exception", e); - } + return new TestEnvironment(xInt); } } diff --git a/qadevOOo/tests/java/mod/_lng/DicList.java b/qadevOOo/tests/java/mod/_lng/DicList.java index 4d2bc6710312..bf3acf14d874 100644 --- a/qadevOOo/tests/java/mod/_lng/DicList.java +++ b/qadevOOo/tests/java/mod/_lng/DicList.java @@ -20,7 +20,6 @@ package mod._lng; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -63,21 +62,14 @@ public class DicList extends TestCase { * <code>com.sun.star.lingu2.DicList</code>. Then two dictionaries * are created (positive and negative) and added to the list, one * entry is added to each of dictionaries and they both are activated. - * The distionary list is retruned as a component for testing. + * The dictionary list is returned as a component for testing. */ @Override public synchronized TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { + throws Exception { XMultiServiceFactory xMSF = Param.getMSF(); - XInterface oObj = null; - - try { - oObj = (XInterface)xMSF.createInstance("com.sun.star.lingu2.DicList"); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Unexpected exception", e); - } + XInterface oObj = (XInterface)xMSF.createInstance("com.sun.star.lingu2.DicList"); String Iname = util.utils.getImplName(oObj); log.println("Implementation Name: "+Iname); diff --git a/qadevOOo/tests/java/mod/_lng/LinguProps.java b/qadevOOo/tests/java/mod/_lng/LinguProps.java index 5beeb5c283cf..15af6bb3b801 100644 --- a/qadevOOo/tests/java/mod/_lng/LinguProps.java +++ b/qadevOOo/tests/java/mod/_lng/LinguProps.java @@ -20,7 +20,6 @@ package mod._lng; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -65,18 +64,11 @@ public class LinguProps extends TestCase { @Override public synchronized TestEnvironment createTestEnvironment ( TestParameters Param, PrintWriter log ) - throws StatusException { + throws Exception { XMultiServiceFactory xMSF = Param.getMSF(); - XInterface oObj = null; - - try { - oObj = (XInterface)xMSF.createInstance - ("com.sun.star.linguistic2.LinguProperties"); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Unexpected exception", e); - } + XInterface oObj = (XInterface)xMSF.createInstance + ("com.sun.star.linguistic2.LinguProperties"); String Iname = util.utils.getImplName(oObj); log.println("Implementation Name: "+Iname); diff --git a/qadevOOo/tests/java/mod/_lng/LngSvcMgr.java b/qadevOOo/tests/java/mod/_lng/LngSvcMgr.java index 7a0b1eee4768..787300df3c34 100644 --- a/qadevOOo/tests/java/mod/_lng/LngSvcMgr.java +++ b/qadevOOo/tests/java/mod/_lng/LngSvcMgr.java @@ -20,7 +20,6 @@ package mod._lng; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -59,18 +58,11 @@ public class LngSvcMgr extends TestCase { @Override public synchronized TestEnvironment createTestEnvironment ( TestParameters Param, PrintWriter log ) - throws StatusException { + throws Exception { XMultiServiceFactory xMSF = Param.getMSF(); - XInterface oObj = null; - - try { - oObj = (XInterface)xMSF.createInstance + XInterface oObj = (XInterface)xMSF.createInstance ("com.sun.star.linguistic2.LinguServiceManager"); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Unexpected exception", e); - } String Iname = util.utils.getImplName(oObj); log.println("Implementation Name: "+Iname); diff --git a/qadevOOo/tests/java/mod/_lnn/Hyphenator.java b/qadevOOo/tests/java/mod/_lnn/Hyphenator.java index 4f3a20d690db..ebc41fa19407 100644 --- a/qadevOOo/tests/java/mod/_lnn/Hyphenator.java +++ b/qadevOOo/tests/java/mod/_lnn/Hyphenator.java @@ -20,7 +20,6 @@ package mod._lnn; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -73,22 +72,15 @@ public class Hyphenator extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment - (TestParameters Param, PrintWriter log) { + (TestParameters Param, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = Param.getMSF(); - XInterface oObj = null; - - try { - oObj = (XInterface)xMSF.createInstance - ("com.sun.star.linguistic2.Hyphenator"); - Object LP = xMSF.createInstance - ("com.sun.star.linguistic2.LinguProperties"); - XPropertySet LProps = UnoRuntime.queryInterface(XPropertySet.class,LP); - LProps.setPropertyValue("IsGermanPreReform",Boolean.TRUE); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Unexpected exception", e); - } + XInterface oObj = (XInterface)xMSF.createInstance + ("com.sun.star.linguistic2.Hyphenator"); + Object LP = xMSF.createInstance + ("com.sun.star.linguistic2.LinguProperties"); + XPropertySet LProps = UnoRuntime.queryInterface(XPropertySet.class,LP); + LProps.setPropertyValue("IsGermanPreReform",Boolean.TRUE); String Iname = util.utils.getImplName(oObj); log.println("Implementation Name: "+Iname); diff --git a/qadevOOo/tests/java/mod/_lnn/SpellChecker.java b/qadevOOo/tests/java/mod/_lnn/SpellChecker.java index 8653f8e0b3b6..2c16edb8e08f 100644 --- a/qadevOOo/tests/java/mod/_lnn/SpellChecker.java +++ b/qadevOOo/tests/java/mod/_lnn/SpellChecker.java @@ -20,7 +20,6 @@ package mod._lnn; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -72,20 +71,12 @@ public class SpellChecker extends TestCase { */ @Override protected TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log) { + (TestParameters tParam, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF(); - XInterface oObj = null; - Object LinguServiceManager = null; - - try { - oObj = (XInterface)xMSF.createInstance - ("com.sun.star.lingu2.SpellChecker"); - LinguServiceManager = xMSF.createInstance - ("com.sun.star.linguistic2.LinguServiceManager"); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Unexpected exception", e); - } + XInterface oObj = (XInterface)xMSF.createInstance + ("com.sun.star.lingu2.SpellChecker"); + Object LinguServiceManager = xMSF.createInstance + ("com.sun.star.linguistic2.LinguServiceManager"); String Iname = util.utils.getImplName(oObj); log.println("Implementation Name: "+Iname); diff --git a/qadevOOo/tests/java/mod/_mcnttype/MimeContentTypeFactory.java b/qadevOOo/tests/java/mod/_mcnttype/MimeContentTypeFactory.java index 6f8b2e1a23a8..771f3e9e2081 100644 --- a/qadevOOo/tests/java/mod/_mcnttype/MimeContentTypeFactory.java +++ b/qadevOOo/tests/java/mod/_mcnttype/MimeContentTypeFactory.java @@ -20,7 +20,6 @@ package mod._mcnttype; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -57,21 +56,11 @@ public class MimeContentTypeFactory extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { - XInterface oObj = null; - Object oInterface = null; + throws Exception { XMultiServiceFactory xMSF = Param.getMSF(); - - - try { - oInterface = xMSF.createInstance - ( "com.sun.star.datatransfer.MimeContentTypeFactory" ); - } catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } - - oObj = (XInterface) oInterface; + Object oInterface = xMSF.createInstance + ( "com.sun.star.datatransfer.MimeContentTypeFactory" ); + XInterface oObj = (XInterface) oInterface; TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_mozab/MozabDriver.java b/qadevOOo/tests/java/mod/_mozab/MozabDriver.java index b0c0072e94f5..86bebe8c51a5 100644 --- a/qadevOOo/tests/java/mod/_mozab/MozabDriver.java +++ b/qadevOOo/tests/java/mod/_mozab/MozabDriver.java @@ -58,16 +58,10 @@ public class MozabDriver extends TestCase { * </ul> */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { - XInterface oObj = null; - - try { - oObj = (XInterface)Param.getMSF(). - createInstance("com.sun.star.comp.sdbc.MozabDriver"); - } catch (com.sun.star.uno.Exception e) { - throw new StatusException(e, Status.failed("Couldn't create object")); - } + XInterface oObj = (XInterface)Param.getMSF(). + createInstance("com.sun.star.comp.sdbc.MozabDriver"); log.println("creating a new environment for object"); TestEnvironment tEnv = new TestEnvironment(oObj); diff --git a/qadevOOo/tests/java/mod/_namingservice/NamingService.java b/qadevOOo/tests/java/mod/_namingservice/NamingService.java index bf4694386b9f..5e2d70550dbd 100644 --- a/qadevOOo/tests/java/mod/_namingservice/NamingService.java +++ b/qadevOOo/tests/java/mod/_namingservice/NamingService.java @@ -20,7 +20,6 @@ package mod._namingservice; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -59,7 +58,7 @@ public class NamingService extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { + throws Exception { XInterface oObj = null; Object oInterface = null; @@ -78,14 +77,9 @@ public class NamingService extends TestCase { TestEnvironment tEnv = new TestEnvironment( oObj ); // objRelation for XNamingService as object to be registered - try { - tEnv.addObjRelation("XNamingService.RegisterObject", - Param.getMSF().createInstance - ("com.sun.star.lang.ServiceManager")) ; - } catch (com.sun.star.uno.Exception e) { - log.println("Can't create object relation") ; - throw new StatusException("Can't create object relation", e) ; - } + tEnv.addObjRelation("XNamingService.RegisterObject", + Param.getMSF().createInstance + ("com.sun.star.lang.ServiceManager")) ; return tEnv; } // finish method getTestEnvironment diff --git a/qadevOOo/tests/java/mod/_namingservice/uno/NamingService.java b/qadevOOo/tests/java/mod/_namingservice/uno/NamingService.java index c28f52f642d7..3c33d8272f54 100644 --- a/qadevOOo/tests/java/mod/_namingservice/uno/NamingService.java +++ b/qadevOOo/tests/java/mod/_namingservice/uno/NamingService.java @@ -21,7 +21,6 @@ package mod._namingservice.uno; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.XInterface; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -55,7 +54,7 @@ public class NamingService 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; XMultiServiceFactory xMSF = null; @@ -75,14 +74,9 @@ public class NamingService extends TestCase { TestEnvironment tEnv = new TestEnvironment( oObj ); // objRelation for XNamingService as object to be registered - try { - tEnv.addObjRelation("XNamingService.RegisterObject", - xMSF.createInstance - ("com.sun.star.lang.ServiceManager")) ; - } catch (com.sun.star.uno.Exception e) { - log.println("Can't create object relation") ; - throw new StatusException("Can't create object relation", e) ; - } + tEnv.addObjRelation("XNamingService.RegisterObject", + xMSF.createInstance + ("com.sun.star.lang.ServiceManager")) ; return tEnv; } // finish method getTestEnvironment diff --git a/qadevOOo/tests/java/mod/_nestedreg/uno/NestedRegistry.java b/qadevOOo/tests/java/mod/_nestedreg/uno/NestedRegistry.java index e4ec34eb4bd3..a5e18932db92 100644 --- a/qadevOOo/tests/java/mod/_nestedreg/uno/NestedRegistry.java +++ b/qadevOOo/tests/java/mod/_nestedreg/uno/NestedRegistry.java @@ -25,7 +25,6 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -127,7 +126,7 @@ public class NestedRegistry 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; @@ -140,15 +139,9 @@ public class NestedRegistry extends TestCase { uniq++ ; log.println("creating copies of the registry for XSimpleRegistry"); - try { - String source = utils.getFullTestDocName("XSimpleRegistry.rdb"); - copyFile(source, openF) ; - copyFile(source, mergeF) ; - } catch (java.io.IOException e) { - log.println("Exception occurred while copying files"); - e.printStackTrace(log); - throw new StatusException("Exception occurred while copying files", e); - } + String source = utils.getFullTestDocName("XSimpleRegistry.rdb"); + copyFile(source, openF) ; + copyFile(source, mergeF) ; try { XMultiServiceFactory xMSF = Param.getMSF(); diff --git a/qadevOOo/tests/java/mod/_odbc/ODBCDriver.java b/qadevOOo/tests/java/mod/_odbc/ODBCDriver.java index 9b7e96d55db0..d45217a2bc9a 100644 --- a/qadevOOo/tests/java/mod/_odbc/ODBCDriver.java +++ b/qadevOOo/tests/java/mod/_odbc/ODBCDriver.java @@ -54,16 +54,10 @@ public class ODBCDriver extends TestCase { * </ul> */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { - XInterface oObj = null; - - try { - oObj = (XInterface)Param.getMSF().createInstance( - "com.sun.star.comp.sdbc.ODBCDriver"); - } catch (com.sun.star.uno.Exception e) { - throw new StatusException(e, Status.failed("Couldn't create object")); - } + XInterface oObj = (XInterface)Param.getMSF().createInstance( + "com.sun.star.comp.sdbc.ODBCDriver"); log.println("creating a new environment for ODBCDriver object"); TestEnvironment tEnv = new TestEnvironment(oObj); diff --git a/qadevOOo/tests/java/mod/_pcr/ObjectInspector.java b/qadevOOo/tests/java/mod/_pcr/ObjectInspector.java index d2f819981371..3bba0ae1b647 100644 --- a/qadevOOo/tests/java/mod/_pcr/ObjectInspector.java +++ b/qadevOOo/tests/java/mod/_pcr/ObjectInspector.java @@ -97,85 +97,72 @@ public class ObjectInspector extends TestCase { * @see helper.PropertyHandlerImpl */ @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { this.cleanup(tParam, log); XMultiServiceFactory xMSF = tParam.getMSF(); - try { - XInterface oInspector = (XInterface) xMSF.createInstance("com.sun.star.inspection.ObjectInspector"); + XInterface oInspector = (XInterface) xMSF.createInstance("com.sun.star.inspection.ObjectInspector"); - XObjectInspector xInspector = UnoRuntime.queryInterface(XObjectInspector.class, oInspector); + XObjectInspector xInspector = UnoRuntime.queryInterface(XObjectInspector.class, oInspector); - log.println("ImplementationName '" + utils.getImplName(xInspector) + "'"); + log.println("ImplementationName '" + utils.getImplName(xInspector) + "'"); - XInterface oInspectorModel = (XInterface) xMSF.createInstance("com.sun.star.inspection.ObjectInspectorModel"); + XInterface oInspectorModel = (XInterface) xMSF.createInstance("com.sun.star.inspection.ObjectInspectorModel"); - XObjectInspectorModel xInspectorModel = UnoRuntime.queryInterface(XObjectInspectorModel.class, oInspectorModel); + XObjectInspectorModel xInspectorModel = UnoRuntime.queryInterface(XObjectInspectorModel.class, oInspectorModel); - XInterface oInspectorModelToSet = (XInterface) xMSF.createInstance("com.sun.star.inspection.ObjectInspectorModel"); + XInterface oInspectorModelToSet = (XInterface) xMSF.createInstance("com.sun.star.inspection.ObjectInspectorModel"); - XObjectInspectorModel xInspectorModelToSet = UnoRuntime.queryInterface(XObjectInspectorModel.class, oInspectorModelToSet); + XObjectInspectorModel xInspectorModelToSet = UnoRuntime.queryInterface(XObjectInspectorModel.class, oInspectorModelToSet); - log.println("create a floating frame..."); + log.println("create a floating frame..."); - XWindow xWindow = null; - try{ - - XWindowPeer xWindowPeer = DesktopTools.createFloatingWindow(xMSF); - - xWindow = UnoRuntime.queryInterface(XWindow.class, xWindowPeer); + XWindowPeer xWindowPeer = DesktopTools.createFloatingWindow(xMSF); - } catch (StatusException e){ - throw new StatusException("Coud not create test object", e); - } - - XInterface oFrame = (XInterface) xMSF.createInstance("com.sun.star.frame.Frame"); + XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, xWindowPeer); - XFrame xFrame = UnoRuntime.queryInterface(XFrame.class, oFrame); + XInterface oFrame = (XInterface) xMSF.createInstance("com.sun.star.frame.Frame"); - xFrame.setName("ObjectInspector"); - xFrame.initialize(xWindow); + XFrame xFrame = UnoRuntime.queryInterface(XFrame.class, oFrame); - XFramesSupplier xFramesSup = UnoRuntime.queryInterface(XFramesSupplier.class, StarDesktop); + xFrame.setName("ObjectInspector"); + xFrame.initialize(xWindow); - XFrames xFrames = xFramesSup.getFrames(); - xFrames.append(xFrame); + XFramesSupplier xFramesSup = UnoRuntime.queryInterface(XFramesSupplier.class, StarDesktop); + XFrames xFrames = xFramesSup.getFrames(); + xFrames.append(xFrame); - log.println("attach ObjectInspector to floating frame..."); - XInitialization xOII = UnoRuntime.queryInterface(XInitialization.class, xInspectorModel); + log.println("attach ObjectInspector to floating frame..."); - xOII.initialize(new Object[0]); + XInitialization xOII = UnoRuntime.queryInterface(XInitialization.class, xInspectorModel); - xInspector.setInspectorModel(xInspectorModel); + xOII.initialize(new Object[0]); - // for debug purposes the following lines could commented out. But in - // this case the com.sun.star.frame.XController would be failed! - //xInspector.attachFrame(xFrame); - //xWindow.setVisible(true); + xInspector.setInspectorModel(xInspectorModel); - Object[] oInspect = new Object[1]; - oInspect[0] = new PropertyHandlerImpl(); + // for debug purposes the following lines could commented out. But in + // this case the com.sun.star.frame.XController would be failed! + //xInspector.attachFrame(xFrame); + //xWindow.setVisible(true); - TestEnvironment tEnv = new TestEnvironment(xInspector); + Object[] oInspect = new Object[1]; + oInspect[0] = new PropertyHandlerImpl(); - // com.sun.star.frame.XController - tEnv.addObjRelation("Frame",xFrame); + TestEnvironment tEnv = new TestEnvironment(xInspector); - tEnv.addObjRelation("XObjectInspector.toInspect", oInspect); + // com.sun.star.frame.XController + tEnv.addObjRelation("Frame",xFrame); - tEnv.addObjRelation("XObjectInspector.InspectorModelToSet", xInspectorModelToSet); + tEnv.addObjRelation("XObjectInspector.toInspect", oInspect); - return tEnv; - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Unexpected exception", e); - } + tEnv.addObjRelation("XObjectInspector.InspectorModelToSet", xInspectorModelToSet); + return tEnv; } /** diff --git a/qadevOOo/tests/java/mod/_pcr/ObjectInspectorModel.java b/qadevOOo/tests/java/mod/_pcr/ObjectInspectorModel.java index bdf81b003683..dcb062727379 100644 --- a/qadevOOo/tests/java/mod/_pcr/ObjectInspectorModel.java +++ b/qadevOOo/tests/java/mod/_pcr/ObjectInspectorModel.java @@ -17,11 +17,9 @@ */ package mod._pcr; -import com.sun.star.beans.UnknownPropertyException; import com.sun.star.beans.XPropertySet; import com.sun.star.frame.XFrame; import com.sun.star.inspection.XObjectInspectorModel; -import com.sun.star.lang.WrappedTargetException; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XComponentContext; import com.sun.star.util.CloseVetoException; @@ -87,7 +85,7 @@ public class ObjectInspectorModel extends TestCase { * @see helper.PropertyHandlerImpl */ @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { this.cleanup(tParam, log); @@ -95,48 +93,32 @@ public class ObjectInspectorModel extends TestCase { XPropertySet xMSFProp = UnoRuntime.queryInterface(XPropertySet.class, xMSF); XComponentContext xDefaultContext = null; - try{ - // Get the default context from the office server. - Object oDefaultContext = xMSFProp.getPropertyValue("DefaultContext"); - - // Query for the interface XComponentContext. - xDefaultContext = UnoRuntime.queryInterface( - XComponentContext.class, oDefaultContext); - - } catch (UnknownPropertyException e){ - throw new StatusException("could not get DefaultContext from xMSF", e); - } catch (WrappedTargetException e){ - throw new StatusException("could not get DefaultContext from xMSF", e); - } catch (Exception e){ - throw new StatusException("could not get DefaultContext from xMSF", e); - } - - try { + // Get the default context from the office server. + Object oDefaultContext = xMSFProp.getPropertyValue("DefaultContext"); - Object[] oHandlerFactories = new Object[1]; - oHandlerFactories[0] = new PropertyHandlerFactroy(); + // Query for the interface XComponentContext. + xDefaultContext = UnoRuntime.queryInterface( + XComponentContext.class, oDefaultContext); - int minHelpTextLines = 200; - int maxHelpTextLines = 400; + Object[] oHandlerFactories = new Object[1]; + oHandlerFactories[0] = new PropertyHandlerFactroy(); - XObjectInspectorModel oInspectorModel = com.sun.star.inspection.ObjectInspectorModel. - createWithHandlerFactoriesAndHelpSection(xDefaultContext, oHandlerFactories, - minHelpTextLines, maxHelpTextLines); + int minHelpTextLines = 200; + int maxHelpTextLines = 400; - log.println("ImplementationName '" + utils.getImplName(oInspectorModel) + "'"); + XObjectInspectorModel oInspectorModel = com.sun.star.inspection.ObjectInspectorModel. + createWithHandlerFactoriesAndHelpSection(xDefaultContext, oHandlerFactories, + minHelpTextLines, maxHelpTextLines); - TestEnvironment tEnv = new TestEnvironment(oInspectorModel); + log.println("ImplementationName '" + utils.getImplName(oInspectorModel) + "'"); - // com.sun.star.inspection.XObjectInspectorModel - tEnv.addObjRelation("minHelpTextLines", Integer.valueOf(minHelpTextLines)); - tEnv.addObjRelation("maxHelpTextLines", Integer.valueOf(maxHelpTextLines)); + TestEnvironment tEnv = new TestEnvironment(oInspectorModel); - return tEnv; - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Unexpected exception", e); - } + // com.sun.star.inspection.XObjectInspectorModel + tEnv.addObjRelation("minHelpTextLines", Integer.valueOf(minHelpTextLines)); + tEnv.addObjRelation("maxHelpTextLines", Integer.valueOf(maxHelpTextLines)); + return tEnv; } /** diff --git a/qadevOOo/tests/java/mod/_proxyfac/ProxyFactory.java b/qadevOOo/tests/java/mod/_proxyfac/ProxyFactory.java index 073bcef31738..c04679c90b1d 100644 --- a/qadevOOo/tests/java/mod/_proxyfac/ProxyFactory.java +++ b/qadevOOo/tests/java/mod/_proxyfac/ProxyFactory.java @@ -20,7 +20,6 @@ package mod._proxyfac; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -51,20 +50,14 @@ public class ProxyFactory extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters tParam, - PrintWriter log) { + PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF(); - try { - XInterface xInt = (XInterface)xMSF.createInstance( - "com.sun.star.reflection.ProxyFactory"); + XInterface xInt = (XInterface)xMSF.createInstance( + "com.sun.star.reflection.ProxyFactory"); - TestEnvironment tEnv = new TestEnvironment(xInt); - - return tEnv; - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Unexpected exception", e); - } + TestEnvironment tEnv = new TestEnvironment(xInt); + return tEnv; } } diff --git a/qadevOOo/tests/java/mod/_proxyfac/uno/ProxyFactory.java b/qadevOOo/tests/java/mod/_proxyfac/uno/ProxyFactory.java index 46fb90d770b9..f9fdb4e9aa75 100644 --- a/qadevOOo/tests/java/mod/_proxyfac/uno/ProxyFactory.java +++ b/qadevOOo/tests/java/mod/_proxyfac/uno/ProxyFactory.java @@ -21,7 +21,6 @@ package mod._proxyfac.uno; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.XInterface; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -49,20 +48,14 @@ public class ProxyFactory extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters tParam, - PrintWriter log) { + PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF(); - try { - XInterface xInt = (XInterface)xMSF.createInstance( - "com.sun.star.reflection.ProxyFactory"); + XInterface xInt = (XInterface)xMSF.createInstance( + "com.sun.star.reflection.ProxyFactory"); - TestEnvironment tEnv = new TestEnvironment(xInt); - - return tEnv; - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Unexpected exception", e); - } + TestEnvironment tEnv = new TestEnvironment(xInt); + return tEnv; } } diff --git a/qadevOOo/tests/java/mod/_remotebridge/uno/various.java b/qadevOOo/tests/java/mod/_remotebridge/uno/various.java index deef50e274e8..b3307dbea659 100644 --- a/qadevOOo/tests/java/mod/_remotebridge/uno/various.java +++ b/qadevOOo/tests/java/mod/_remotebridge/uno/various.java @@ -170,79 +170,63 @@ public class various extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters tParam, - PrintWriter log) { + PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF(); - try { - XInterface xInt = (XInterface)xMSF.createInstance( - "com.sun.star.bridge.Bridge"); - - TestEnvironment tEnv = new TestEnvironment(xInt); - // creating arguments for XInitialization - // first, creating a connection - // connection string - String cncstr = (String) tParam.get("CONNECTION_STRING") ; - int idx = cncstr.indexOf("host=") + 5 ; - - // select the port - log.println("Choose Port nr: " + curPort); - - connectString = "socket,host=" + - cncstr.substring(idx, cncstr.indexOf(",", idx)) + - ",port=" + curPort; - - // create acceptor - XInterface oAcctr = (XInterface)xMSF.createInstance( - "com.sun.star.connection.Acceptor") ; - - xAcctr = UnoRuntime.queryInterface( - XAcceptor.class, oAcctr); - // create connector - XInterface oCntr = (XInterface)xMSF.createInstance( - "com.sun.star.connection.Connector") ; - xCntr = UnoRuntime.queryInterface( - XConnector.class, oCntr); - - // create bridge factory - XInterface oBrdg = (XInterface)xMSF.createInstance( - "com.sun.star.bridge.BridgeFactory") ; - xBrdgFctr = UnoRuntime.queryInterface(XBridgeFactory.class, oBrdg); - - // create own implementation of XInstanceProvider - XInstanceProvider xInstProv = new MyInstanceProvider(xMSF); - // create waiting acceptor thread - accThread = new AcceptorThread(xAcctr, xInstProv, xBrdgFctr); - accThread.start(); - // let the thread sleep - util.utils.pause(500); - - // establish the connection - XConnection xConnection = xCntr.connect(connectString); - - String protocol = "urp"; - String bridgeName = protocol + ":" + connectString; - -/* bridgeDisposed[0] = false ; - XComponent xComp = (XComponent)UnoRuntime.queryInterface( - XComponent.class, xInt); - final PrintWriter logF = log; - xComp.addEventListener(new XEventListener() { - public void disposing(EventObject ev) { - bridgeDisposed[0] = true ; - logF.println("The bridge Disposed."); - } - }); -*/ - tEnv.addObjRelation("XInitialization.args", new Object[] { - bridgeName, protocol, xConnection, null}); + XInterface xInt = (XInterface)xMSF.createInstance( + "com.sun.star.bridge.Bridge"); - bridge = tEnv.getTestObject(); + TestEnvironment tEnv = new TestEnvironment(xInt); + // creating arguments for XInitialization + // first, creating a connection + // connection string + String cncstr = (String) tParam.get("CONNECTION_STRING") ; + int idx = cncstr.indexOf("host=") + 5 ; - return tEnv; - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Unexpected exception", e); - } + // select the port + log.println("Choose Port nr: " + curPort); + + connectString = "socket,host=" + + cncstr.substring(idx, cncstr.indexOf(",", idx)) + + ",port=" + curPort; + + // create acceptor + XInterface oAcctr = (XInterface)xMSF.createInstance( + "com.sun.star.connection.Acceptor") ; + + xAcctr = UnoRuntime.queryInterface( + XAcceptor.class, oAcctr); + // create connector + XInterface oCntr = (XInterface)xMSF.createInstance( + "com.sun.star.connection.Connector") ; + xCntr = UnoRuntime.queryInterface( + XConnector.class, oCntr); + + // create bridge factory + XInterface oBrdg = (XInterface)xMSF.createInstance( + "com.sun.star.bridge.BridgeFactory") ; + xBrdgFctr = UnoRuntime.queryInterface(XBridgeFactory.class, oBrdg); + + // create own implementation of XInstanceProvider + XInstanceProvider xInstProv = new MyInstanceProvider(xMSF); + // create waiting acceptor thread + accThread = new AcceptorThread(xAcctr, xInstProv, xBrdgFctr); + accThread.start(); + // let the thread sleep + util.utils.pause(500); + + // establish the connection + XConnection xConnection = xCntr.connect(connectString); + + String protocol = "urp"; + String bridgeName = protocol + ":" + connectString; + + tEnv.addObjRelation("XInitialization.args", new Object[] { + bridgeName, protocol, xConnection, null}); + + bridge = tEnv.getTestObject(); + + return tEnv; } /** diff --git a/qadevOOo/tests/java/mod/_remotebridge/various.java b/qadevOOo/tests/java/mod/_remotebridge/various.java index 6c751cd05560..2393efb397ec 100644 --- a/qadevOOo/tests/java/mod/_remotebridge/various.java +++ b/qadevOOo/tests/java/mod/_remotebridge/various.java @@ -159,79 +159,63 @@ public class various extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters tParam, - PrintWriter log) { + PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF(); - try { - XInterface xInt = (XInterface)xMSF.createInstance( - "com.sun.star.bridge.Bridge"); - - TestEnvironment tEnv = new TestEnvironment(xInt); - // creating arguments for XInitialization - // first, creating a connection - // connection string - String cncstr = (String) tParam.get("CONNECTION_STRING") ; - int idx = cncstr.indexOf("host=") + 5 ; - - // select the port - log.println("Choose Port nr: " + curPort); - - connectString = "socket,host=" + - cncstr.substring(idx, cncstr.indexOf(",", idx)) + - ",port=" + curPort; - - // create acceptor - XInterface oAcctr = (XInterface)xMSF.createInstance( - "com.sun.star.connection.Acceptor") ; - - xAcctr = UnoRuntime.queryInterface( - XAcceptor.class, oAcctr); - // create connector - XInterface oCntr = (XInterface)xMSF.createInstance( - "com.sun.star.connection.Connector") ; - xCntr = UnoRuntime.queryInterface( - XConnector.class, oCntr); - - // create bridge factory - XInterface oBrdg = (XInterface)xMSF.createInstance( - "com.sun.star.bridge.BridgeFactory") ; - xBrdgFctr = UnoRuntime.queryInterface(XBridgeFactory.class, oBrdg); - - // create own implementation of XInstanceProvider - new MyInstanceProvider(xMSF); - // create waiting acceptor thread - accThread = new AcceptorThread(xAcctr); - accThread.start(); - // let the thread sleep - util.utils.pause(500); - - // establish the connection - XConnection xConnection = xCntr.connect(connectString); - - String protocol = "urp"; - String bridgeName = protocol + ":" + connectString; - -/* bridgeDisposed[0] = false ; - XComponent xComp = (XComponent)UnoRuntime.queryInterface( - XComponent.class, xInt); - final PrintWriter logF = log; - xComp.addEventListener(new XEventListener() { - public void disposing(EventObject ev) { - bridgeDisposed[0] = true ; - logF.println("The bridge Disposed."); - } - }); -*/ - tEnv.addObjRelation("XInitialization.args", new Object[] { - bridgeName, protocol, xConnection, null}); + XInterface xInt = (XInterface)xMSF.createInstance( + "com.sun.star.bridge.Bridge"); - bridge = tEnv.getTestObject(); + TestEnvironment tEnv = new TestEnvironment(xInt); + // creating arguments for XInitialization + // first, creating a connection + // connection string + String cncstr = (String) tParam.get("CONNECTION_STRING") ; + int idx = cncstr.indexOf("host=") + 5 ; - return tEnv; - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Unexpected exception", e); - } + // select the port + log.println("Choose Port nr: " + curPort); + + connectString = "socket,host=" + + cncstr.substring(idx, cncstr.indexOf(",", idx)) + + ",port=" + curPort; + + // create acceptor + XInterface oAcctr = (XInterface)xMSF.createInstance( + "com.sun.star.connection.Acceptor") ; + + xAcctr = UnoRuntime.queryInterface( + XAcceptor.class, oAcctr); + // create connector + XInterface oCntr = (XInterface)xMSF.createInstance( + "com.sun.star.connection.Connector") ; + xCntr = UnoRuntime.queryInterface( + XConnector.class, oCntr); + + // create bridge factory + XInterface oBrdg = (XInterface)xMSF.createInstance( + "com.sun.star.bridge.BridgeFactory") ; + xBrdgFctr = UnoRuntime.queryInterface(XBridgeFactory.class, oBrdg); + + // create own implementation of XInstanceProvider + new MyInstanceProvider(xMSF); + // create waiting acceptor thread + accThread = new AcceptorThread(xAcctr); + accThread.start(); + // let the thread sleep + util.utils.pause(500); + + // establish the connection + XConnection xConnection = xCntr.connect(connectString); + + String protocol = "urp"; + String bridgeName = protocol + ":" + connectString; + + tEnv.addObjRelation("XInitialization.args", new Object[] { + bridgeName, protocol, xConnection, null}); + + bridge = tEnv.getTestObject(); + + return tEnv; } /** diff --git a/qadevOOo/tests/java/mod/_sc/AccessibleEditableTextPara_HeaderFooter.java b/qadevOOo/tests/java/mod/_sc/AccessibleEditableTextPara_HeaderFooter.java index 111b20c246b4..3c5cdfabd7fe 100644 --- a/qadevOOo/tests/java/mod/_sc/AccessibleEditableTextPara_HeaderFooter.java +++ b/qadevOOo/tests/java/mod/_sc/AccessibleEditableTextPara_HeaderFooter.java @@ -53,17 +53,9 @@ public class AccessibleEditableTextPara_HeaderFooter extends TestCase { @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XAccessibleContext oObj = null; - Object toolkit = null; - - try { - toolkit = msf.createInstance("com.sun.star.awt.Toolkit"); - } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't get toolkit"); - e.printStackTrace(log); - throw new StatusException("Couldn't get toolkit", e); - } + Object toolkit = msf.createInstance("com.sun.star.awt.Toolkit"); XExtendedToolkit tk = UnoRuntime.queryInterface( XExtendedToolkit.class, toolkit); diff --git a/qadevOOo/tests/java/mod/_sc/AccessibleEditableTextPara_PreviewCell.java b/qadevOOo/tests/java/mod/_sc/AccessibleEditableTextPara_PreviewCell.java index 87a66ea25fbe..8d3b6f47599d 100644 --- a/qadevOOo/tests/java/mod/_sc/AccessibleEditableTextPara_PreviewCell.java +++ b/qadevOOo/tests/java/mod/_sc/AccessibleEditableTextPara_PreviewCell.java @@ -20,7 +20,6 @@ package mod._sc; import java.io.PrintWriter; -import lib.Status; import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; @@ -86,32 +85,18 @@ public class AccessibleEditableTextPara_PreviewCell extends TestCase { * Obtains the accessible object for a one of cell in preview mode. */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XCell xCell = null; - try { - log.println("Getting spreadsheet") ; - XSpreadsheets oSheets = xSheetDoc.getSheets() ; - XIndexAccess oIndexSheets = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); - XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); - - log.println("Getting a cell from sheet") ; - xCell = oSheet.getCellByPosition(0, 0); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException( - "Error getting cell object from spreadsheet document", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException( - "Error getting cell object from spreadsheet document", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException( - "Error getting cell object from spreadsheet document", e); - } + log.println("Getting spreadsheet") ; + XSpreadsheets oSheets = xSheetDoc.getSheets() ; + XIndexAccess oIndexSheets = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); + XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); + + log.println("Getting a cell from sheet") ; + xCell = oSheet.getCellByPosition(0, 0); xCell.setFormula("Value"); @@ -120,30 +105,21 @@ public class AccessibleEditableTextPara_PreviewCell extends TestCase { XController xController = xModel.getCurrentController(); //switch to 'Print Preview' mode - try { - XDispatchProvider xDispProv = UnoRuntime.queryInterface(XDispatchProvider.class, xController); - XURLTransformer xParser = UnoRuntime.queryInterface(XURLTransformer.class, - Param.getMSF().createInstance("com.sun.star.util.URLTransformer")); - URL[] aParseURL = new URL[1]; - aParseURL[0] = new URL(); - aParseURL[0].Complete = ".uno:PrintPreview"; - xParser.parseStrict(aParseURL); - URL aURL = aParseURL[0]; - XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", 0); - if(xDispatcher != null) - xDispatcher.dispatch( aURL, null ); - } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't change mode"); - throw new StatusException(e, Status.failed("Couldn't change mode")); - } + XDispatchProvider xDispProv = UnoRuntime.queryInterface(XDispatchProvider.class, xController); + XURLTransformer xParser = UnoRuntime.queryInterface(XURLTransformer.class, + Param.getMSF().createInstance("com.sun.star.util.URLTransformer")); + URL[] aParseURL = new URL[1]; + aParseURL[0] = new URL(); + aParseURL[0].Complete = ".uno:PrintPreview"; + xParser.parseStrict(aParseURL); + URL aURL = aParseURL[0]; + XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", 0); + if(xDispatcher != null) + xDispatcher.dispatch( aURL, null ); XAccessibleContext oObj = null; for (int i = 0;; ++i) { - try { - Thread.sleep(500); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } + Thread.sleep(500); try { XAccessible xRoot = AccessibilityTools.getAccessibleObject( AccessibilityTools.getCurrentWindow( diff --git a/qadevOOo/tests/java/mod/_sc/ScAccessibleCell.java b/qadevOOo/tests/java/mod/_sc/ScAccessibleCell.java index 6734ca79cc24..ebd9437b4411 100644 --- a/qadevOOo/tests/java/mod/_sc/ScAccessibleCell.java +++ b/qadevOOo/tests/java/mod/_sc/ScAccessibleCell.java @@ -87,18 +87,13 @@ public class ScAccessibleCell extends TestCase { */ @Override protected TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) { + TestParameters Param, PrintWriter log) throws Exception { // get a soffice factory object SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF()); - try { - log.println("creating a spreadsheetdocument"); - xSpreadsheetDoc = SOF.createCalcDoc(null); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace( log ); - throw new StatusException( "Couldn't create document ", e ); - } + log.println("creating a spreadsheetdocument"); + xSpreadsheetDoc = SOF.createCalcDoc(null); XInterface oObj = null; diff --git a/qadevOOo/tests/java/mod/_sc/ScAccessibleCsvCell.java b/qadevOOo/tests/java/mod/_sc/ScAccessibleCsvCell.java index 02608fcbdc44..10acdbc2f9b7 100644 --- a/qadevOOo/tests/java/mod/_sc/ScAccessibleCsvCell.java +++ b/qadevOOo/tests/java/mod/_sc/ScAccessibleCsvCell.java @@ -56,20 +56,12 @@ public class ScAccessibleCsvCell extends TestCase { * @see #getTestEnvironment */ @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { - XInterface oObj = null; + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { util.utils.pause(2000); - try { - oObj = (XInterface) tParam.getMSF().createInstance - ("com.sun.star.awt.Toolkit") ; - } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't get toolkit"); - e.printStackTrace(log); - throw new StatusException("Couldn't get toolkit", e ); - } - + XInterface oObj = (XInterface) tParam.getMSF().createInstance + ("com.sun.star.awt.Toolkit") ; XExtendedToolkit tk = UnoRuntime.queryInterface(XExtendedToolkit.class,oObj); diff --git a/qadevOOo/tests/java/mod/_sc/ScAccessibleCsvGrid.java b/qadevOOo/tests/java/mod/_sc/ScAccessibleCsvGrid.java index 8fa3f4c458f8..e577bcdf443f 100644 --- a/qadevOOo/tests/java/mod/_sc/ScAccessibleCsvGrid.java +++ b/qadevOOo/tests/java/mod/_sc/ScAccessibleCsvGrid.java @@ -55,25 +55,15 @@ public class ScAccessibleCsvGrid extends TestCase { * @see #getTestEnvironment */ @Override - protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { - - XInterface oObj = null; + protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { util.utils.pause(2000); - try { - oObj = (XInterface) Param.getMSF().createInstance - ("com.sun.star.awt.Toolkit") ; - } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't get toolkit"); - e.printStackTrace(log); - throw new StatusException("Couldn't get toolkit", e ); - } - + XInterface oObj = (XInterface) Param.getMSF().createInstance + ("com.sun.star.awt.Toolkit") ; XExtendedToolkit tk = UnoRuntime.queryInterface(XExtendedToolkit.class,oObj); - XWindow xWindow = UnoRuntime.queryInterface(XWindow.class,tk.getActiveTopWindow()); XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); diff --git a/qadevOOo/tests/java/mod/_sc/ScAccessibleCsvRuler.java b/qadevOOo/tests/java/mod/_sc/ScAccessibleCsvRuler.java index d41103abad15..4576ff84f891 100644 --- a/qadevOOo/tests/java/mod/_sc/ScAccessibleCsvRuler.java +++ b/qadevOOo/tests/java/mod/_sc/ScAccessibleCsvRuler.java @@ -59,20 +59,12 @@ public class ScAccessibleCsvRuler extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { - XInterface oObj = null; - + PrintWriter log) throws Exception { util.utils.pause(2000); XMultiServiceFactory msf = Param.getMSF(); - try { - oObj = (XInterface) msf.createInstance("com.sun.star.awt.Toolkit"); - } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't get toolkit"); - e.printStackTrace(log); - throw new StatusException("Couldn't get toolkit", e); - } + XInterface oObj = (XInterface) msf.createInstance("com.sun.star.awt.Toolkit"); XExtendedToolkit tk = UnoRuntime.queryInterface( XExtendedToolkit.class, oObj); diff --git a/qadevOOo/tests/java/mod/_sc/ScAccessibleDocumentPagePreview.java b/qadevOOo/tests/java/mod/_sc/ScAccessibleDocumentPagePreview.java index 3cdcce98765f..9530e7475133 100644 --- a/qadevOOo/tests/java/mod/_sc/ScAccessibleDocumentPagePreview.java +++ b/qadevOOo/tests/java/mod/_sc/ScAccessibleDocumentPagePreview.java @@ -20,7 +20,6 @@ package mod._sc; import java.io.PrintWriter; -import lib.Status; import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; @@ -84,7 +83,7 @@ public class ScAccessibleDocumentPagePreview extends TestCase { */ @Override protected TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) { + TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; @@ -94,29 +93,17 @@ public class ScAccessibleDocumentPagePreview extends TestCase { XSpreadsheets oSheets = xSpreadsheetDoc.getSheets() ; XIndexAccess oIndexSheets = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); XSpreadsheet oSheet = null; - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexSheets.getByIndex(1)); - } catch (com.sun.star.lang.IllegalArgumentException iae) { - throw new StatusException("couldn't get sheet",iae); - } + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexSheets.getByIndex(1)); xCell = oSheet.getCellByPosition(0, 0) ; xCell.setFormula("ScAccessibleDocumentPagePreview - Page 2"); - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexSheets.getByIndex(2)); - } catch (com.sun.star.lang.IllegalArgumentException iae) { - throw new StatusException("couldn't get sheet",iae); - } + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexSheets.getByIndex(2)); xCell = oSheet.getCellByPosition(0, 0) ; xCell.setFormula("ScAccessibleDocumentPagePreview - Page 3"); - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); - } catch (com.sun.star.lang.IllegalArgumentException iae) { - throw new StatusException("couldn't get sheet",iae); - } + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); xCell = oSheet.getCellByPosition(0, 0) ; xCell.setFormula("ScAccessibleDocumentPagePreview"); } catch(com.sun.star.lang.WrappedTargetException e) { @@ -132,22 +119,18 @@ public class ScAccessibleDocumentPagePreview extends TestCase { XController xController = aModel.getCurrentController(); // switching to 'Page Preview' mode - try { - XDispatchProvider xDispProv = UnoRuntime.queryInterface(XDispatchProvider.class, xController); - XURLTransformer xParser = UnoRuntime.queryInterface(XURLTransformer.class, - Param.getMSF().createInstance("com.sun.star.util.URLTransformer")); - // Because it's an in/out parameter we must use an array of URL objects. - URL[] aParseURL = new URL[1]; - aParseURL[0] = new URL(); - aParseURL[0].Complete = ".uno:PrintPreview"; - xParser.parseStrict(aParseURL); - URL aURL = aParseURL[0]; - XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", 0); - if(xDispatcher != null) - xDispatcher.dispatch( aURL, null ); - } catch (com.sun.star.uno.Exception e) { - throw new StatusException(e, Status.failed("Couldn't change mode")); - } + XDispatchProvider xDispProv = UnoRuntime.queryInterface(XDispatchProvider.class, xController); + XURLTransformer xParser = UnoRuntime.queryInterface(XURLTransformer.class, + Param.getMSF().createInstance("com.sun.star.util.URLTransformer")); + // Because it's an in/out parameter we must use an array of URL objects. + URL[] aParseURL = new URL[1]; + aParseURL[0] = new URL(); + aParseURL[0].Complete = ".uno:PrintPreview"; + xParser.parseStrict(aParseURL); + URL aURL = aParseURL[0]; + XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", 0); + if(xDispatcher != null) + xDispatcher.dispatch( aURL, null ); util.utils.shortWait(); diff --git a/qadevOOo/tests/java/mod/_sc/ScAccessiblePageHeader.java b/qadevOOo/tests/java/mod/_sc/ScAccessiblePageHeader.java index 318e29dfe99b..e6060aadb4e0 100644 --- a/qadevOOo/tests/java/mod/_sc/ScAccessiblePageHeader.java +++ b/qadevOOo/tests/java/mod/_sc/ScAccessiblePageHeader.java @@ -20,7 +20,6 @@ package mod._sc; import java.io.PrintWriter; -import lib.Status; import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; @@ -89,7 +88,7 @@ public class ScAccessiblePageHeader extends TestCase { */ @Override protected TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) { + TestParameters Param, PrintWriter log) throws Exception { // inserting some content to have non-empty page preview XCell xCell = null; @@ -118,30 +117,22 @@ public class ScAccessiblePageHeader extends TestCase { XController xController = aModel.getCurrentController(); // switching to 'Page Preview' mode - try { - XDispatchProvider xDispProv = UnoRuntime.queryInterface(XDispatchProvider.class, xController); - XURLTransformer xParser = UnoRuntime.queryInterface(XURLTransformer.class, - Param.getMSF().createInstance("com.sun.star.util.URLTransformer")); - // Because it's an in/out parameter we must use an array of URL objects. - URL[] aParseURL = new URL[1]; - aParseURL[0] = new URL(); - aParseURL[0].Complete = ".uno:PrintPreview"; - xParser.parseStrict(aParseURL); - URL aURL = aParseURL[0]; - XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", 0); - if(xDispatcher != null) - xDispatcher.dispatch( aURL, null ); - } catch (com.sun.star.uno.Exception e) { - throw new StatusException(e, Status.failed("Couldn't change mode")); - } + XDispatchProvider xDispProv = UnoRuntime.queryInterface(XDispatchProvider.class, xController); + XURLTransformer xParser = UnoRuntime.queryInterface(XURLTransformer.class, + Param.getMSF().createInstance("com.sun.star.util.URLTransformer")); + // Because it's an in/out parameter we must use an array of URL objects. + URL[] aParseURL = new URL[1]; + aParseURL[0] = new URL(); + aParseURL[0].Complete = ".uno:PrintPreview"; + xParser.parseStrict(aParseURL); + URL aURL = aParseURL[0]; + XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", 0); + if(xDispatcher != null) + xDispatcher.dispatch( aURL, null ); XInterface oObj = null; for (int i = 0;; ++i) { - try { - Thread.sleep(500); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } + Thread.sleep(500); try { XWindow xWindow = AccessibilityTools.getCurrentWindow(aModel); XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); @@ -172,21 +163,11 @@ public class ScAccessiblePageHeader extends TestCase { XNameAccess StyleFamNames = StyleFam.getStyleFamilies(); XStyle StdStyle = null; - try{ - XNameAccess PageStyles = (XNameAccess) AnyConverter.toObject( - new Type(XNameAccess.class), - StyleFamNames.getByName("PageStyles")); - StdStyle = (XStyle) AnyConverter.toObject( - new Type(XStyle.class), PageStyles.getByName("Default")); - } catch(com.sun.star.lang.WrappedTargetException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get by name", e); - } catch(com.sun.star.container.NoSuchElementException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get by name", e); - } catch (com.sun.star.lang.IllegalArgumentException iae) { - throw new StatusException("Couldn't convert any", iae); - } + XNameAccess PageStyles = (XNameAccess) AnyConverter.toObject( + new Type(XNameAccess.class), + StyleFamNames.getByName("PageStyles")); + StdStyle = (XStyle) AnyConverter.toObject( + new Type(XStyle.class), PageStyles.getByName("Default")); //get the property-set final XPropertySet PropSet = UnoRuntime.queryInterface(XPropertySet.class, StdStyle); @@ -195,20 +176,9 @@ public class ScAccessiblePageHeader extends TestCase { // creation of testobject here // first we write what we are intend to do to log file log.println( "creating a test environment" ); - try { - RPHC = (XHeaderFooterContent) AnyConverter.toObject( - new Type(XHeaderFooterContent.class), - PropSet.getPropertyValue("RightPageHeaderContent")); - } catch(com.sun.star.lang.WrappedTargetException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get HeaderContent", e); - } catch(com.sun.star.beans.UnknownPropertyException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get HeaderContent", e); - } catch(com.sun.star.lang.IllegalArgumentException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get HeaderContent", e); - } + RPHC = (XHeaderFooterContent) AnyConverter.toObject( + new Type(XHeaderFooterContent.class), + PropSet.getPropertyValue("RightPageHeaderContent")); final XHeaderFooterContent RPHC2 = RPHC; diff --git a/qadevOOo/tests/java/mod/_sc/ScAccessiblePageHeaderArea.java b/qadevOOo/tests/java/mod/_sc/ScAccessiblePageHeaderArea.java index 2118c7ad1d78..1fcc985cacd2 100644 --- a/qadevOOo/tests/java/mod/_sc/ScAccessiblePageHeaderArea.java +++ b/qadevOOo/tests/java/mod/_sc/ScAccessiblePageHeaderArea.java @@ -20,7 +20,6 @@ package mod._sc; import java.io.PrintWriter; -import lib.Status; import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; @@ -85,7 +84,7 @@ public class ScAccessiblePageHeaderArea extends TestCase { */ @Override protected TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) { + TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; @@ -114,38 +113,30 @@ public class ScAccessiblePageHeaderArea extends TestCase { XController xController = aModel.getCurrentController(); // switching to 'Page Preview' mode - try { - XDispatchProvider xDispProv = UnoRuntime.queryInterface(XDispatchProvider.class, xController); - XURLTransformer xParser = UnoRuntime.queryInterface(XURLTransformer.class, - Param.getMSF().createInstance("com.sun.star.util.URLTransformer")); - // Because it's an in/out parameter we must use an array of URL objects. - URL[] aParseURL = new URL[1]; - aParseURL[0] = new URL(); - aParseURL[0].Complete = ".uno:PrintPreview"; - xParser.parseStrict(aParseURL); - URL aURL = aParseURL[0]; - XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", 0); - if(xDispatcher != null) - xDispatcher.dispatch( aURL, null ); - } catch (com.sun.star.uno.Exception e) { - throw new StatusException(e, Status.failed("Couldn't change mode")); - } + XDispatchProvider xDispProv = UnoRuntime.queryInterface(XDispatchProvider.class, xController); + XURLTransformer xParser = UnoRuntime.queryInterface(XURLTransformer.class, + Param.getMSF().createInstance("com.sun.star.util.URLTransformer")); + // Because it's an in/out parameter we must use an array of URL objects. + URL[] aParseURL = new URL[1]; + aParseURL[0] = new URL(); + aParseURL[0].Complete = ".uno:PrintPreview"; + xParser.parseStrict(aParseURL); + URL aURL = aParseURL[0]; + XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", 0); + if(xDispatcher != null) + xDispatcher.dispatch( aURL, null ); util.utils.pause(500); XWindow xWindow = AccessibilityTools.getCurrentContainerWindow(aModel); XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); - try { - oObj = AccessibilityTools.getAccessibleObjectForRole - (xRoot, AccessibleRole.HEADER, "").getAccessibleChild(0); - XAccessibleContext cont = UnoRuntime.queryInterface(XAccessibleContext.class, oObj); - XAccessibleStateSet StateSet = cont.getAccessibleStateSet(); - if (StateSet.contains((short)27)) { - log.println("Object is transient"); - } - } catch (com.sun.star.lang.IndexOutOfBoundsException iabe) { - throw new StatusException("Couldn't find needed Child",iabe); + oObj = AccessibilityTools.getAccessibleObjectForRole + (xRoot, AccessibleRole.HEADER, "").getAccessibleChild(0); + XAccessibleContext cont = UnoRuntime.queryInterface(XAccessibleContext.class, oObj); + XAccessibleStateSet StateSet = cont.getAccessibleStateSet(); + if (StateSet.contains((short)27)) { + log.println("Object is transient"); } log.println("ImplementationName " + utils.getImplName(oObj)); diff --git a/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewCell.java b/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewCell.java index cc074f711c17..3ddcc7e0bfd8 100644 --- a/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewCell.java +++ b/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewCell.java @@ -20,7 +20,6 @@ package mod._sc; import java.io.PrintWriter; -import lib.Status; import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; @@ -110,31 +109,17 @@ public class ScAccessiblePreviewCell extends TestCase { * Obtains the accessible object for a one of cell in preview mode. */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XCell xCell = null; - try { - log.println("Getting spreadsheet") ; - XSpreadsheets oSheets = xSheetDoc.getSheets() ; - XIndexAccess oIndexSheets = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); - XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); - - log.println("Getting a cell from sheet") ; - xCell = oSheet.getCellByPosition(0, 0); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException( - "Error getting cell object from spreadsheet document", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException( - "Error getting cell object from spreadsheet document", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException( - "Error getting cell object from spreadsheet document", e); - } + log.println("Getting spreadsheet") ; + XSpreadsheets oSheets = xSheetDoc.getSheets() ; + XIndexAccess oIndexSheets = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); + XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); + + log.println("Getting a cell from sheet") ; + xCell = oSheet.getCellByPosition(0, 0); xCell.setFormula("Value"); @@ -143,29 +128,21 @@ public class ScAccessiblePreviewCell extends TestCase { XController xController = xModel.getCurrentController(); //switch to 'Print Preview' mode - try { - XDispatchProvider xDispProv = UnoRuntime.queryInterface(XDispatchProvider.class, xController); - XURLTransformer xParser = UnoRuntime.queryInterface(XURLTransformer.class, - Param.getMSF().createInstance("com.sun.star.util.URLTransformer")); - URL[] aParseURL = new URL[1]; - aParseURL[0] = new URL(); - aParseURL[0].Complete = ".uno:PrintPreview"; - xParser.parseStrict(aParseURL); - URL aURL = aParseURL[0]; - XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", 0); - if(xDispatcher != null) - xDispatcher.dispatch( aURL, null ); - } catch (com.sun.star.uno.Exception e) { - throw new StatusException(e, Status.failed("Couldn't change mode")); - } + XDispatchProvider xDispProv = UnoRuntime.queryInterface(XDispatchProvider.class, xController); + XURLTransformer xParser = UnoRuntime.queryInterface(XURLTransformer.class, + Param.getMSF().createInstance("com.sun.star.util.URLTransformer")); + URL[] aParseURL = new URL[1]; + aParseURL[0] = new URL(); + aParseURL[0].Complete = ".uno:PrintPreview"; + xParser.parseStrict(aParseURL); + URL aURL = aParseURL[0]; + XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", 0); + if(xDispatcher != null) + xDispatcher.dispatch( aURL, null ); XInterface oObj = null; for (int i = 0;; ++i) { - try { - Thread.sleep(500); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } + Thread.sleep(500); try { XAccessible xRoot = AccessibilityTools.getAccessibleObject( AccessibilityTools.getCurrentWindow( diff --git a/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewHeaderCell.java b/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewHeaderCell.java index 6e30f6fdba96..3e8af0450839 100644 --- a/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewHeaderCell.java +++ b/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewHeaderCell.java @@ -19,8 +19,6 @@ package mod._sc; import java.io.PrintWriter; -import lib.Status; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -119,7 +117,7 @@ public class ScAccessiblePreviewHeaderCell extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { if (xSheetDoc != null) { XComponent oComp = UnoRuntime.queryInterface( XComponent.class, xSheetDoc); @@ -128,14 +126,8 @@ public class ScAccessiblePreviewHeaderCell extends TestCase { SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF()); - try { - log.println("creating a Spreadsheet document"); - xSheetDoc = SOF.createCalcDoc(null); - } catch (com.sun.star.uno.Exception e) { - // Some exception occurs.FAILED - e.printStackTrace(log); - throw new StatusException("Couldn't create document", e); - } + log.println("creating a Spreadsheet document"); + xSheetDoc = SOF.createCalcDoc(null); XModel xModel = UnoRuntime.queryInterface(XModel.class, xSheetDoc); @@ -145,31 +137,17 @@ public class ScAccessiblePreviewHeaderCell extends TestCase { //setting value of cell A1 XCell xCell = null; - try { - log.println("Getting spreadsheet"); + log.println("Getting spreadsheet"); - XSpreadsheets oSheets = xSheetDoc.getSheets(); - XIndexAccess oIndexSheets = UnoRuntime.queryInterface( - XIndexAccess.class, oSheets); - XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class), - oIndexSheets.getByIndex(0)); + XSpreadsheets oSheets = xSheetDoc.getSheets(); + XIndexAccess oIndexSheets = UnoRuntime.queryInterface( + XIndexAccess.class, oSheets); + XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class), + oIndexSheets.getByIndex(0)); - log.println("Getting a cell from sheet"); - xCell = oSheet.getCellByPosition(0, 0); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException( - "Error getting cell object from spreadsheet document", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException( - "Error getting cell object from spreadsheet document", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException( - "Error getting cell object from spreadsheet document", e); - } + log.println("Getting a cell from sheet"); + xCell = oSheet.getCellByPosition(0, 0); xCell.setFormula("Value"); @@ -180,67 +158,39 @@ public class ScAccessiblePreviewHeaderCell extends TestCase { XNameAccess xNA = xSFS.getStyleFamilies(); XPropertySet xPropSet = null; - try { - Object oPageStyles = xNA.getByName("PageStyles"); - xNA = UnoRuntime.queryInterface(XNameAccess.class, - oPageStyles); + Object oPageStyles = xNA.getByName("PageStyles"); + xNA = UnoRuntime.queryInterface(XNameAccess.class, + oPageStyles); - Object oDefStyle = xNA.getByName("Default"); - xPropSet = UnoRuntime.queryInterface( - XPropertySet.class, oDefStyle); - } catch (com.sun.star.lang.WrappedTargetException e) { - throw new StatusException(e, Status.failed("Couldn't get element")); - } catch (com.sun.star.container.NoSuchElementException e) { - throw new StatusException(e, Status.failed("Couldn't get element")); - } + Object oDefStyle = xNA.getByName("Default"); + xPropSet = UnoRuntime.queryInterface( + XPropertySet.class, oDefStyle); - try { - xPropSet.setPropertyValue("PrintHeaders", Boolean.TRUE); - } catch (com.sun.star.lang.WrappedTargetException e) { - throw new StatusException(e, Status.failed( - "Couldn't set property 'PrintHeaders'")); - } catch (com.sun.star.lang.IllegalArgumentException e) { - throw new StatusException(e, Status.failed( - "Couldn't set property 'PrintHeaders'")); - } catch (com.sun.star.beans.PropertyVetoException e) { - throw new StatusException(e, Status.failed( - "Couldn't set property 'PrintHeaders'")); - } catch (com.sun.star.beans.UnknownPropertyException e) { - throw new StatusException(e, Status.failed( - "Couldn't set property 'PrintHeaders'")); - } + xPropSet.setPropertyValue("PrintHeaders", Boolean.TRUE); //switching to 'Print Preview' mode - try { - XDispatchProvider xDispProv = UnoRuntime.queryInterface( - XDispatchProvider.class, - xController); - XURLTransformer xParser = UnoRuntime.queryInterface( - XURLTransformer.class, - Param.getMSF() - .createInstance("com.sun.star.util.URLTransformer")); - URL[] aParseURL = new URL[1]; - aParseURL[0] = new URL(); - aParseURL[0].Complete = ".uno:PrintPreview"; - xParser.parseStrict(aParseURL); - - URL aURL = aParseURL[0]; - XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", 0); - - if (xDispatcher != null) { - xDispatcher.dispatch(aURL, null); - } - } catch (com.sun.star.uno.Exception e) { - throw new StatusException(e, Status.failed("Couldn't change mode")); + XDispatchProvider xDispProv = UnoRuntime.queryInterface( + XDispatchProvider.class, + xController); + XURLTransformer xParser = UnoRuntime.queryInterface( + XURLTransformer.class, + Param.getMSF() + .createInstance("com.sun.star.util.URLTransformer")); + URL[] aParseURL = new URL[1]; + aParseURL[0] = new URL(); + aParseURL[0].Complete = ".uno:PrintPreview"; + xParser.parseStrict(aParseURL); + + URL aURL = aParseURL[0]; + XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", 0); + + if (xDispatcher != null) { + xDispatcher.dispatch(aURL, null); } XInterface oObj = null; for (int i = 0;; ++i) { - try { - Thread.sleep(500); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } + Thread.sleep(500); try { XAccessible xRoot = AccessibilityTools.getAccessibleObject( AccessibilityTools.getCurrentWindow( diff --git a/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewTable.java b/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewTable.java index c6b407cd46eb..3a1d918e7e81 100644 --- a/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewTable.java +++ b/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewTable.java @@ -20,7 +20,6 @@ package mod._sc; import java.io.PrintWriter; -import lib.Status; import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; @@ -112,32 +111,18 @@ public class ScAccessiblePreviewTable extends TestCase { * Obtains the accessible object for a table in preview mode. */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XCell xCell = null; - try { - log.println("Getting spreadsheet") ; - XSpreadsheets oSheets = xSheetDoc.getSheets() ; - XIndexAccess oIndexSheets = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); - XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); - - log.println("Getting a cell from sheet") ; - xCell = oSheet.getCellByPosition(0, 0); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException( - "Error getting cell object from spreadsheet document", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException( - "Error getting cell object from spreadsheet document", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException( - "Error getting cell object from spreadsheet document", e); - } + log.println("Getting spreadsheet") ; + XSpreadsheets oSheets = xSheetDoc.getSheets() ; + XIndexAccess oIndexSheets = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); + XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); + + log.println("Getting a cell from sheet") ; + xCell = oSheet.getCellByPosition(0, 0); xCell.setFormula("Value"); @@ -146,30 +131,22 @@ public class ScAccessiblePreviewTable extends TestCase { XController xController = xModel.getCurrentController(); //switch to 'Print Preview' mode - try { - XDispatchProvider xDispProv = UnoRuntime.queryInterface(XDispatchProvider.class, xController); - XURLTransformer xParser = UnoRuntime.queryInterface(XURLTransformer.class, - Param.getMSF().createInstance("com.sun.star.util.URLTransformer")); - URL[] aParseURL = new URL[1]; - aParseURL[0] = new URL(); - aParseURL[0].Complete = ".uno:PrintPreview"; - xParser.parseStrict(aParseURL); - URL aURL = aParseURL[0]; - XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", 0); - if(xDispatcher != null) - xDispatcher.dispatch( aURL, null ); - } catch (com.sun.star.uno.Exception e) { - throw new StatusException(e, Status.failed("Couldn't change mode")); - } + XDispatchProvider xDispProv = UnoRuntime.queryInterface(XDispatchProvider.class, xController); + XURLTransformer xParser = UnoRuntime.queryInterface(XURLTransformer.class, + Param.getMSF().createInstance("com.sun.star.util.URLTransformer")); + URL[] aParseURL = new URL[1]; + aParseURL[0] = new URL(); + aParseURL[0].Complete = ".uno:PrintPreview"; + xParser.parseStrict(aParseURL); + URL aURL = aParseURL[0]; + XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", 0); + if(xDispatcher != null) + xDispatcher.dispatch( aURL, null ); XAccessible xRoot; XInterface oObj; for (int i = 0;; ++i) { - try { - Thread.sleep(500); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } + Thread.sleep(500); try { xRoot = AccessibilityTools.getAccessibleObject( AccessibilityTools.getCurrentContainerWindow( diff --git a/qadevOOo/tests/java/mod/_sc/ScAnnotationObj.java b/qadevOOo/tests/java/mod/_sc/ScAnnotationObj.java index 9f1833e89f94..aabb241074bd 100644 --- a/qadevOOo/tests/java/mod/_sc/ScAnnotationObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScAnnotationObj.java @@ -39,7 +39,6 @@ import com.sun.star.table.XCellRange; import com.sun.star.uno.AnyConverter; import com.sun.star.uno.Type; import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XInterface; /** * Test for object which represents some text annotation @@ -111,10 +110,7 @@ public class ScAnnotationObj extends TestCase { @Override public synchronized TestEnvironment createTestEnvironment ( TestParameters Param, PrintWriter log ) - throws StatusException { - - XInterface oObj = null; - + throws Exception { // creation of testobject here // first we write what we are intend to do to log file @@ -129,31 +125,15 @@ public class ScAnnotationObj extends TestCase { XIndexAccess XAccess = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); XCell oCell = null; - try { - XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),XAccess.getByIndex(cellPos.Sheet)); - XCellRange oCRange = UnoRuntime.queryInterface(XCellRange.class, oSheet); - oCell = oCRange.getCellByPosition(cellPos.Column, cellPos.Row); - } catch(com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException( - "Error getting test object from spreadsheet document",e); - } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException( - "Error getting test object from spreadsheet document",e); - } catch(com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException( - "Error getting test object from spreadsheet document",e); - } + XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),XAccess.getByIndex(cellPos.Sheet)); + XCellRange oCRange = UnoRuntime.queryInterface(XCellRange.class, oSheet); + oCell = oCRange.getCellByPosition(cellPos.Column, cellPos.Row); XSheetAnnotationAnchor oAnnoA = UnoRuntime.queryInterface(XSheetAnnotationAnchor.class, oCell); XSheetAnnotation oAnno = oAnnoA.getAnnotation(); - oObj = oAnno; - - TestEnvironment tEnv = new TestEnvironment( oObj ); + TestEnvironment tEnv = new TestEnvironment( oAnno ); tEnv.addObjRelation("CELLPOS", cellPos); diff --git a/qadevOOo/tests/java/mod/_sc/ScAnnotationShapeObj.java b/qadevOOo/tests/java/mod/_sc/ScAnnotationShapeObj.java index b7438b11b885..84704f9fb986 100644 --- a/qadevOOo/tests/java/mod/_sc/ScAnnotationShapeObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScAnnotationShapeObj.java @@ -123,7 +123,7 @@ public class ScAnnotationShapeObj extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) throws StatusException { + TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; // creation of testobject here @@ -144,29 +144,15 @@ public class ScAnnotationShapeObj extends TestCase { oSheets); XCell oCell = null; - try { - XSpreadsheet oSheet = - (XSpreadsheet) AnyConverter.toObject(new Type( - XSpreadsheet.class), - XAccess.getByIndex(cellPos.Sheet)); - XCellRange oCRange = - UnoRuntime.queryInterface(XCellRange.class, - oSheet); - oCell = - oCRange.getCellByPosition(cellPos.Column, cellPos.Row); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Error getting test object from spreadsheet document", - e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException("Error getting test object from spreadsheet document", - e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Error getting test object from spreadsheet document", - e); - } + XSpreadsheet oSheet = + (XSpreadsheet) AnyConverter.toObject(new Type( + XSpreadsheet.class), + XAccess.getByIndex(cellPos.Sheet)); + XCellRange oCRange = + UnoRuntime.queryInterface(XCellRange.class, + oSheet); + oCell = + oCRange.getCellByPosition(cellPos.Column, cellPos.Row); XSheetAnnotationAnchor oAnnoA = UnoRuntime.queryInterface(XSheetAnnotationAnchor.class, diff --git a/qadevOOo/tests/java/mod/_sc/ScAnnotationTextCursor.java b/qadevOOo/tests/java/mod/_sc/ScAnnotationTextCursor.java index e9050376e46a..1df59acfddf3 100644 --- a/qadevOOo/tests/java/mod/_sc/ScAnnotationTextCursor.java +++ b/qadevOOo/tests/java/mod/_sc/ScAnnotationTextCursor.java @@ -91,7 +91,7 @@ public class ScAnnotationTextCursor extends TestCase { @Override public synchronized TestEnvironment createTestEnvironment ( TestParameters Param, PrintWriter log ) - throws StatusException { + throws Exception { XInterface oObj = null; @@ -101,33 +101,26 @@ public class ScAnnotationTextCursor extends TestCase { CellAddress cellPos = new CellAddress((short)0, 1, 2); - try { - log.println("Getting test object ") ; - - XSpreadsheetDocument xArea = UnoRuntime.queryInterface(XSpreadsheetDocument.class, xSheetDoc); + log.println("Getting test object ") ; - XSpreadsheets oSheets = xArea.getSheets(); + XSpreadsheetDocument xArea = UnoRuntime.queryInterface(XSpreadsheetDocument.class, xSheetDoc); - XIndexAccess XAccess = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); + XSpreadsheets oSheets = xArea.getSheets(); - XSpreadsheet oSheet = (XSpreadsheet)XAccess.getByIndex(cellPos.Sheet); + XIndexAccess XAccess = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); - XCellRange oCRange = UnoRuntime.queryInterface(XCellRange.class, oSheet); + XSpreadsheet oSheet = (XSpreadsheet)XAccess.getByIndex(cellPos.Sheet); - XCell oCell = oCRange.getCellByPosition(cellPos.Column, cellPos.Row); + XCellRange oCRange = UnoRuntime.queryInterface(XCellRange.class, oSheet); - XSheetAnnotationAnchor oAnnoA = UnoRuntime.queryInterface(XSheetAnnotationAnchor.class, oCell); + XCell oCell = oCRange.getCellByPosition(cellPos.Column, cellPos.Row); - XSheetAnnotation oAnno = oAnnoA.getAnnotation(); - XSimpleText aText = UnoRuntime.queryInterface(XSimpleText.class,oAnno); - aText.setString("A nice little Test"); - oObj = aText.createTextCursor(); + XSheetAnnotationAnchor oAnnoA = UnoRuntime.queryInterface(XSheetAnnotationAnchor.class, oCell); - } catch (Exception e) { - e.printStackTrace(log) ; - throw new StatusException( - "Error getting test object from spreadsheet document",e) ; - } + XSheetAnnotation oAnno = oAnnoA.getAnnotation(); + XSimpleText aText = UnoRuntime.queryInterface(XSimpleText.class,oAnno); + aText.setString("A nice little Test"); + oObj = aText.createTextCursor(); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_sc/ScAnnotationsObj.java b/qadevOOo/tests/java/mod/_sc/ScAnnotationsObj.java index 15dac9a23332..aed6a873b433 100644 --- a/qadevOOo/tests/java/mod/_sc/ScAnnotationsObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScAnnotationsObj.java @@ -101,9 +101,7 @@ public class ScAnnotationsObj extends TestCase { * <code>com.sun.star.sheet.XSheetAnnotationsSupplier</code> interface. */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { - - XInterface oObj = null; + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { // creation of testobject here // first we write what we are intend to do to log file @@ -117,30 +115,12 @@ public class ScAnnotationsObj extends TestCase { XNameAccess oNames = UnoRuntime.queryInterface( XNameAccess.class, sheets ); XCell oCell = null; XSpreadsheet oSheet = null; - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class), - oNames.getByName(oNames.getElementNames()[0])); - // adding an annotation... - XCellRange oCRange = UnoRuntime.queryInterface(XCellRange.class, oSheet); - oCell = oCRange.getCellByPosition(10,10); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException( - "Error getting test object from spreadsheet document",e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log) ; - throw new StatusException( - "Error getting test object from spreadsheet document",e) ; - } catch (com.sun.star.container.NoSuchElementException e) { - e.printStackTrace(log) ; - throw new StatusException( - "Error getting test object from spreadsheet document",e) ; - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log) ; - throw new StatusException( - "Error getting test object from spreadsheet document",e) ; - } + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class), + oNames.getByName(oNames.getElementNames()[0])); + // adding an annotation... + XCellRange oCRange = UnoRuntime.queryInterface(XCellRange.class, oSheet); + oCell = oCRange.getCellByPosition(10,10); XSheetAnnotationAnchor oAnnoA = UnoRuntime.queryInterface(XSheetAnnotationAnchor.class, oCell); XSheetAnnotation oAnno = oAnnoA.getAnnotation(); @@ -149,7 +129,7 @@ public class ScAnnotationsObj extends TestCase { XSheetAnnotationsSupplier supp = UnoRuntime.queryInterface( XSheetAnnotationsSupplier.class, oSheet); - oObj = supp.getAnnotations(); + XInterface oObj = supp.getAnnotations(); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_sc/ScAreaLinkObj.java b/qadevOOo/tests/java/mod/_sc/ScAreaLinkObj.java index 07e4942e14cf..d7559ff193d0 100644 --- a/qadevOOo/tests/java/mod/_sc/ScAreaLinkObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScAreaLinkObj.java @@ -103,40 +103,21 @@ public class ScAreaLinkObj extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment - ( TestParameters Param, PrintWriter log ) throws StatusException { + ( TestParameters Param, PrintWriter log ) throws Exception { XInterface oObj = null; - try { - - // creation of testobject here - XPropertySet props = UnoRuntime.queryInterface - (XPropertySet.class, xSheetDoc); - XAreaLinks links = (XAreaLinks) AnyConverter.toObject( - new Type(XAreaLinks.class),props.getPropertyValue("AreaLinks")) ; - CellAddress addr = new CellAddress ((short) 1,2,3) ; - String aSourceArea = util.utils.getFullTestURL("calcshapes.sxc"); - links.insertAtPosition (addr, aSourceArea, "a2:b5", "", "") ; - - oObj = (XInterface) AnyConverter.toObject( - new Type(XInterface.class), links.getByIndex(0)) ; - } catch (com.sun.star.beans.UnknownPropertyException e) { - log.println ("Exception occurred while creating test Object.") ; - e.printStackTrace(log) ; - throw new StatusException("Couldn't create test object", e); - } catch (com.sun.star.lang.WrappedTargetException e) { - log.println ("Exception occurred while creating test Object.") ; - e.printStackTrace(log) ; - throw new StatusException("Couldn't create test object", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - log.println ("Exception occurred while creating test Object.") ; - e.printStackTrace(log) ; - throw new StatusException("Couldn't create test object", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - log.println ("Exception occurred while creating test Object.") ; - e.printStackTrace(log) ; - throw new StatusException("Couldn't create test object", e); - } + // creation of testobject here + XPropertySet props = UnoRuntime.queryInterface + (XPropertySet.class, xSheetDoc); + XAreaLinks links = (XAreaLinks) AnyConverter.toObject( + new Type(XAreaLinks.class),props.getPropertyValue("AreaLinks")) ; + CellAddress addr = new CellAddress ((short) 1,2,3) ; + String aSourceArea = util.utils.getFullTestURL("calcshapes.sxc"); + links.insertAtPosition (addr, aSourceArea, "a2:b5", "", "") ; + + oObj = (XInterface) AnyConverter.toObject( + new Type(XInterface.class), links.getByIndex(0)) ; TestEnvironment tEnv = new TestEnvironment(oObj) ; diff --git a/qadevOOo/tests/java/mod/_sc/ScAreaLinksObj.java b/qadevOOo/tests/java/mod/_sc/ScAreaLinksObj.java index 9ad090a3bc46..fd5d7374fd29 100644 --- a/qadevOOo/tests/java/mod/_sc/ScAreaLinksObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScAreaLinksObj.java @@ -98,45 +98,29 @@ protected void initialize( TestParameters tParam, PrintWriter log ) { * link collection is passed as a tested object. */ @Override - public synchronized TestEnvironment createTestEnvironment - (TestParameters Param, PrintWriter log){ + public synchronized TestEnvironment createTestEnvironment( + TestParameters Param, PrintWriter log) throws Exception { - XInterface oObj = null; - TestEnvironment tEnv = null ; - - try { + XInterface oObj = null; + TestEnvironment tEnv = null; // creation of testobject here - XPropertySet props = UnoRuntime.queryInterface - (XPropertySet.class, xSheetDoc); - oObj = (XInterface) AnyConverter.toObject( - new Type(XInterface.class),props.getPropertyValue("AreaLinks")) ; - XAreaLinks links = null ; + XPropertySet props = UnoRuntime.queryInterface(XPropertySet.class, + xSheetDoc); + oObj = (XInterface) AnyConverter.toObject(new Type(XInterface.class), + props.getPropertyValue("AreaLinks")); + XAreaLinks links = null; // adding one link into collection (for best testing) - links = UnoRuntime.queryInterface(XAreaLinks.class, oObj) ; - CellAddress addr = new CellAddress ((short) 1,2,3) ; + links = UnoRuntime.queryInterface(XAreaLinks.class, oObj); + CellAddress addr = new CellAddress((short) 1, 2, 3); String aSourceArea = util.utils.getFullTestURL("calcshapes.sxc"); - links.insertAtPosition (addr, aSourceArea, "a2:b5", "", "") ; + links.insertAtPosition(addr, aSourceArea, "a2:b5", "", ""); // creating test environment tEnv = new TestEnvironment(oObj); - } catch (com.sun.star.beans.UnknownPropertyException e) { - log.println ("Exception occurred while creating test Object.") ; - e.printStackTrace(log) ; - throw new StatusException("Couldn't create test object", e); - } catch (com.sun.star.lang.WrappedTargetException e) { - log.println ("Exception occurred while creating test Object.") ; - e.printStackTrace(log) ; - throw new StatusException("Couldn't create test object", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - log.println ("Exception occurred while creating test Object.") ; - e.printStackTrace(log) ; - throw new StatusException("Couldn't create test object", e); - } - - return tEnv ; + return tEnv; } } // finish class ScAreaLinksObj diff --git a/qadevOOo/tests/java/mod/_sc/ScAutoFormatFieldObj.java b/qadevOOo/tests/java/mod/_sc/ScAutoFormatFieldObj.java index bfeafcf03f96..43d4546865d5 100644 --- a/qadevOOo/tests/java/mod/_sc/ScAutoFormatFieldObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScAutoFormatFieldObj.java @@ -70,7 +70,7 @@ public class ScAutoFormatFieldObj extends TestCase { try { - log.println ("create Object ...") ; + log.println ("create Object ...") ; // creation of testobject here XInterface formats = (XInterface)Param.getMSF().createInstance ("com.sun.star.sheet.TableAutoFormats"); diff --git a/qadevOOo/tests/java/mod/_sc/ScAutoFormatObj.java b/qadevOOo/tests/java/mod/_sc/ScAutoFormatObj.java index 55dd6f090f01..7790499eb62f 100644 --- a/qadevOOo/tests/java/mod/_sc/ScAutoFormatObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScAutoFormatObj.java @@ -20,7 +20,6 @@ package mod._sc; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -72,24 +71,19 @@ public class ScAutoFormatObj extends TestCase { */ @Override public TestEnvironment createTestEnvironment(TestParameters tParam, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; XMultiServiceFactory oMSF = tParam.getMSF(); - try { - XInterface formats = (XInterface)oMSF.createInstance - ("com.sun.star.sheet.TableAutoFormats"); - XIndexAccess formatsIndex = UnoRuntime.queryInterface(XIndexAccess.class, formats); - oObj = (XInterface) AnyConverter.toObject( - new Type(XInterface.class),formatsIndex.getByIndex - (formatsIndex.getCount() - 1)); + XInterface formats = (XInterface)oMSF.createInstance + ("com.sun.star.sheet.TableAutoFormats"); + XIndexAccess formatsIndex = UnoRuntime.queryInterface(XIndexAccess.class, formats); + oObj = (XInterface) AnyConverter.toObject( + new Type(XInterface.class),formatsIndex.getByIndex + (formatsIndex.getCount() - 1)); - XNamed objNamed = UnoRuntime.queryInterface(XNamed.class, oObj) ; - log.println("AutoFormat name is '" + objNamed.getName() + "'") ; - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Unexpected exception", e); - } + XNamed objNamed = UnoRuntime.queryInterface(XNamed.class, oObj) ; + log.println("AutoFormat name is '" + objNamed.getName() + "'") ; TestEnvironment tEnv = new TestEnvironment(oObj); diff --git a/qadevOOo/tests/java/mod/_sc/ScCellCursorObj.java b/qadevOOo/tests/java/mod/_sc/ScCellCursorObj.java index a7e4b7a48b73..ca6f85990da4 100644 --- a/qadevOOo/tests/java/mod/_sc/ScCellCursorObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScCellCursorObj.java @@ -147,7 +147,7 @@ public class ScCellCursorObj extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; TestEnvironment tEnv = null; XSpreadsheet oSheet = null; @@ -162,39 +162,21 @@ public class ScCellCursorObj extends TestCase { XSpreadsheetDocument.class, xSheetDoc).getSheets(); - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class), - oSpreadsheets.getByName( - oSpreadsheets.getElementNames()[0])); - - testRange = oSheet.getCellRangeByName("$A$1:$D$4"); - - XSheetCellRange testSheetRange = UnoRuntime.queryInterface( - XSheetCellRange.class, - testRange); - oObj = oSheet.createCursorByRange(testSheetRange); - oSheet.getCellByPosition(1, 1).setValue(1); - oSheet.getCellByPosition(4, 5).setValue(1); - oSheet.getCellByPosition(3, 2).setFormula("xTextDoc"); - oSheet.getCellByPosition(3, 3).setFormula("xTextDoc"); - } catch (com.sun.star.lang.WrappedTargetException e) { - log.println("Exception occurred while creating test object:"); - e.printStackTrace(log); - throw new StatusException("Couldn't create test object", e); - } catch (com.sun.star.container.NoSuchElementException e) { - log.println("Exception occurred while creating test object:"); - e.printStackTrace(log); - throw new StatusException("Couldn't create test object", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Exception occurred while creating test object:"); - e.printStackTrace(log); - throw new StatusException("Couldn't create test object", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - log.println("Exception occurred while creating test object:"); - e.printStackTrace(log); - throw new StatusException("Couldn't create test object", e); - } + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class), + oSpreadsheets.getByName( + oSpreadsheets.getElementNames()[0])); + + testRange = oSheet.getCellRangeByName("$A$1:$D$4"); + + XSheetCellRange testSheetRange = UnoRuntime.queryInterface( + XSheetCellRange.class, + testRange); + oObj = oSheet.createCursorByRange(testSheetRange); + oSheet.getCellByPosition(1, 1).setValue(1); + oSheet.getCellByPosition(4, 5).setValue(1); + oSheet.getCellByPosition(3, 2).setFormula("xTextDoc"); + oSheet.getCellByPosition(3, 3).setFormula("xTextDoc"); log.println("Test object successfully created."); diff --git a/qadevOOo/tests/java/mod/_sc/ScCellFieldObj.java b/qadevOOo/tests/java/mod/_sc/ScCellFieldObj.java index 76d9ba06864c..4463a98a4f2c 100644 --- a/qadevOOo/tests/java/mod/_sc/ScCellFieldObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScCellFieldObj.java @@ -114,61 +114,43 @@ public class ScCellFieldObj extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) { + TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; XText oText = null; XTextContent oContent = null; XInterface aField = null; - try { - // we want to create an instance of ScCellFieldObj. - // to do this we must get an MultiServiceFactory. - - XMultiServiceFactory _oMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xSheetDoc); - - // Now create the instance of com.sun.star.text.TextField. - // This object has type ScCellFieldObj. - - oObj = (XInterface) - _oMSF.createInstance("com.sun.star.text.TextField.URL"); - - aField = (XInterface) - _oMSF.createInstance("com.sun.star.text.TextField.URL"); - oContent = UnoRuntime.queryInterface(XTextContent.class, aField); - - XSpreadsheets oSheets = xSheetDoc.getSheets() ; - XIndexAccess oIndexSheets = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); - XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); - - XCell oCell = oSheet.getCellByPosition(2,3); - oText = UnoRuntime.queryInterface(XText.class, oCell); - - XTextContent oTextContent = UnoRuntime.queryInterface(XTextContent.class, oObj); - - oText.insertTextContent( - oText.createTextCursor(), oTextContent, true); - - oCell = oSheet.getCellByPosition(1,4); - oText = UnoRuntime.queryInterface(XText.class, oCell); - } catch (com.sun.star.lang.WrappedTargetException e) { - log.println("Exception occurred while creating test Object."); - e.printStackTrace(log); - throw new StatusException("Couldn't create test object", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Exception occurred while creating test Object."); - e.printStackTrace(log); - throw new StatusException("Couldn't create test object", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - log.println("Exception occurred while creating test Object."); - e.printStackTrace(log); - throw new StatusException("Couldn't create test object", e); - } catch (com.sun.star.uno.Exception e) { - log.println("Exception occurred while creating test Object."); - e.printStackTrace(log); - throw new StatusException("Couldn't create test object", e); - } + // we want to create an instance of ScCellFieldObj. + // to do this we must get an MultiServiceFactory. + + XMultiServiceFactory _oMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xSheetDoc); + + // Now create the instance of com.sun.star.text.TextField. + // This object has type ScCellFieldObj. + + oObj = (XInterface) + _oMSF.createInstance("com.sun.star.text.TextField.URL"); + + aField = (XInterface) + _oMSF.createInstance("com.sun.star.text.TextField.URL"); + oContent = UnoRuntime.queryInterface(XTextContent.class, aField); + + XSpreadsheets oSheets = xSheetDoc.getSheets() ; + XIndexAccess oIndexSheets = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); + XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); + + XCell oCell = oSheet.getCellByPosition(2,3); + oText = UnoRuntime.queryInterface(XText.class, oCell); + + XTextContent oTextContent = UnoRuntime.queryInterface(XTextContent.class, oObj); + + oText.insertTextContent( + oText.createTextCursor(), oTextContent, true); + + oCell = oSheet.getCellByPosition(1,4); + oText = UnoRuntime.queryInterface(XText.class, oCell); TestEnvironment tEnv = new TestEnvironment(oObj) ; diff --git a/qadevOOo/tests/java/mod/_sc/ScCellFieldsObj.java b/qadevOOo/tests/java/mod/_sc/ScCellFieldsObj.java index 3f453b4e8cb0..33f0a158157d 100644 --- a/qadevOOo/tests/java/mod/_sc/ScCellFieldsObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScCellFieldsObj.java @@ -98,54 +98,36 @@ public class ScCellFieldsObj extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) { + TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; XText oText = null; XTextContent oContent = null; XInterface aField = null; - try { - // we want to create an instance of ScCellFieldObj. - // to do this we must get an MultiServiceFactory. - - XMultiServiceFactory _oMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xSheetDoc); - - aField = (XInterface) - _oMSF.createInstance("com.sun.star.text.TextField.URL"); - oContent = UnoRuntime.queryInterface(XTextContent.class, aField); - - XSpreadsheets oSheets = xSheetDoc.getSheets() ; - XIndexAccess oIndexSheets = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); - XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); - - XCell oCell = oSheet.getCellByPosition(2,3); - oText = UnoRuntime.queryInterface(XText.class, oCell); - - oText.insertTextContent( - oText.createTextCursor(), oContent, true); - - XTextFieldsSupplier xTextFieldsSupp = UnoRuntime.queryInterface(XTextFieldsSupplier.class, oCell); - - oObj = xTextFieldsSupp.getTextFields(); - } catch (com.sun.star.lang.WrappedTargetException e) { - log.println("Exception occurred while creating test Object."); - e.printStackTrace(log); - throw new StatusException("Couldn't create test object", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Exception occurred while creating test Object."); - e.printStackTrace(log); - throw new StatusException("Couldn't create test object", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - log.println("Exception occurred while creating test Object."); - e.printStackTrace(log); - throw new StatusException("Couldn't create test object", e); - } catch (com.sun.star.uno.Exception e) { - log.println("Exception occurred while creating test Object."); - e.printStackTrace(log); - throw new StatusException("Couldn't create test object", e); - } + // we want to create an instance of ScCellFieldObj. + // to do this we must get an MultiServiceFactory. + + XMultiServiceFactory _oMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xSheetDoc); + + aField = (XInterface) + _oMSF.createInstance("com.sun.star.text.TextField.URL"); + oContent = UnoRuntime.queryInterface(XTextContent.class, aField); + + XSpreadsheets oSheets = xSheetDoc.getSheets() ; + XIndexAccess oIndexSheets = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); + XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); + + XCell oCell = oSheet.getCellByPosition(2,3); + oText = UnoRuntime.queryInterface(XText.class, oCell); + + oText.insertTextContent( + oText.createTextCursor(), oContent, true); + + XTextFieldsSupplier xTextFieldsSupp = UnoRuntime.queryInterface(XTextFieldsSupplier.class, oCell); + + oObj = xTextFieldsSupp.getTextFields(); TestEnvironment tEnv = new TestEnvironment(oObj) ; diff --git a/qadevOOo/tests/java/mod/_sc/ScCellFormatsEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScCellFormatsEnumeration.java index 242d142fc21b..9b118c7e373e 100644 --- a/qadevOOo/tests/java/mod/_sc/ScCellFormatsEnumeration.java +++ b/qadevOOo/tests/java/mod/_sc/ScCellFormatsEnumeration.java @@ -100,7 +100,7 @@ public class ScCellFormatsEnumeration extends TestCase { * @see com.sun.star.container.XEnumerationAccess */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; @@ -111,19 +111,8 @@ public class ScCellFormatsEnumeration extends TestCase { XSpreadsheet oSheet = null; XIndexAccess oIndexAccess = UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets); - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); log.println("getting CellFormats"); diff --git a/qadevOOo/tests/java/mod/_sc/ScCellFormatsObj.java b/qadevOOo/tests/java/mod/_sc/ScCellFormatsObj.java index 3b3d204b1d6c..f46074593467 100644 --- a/qadevOOo/tests/java/mod/_sc/ScCellFormatsObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScCellFormatsObj.java @@ -92,7 +92,7 @@ public class ScCellFormatsObj extends TestCase { * @see com.sun.star.sheet.XCellFormatRangesSupplier */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; @@ -102,19 +102,8 @@ public class ScCellFormatsObj extends TestCase { log.println("getting a sheet"); XSpreadsheet oSheet = null; XIndexAccess oIndexAccess = UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets); - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); log.println("getting CellFormats"); XCellFormatRangesSupplier xCFRS = UnoRuntime.queryInterface(XCellFormatRangesSupplier.class, oSheet); diff --git a/qadevOOo/tests/java/mod/_sc/ScCellObj.java b/qadevOOo/tests/java/mod/_sc/ScCellObj.java index fb009cc01e6a..8816169ad92a 100644 --- a/qadevOOo/tests/java/mod/_sc/ScCellObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScCellObj.java @@ -122,7 +122,7 @@ public class ScCellObj extends TestCase { * @see com.sun.star.sheet.SheetCell */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; @@ -132,30 +132,15 @@ public class ScCellObj extends TestCase { XSpreadsheet oSheet = null; XCell cell = null; - try { - log.println("Getting spreadsheet") ; - XSpreadsheets oSheets = xSheetDoc.getSheets() ; - XIndexAccess oIndexSheets = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); - - log.println("Getting a cell from sheet") ; - oObj = oSheet.getCellByPosition(2, 3) ; - cell = UnoRuntime.queryInterface(XCell.class, oObj); - - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException( - "Error getting cell object from spreadsheet document", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException( - "Error getting cell object from spreadsheet document", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException( - "Error getting cell object from spreadsheet document", e); - } + log.println("Getting spreadsheet") ; + XSpreadsheets oSheets = xSheetDoc.getSheets() ; + XIndexAccess oIndexSheets = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); + + log.println("Getting a cell from sheet") ; + oObj = oSheet.getCellByPosition(2, 3) ; + cell = UnoRuntime.queryInterface(XCell.class, oObj); log.println( "creating a new environment for ScCellObj object" ); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_sc/ScCellRangeObj.java b/qadevOOo/tests/java/mod/_sc/ScCellRangeObj.java index ecabf27382e6..90dbbe9728b2 100644 --- a/qadevOOo/tests/java/mod/_sc/ScCellRangeObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScCellRangeObj.java @@ -132,7 +132,7 @@ public class ScCellRangeObj extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; XCellRange testRange; @@ -149,32 +149,13 @@ public class ScCellRangeObj extends TestCase { XSpreadsheet oSheet = null; - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class), - oNames.getByName(oNames.getElementNames()[0])); - - oObj = oSheet.getCellRangeByPosition(0, 0, 3, 4); - testRange = UnoRuntime.queryInterface( - XCellRange.class, oObj); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException( - "Error getting cell object from spreadsheet document", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException( - "Error getting cell object from spreadsheet document", e); - } catch (com.sun.star.container.NoSuchElementException e) { - e.printStackTrace(log); - throw new StatusException( - "Error getting cell object from spreadsheet document", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException( - "Error getting cell object from spreadsheet document", e); - } + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class), + oNames.getByName(oNames.getElementNames()[0])); + oObj = oSheet.getCellRangeByPosition(0, 0, 3, 4); + testRange = UnoRuntime.queryInterface( + XCellRange.class, oObj); TestEnvironment tEnv = new TestEnvironment(oObj); diff --git a/qadevOOo/tests/java/mod/_sc/ScCellRangesObj.java b/qadevOOo/tests/java/mod/_sc/ScCellRangesObj.java index 7e03d122ab3e..4a713e3ec369 100644 --- a/qadevOOo/tests/java/mod/_sc/ScCellRangesObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScCellRangesObj.java @@ -133,7 +133,7 @@ public class ScCellRangesObj extends TestCase { * @see com.sun.star.table.XCellRange */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; Object oRange = null ; @@ -155,49 +155,29 @@ public class ScCellRangesObj extends TestCase { XSpreadsheets oSheets = xSheetDoc.getSheets() ; XIndexAccess oIndSheets = UnoRuntime.queryInterface (XIndexAccess.class, oSheets); XSpreadsheet oSheet = null; - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class), oIndSheets.getByIndex(0)); - XNameContainer oRanges = UnoRuntime.queryInterface(XNameContainer.class, oObj); - - oRange = oSheet.getCellRangeByName("C1:D4"); - oRanges.insertByName("Range1", oRange); - oRange = oSheet.getCellRangeByName("E2:F5"); - oRanges.insertByName("Range2", oRange); - oRange = oSheet.getCellRangeByName("G2:H3"); - oRanges.insertByName("Range3", oRange); - oRange = oSheet.getCellRangeByName("I7:J8"); - oRanges.insertByName("Range4", oRange); - } catch(com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create test object", e); - } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create test object", e); - } catch(com.sun.star.container.ElementExistException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create test object", e); - } catch(com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create test object", e); - } + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class), oIndSheets.getByIndex(0)); + XNameContainer oRanges = UnoRuntime.queryInterface(XNameContainer.class, oObj); + + oRange = oSheet.getCellRangeByName("C1:D4"); + oRanges.insertByName("Range1", oRange); + oRange = oSheet.getCellRangeByName("E2:F5"); + oRanges.insertByName("Range2", oRange); + oRange = oSheet.getCellRangeByName("G2:H3"); + oRanges.insertByName("Range3", oRange); + oRange = oSheet.getCellRangeByName("I7:J8"); + oRanges.insertByName("Range4", oRange); log.println("filling some cells"); - try { - for (int i = 0; i < 10; i++) { - for (int j = 0; j < 5; j++) { - oSheet.getCellByPosition(i, j).setFormula("a"); - } + for (int i = 0; i < 10; i++) { + for (int j = 0; j < 5; j++) { + oSheet.getCellByPosition(i, j).setFormula("a"); } - for (int i = 0; i < 10; i++) { - for (int j = 5; j < 10; j++) { - oSheet.getCellByPosition(i, j).setValue(i + j); - } + } + for (int i = 0; i < 10; i++) { + for (int j = 5; j < 10; j++) { + oSheet.getCellByPosition(i, j).setValue(i + j); } - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException ( - "Exception occurred while filling cells", e); } diff --git a/qadevOOo/tests/java/mod/_sc/ScCellSearchObj.java b/qadevOOo/tests/java/mod/_sc/ScCellSearchObj.java index 530619ae679c..56100f05ac4d 100644 --- a/qadevOOo/tests/java/mod/_sc/ScCellSearchObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScCellSearchObj.java @@ -99,7 +99,7 @@ public class ScCellSearchObj extends TestCase { * @see com.sun.star.util.XSearchable */ @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { XInterface oObj = null; @@ -114,19 +114,8 @@ public class ScCellSearchObj extends TestCase { XSpreadsheet oSheet = null; XIndexAccess oIndexAccess = UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets); - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); XSearchable xSearch = UnoRuntime.queryInterface(XSearchable.class,oSheet); diff --git a/qadevOOo/tests/java/mod/_sc/ScCellTextCursor.java b/qadevOOo/tests/java/mod/_sc/ScCellTextCursor.java index eaeb1439c813..0a0eb64fef9d 100644 --- a/qadevOOo/tests/java/mod/_sc/ScCellTextCursor.java +++ b/qadevOOo/tests/java/mod/_sc/ScCellTextCursor.java @@ -135,7 +135,7 @@ public class ScCellTextCursor extends TestCase { * @see com.sun.star.text.XText */ @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { XInterface oObj = null; XCell aCell = null; @@ -145,29 +145,14 @@ public class ScCellTextCursor extends TestCase { log.println( "Creating a test environment" ); // get a soffice factory object - try { - log.println("Getting spreadsheet") ; - XSpreadsheets oSheets = xSheetDoc.getSheets() ; - XIndexAccess oIndexSheets = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); - XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); - - log.println("Getting a cell from sheet") ; - aCell = oSheet.getCellByPosition(1,1) ; - - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log) ; - throw new StatusException( - "Error getting cell object from spreadsheet document",e) ; - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log) ; - throw new StatusException( - "Error getting cell object from spreadsheet document",e) ; - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log) ; - throw new StatusException( - "Error getting cell object from spreadsheet document",e) ; - } + log.println("Getting spreadsheet") ; + XSpreadsheets oSheets = xSheetDoc.getSheets() ; + XIndexAccess oIndexSheets = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); + XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); + + log.println("Getting a cell from sheet") ; + aCell = oSheet.getCellByPosition(1,1) ; XText aText = UnoRuntime.queryInterface(XText.class, aCell); aText.setString("ScCellTextCursor"); diff --git a/qadevOOo/tests/java/mod/_sc/ScCellsEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScCellsEnumeration.java index 77fe41742640..88781f2fa9b4 100644 --- a/qadevOOo/tests/java/mod/_sc/ScCellsEnumeration.java +++ b/qadevOOo/tests/java/mod/_sc/ScCellsEnumeration.java @@ -102,7 +102,7 @@ public class ScCellsEnumeration extends TestCase { * @see com.sun.star.container.XEnumerationAccess */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; Object cellArr[] = new Object[3] ; @@ -112,36 +112,22 @@ public class ScCellsEnumeration extends TestCase { XSpreadsheets oSheets = xSheetDoc.getSheets(); XIndexAccess oIndexAccess = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); XCellRange oSheet = null; - try { - oSheet = (XCellRange) AnyConverter.toObject( - new Type(XCellRange.class),oIndexAccess.getByIndex(0)); - - XCell oCell_1 = oSheet.getCellByPosition(0, 0); - XTextRange oTextRange = UnoRuntime.queryInterface(XTextRange.class, oCell_1); - oTextRange.setString("Test string 1"); - - XCell oCell_2 = oSheet.getCellByPosition(5, 1); - oCell_2.setValue(15); - - XCell oCell_3 = oSheet.getCellByPosition(3, 9); - oTextRange = UnoRuntime.queryInterface(XTextRange.class, oCell_3); - oTextRange.setString("test 2"); - cellArr[0] = oCell_1; - cellArr[1] = oCell_2; - cellArr[2] = oCell_3; - } catch(com.sun.star.lang.WrappedTargetException e) { - log.println ("Exception occurred while creating test Object."); - e.printStackTrace(log); - throw new StatusException("Couldn't create test object", e); - } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println ("Exception occurred while creating test Object."); - e.printStackTrace(log); - throw new StatusException("Couldn't create test object", e); - } catch(com.sun.star.lang.IllegalArgumentException e) { - log.println ("Exception occurred while creating test Object."); - e.printStackTrace(log); - throw new StatusException("Couldn't create test object", e); - } + oSheet = (XCellRange) AnyConverter.toObject( + new Type(XCellRange.class),oIndexAccess.getByIndex(0)); + + XCell oCell_1 = oSheet.getCellByPosition(0, 0); + XTextRange oTextRange = UnoRuntime.queryInterface(XTextRange.class, oCell_1); + oTextRange.setString("Test string 1"); + + XCell oCell_2 = oSheet.getCellByPosition(5, 1); + oCell_2.setValue(15); + + XCell oCell_3 = oSheet.getCellByPosition(3, 9); + oTextRange = UnoRuntime.queryInterface(XTextRange.class, oCell_3); + oTextRange.setString("test 2"); + cellArr[0] = oCell_1; + cellArr[1] = oCell_2; + cellArr[2] = oCell_3; XCellRangesQuery oCellRangesQuery = UnoRuntime.queryInterface(XCellRangesQuery.class, oSheet); XSheetCellRanges oSheetCellRanges = oCellRangesQuery.queryVisibleCells(); diff --git a/qadevOOo/tests/java/mod/_sc/ScCellsObj.java b/qadevOOo/tests/java/mod/_sc/ScCellsObj.java index 0ca4e0adb70a..f7f6f62575e6 100644 --- a/qadevOOo/tests/java/mod/_sc/ScCellsObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScCellsObj.java @@ -97,7 +97,7 @@ public class ScCellsObj extends TestCase { * @see com.sun.star.sheet.XCellRangesQuery */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; Object cellArr[] = new Object[3]; @@ -106,39 +106,25 @@ public class ScCellsObj extends TestCase { XSpreadsheets oSheets = xSheetDoc.getSheets(); XIndexAccess oIndexAccess = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); XCellRange oSheet = null; - try { - oSheet = (XCellRange) AnyConverter.toObject( - new Type(XCellRange.class),oIndexAccess.getByIndex(0)); - - XCell oCell_1 = oSheet.getCellByPosition(0, 0); - XTextRange oTextRange = UnoRuntime.queryInterface(XTextRange.class, oCell_1); - - oTextRange.setString("ScCellsObj test 1"); - - XCell oCell_2 = oSheet.getCellByPosition(5, 1); - oCell_2.setValue(15); - - XCell oCell_3 = oSheet.getCellByPosition(3, 9); - oTextRange = UnoRuntime.queryInterface(XTextRange.class, oCell_3); - - oTextRange.setString("ScCellsObj test 2"); - - cellArr[0] = oCell_1; - cellArr[2] = oCell_2; - cellArr[1] = oCell_3; - } catch(com.sun.star.lang.WrappedTargetException e) { - log.println ("Exception occurred while creating test Object."); - e.printStackTrace(log); - throw new StatusException("Couldn't create test object", e); - } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println ("Exception occurred while creating test Object."); - e.printStackTrace(log); - throw new StatusException("Couldn't create test object", e); - } catch(com.sun.star.lang.IllegalArgumentException e) { - log.println ("Exception occurred while creating test Object."); - e.printStackTrace(log); - throw new StatusException("Couldn't create test object", e); - } + oSheet = (XCellRange) AnyConverter.toObject( + new Type(XCellRange.class),oIndexAccess.getByIndex(0)); + + XCell oCell_1 = oSheet.getCellByPosition(0, 0); + XTextRange oTextRange = UnoRuntime.queryInterface(XTextRange.class, oCell_1); + + oTextRange.setString("ScCellsObj test 1"); + + XCell oCell_2 = oSheet.getCellByPosition(5, 1); + oCell_2.setValue(15); + + XCell oCell_3 = oSheet.getCellByPosition(3, 9); + oTextRange = UnoRuntime.queryInterface(XTextRange.class, oCell_3); + + oTextRange.setString("ScCellsObj test 2"); + + cellArr[0] = oCell_1; + cellArr[2] = oCell_2; + cellArr[1] = oCell_3; XCellRangesQuery oCellRangesQuery = UnoRuntime.queryInterface(XCellRangesQuery.class, oSheet); XSheetCellRanges oSheetCellRanges = oCellRangesQuery.queryVisibleCells(); diff --git a/qadevOOo/tests/java/mod/_sc/ScChartObj.java b/qadevOOo/tests/java/mod/_sc/ScChartObj.java index da813e3e9f5a..360657f99aac 100644 --- a/qadevOOo/tests/java/mod/_sc/ScChartObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScChartObj.java @@ -108,29 +108,15 @@ public class ScChartObj extends TestCase { * @see com.sun.star.container.XNamed */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XSpreadsheet oSheet=null; - try { - log.println("Getting spreadsheet") ; - XSpreadsheets oSheets = xSheetDoc.getSheets() ; - XIndexAccess oIndexSheets = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - log.println("Couldn't get Sheet "); - e.printStackTrace(log); - throw new StatusException("Couldn't get sheet", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Couldn't get Sheet "); - e.printStackTrace(log); - throw new StatusException("Couldn't get sheet", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - log.println("Couldn't get Sheet "); - e.printStackTrace(log); - throw new StatusException("Couldn't get sheet", e); - } + log.println("Getting spreadsheet") ; + XSpreadsheets oSheets = xSheetDoc.getSheets() ; + XIndexAccess oIndexSheets = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); log.println("Creating the Header") ; diff --git a/qadevOOo/tests/java/mod/_sc/ScChartsObj.java b/qadevOOo/tests/java/mod/_sc/ScChartsObj.java index f4833794d5d3..0bebd91cfbfb 100644 --- a/qadevOOo/tests/java/mod/_sc/ScChartsObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScChartsObj.java @@ -116,29 +116,15 @@ public class ScChartsObj extends TestCase { * @see com.sun.star.table.XTableChartsSupplier */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XSpreadsheet oSheet=null; - try { - log.println("Getting spreadsheet") ; - XSpreadsheets oSheets = xSheetDoc.getSheets() ; - XIndexAccess oIndexSheets = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - log.println("Couldn't get Sheet "); - e.printStackTrace(log); - throw new StatusException("Couldn't get sheet", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Couldn't get Sheet "); - e.printStackTrace(log); - throw new StatusException("Couldn't get sheet", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - log.println("Couldn't get Sheet "); - e.printStackTrace(log); - throw new StatusException("Couldn't get sheet", e); - } + log.println("Getting spreadsheet") ; + XSpreadsheets oSheets = xSheetDoc.getSheets() ; + XIndexAccess oIndexSheets = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); log.println("Creating the Header") ; diff --git a/qadevOOo/tests/java/mod/_sc/ScDDELinkObj.java b/qadevOOo/tests/java/mod/_sc/ScDDELinkObj.java index 5ec374bb8ab7..e4dc867b98d3 100644 --- a/qadevOOo/tests/java/mod/_sc/ScDDELinkObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScDDELinkObj.java @@ -121,7 +121,7 @@ public class ScDDELinkObj extends TestCase { * @see com.sun.star.sheet.DDELink */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; @@ -139,18 +139,7 @@ public class ScDDELinkObj extends TestCase { // load the predefined testdocument String testdoc = util.utils.getFullTestURL("ScDDELinksObj.ods"); - try { - oDoc = SOfficeFactory.getFactory(oMSF).loadDocument(testdoc); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Can't load test document", e); - } catch (com.sun.star.io.IOException e) { - e.printStackTrace(log); - throw new StatusException("Can't load test document", e); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Can't load test document", e); - } + oDoc = SOfficeFactory.getFactory(oMSF).loadDocument(testdoc); log.println("getting sheets"); XSpreadsheets xSpreadsheets = xSheetDoc.getSheets(); @@ -158,67 +147,32 @@ public class ScDDELinkObj extends TestCase { log.println("getting a sheet"); XSpreadsheet oSheet = null; XIndexAccess oIndexAccess = UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets); - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get a spreadsheet", e); - } + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); log.println("filling some cells"); String sAppl = "soffice"; String sItem = "Sheet1.A1"; testdoc = util.utils.getFullTestDocName("ScDDELinksObj.ods"); - try { - oSheet.getCellByPosition(5, 5).setFormula( - "=DDE(\""+ sAppl +"\";\""+testdoc+"\";\""+ sItem +"\""); - oSheet.getCellByPosition(1, 4).setFormula( - "=DDE(\""+ sAppl +"\";\""+testdoc+"\";\""+ sItem +"\""); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException( - "Exception occurred while filling cells", e); - } + oSheet.getCellByPosition(5, 5).setFormula( + "=DDE(\""+ sAppl +"\";\""+testdoc+"\";\""+ sItem +"\""); + oSheet.getCellByPosition(1, 4).setFormula( + "=DDE(\""+ sAppl +"\";\""+testdoc+"\";\""+ sItem +"\""); - try { - log.println("Getting test object ") ; + log.println("Getting test object ") ; - // Getting named ranges. - XPropertySet docProps = UnoRuntime.queryInterface(XPropertySet.class, xSheetDoc); - XNameAccess links = (XNameAccess) AnyConverter.toObject( - new Type(XNameAccess.class), UnoRuntime.queryInterface( - XNameAccess.class, docProps.getPropertyValue("DDELinks"))); + // Getting named ranges. + XPropertySet docProps = UnoRuntime.queryInterface(XPropertySet.class, xSheetDoc); + XNameAccess links = (XNameAccess) AnyConverter.toObject( + new Type(XNameAccess.class), UnoRuntime.queryInterface( + XNameAccess.class, docProps.getPropertyValue("DDELinks"))); - String[] linkNames = links.getElementNames(); + String[] linkNames = links.getElementNames(); - oObj = (XInterface) AnyConverter.toObject( - new Type(XInterface.class),links.getByName(linkNames[0])); - log.println("Creating object - " + + oObj = (XInterface) AnyConverter.toObject( + new Type(XInterface.class),links.getByName(linkNames[0])); + log.println("Creating object - " + ((oObj == null) ? "FAILED" : "OK")); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log) ; - throw new StatusException( - "Error getting test object from spreadsheet document", e) ; - } catch (com.sun.star.beans.UnknownPropertyException e) { - e.printStackTrace(log) ; - throw new StatusException( - "Error getting test object from spreadsheet document", e) ; - } catch (com.sun.star.container.NoSuchElementException e) { - e.printStackTrace(log) ; - throw new StatusException( - "Error getting test object from spreadsheet document", e) ; - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log) ; - throw new StatusException( - "Error getting test object from spreadsheet document", e) ; - } TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_sc/ScDDELinksObj.java b/qadevOOo/tests/java/mod/_sc/ScDDELinksObj.java index 4d9ea8dca70b..6e51429b414a 100644 --- a/qadevOOo/tests/java/mod/_sc/ScDDELinksObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScDDELinksObj.java @@ -105,7 +105,7 @@ public class ScDDELinksObj extends TestCase { * @see com.sun.star.sheet.DDELinks */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; @@ -119,18 +119,7 @@ public class ScDDELinksObj extends TestCase { // load the predefined testdocument String testdoc = utils.getFullTestURL("ScDDELinksObj.ods"); - try { - oDoc = SOfficeFactory.getFactory(oMSF).loadDocument(testdoc); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Can't load test document", e); - } catch (com.sun.star.io.IOException e) { - e.printStackTrace(log); - throw new StatusException("Can't load test document", e); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Can't load test document", e); - } + oDoc = SOfficeFactory.getFactory(oMSF).loadDocument(testdoc); log.println("getting sheets"); XSpreadsheets xSpreadsheets = xSheetDoc.getSheets(); @@ -138,57 +127,26 @@ public class ScDDELinksObj extends TestCase { log.println("getting a sheet"); XSpreadsheet oSheet = null; XIndexAccess oIndexAccess = UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets); - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get a spreadsheet", e); - } + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); testdoc = utils.getFullTestDocName("ScDDELinksObj.ods"); log.println("filling some cells"); - try { - oSheet.getCellByPosition(5, 5).setFormula( - "=DDE(\"soffice\";\""+testdoc+"\";\"Sheet1.A1\""); - oSheet.getCellByPosition(1, 4).setFormula( - "=DDE(\"soffice\";\""+testdoc+"\";\"Sheet1.A1\""); - oSheet.getCellByPosition(2, 0).setFormula( - "=DDE(\"soffice\";\""+testdoc+"\";\"Sheet1.A1\""); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException( - "Exception occurred while filling cells", e); - } - - try { - log.println("Getting test object ") ; - - // Getting named ranges. - XPropertySet docProps = UnoRuntime.queryInterface(XPropertySet.class, xSheetDoc); - oObj = (XInterface)AnyConverter.toObject( - new Type(XInterface.class),docProps.getPropertyValue("DDELinks")); - log.println("Creating object - " + - ((oObj == null) ? "FAILED" : "OK")); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log) ; - throw new StatusException( - "Error getting test object from spreadsheet document", e) ; - } catch (com.sun.star.beans.UnknownPropertyException e) { - e.printStackTrace(log) ; - throw new StatusException( - "Error getting test object from spreadsheet document", e) ; - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log) ; - throw new StatusException( - "Error getting test object from spreadsheet document", e) ; - } + oSheet.getCellByPosition(5, 5).setFormula( + "=DDE(\"soffice\";\""+testdoc+"\";\"Sheet1.A1\""); + oSheet.getCellByPosition(1, 4).setFormula( + "=DDE(\"soffice\";\""+testdoc+"\";\"Sheet1.A1\""); + oSheet.getCellByPosition(2, 0).setFormula( + "=DDE(\"soffice\";\""+testdoc+"\";\"Sheet1.A1\""); + + log.println("Getting test object ") ; + + // Getting named ranges. + XPropertySet docProps = UnoRuntime.queryInterface(XPropertySet.class, xSheetDoc); + oObj = (XInterface)AnyConverter.toObject( + new Type(XInterface.class),docProps.getPropertyValue("DDELinks")); + log.println("Creating object - " + + ((oObj == null) ? "FAILED" : "OK")); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_sc/ScDataPilotFieldGroupItemObj.java b/qadevOOo/tests/java/mod/_sc/ScDataPilotFieldGroupItemObj.java index 5a58ab6a6730..f1179c23df24 100644 --- a/qadevOOo/tests/java/mod/_sc/ScDataPilotFieldGroupItemObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScDataPilotFieldGroupItemObj.java @@ -95,7 +95,7 @@ public class ScDataPilotFieldGroupItemObj extends TestCase @Override protected synchronized TestEnvironment createTestEnvironment (TestParameters Param, - PrintWriter log) + PrintWriter log) throws Exception { XInterface oObj = null; XInterface datapilotfield = null; @@ -129,81 +129,46 @@ public class ScDataPilotFieldGroupItemObj extends TestCase // Make sure there are at least two sheets xSpreadsheets.insertNewByName("Some Sheet", (short)0); - try - { - oSheet = (XSpreadsheet) AnyConverter.toObject ( - new Type (XSpreadsheet.class), - oIndexAccess.getByIndex (0)); - oSheet2 = (XSpreadsheet) AnyConverter.toObject ( - new Type (XSpreadsheet.class), - oIndexAccess.getByIndex (1)); - } - catch (com.sun.star.lang.WrappedTargetException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't get a spreadsheet", e); - } - catch (com.sun.star.lang.IndexOutOfBoundsException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't get a spreadsheet", e); - } - catch (com.sun.star.lang.IllegalArgumentException e) + oSheet = (XSpreadsheet) AnyConverter.toObject ( + new Type (XSpreadsheet.class), + oIndexAccess.getByIndex (0)); + oSheet2 = (XSpreadsheet) AnyConverter.toObject ( + new Type (XSpreadsheet.class), + oIndexAccess.getByIndex (1)); + + log.println ("Filling a table"); + + for (int i = 1; i < mMaxFieldIndex; i++) { - e.printStackTrace (); - throw new StatusException ("Couldn't get a spreadsheet", e); + oSheet.getCellByPosition (i, 0).setFormula ("Col" + i); + oSheet.getCellByPosition (0, i).setFormula ("Row" + i); + oSheet2.getCellByPosition (i, 0).setFormula ("Col" + i); + oSheet2.getCellByPosition (0, i).setFormula ("Row" + i); } - try + for (int i = 1; i < mMaxFieldIndex; i++) { - log.println ("Filling a table"); - - for (int i = 1; i < mMaxFieldIndex; i++) + for (int j = 1; j < mMaxFieldIndex; j++) { - oSheet.getCellByPosition (i, 0).setFormula ("Col" + i); - oSheet.getCellByPosition (0, i).setFormula ("Row" + i); - oSheet2.getCellByPosition (i, 0).setFormula ("Col" + i); - oSheet2.getCellByPosition (0, i).setFormula ("Row" + i); + oSheet.getCellByPosition (i, j).setValue (i * (j + 1)); + oSheet2.getCellByPosition (i, j).setValue (i * (j + 2)); } - - for (int i = 1; i < mMaxFieldIndex; i++) - { - for (int j = 1; j < mMaxFieldIndex; j++) - { - oSheet.getCellByPosition (i, j).setValue (i * (j + 1)); - oSheet2.getCellByPosition (i, j).setValue (i * (j + 2)); - } - } - - oSheet.getCellByPosition (1, 1).setFormula ("aName"); - oSheet.getCellByPosition (1, 2).setFormula ("otherName"); - oSheet.getCellByPosition (1, 3).setFormula ("una"); - oSheet.getCellByPosition (1, 4).setFormula ("otherName"); - oSheet.getCellByPosition (1, 5).setFormula ("somethingelse"); - - } - catch (com.sun.star.lang.IndexOutOfBoundsException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't fill some cells", e); } - try - { - oSheet.getCellByPosition (1, 5); + oSheet.getCellByPosition (1, 1).setFormula ("aName"); + oSheet.getCellByPosition (1, 2).setFormula ("otherName"); + oSheet.getCellByPosition (1, 3).setFormula ("una"); + oSheet.getCellByPosition (1, 4).setFormula ("otherName"); + oSheet.getCellByPosition (1, 5).setFormula ("somethingelse"); - int x = sCellAdress.Column; - int y = sCellAdress.Row + 3; + oSheet.getCellByPosition (1, 5); + int x = sCellAdress.Column; + int y = sCellAdress.Row + 3; - oSheet.getCellByPosition (x, y); - Integer.valueOf(27); - } - catch (com.sun.star.lang.IndexOutOfBoundsException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't get cells for changing.", e); - } + + oSheet.getCellByPosition (x, y); + Integer.valueOf(27); // create the test objects @@ -218,51 +183,23 @@ public class ScDataPilotFieldGroupItemObj extends TestCase XPropertySet fieldPropSet = null; - try - { - Object oDataPilotField = DPDsc.getDataPilotFields ().getByIndex (0); - fieldPropSet = UnoRuntime.queryInterface ( - XPropertySet.class, oDataPilotField); - fieldPropSet.setPropertyValue ("Orientation", - com.sun.star.sheet.DataPilotFieldOrientation.ROW); - oDataPilotField = DPDsc.getDataPilotFields ().getByIndex (1); - fieldPropSet = UnoRuntime.queryInterface ( - XPropertySet.class, oDataPilotField); - fieldPropSet.setPropertyValue ("Function", - com.sun.star.sheet.GeneralFunction.SUM); - fieldPropSet.setPropertyValue ("Orientation", - com.sun.star.sheet.DataPilotFieldOrientation.DATA); - oDataPilotField = DPDsc.getDataPilotFields ().getByIndex (2); - fieldPropSet = UnoRuntime.queryInterface ( - XPropertySet.class, oDataPilotField); - fieldPropSet.setPropertyValue ("Orientation", - com.sun.star.sheet.DataPilotFieldOrientation.COLUMN); - } - catch (com.sun.star.lang.WrappedTargetException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't create a test environment", e); - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't create a test environment", e); - } - catch (com.sun.star.beans.PropertyVetoException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't create a test environment", e); - } - catch (com.sun.star.beans.UnknownPropertyException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't create a test environment", e); - } - catch (com.sun.star.lang.IndexOutOfBoundsException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't create a test environment", e); - } + Object oDataPilotField = DPDsc.getDataPilotFields ().getByIndex (0); + fieldPropSet = UnoRuntime.queryInterface ( + XPropertySet.class, oDataPilotField); + fieldPropSet.setPropertyValue ("Orientation", + com.sun.star.sheet.DataPilotFieldOrientation.ROW); + oDataPilotField = DPDsc.getDataPilotFields ().getByIndex (1); + fieldPropSet = UnoRuntime.queryInterface ( + XPropertySet.class, oDataPilotField); + fieldPropSet.setPropertyValue ("Function", + com.sun.star.sheet.GeneralFunction.SUM); + fieldPropSet.setPropertyValue ("Orientation", + com.sun.star.sheet.DataPilotFieldOrientation.DATA); + oDataPilotField = DPDsc.getDataPilotFields ().getByIndex (2); + fieldPropSet = UnoRuntime.queryInterface ( + XPropertySet.class, oDataPilotField); + fieldPropSet.setPropertyValue ("Orientation", + com.sun.star.sheet.DataPilotFieldOrientation.COLUMN); log.println ("Insert the DataPilotTable"); @@ -274,29 +211,11 @@ public class ScDataPilotFieldGroupItemObj extends TestCase DPT.insertNewByName ("DataPilotTable", sCellAdress, DPDsc); XIndexAccess xIA = UnoRuntime.queryInterface (XIndexAccess.class,DPTS.getDataPilotTables ()); XIndexAccess IA = null; - try - { - XDataPilotDescriptor xDPT = UnoRuntime.queryInterface (XDataPilotDescriptor.class,xIA.getByIndex (0)); - IA = xDPT.getRowFields (); - System.out.println ("COUNT: "+IA.getCount ()); - datapilotfield = (XInterface) AnyConverter.toObject ( - new Type (XInterface.class), IA.getByIndex (0)); - } - catch (com.sun.star.lang.WrappedTargetException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't get data pilot field", e); - } - catch (com.sun.star.lang.IndexOutOfBoundsException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't get data pilot field", e); - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't get data pilot field", e); - } + XDataPilotDescriptor xDPT = UnoRuntime.queryInterface (XDataPilotDescriptor.class,xIA.getByIndex (0)); + IA = xDPT.getRowFields (); + System.out.println ("COUNT: "+IA.getCount ()); + datapilotfield = (XInterface) AnyConverter.toObject ( + new Type (XInterface.class), IA.getByIndex (0)); try { @@ -305,21 +224,8 @@ public class ScDataPilotFieldGroupItemObj extends TestCase dpfg.createNameGroup (elements); DataPilotFieldGroupInfo dpgi=null; xIA = UnoRuntime.queryInterface (XIndexAccess.class,DPTS.getDataPilotTables ()); - try - { - XDataPilotDescriptor xDPT = UnoRuntime.queryInterface (XDataPilotDescriptor.class,xIA.getByIndex (0)); - IA = xDPT.getRowFields (); - } - catch (com.sun.star.lang.WrappedTargetException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't get data pilot field", e); - } - catch (com.sun.star.lang.IndexOutOfBoundsException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't get data pilot field", e); - } + XDataPilotDescriptor xDPT2 = UnoRuntime.queryInterface (XDataPilotDescriptor.class,xIA.getByIndex (0)); + IA = xDPT2.getRowFields (); for (int i=0;i<IA.getCount ();i++) { datapilotfield = (XInterface) AnyConverter.toObject ( diff --git a/qadevOOo/tests/java/mod/_sc/ScDataPilotFieldGroupObj.java b/qadevOOo/tests/java/mod/_sc/ScDataPilotFieldGroupObj.java index 148f81aa71ce..4fd039c88222 100644 --- a/qadevOOo/tests/java/mod/_sc/ScDataPilotFieldGroupObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScDataPilotFieldGroupObj.java @@ -94,7 +94,7 @@ public class ScDataPilotFieldGroupObj extends TestCase @Override protected synchronized TestEnvironment createTestEnvironment (TestParameters Param, - PrintWriter log) + PrintWriter log) throws Exception { XInterface oObj = null; XInterface datapilotfield = null; @@ -128,81 +128,46 @@ public class ScDataPilotFieldGroupObj extends TestCase // Make sure there are at least two sheets xSpreadsheets.insertNewByName("Some Sheet", (short)0); - try - { - oSheet = (XSpreadsheet) AnyConverter.toObject ( - new Type (XSpreadsheet.class), - oIndexAccess.getByIndex (0)); - oSheet2 = (XSpreadsheet) AnyConverter.toObject ( - new Type (XSpreadsheet.class), - oIndexAccess.getByIndex (1)); - } - catch (com.sun.star.lang.WrappedTargetException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't get a spreadsheet", e); - } - catch (com.sun.star.lang.IndexOutOfBoundsException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't get a spreadsheet", e); - } - catch (com.sun.star.lang.IllegalArgumentException e) + oSheet = (XSpreadsheet) AnyConverter.toObject ( + new Type (XSpreadsheet.class), + oIndexAccess.getByIndex (0)); + oSheet2 = (XSpreadsheet) AnyConverter.toObject ( + new Type (XSpreadsheet.class), + oIndexAccess.getByIndex (1)); + + log.println ("Filling a table"); + + for (int i = 1; i < mMaxFieldIndex; i++) { - e.printStackTrace (); - throw new StatusException ("Couldn't get a spreadsheet", e); + oSheet.getCellByPosition (i, 0).setFormula ("Col" + i); + oSheet.getCellByPosition (0, i).setFormula ("Row" + i); + oSheet2.getCellByPosition (i, 0).setFormula ("Col" + i); + oSheet2.getCellByPosition (0, i).setFormula ("Row" + i); } - try + for (int i = 1; i < mMaxFieldIndex; i++) { - log.println ("Filling a table"); - - for (int i = 1; i < mMaxFieldIndex; i++) + for (int j = 1; j < mMaxFieldIndex; j++) { - oSheet.getCellByPosition (i, 0).setFormula ("Col" + i); - oSheet.getCellByPosition (0, i).setFormula ("Row" + i); - oSheet2.getCellByPosition (i, 0).setFormula ("Col" + i); - oSheet2.getCellByPosition (0, i).setFormula ("Row" + i); + oSheet.getCellByPosition (i, j).setValue (i * (j + 1)); + oSheet2.getCellByPosition (i, j).setValue (i * (j + 2)); } - - for (int i = 1; i < mMaxFieldIndex; i++) - { - for (int j = 1; j < mMaxFieldIndex; j++) - { - oSheet.getCellByPosition (i, j).setValue (i * (j + 1)); - oSheet2.getCellByPosition (i, j).setValue (i * (j + 2)); - } - } - - oSheet.getCellByPosition (1, 1).setFormula ("aName"); - oSheet.getCellByPosition (1, 2).setFormula ("otherName"); - oSheet.getCellByPosition (1, 3).setFormula ("una"); - oSheet.getCellByPosition (1, 4).setFormula ("otherName"); - oSheet.getCellByPosition (1, 5).setFormula ("somethingelse"); - - } - catch (com.sun.star.lang.IndexOutOfBoundsException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't fill some cells", e); } - try - { - oSheet.getCellByPosition (1, 5); + oSheet.getCellByPosition (1, 1).setFormula ("aName"); + oSheet.getCellByPosition (1, 2).setFormula ("otherName"); + oSheet.getCellByPosition (1, 3).setFormula ("una"); + oSheet.getCellByPosition (1, 4).setFormula ("otherName"); + oSheet.getCellByPosition (1, 5).setFormula ("somethingelse"); - int x = sCellAdress.Column; - int y = sCellAdress.Row + 3; + oSheet.getCellByPosition (1, 5); + int x = sCellAdress.Column; + int y = sCellAdress.Row + 3; - oSheet.getCellByPosition (x, y); - Integer.valueOf(27); - } - catch (com.sun.star.lang.IndexOutOfBoundsException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't get cells for changing.", e); - } + + oSheet.getCellByPosition (x, y); + Integer.valueOf(27); // create the test objects @@ -217,51 +182,23 @@ public class ScDataPilotFieldGroupObj extends TestCase XPropertySet fieldPropSet = null; - try - { - Object oDataPilotField = DPDsc.getDataPilotFields ().getByIndex (0); - fieldPropSet = UnoRuntime.queryInterface ( - XPropertySet.class, oDataPilotField); - fieldPropSet.setPropertyValue ("Orientation", - com.sun.star.sheet.DataPilotFieldOrientation.ROW); - oDataPilotField = DPDsc.getDataPilotFields ().getByIndex (1); - fieldPropSet = UnoRuntime.queryInterface ( - XPropertySet.class, oDataPilotField); - fieldPropSet.setPropertyValue ("Function", - com.sun.star.sheet.GeneralFunction.SUM); - fieldPropSet.setPropertyValue ("Orientation", - com.sun.star.sheet.DataPilotFieldOrientation.DATA); - oDataPilotField = DPDsc.getDataPilotFields ().getByIndex (2); - fieldPropSet = UnoRuntime.queryInterface ( - XPropertySet.class, oDataPilotField); - fieldPropSet.setPropertyValue ("Orientation", - com.sun.star.sheet.DataPilotFieldOrientation.COLUMN); - } - catch (com.sun.star.lang.WrappedTargetException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't create a test environment", e); - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't create a test environment", e); - } - catch (com.sun.star.beans.PropertyVetoException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't create a test environment", e); - } - catch (com.sun.star.beans.UnknownPropertyException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't create a test environment", e); - } - catch (com.sun.star.lang.IndexOutOfBoundsException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't create a test environment", e); - } + Object oDataPilotField = DPDsc.getDataPilotFields ().getByIndex (0); + fieldPropSet = UnoRuntime.queryInterface ( + XPropertySet.class, oDataPilotField); + fieldPropSet.setPropertyValue ("Orientation", + com.sun.star.sheet.DataPilotFieldOrientation.ROW); + oDataPilotField = DPDsc.getDataPilotFields ().getByIndex (1); + fieldPropSet = UnoRuntime.queryInterface ( + XPropertySet.class, oDataPilotField); + fieldPropSet.setPropertyValue ("Function", + com.sun.star.sheet.GeneralFunction.SUM); + fieldPropSet.setPropertyValue ("Orientation", + com.sun.star.sheet.DataPilotFieldOrientation.DATA); + oDataPilotField = DPDsc.getDataPilotFields ().getByIndex (2); + fieldPropSet = UnoRuntime.queryInterface ( + XPropertySet.class, oDataPilotField); + fieldPropSet.setPropertyValue ("Orientation", + com.sun.star.sheet.DataPilotFieldOrientation.COLUMN); log.println ("Insert the DataPilotTable"); @@ -273,29 +210,11 @@ public class ScDataPilotFieldGroupObj extends TestCase DPT.insertNewByName ("DataPilotTable", sCellAdress, DPDsc); XIndexAccess xIA = UnoRuntime.queryInterface (XIndexAccess.class,DPTS.getDataPilotTables ()); XIndexAccess IA = null; - try - { - XDataPilotDescriptor xDPT = UnoRuntime.queryInterface (XDataPilotDescriptor.class,xIA.getByIndex (0)); - IA = xDPT.getRowFields (); - System.out.println ("COUNT: "+IA.getCount ()); - datapilotfield = (XInterface) AnyConverter.toObject ( - new Type (XInterface.class), IA.getByIndex (0)); - } - catch (com.sun.star.lang.WrappedTargetException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't get data pilot field", e); - } - catch (com.sun.star.lang.IndexOutOfBoundsException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't get data pilot field", e); - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't get data pilot field", e); - } + XDataPilotDescriptor xDPT = UnoRuntime.queryInterface (XDataPilotDescriptor.class,xIA.getByIndex (0)); + IA = xDPT.getRowFields (); + System.out.println ("COUNT: "+IA.getCount ()); + datapilotfield = (XInterface) AnyConverter.toObject ( + new Type (XInterface.class), IA.getByIndex (0)); try { @@ -304,21 +223,8 @@ public class ScDataPilotFieldGroupObj extends TestCase dpfg.createNameGroup (elements); DataPilotFieldGroupInfo dpgi=null; xIA = UnoRuntime.queryInterface (XIndexAccess.class,DPTS.getDataPilotTables ()); - try - { - XDataPilotDescriptor xDPT = UnoRuntime.queryInterface (XDataPilotDescriptor.class,xIA.getByIndex (0)); - IA = xDPT.getRowFields (); - } - catch (com.sun.star.lang.WrappedTargetException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't get data pilot field", e); - } - catch (com.sun.star.lang.IndexOutOfBoundsException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't get data pilot field", e); - } + XDataPilotDescriptor xDPT2 = UnoRuntime.queryInterface (XDataPilotDescriptor.class,xIA.getByIndex (0)); + IA = xDPT2.getRowFields (); for (int i=0;i<IA.getCount ();i++) { datapilotfield = (XInterface) AnyConverter.toObject ( diff --git a/qadevOOo/tests/java/mod/_sc/ScDataPilotFieldGroupsObj.java b/qadevOOo/tests/java/mod/_sc/ScDataPilotFieldGroupsObj.java index da08d525ef62..b317c79dd642 100644 --- a/qadevOOo/tests/java/mod/_sc/ScDataPilotFieldGroupsObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScDataPilotFieldGroupsObj.java @@ -94,7 +94,7 @@ public class ScDataPilotFieldGroupsObj extends TestCase @Override protected synchronized TestEnvironment createTestEnvironment (TestParameters Param, - PrintWriter log) + PrintWriter log) throws Exception { XInterface oObj = null; XInterface datapilotfield = null; @@ -128,82 +128,44 @@ public class ScDataPilotFieldGroupsObj extends TestCase // Make sure there are at least two sheets xSpreadsheets.insertNewByName("Some Sheet", (short)0); - try - { - oSheet = (XSpreadsheet) AnyConverter.toObject ( - new Type (XSpreadsheet.class), - oIndexAccess.getByIndex (0)); - oSheet2 = (XSpreadsheet) AnyConverter.toObject ( - new Type (XSpreadsheet.class), - oIndexAccess.getByIndex (1)); - } - catch (com.sun.star.lang.WrappedTargetException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't get a spreadsheet", e); - } - catch (com.sun.star.lang.IndexOutOfBoundsException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't get a spreadsheet", e); - } - catch (com.sun.star.lang.IllegalArgumentException e) + oSheet = (XSpreadsheet) AnyConverter.toObject ( + new Type (XSpreadsheet.class), + oIndexAccess.getByIndex (0)); + oSheet2 = (XSpreadsheet) AnyConverter.toObject ( + new Type (XSpreadsheet.class), + oIndexAccess.getByIndex (1)); + + log.println ("Filling a table"); + + for (int i = 1; i < mMaxFieldIndex; i++) { - e.printStackTrace (); - throw new StatusException ("Couldn't get a spreadsheet", e); + oSheet.getCellByPosition (i, 0).setFormula ("Col" + i); + oSheet.getCellByPosition (0, i).setFormula ("Row" + i); + oSheet2.getCellByPosition (i, 0).setFormula ("Col" + i); + oSheet2.getCellByPosition (0, i).setFormula ("Row" + i); } - try + for (int i = 1; i < mMaxFieldIndex; i++) { - log.println ("Filling a table"); - - for (int i = 1; i < mMaxFieldIndex; i++) + for (int j = 1; j < mMaxFieldIndex; j++) { - oSheet.getCellByPosition (i, 0).setFormula ("Col" + i); - oSheet.getCellByPosition (0, i).setFormula ("Row" + i); - oSheet2.getCellByPosition (i, 0).setFormula ("Col" + i); - oSheet2.getCellByPosition (0, i).setFormula ("Row" + i); + oSheet.getCellByPosition (i, j).setValue (i * (j + 1)); + oSheet2.getCellByPosition (i, j).setValue (i * (j + 2)); } - - for (int i = 1; i < mMaxFieldIndex; i++) - { - for (int j = 1; j < mMaxFieldIndex; j++) - { - oSheet.getCellByPosition (i, j).setValue (i * (j + 1)); - oSheet2.getCellByPosition (i, j).setValue (i * (j + 2)); - } - } - - oSheet.getCellByPosition (1, 1).setFormula ("aName"); - oSheet.getCellByPosition (1, 2).setFormula ("otherName"); - oSheet.getCellByPosition (1, 3).setFormula ("una"); - oSheet.getCellByPosition (1, 4).setFormula ("otherName"); - oSheet.getCellByPosition (1, 5).setFormula ("somethingelse"); - - } - catch (com.sun.star.lang.IndexOutOfBoundsException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't fill some cells", e); } - try - { - oSheet.getCellByPosition (1, 5); + oSheet.getCellByPosition (1, 1).setFormula ("aName"); + oSheet.getCellByPosition (1, 2).setFormula ("otherName"); + oSheet.getCellByPosition (1, 3).setFormula ("una"); + oSheet.getCellByPosition (1, 4).setFormula ("otherName"); + oSheet.getCellByPosition (1, 5).setFormula ("somethingelse"); - int x = sCellAdress.Column; - int y = sCellAdress.Row + 3; + oSheet.getCellByPosition (1, 5); + int x = sCellAdress.Column; + int y = sCellAdress.Row + 3; - oSheet.getCellByPosition (x, y); - Integer.valueOf(27); - } - catch (com.sun.star.lang.IndexOutOfBoundsException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't get cells for changing.", e); - } - + oSheet.getCellByPosition (x, y); // create the test objects log.println ("Getting test objects"); @@ -217,51 +179,23 @@ public class ScDataPilotFieldGroupsObj extends TestCase XPropertySet fieldPropSet = null; - try - { - Object oDataPilotField = DPDsc.getDataPilotFields ().getByIndex (0); - fieldPropSet = UnoRuntime.queryInterface ( - XPropertySet.class, oDataPilotField); - fieldPropSet.setPropertyValue ("Orientation", - com.sun.star.sheet.DataPilotFieldOrientation.ROW); - oDataPilotField = DPDsc.getDataPilotFields ().getByIndex (1); - fieldPropSet = UnoRuntime.queryInterface ( - XPropertySet.class, oDataPilotField); - fieldPropSet.setPropertyValue ("Function", - com.sun.star.sheet.GeneralFunction.SUM); - fieldPropSet.setPropertyValue ("Orientation", - com.sun.star.sheet.DataPilotFieldOrientation.DATA); - oDataPilotField = DPDsc.getDataPilotFields ().getByIndex (2); - fieldPropSet = UnoRuntime.queryInterface ( - XPropertySet.class, oDataPilotField); - fieldPropSet.setPropertyValue ("Orientation", - com.sun.star.sheet.DataPilotFieldOrientation.COLUMN); - } - catch (com.sun.star.lang.WrappedTargetException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't create a test environment", e); - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't create a test environment", e); - } - catch (com.sun.star.beans.PropertyVetoException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't create a test environment", e); - } - catch (com.sun.star.beans.UnknownPropertyException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't create a test environment", e); - } - catch (com.sun.star.lang.IndexOutOfBoundsException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't create a test environment", e); - } + Object oDataPilotField = DPDsc.getDataPilotFields ().getByIndex (0); + fieldPropSet = UnoRuntime.queryInterface ( + XPropertySet.class, oDataPilotField); + fieldPropSet.setPropertyValue ("Orientation", + com.sun.star.sheet.DataPilotFieldOrientation.ROW); + oDataPilotField = DPDsc.getDataPilotFields ().getByIndex (1); + fieldPropSet = UnoRuntime.queryInterface ( + XPropertySet.class, oDataPilotField); + fieldPropSet.setPropertyValue ("Function", + com.sun.star.sheet.GeneralFunction.SUM); + fieldPropSet.setPropertyValue ("Orientation", + com.sun.star.sheet.DataPilotFieldOrientation.DATA); + oDataPilotField = DPDsc.getDataPilotFields ().getByIndex (2); + fieldPropSet = UnoRuntime.queryInterface ( + XPropertySet.class, oDataPilotField); + fieldPropSet.setPropertyValue ("Orientation", + com.sun.star.sheet.DataPilotFieldOrientation.COLUMN); log.println ("Insert the DataPilotTable"); @@ -273,29 +207,11 @@ public class ScDataPilotFieldGroupsObj extends TestCase DPT.insertNewByName ("DataPilotTable", sCellAdress, DPDsc); XIndexAccess xIA = UnoRuntime.queryInterface (XIndexAccess.class,DPTS.getDataPilotTables ()); XIndexAccess IA = null; - try - { - XDataPilotDescriptor xDPT = UnoRuntime.queryInterface (XDataPilotDescriptor.class,xIA.getByIndex (0)); - IA = xDPT.getRowFields (); - System.out.println ("COUNT: "+IA.getCount ()); - datapilotfield = (XInterface) AnyConverter.toObject ( - new Type (XInterface.class), IA.getByIndex (0)); - } - catch (com.sun.star.lang.WrappedTargetException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't get data pilot field", e); - } - catch (com.sun.star.lang.IndexOutOfBoundsException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't get data pilot field", e); - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't get data pilot field", e); - } + XDataPilotDescriptor xDPT = UnoRuntime.queryInterface (XDataPilotDescriptor.class,xIA.getByIndex (0)); + IA = xDPT.getRowFields (); + System.out.println ("COUNT: "+IA.getCount ()); + datapilotfield = (XInterface) AnyConverter.toObject ( + new Type (XInterface.class), IA.getByIndex (0)); try { @@ -304,21 +220,8 @@ public class ScDataPilotFieldGroupsObj extends TestCase dpfg.createNameGroup (elements); DataPilotFieldGroupInfo dpgi=null; xIA = UnoRuntime.queryInterface (XIndexAccess.class,DPTS.getDataPilotTables ()); - try - { - XDataPilotDescriptor xDPT = UnoRuntime.queryInterface (XDataPilotDescriptor.class,xIA.getByIndex (0)); - IA = xDPT.getRowFields (); - } - catch (com.sun.star.lang.WrappedTargetException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't get data pilot field", e); - } - catch (com.sun.star.lang.IndexOutOfBoundsException e) - { - e.printStackTrace (); - throw new StatusException ("Couldn't get data pilot field", e); - } + XDataPilotDescriptor xDPT2 = UnoRuntime.queryInterface (XDataPilotDescriptor.class,xIA.getByIndex (0)); + IA = xDPT2.getRowFields (); for (int i=0;i<IA.getCount ();i++) { datapilotfield = (XInterface) AnyConverter.toObject ( diff --git a/qadevOOo/tests/java/mod/_sc/ScDataPilotFieldObj.java b/qadevOOo/tests/java/mod/_sc/ScDataPilotFieldObj.java index 85a683ee6c41..47cf024b266a 100644 --- a/qadevOOo/tests/java/mod/_sc/ScDataPilotFieldObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScDataPilotFieldObj.java @@ -117,11 +117,10 @@ public class ScDataPilotFieldObj extends TestCase { * @see com.sun.star.sheet.XDataPilotDescriptor */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment( + TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; - // creation of testobject here // first we write what we are intend to do to log file log.println("Creating a test environment"); @@ -146,105 +145,56 @@ public class ScDataPilotFieldObj extends TestCase { XSpreadsheet oSheet = null; XSpreadsheet oSheet2 = null; XIndexAccess oIndexAccess = UnoRuntime.queryInterface( - XIndexAccess.class, xSpreadsheets); + XIndexAccess.class, xSpreadsheets); // Make sure there are at least two sheets - xSpreadsheets.insertNewByName("Some Sheet", (short)0); + xSpreadsheets.insertNewByName("Some Sheet", (short) 0); - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class), - oIndexAccess.getByIndex(0)); - oSheet2 = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class), - oIndexAccess.getByIndex(1)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(); - throw new StatusException("Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(); - throw new StatusException("Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(); - throw new StatusException("Couldn't get a spreadsheet", e); - } + oSheet = (XSpreadsheet) AnyConverter.toObject(new Type( + XSpreadsheet.class), oIndexAccess.getByIndex(0)); + oSheet2 = (XSpreadsheet) AnyConverter.toObject(new Type( + XSpreadsheet.class), oIndexAccess.getByIndex(1)); - try { - log.println("Filling a table"); + log.println("Filling a table"); - for (int i = 1; i < mMaxFieldIndex; i++) { - oSheet.getCellByPosition(i, 0).setFormula("Col" + i); - oSheet.getCellByPosition(0, i).setFormula("Row" + i); - oSheet2.getCellByPosition(i, 0).setFormula("Col" + i); - oSheet2.getCellByPosition(0, i).setFormula("Row" + i); - } - - for (int i = 1; i < mMaxFieldIndex; i++) - for (int j = 1; j < mMaxFieldIndex; j++) { - oSheet.getCellByPosition(i, j).setValue(i * (j + 1)); - oSheet2.getCellByPosition(i, j).setValue(i * (j + 2)); - } - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(); - throw new StatusException("Couldn't fill some cells", e); + for (int i = 1; i < mMaxFieldIndex; i++) { + oSheet.getCellByPosition(i, 0).setFormula("Col" + i); + oSheet.getCellByPosition(0, i).setFormula("Row" + i); + oSheet2.getCellByPosition(i, 0).setFormula("Col" + i); + oSheet2.getCellByPosition(0, i).setFormula("Row" + i); } - try { - oSheet.getCellByPosition(1, 5); - - int x = sCellAdress.Column; - int y = sCellAdress.Row + 3; + for (int i = 1; i < mMaxFieldIndex; i++) + for (int j = 1; j < mMaxFieldIndex; j++) { + oSheet.getCellByPosition(i, j).setValue(i * (j + 1)); + oSheet2.getCellByPosition(i, j).setValue(i * (j + 2)); + } + oSheet.getCellByPosition(1, 5); - oSheet.getCellByPosition(x, y); - Integer.valueOf(27); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(); - throw new StatusException("Couldn't get cells for changing.", e); - } + int x = sCellAdress.Column; + int y = sCellAdress.Row + 3; + oSheet.getCellByPosition(x, y); // create the test objects log.println("Getting test objects"); XDataPilotTablesSupplier DPTS = UnoRuntime.queryInterface( - XDataPilotTablesSupplier.class, - oSheet); + XDataPilotTablesSupplier.class, oSheet); XDataPilotTables DPT = DPTS.getDataPilotTables(); XDataPilotDescriptor DPDsc = DPT.createDataPilotDescriptor(); DPDsc.setSourceRange(sCellRangeAdress); XPropertySet fieldPropSet = null; - try { - Object oDataPilotField = DPDsc.getDataPilotFields().getByIndex(0); - fieldPropSet = UnoRuntime.queryInterface( - XPropertySet.class, oDataPilotField); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(); - throw new StatusException("Couldn't create a test environment", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(); - throw new StatusException("Couldn't create a test environment", e); - } + Object oDataPilotField = DPDsc.getDataPilotFields().getByIndex(0); + fieldPropSet = UnoRuntime.queryInterface(XPropertySet.class, + oDataPilotField); - try { - fieldPropSet.setPropertyValue("Function", - com.sun.star.sheet.GeneralFunction.SUM); - fieldPropSet.setPropertyValue("Orientation", - com.sun.star.sheet.DataPilotFieldOrientation.DATA); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(); - throw new StatusException("Couldn't create a test environment", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(); - throw new StatusException("Couldn't create a test environment", e); - } catch (com.sun.star.beans.PropertyVetoException e) { - e.printStackTrace(); - throw new StatusException("Couldn't create a test environment", e); - } catch (com.sun.star.beans.UnknownPropertyException e) { - e.printStackTrace(); - throw new StatusException("Couldn't create a test environment", e); - } + fieldPropSet.setPropertyValue("Function", + com.sun.star.sheet.GeneralFunction.SUM); + fieldPropSet.setPropertyValue("Orientation", + com.sun.star.sheet.DataPilotFieldOrientation.DATA); log.println("Insert the DataPilotTable"); @@ -257,22 +207,10 @@ public class ScDataPilotFieldObj extends TestCase { DPT.insertNewByName("DataPilotTable", sCellAdress, DPDsc); - try { - oObj = (XInterface) AnyConverter.toObject( - new Type(XInterface.class), IA.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(); - throw new StatusException("Couldn't get data pilot field", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(); - throw new StatusException("Couldn't get data pilot field", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(); - throw new StatusException("Couldn't get data pilot field", e); - } + oObj = (XInterface) AnyConverter.toObject(new Type(XInterface.class), + IA.getByIndex(0)); - log.println("Creating object - " + - ((oObj == null) ? "FAILED" : "OK")); + log.println("Creating object - " + ((oObj == null) ? "FAILED" : "OK")); TestEnvironment tEnv = new TestEnvironment(oObj); diff --git a/qadevOOo/tests/java/mod/_sc/ScDataPilotFieldsObj.java b/qadevOOo/tests/java/mod/_sc/ScDataPilotFieldsObj.java index 06cc9084d275..c308eb80a737 100644 --- a/qadevOOo/tests/java/mod/_sc/ScDataPilotFieldsObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScDataPilotFieldsObj.java @@ -101,7 +101,7 @@ public class ScDataPilotFieldsObj extends TestCase { * @see com.sun.star.sheet.XDataPilotDescriptor */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; @@ -117,36 +117,20 @@ public class ScDataPilotFieldsObj extends TestCase { log.println("getting a sheet"); XSpreadsheet oSheet = null; XIndexAccess oIndexAccess = UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets); - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); + + log.println("Filing a table"); + for (int i = 1; i < 4; i++) { + oSheet.getCellByPosition(i, 0).setFormula("Col" + i); + oSheet.getCellByPosition(0, i).setFormula("Row" + i); } - try { - log.println("Filing a table"); - for (int i = 1; i < 4; i++) { - oSheet.getCellByPosition(i, 0).setFormula("Col" + i); - oSheet.getCellByPosition(0, i).setFormula("Row" + i); + for (int i = 1; i < 4; i++) + for (int j = 1; j < 4; j++) { + oSheet.getCellByPosition(i, j).setValue(i * (j + 1)); } - for (int i = 1; i < 4; i++) - for (int j = 1; j < 4; j++) { - oSheet.getCellByPosition(i, j).setValue(i * (j + 1)); - } - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't fill some cells", e); - } - XDataPilotTablesSupplier DPTS = UnoRuntime.queryInterface(XDataPilotTablesSupplier.class, oSheet); log.println("Getting test object ") ; diff --git a/qadevOOo/tests/java/mod/_sc/ScDataPilotItemObj.java b/qadevOOo/tests/java/mod/_sc/ScDataPilotItemObj.java index b2a5e3b814a8..a37e23f4fb77 100644 --- a/qadevOOo/tests/java/mod/_sc/ScDataPilotItemObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScDataPilotItemObj.java @@ -119,7 +119,7 @@ public class ScDataPilotItemObj extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; @@ -151,57 +151,35 @@ public class ScDataPilotItemObj extends TestCase { // Make sure there are at least two sheets xSpreadsheets.insertNewByName("Some Sheet", (short)0); - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class), - oIndexAccess.getByIndex(0)); - oSheet2 = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class), - oIndexAccess.getByIndex(1)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(); - throw new StatusException("Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(); - throw new StatusException("Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(); - throw new StatusException("Couldn't get a spreadsheet", e); - } + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class), + oIndexAccess.getByIndex(0)); + oSheet2 = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class), + oIndexAccess.getByIndex(1)); - try { - log.println("Filling a table"); - - for (int i = 1; i < mMaxFieldIndex; i++) { - oSheet.getCellByPosition(i, 0).setFormula("Col" + i); - oSheet.getCellByPosition(0, i).setFormula("Row" + i); - oSheet2.getCellByPosition(i, 0).setFormula("Col" + i); - oSheet2.getCellByPosition(0, i).setFormula("Row" + i); - } + log.println("Filling a table"); - for (int i = 1; i < mMaxFieldIndex; i++) - for (int j = 1; j < mMaxFieldIndex; j++) { - oSheet.getCellByPosition(i, j).setValue(i * (j + 1)); - oSheet2.getCellByPosition(i, j).setValue(i * (j + 2)); - } - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(); - throw new StatusException("Couldn't fill some cells", e); + for (int i = 1; i < mMaxFieldIndex; i++) { + oSheet.getCellByPosition(i, 0).setFormula("Col" + i); + oSheet.getCellByPosition(0, i).setFormula("Row" + i); + oSheet2.getCellByPosition(i, 0).setFormula("Col" + i); + oSheet2.getCellByPosition(0, i).setFormula("Row" + i); } - try { - oSheet.getCellByPosition(1, 5); + for (int i = 1; i < mMaxFieldIndex; i++) + for (int j = 1; j < mMaxFieldIndex; j++) { + oSheet.getCellByPosition(i, j).setValue(i * (j + 1)); + oSheet2.getCellByPosition(i, j).setValue(i * (j + 2)); + } - int x = sCellAdress.Column; - int y = sCellAdress.Row + 3; + oSheet.getCellByPosition(1, 5); + int x = sCellAdress.Column; + int y = sCellAdress.Row + 3; - oSheet.getCellByPosition(x, y); - Integer.valueOf(27); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(); - throw new StatusException("Couldn't get cells for changing.", e); - } + + oSheet.getCellByPosition(x, y); // create the test objects @@ -216,36 +194,14 @@ public class ScDataPilotItemObj extends TestCase { XPropertySet fieldPropSet = null; - try { - Object oDataPilotField = DPDsc.getDataPilotFields().getByIndex(0); - fieldPropSet = UnoRuntime.queryInterface( - XPropertySet.class, oDataPilotField); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(); - throw new StatusException("Couldn't create a test environment", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(); - throw new StatusException("Couldn't create a test environment", e); - } + Object oDataPilotField = DPDsc.getDataPilotFields().getByIndex(0); + fieldPropSet = UnoRuntime.queryInterface( + XPropertySet.class, oDataPilotField); - try { - fieldPropSet.setPropertyValue("Function", - com.sun.star.sheet.GeneralFunction.SUM); - fieldPropSet.setPropertyValue("Orientation", - com.sun.star.sheet.DataPilotFieldOrientation.DATA); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(); - throw new StatusException("Couldn't create a test environment", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(); - throw new StatusException("Couldn't create a test environment", e); - } catch (com.sun.star.beans.PropertyVetoException e) { - e.printStackTrace(); - throw new StatusException("Couldn't create a test environment", e); - } catch (com.sun.star.beans.UnknownPropertyException e) { - e.printStackTrace(); - throw new StatusException("Couldn't create a test environment", e); - } + fieldPropSet.setPropertyValue("Function", + com.sun.star.sheet.GeneralFunction.SUM); + fieldPropSet.setPropertyValue("Orientation", + com.sun.star.sheet.DataPilotFieldOrientation.DATA); log.println("Insert the DataPilotTable"); @@ -258,19 +214,8 @@ public class ScDataPilotItemObj extends TestCase { DPT.insertNewByName("DataPilotTable", sCellAdress, DPDsc); - try { - oObj = (XInterface) AnyConverter.toObject( - new Type(XInterface.class), IA.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(); - throw new StatusException("Couldn't get data pilot field", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(); - throw new StatusException("Couldn't get data pilot field", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(); - throw new StatusException("Couldn't get data pilot field", e); - } + oObj = (XInterface) AnyConverter.toObject( + new Type(XInterface.class), IA.getByIndex(0)); log.println("Creating object - " + ((oObj == null) ? "FAILED" : "OK")); @@ -280,16 +225,8 @@ public class ScDataPilotItemObj extends TestCase { XIndexAccess xIA = xDataPilotField.getItems(); - try { - oObj = UnoRuntime.queryInterface(XInterface.class, - xIA.getByIndex(0)); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Couldn't get DataPilotItemObj"); - e.printStackTrace(log); - } catch (com.sun.star.lang.WrappedTargetException e) { - log.println("Couldn't get DataPilotItemObj"); - e.printStackTrace(log); - } + oObj = UnoRuntime.queryInterface(XInterface.class, + xIA.getByIndex(0)); TestEnvironment tEnv = new TestEnvironment(oObj); diff --git a/qadevOOo/tests/java/mod/_sc/ScDataPilotItemsObj.java b/qadevOOo/tests/java/mod/_sc/ScDataPilotItemsObj.java index be8566fa4019..fd95c14c4f4b 100644 --- a/qadevOOo/tests/java/mod/_sc/ScDataPilotItemsObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScDataPilotItemsObj.java @@ -119,7 +119,7 @@ public class ScDataPilotItemsObj extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; @@ -151,57 +151,35 @@ public class ScDataPilotItemsObj extends TestCase { // Make sure there are at least two sheets xSpreadsheets.insertNewByName("Some Sheet", (short)0); - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class), - oIndexAccess.getByIndex(0)); - oSheet2 = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class), - oIndexAccess.getByIndex(1)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(); - throw new StatusException("Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(); - throw new StatusException("Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(); - throw new StatusException("Couldn't get a spreadsheet", e); - } - - try { - log.println("Filling a table"); + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class), + oIndexAccess.getByIndex(0)); + oSheet2 = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class), + oIndexAccess.getByIndex(1)); - for (int i = 1; i < mMaxFieldIndex; i++) { - oSheet.getCellByPosition(i, 0).setFormula("Col" + i); - oSheet.getCellByPosition(0, i).setFormula("Row" + i); - oSheet2.getCellByPosition(i, 0).setFormula("Col" + i); - oSheet2.getCellByPosition(0, i).setFormula("Row" + i); - } + log.println("Filling a table"); - for (int i = 1; i < mMaxFieldIndex; i++) - for (int j = 1; j < mMaxFieldIndex; j++) { - oSheet.getCellByPosition(i, j).setValue(i * (j + 1)); - oSheet2.getCellByPosition(i, j).setValue(i * (j + 2)); - } - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(); - throw new StatusException("Couldn't fill some cells", e); + for (int i = 1; i < mMaxFieldIndex; i++) { + oSheet.getCellByPosition(i, 0).setFormula("Col" + i); + oSheet.getCellByPosition(0, i).setFormula("Row" + i); + oSheet2.getCellByPosition(i, 0).setFormula("Col" + i); + oSheet2.getCellByPosition(0, i).setFormula("Row" + i); } - try { - oSheet.getCellByPosition(1, 5); + for (int i = 1; i < mMaxFieldIndex; i++) + for (int j = 1; j < mMaxFieldIndex; j++) { + oSheet.getCellByPosition(i, j).setValue(i * (j + 1)); + oSheet2.getCellByPosition(i, j).setValue(i * (j + 2)); + } - int x = sCellAdress.Column; - int y = sCellAdress.Row + 3; + oSheet.getCellByPosition(1, 5); + int x = sCellAdress.Column; + int y = sCellAdress.Row + 3; - oSheet.getCellByPosition(x, y); - Integer.valueOf(27); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(); - throw new StatusException("Couldn't get cells for changing.", e); - } + + oSheet.getCellByPosition(x, y); // create the test objects @@ -216,36 +194,14 @@ public class ScDataPilotItemsObj extends TestCase { XPropertySet fieldPropSet = null; - try { - Object oDataPilotField = DPDsc.getDataPilotFields().getByIndex(0); - fieldPropSet = UnoRuntime.queryInterface( - XPropertySet.class, oDataPilotField); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(); - throw new StatusException("Couldn't create a test environment", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(); - throw new StatusException("Couldn't create a test environment", e); - } + Object oDataPilotField = DPDsc.getDataPilotFields().getByIndex(0); + fieldPropSet = UnoRuntime.queryInterface( + XPropertySet.class, oDataPilotField); - try { - fieldPropSet.setPropertyValue("Function", - com.sun.star.sheet.GeneralFunction.SUM); - fieldPropSet.setPropertyValue("Orientation", - com.sun.star.sheet.DataPilotFieldOrientation.DATA); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(); - throw new StatusException("Couldn't create a test environment", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(); - throw new StatusException("Couldn't create a test environment", e); - } catch (com.sun.star.beans.PropertyVetoException e) { - e.printStackTrace(); - throw new StatusException("Couldn't create a test environment", e); - } catch (com.sun.star.beans.UnknownPropertyException e) { - e.printStackTrace(); - throw new StatusException("Couldn't create a test environment", e); - } + fieldPropSet.setPropertyValue("Function", + com.sun.star.sheet.GeneralFunction.SUM); + fieldPropSet.setPropertyValue("Orientation", + com.sun.star.sheet.DataPilotFieldOrientation.DATA); log.println("Insert the DataPilotTable"); @@ -258,19 +214,8 @@ public class ScDataPilotItemsObj extends TestCase { DPT.insertNewByName("DataPilotTable", sCellAdress, DPDsc); - try { - oObj = (XInterface) AnyConverter.toObject( - new Type(XInterface.class), IA.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(); - throw new StatusException("Couldn't get data pilot field", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(); - throw new StatusException("Couldn't get data pilot field", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(); - throw new StatusException("Couldn't get data pilot field", e); - } + oObj = (XInterface) AnyConverter.toObject( + new Type(XInterface.class), IA.getByIndex(0)); log.println("Creating object - " + ((oObj == null) ? "FAILED" : "OK")); diff --git a/qadevOOo/tests/java/mod/_sc/ScDataPilotTableObj.java b/qadevOOo/tests/java/mod/_sc/ScDataPilotTableObj.java index 8190474a5dc4..5944b02b0a03 100644 --- a/qadevOOo/tests/java/mod/_sc/ScDataPilotTableObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScDataPilotTableObj.java @@ -124,7 +124,7 @@ public class ScDataPilotTableObj extends TestCase { * @see com.sun.star.sheet.XDataPilotDescriptor */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; @@ -142,37 +142,21 @@ public class ScDataPilotTableObj extends TestCase { XSpreadsheet oSheet = null; Object oChangeCell = null; Object oCheckCell = null; - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); - oChangeCell = oSheet.getCellByPosition(1, 5); - oCheckCell = oSheet.getCellByPosition( - sCellAddress.Column, sCellAddress.Row + 3); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); + oChangeCell = oSheet.getCellByPosition(1, 5); + oCheckCell = oSheet.getCellByPosition( + sCellAddress.Column, sCellAddress.Row + 3); + log.println("Filing a table"); + for (int i = 1; i < 6; i++) { + oSheet.getCellByPosition(0, i).setFormula("Row" + i); + oSheet.getCellByPosition(i, 0).setFormula("Col" + i); } - try { - log.println("Filing a table"); - for (int i = 1; i < 6; i++) { - oSheet.getCellByPosition(0, i).setFormula("Row" + i); - oSheet.getCellByPosition(i, 0).setFormula("Col" + i); - } - for (int i = 1; i < 6; i++) - for (int j = 1; j < 6; j++) { - oSheet.getCellByPosition(i, j).setValue(2.5 * j + i); - } - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't fill some cells", e); - } + for (int i = 1; i < 6; i++) + for (int j = 1; j < 6; j++) { + oSheet.getCellByPosition(i, j).setValue(2.5 * j + i); + } CellRangeAddress sCellRangeAddress = new CellRangeAddress(); sCellRangeAddress.Sheet = 0; @@ -205,53 +189,20 @@ public class ScDataPilotTableObj extends TestCase { SFD.setFilterFields(filterFields); XPropertySet fieldPropSet = null; - try { - Object oDataPilotField = DPDsc.getDataPilotFields().getByIndex(0); - fieldPropSet = UnoRuntime.queryInterface(XPropertySet.class, oDataPilotField); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create a test environment", e); - } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create a test environment", e); - } + Object oDataPilotField = DPDsc.getDataPilotFields().getByIndex(0); + fieldPropSet = UnoRuntime.queryInterface(XPropertySet.class, oDataPilotField); - try { - fieldPropSet.setPropertyValue("Function", - com.sun.star.sheet.GeneralFunction.SUM); - fieldPropSet.setPropertyValue("Orientation", - com.sun.star.sheet.DataPilotFieldOrientation.DATA); - } catch(com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create a test environment", e); - } catch(com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create a test environment", e); - } catch(com.sun.star.beans.PropertyVetoException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create a test environment", e); - } catch(com.sun.star.beans.UnknownPropertyException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create a test environment", e); - } + fieldPropSet.setPropertyValue("Function", + com.sun.star.sheet.GeneralFunction.SUM); + fieldPropSet.setPropertyValue("Orientation", + com.sun.star.sheet.DataPilotFieldOrientation.DATA); if (DPT.hasByName("DataPilotTable")) { DPT.removeByName("DataPilotTable"); } DPT.insertNewByName("DataPilotTable", sCellAddress, DPDsc); - try { - oObj = (XInterface) AnyConverter.toObject( - new Type(XInterface.class),DPT.getByName(DPT.getElementNames()[0])); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create a test environment", e); - } catch (com.sun.star.container.NoSuchElementException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create a test environment", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create a test environment", e); - } + oObj = (XInterface) AnyConverter.toObject( + new Type(XInterface.class),DPT.getByName(DPT.getElementNames()[0])); log.println("Creating object - " + ((oObj == null) ? "FAILED" : "OK")); diff --git a/qadevOOo/tests/java/mod/_sc/ScDataPilotTablesObj.java b/qadevOOo/tests/java/mod/_sc/ScDataPilotTablesObj.java index ad5783dcdb0a..75095f19708b 100644 --- a/qadevOOo/tests/java/mod/_sc/ScDataPilotTablesObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScDataPilotTablesObj.java @@ -108,7 +108,7 @@ public class ScDataPilotTablesObj extends TestCase { * @see com.sun.star.sheet.XDataPilotTablesSupplier */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; @@ -124,37 +124,21 @@ public class ScDataPilotTablesObj extends TestCase { log.println("getting a sheet"); XSpreadsheet oSheet = null; XIndexAccess oIndexAccess = UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets); - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); - try { - log.println("Filing a table"); - for (int i = 1; i < 4; i++) { - oSheet.getCellByPosition(i, 0).setFormula("Col" + i); - oSheet.getCellByPosition(0, i).setFormula("Row" + i); - } - - for (int i = 1; i < 4; i++) - for (int j = 1; j < 4; j++) { - oSheet.getCellByPosition(i, j).setValue(i * (j + 1)); - } - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't fill some cells", e); + log.println("Filing a table"); + for (int i = 1; i < 4; i++) { + oSheet.getCellByPosition(i, 0).setFormula("Col" + i); + oSheet.getCellByPosition(0, i).setFormula("Row" + i); } + for (int i = 1; i < 4; i++) + for (int j = 1; j < 4; j++) { + oSheet.getCellByPosition(i, j).setValue(i * (j + 1)); + } + XDataPilotTablesSupplier DPTS = UnoRuntime.queryInterface(XDataPilotTablesSupplier.class, oSheet); log.println("Getting test object ") ; diff --git a/qadevOOo/tests/java/mod/_sc/ScDatabaseRangeObj.java b/qadevOOo/tests/java/mod/_sc/ScDatabaseRangeObj.java index cd7287f79af4..a506bdd60642 100644 --- a/qadevOOo/tests/java/mod/_sc/ScDatabaseRangeObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScDatabaseRangeObj.java @@ -122,7 +122,7 @@ public class ScDatabaseRangeObj extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; @@ -140,28 +140,13 @@ public class ScDatabaseRangeObj extends TestCase { XDatabaseRanges dbRanges = null; XImportable xImp = null; - try { - Object sheet = sheets.getByName(names[0]); - xImp = UnoRuntime.queryInterface(XImportable.class, - sheet); - dbRanges = (XDatabaseRanges) AnyConverter.toObject( - new Type(XDatabaseRanges.class), - docProps.getPropertyValue("DatabaseRanges")); - _doImport(xImp); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get a property", e); - } catch (com.sun.star.beans.UnknownPropertyException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get a property", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get a property", e); - } catch (com.sun.star.container.NoSuchElementException e) { - e.printStackTrace(log); - throw new StatusException( - "Error getting test object from spreadsheet document", e); - } + Object sheet = sheets.getByName(names[0]); + xImp = UnoRuntime.queryInterface(XImportable.class, + sheet); + dbRanges = (XDatabaseRanges) AnyConverter.toObject( + new Type(XDatabaseRanges.class), + docProps.getPropertyValue("DatabaseRanges")); + _doImport(xImp); String dbName = "dbRange"; @@ -174,37 +159,23 @@ public class ScDatabaseRangeObj extends TestCase { XNameAccess dbrNA = UnoRuntime.queryInterface( XNameAccess.class, dbRanges); - try { - // we need to add it - dbRanges.addNewByName(dbName,new CellRangeAddress((short)0, 0, 0, 0, 5)); - - UnoRuntime.queryInterface(XNamed.class, - dbrNA.getByName( - dbName)); - - XCellRangeReferrer aReferrer = UnoRuntime.queryInterface( - XCellRangeReferrer.class, - dbrNA.getByName(dbName)); - XCellRangeAddressable aRangeA = UnoRuntime.queryInterface( - XCellRangeAddressable.class, - aReferrer.getReferredCells()); - aRange = aRangeA.getRangeAddress(); - oObj = (XInterface) AnyConverter.toObject( - new Type(XInterface.class), - dbrNA.getByName(dbName)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException( - "Error getting test object from spreadsheet document", e); - } catch (com.sun.star.container.NoSuchElementException e) { - e.printStackTrace(log); - throw new StatusException( - "Error getting test object from spreadsheet document", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException( - "Error getting test object from spreadsheet document", e); - } + // we need to add it + dbRanges.addNewByName(dbName,new CellRangeAddress((short)0, 0, 0, 0, 5)); + + UnoRuntime.queryInterface(XNamed.class, + dbrNA.getByName( + dbName)); + + XCellRangeReferrer aReferrer = UnoRuntime.queryInterface( + XCellRangeReferrer.class, + dbrNA.getByName(dbName)); + XCellRangeAddressable aRangeA = UnoRuntime.queryInterface( + XCellRangeAddressable.class, + aReferrer.getReferredCells()); + aRange = aRangeA.getRangeAddress(); + oObj = (XInterface) AnyConverter.toObject( + new Type(XInterface.class), + dbrNA.getByName(dbName)); TestEnvironment tEnv = new TestEnvironment(oObj); @@ -212,23 +183,8 @@ public class ScDatabaseRangeObj extends TestCase { // Other parameters required for interface tests tEnv.addObjRelation("DATAAREA", aRange); - XCellRange xCellRange = null; - - try { - Object sheet = sheets.getByName(names[0]); - xCellRange = UnoRuntime.queryInterface( - XCellRange.class, sheet); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException( - "Error getting of first spreadsheet from spreadsheet" + - " document", e); - } catch (com.sun.star.container.NoSuchElementException e) { - e.printStackTrace(log); - throw new StatusException( - "Error getting of first spreadsheet from spreadsheet" + - " document", e); - } + XCellRange xCellRange = UnoRuntime.queryInterface( + XCellRange.class, sheets.getByName(names[0])); tEnv.addObjRelation("XCELLRANGE", xCellRange); diff --git a/qadevOOo/tests/java/mod/_sc/ScDatabaseRangesObj.java b/qadevOOo/tests/java/mod/_sc/ScDatabaseRangesObj.java index 28d95611222c..b6abc1ddcaf1 100644 --- a/qadevOOo/tests/java/mod/_sc/ScDatabaseRangesObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScDatabaseRangesObj.java @@ -97,7 +97,7 @@ public class ScDatabaseRangesObj extends TestCase { * @see com.sun.star.container.XElementAccess */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; @@ -109,23 +109,9 @@ public class ScDatabaseRangesObj extends TestCase { XPropertySet docProps = UnoRuntime.queryInterface(XPropertySet.class, xSheetDoc); XDatabaseRanges dbRanges = null; - try { - dbRanges = (XDatabaseRanges) AnyConverter.toObject( - new Type(XDatabaseRanges.class), - docProps.getPropertyValue("DatabaseRanges")); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log) ; - throw new StatusException( - "Error getting test object from spreadsheet document",e) ; - } catch (com.sun.star.beans.UnknownPropertyException e) { - e.printStackTrace(log) ; - throw new StatusException( - "Error getting test object from spreadsheet document",e) ; - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log) ; - throw new StatusException( - "Error getting test object from spreadsheet document",e) ; - } + dbRanges = (XDatabaseRanges) AnyConverter.toObject( + new Type(XDatabaseRanges.class), + docProps.getPropertyValue("DatabaseRanges")); log.println("Adding at least one element for ElementAccess interface"); CellRangeAddress aRange = new CellRangeAddress((short)0, 2, 4, 5, 6); diff --git a/qadevOOo/tests/java/mod/_sc/ScDocumentConfiguration.java b/qadevOOo/tests/java/mod/_sc/ScDocumentConfiguration.java index 2c43c102eca7..44494f2b9609 100644 --- a/qadevOOo/tests/java/mod/_sc/ScDocumentConfiguration.java +++ b/qadevOOo/tests/java/mod/_sc/ScDocumentConfiguration.java @@ -63,17 +63,11 @@ public class ScDocumentConfiguration extends TestCase { @Override protected TestEnvironment createTestEnvironment(TestParameters tParam, - PrintWriter log) { + PrintWriter log) throws Exception { XMultiServiceFactory docMSF = UnoRuntime.queryInterface( XMultiServiceFactory.class, xSheetDoc); - Object oObj = null; - - try { - oObj = docMSF.createInstance("com.sun.star.sheet.DocumentSettings"); - } catch (com.sun.star.uno.Exception e) { - throw new StatusException("Couldn't create document settings", e); - } + Object oObj = docMSF.createInstance("com.sun.star.sheet.DocumentSettings"); log.println("Implementationname: " + util.utils.getImplName(oObj)); diff --git a/qadevOOo/tests/java/mod/_sc/ScDrawPageObj.java b/qadevOOo/tests/java/mod/_sc/ScDrawPageObj.java index c7b6e9db48ec..a33fbc739612 100644 --- a/qadevOOo/tests/java/mod/_sc/ScDrawPageObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScDrawPageObj.java @@ -92,7 +92,7 @@ public class ScDrawPageObj extends TestCase { * </ul> */ @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { XInterface oObj = null; XShape oShape = null ; @@ -103,35 +103,21 @@ public class ScDrawPageObj extends TestCase { // creation of testobject here // first we write what we are intend to do to log file log.println( "creating a test environment" ); - try { - log.println( "getting Drawpages" ); - XDrawPagesSupplier oDPS = UnoRuntime.queryInterface(XDrawPagesSupplier.class,xDoc); - oDP = oDPS.getDrawPages(); - oDP.insertNewByIndex(1); - oDP.insertNewByIndex(2); - oObj = (XDrawPage) AnyConverter.toObject( - new Type(XDrawPage.class),oDP.getByIndex(0)); - - SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); - - oShape = SOF.createShape(xComp,5000,3500,7500,5000,"Rectangle"); - DrawTools.getShapes((XDrawPage) oObj).add(oShape); - XShape oShape1 = SOF.createShape(xComp, - 5000,5500,5000,5000,"Rectangle"); - DrawTools.getShapes((XDrawPage) oObj).add(oShape1); - } catch (com.sun.star.lang.WrappedTargetException e) { - log.println("Couldn't create insance"); - e.printStackTrace(log); - throw new StatusException("Can't create environment", e) ; - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Couldn't create insance"); - e.printStackTrace(log); - throw new StatusException("Can't create environment", e) ; - } catch (com.sun.star.lang.IllegalArgumentException e) { - log.println("Couldn't create insance"); - e.printStackTrace(log); - throw new StatusException("Can't create environment", e) ; - } + log.println( "getting Drawpages" ); + XDrawPagesSupplier oDPS = UnoRuntime.queryInterface(XDrawPagesSupplier.class,xDoc); + oDP = oDPS.getDrawPages(); + oDP.insertNewByIndex(1); + oDP.insertNewByIndex(2); + oObj = (XDrawPage) AnyConverter.toObject( + new Type(XDrawPage.class),oDP.getByIndex(0)); + + SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); + + oShape = SOF.createShape(xComp,5000,3500,7500,5000,"Rectangle"); + DrawTools.getShapes((XDrawPage) oObj).add(oShape); + XShape oShape1 = SOF.createShape(xComp, + 5000,5500,5000,5000,"Rectangle"); + DrawTools.getShapes((XDrawPage) oObj).add(oShape1); // create test environment here TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_sc/ScFilterDescriptorBase.java b/qadevOOo/tests/java/mod/_sc/ScFilterDescriptorBase.java index 4246f24cac96..a6fc183f22b6 100644 --- a/qadevOOo/tests/java/mod/_sc/ScFilterDescriptorBase.java +++ b/qadevOOo/tests/java/mod/_sc/ScFilterDescriptorBase.java @@ -97,7 +97,7 @@ public class ScFilterDescriptorBase extends TestCase { * @see com.sun.star.sheet.SheetFilterDescriptor */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; XSheetFilterable SF = null; @@ -109,30 +109,13 @@ public class ScFilterDescriptorBase extends TestCase { XSpreadsheet oSheet = null; XIndexAccess oIndexAccess = UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets); - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get a spreadsheet", e); - } + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); log.println("filling some cells"); - try { - oSheet.getCellByPosition(5, 5).setValue(15); - oSheet.getCellByPosition(1, 4).setValue(10); - oSheet.getCellByPosition(2, 0).setValue(-5.15); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException( - "Exception occurred while filling cells", e); - } + oSheet.getCellByPosition(5, 5).setValue(15); + oSheet.getCellByPosition(1, 4).setValue(10); + oSheet.getCellByPosition(2, 0).setValue(-5.15); SF = UnoRuntime.queryInterface(XSheetFilterable.class, oSheet); diff --git a/qadevOOo/tests/java/mod/_sc/ScFunctionDescriptionObj.java b/qadevOOo/tests/java/mod/_sc/ScFunctionDescriptionObj.java index b47987506129..239080a9d13f 100644 --- a/qadevOOo/tests/java/mod/_sc/ScFunctionDescriptionObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScFunctionDescriptionObj.java @@ -67,7 +67,7 @@ public class ScFunctionDescriptionObj extends TestCase { @Override public synchronized TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { + throws Exception { XInterface oObj = null; @@ -75,30 +75,23 @@ public class ScFunctionDescriptionObj extends TestCase { // first we write what we are intend to do to log file log.println( "Creating a test environment" ); - try { - log.println("Getting test object ") ; - - XMultiServiceFactory oDocMSF = Param.getMSF(); + log.println("Getting test object ") ; - XInterface FDs = (XInterface)oDocMSF. - createInstance("com.sun.star.sheet.FunctionDescriptions"); - XNameAccess NA = UnoRuntime.queryInterface - (XNameAccess.class, FDs); + XMultiServiceFactory oDocMSF = Param.getMSF(); - String names[] = NA.getElementNames(); - Random rnd = new Random(); - int idx = rnd.nextInt(names.length); + XInterface FDs = (XInterface)oDocMSF. + createInstance("com.sun.star.sheet.FunctionDescriptions"); + XNameAccess NA = UnoRuntime.queryInterface + (XNameAccess.class, FDs); - oObj = (XInterface)NA.getByName(names[idx]); + String names[] = NA.getElementNames(); + Random rnd = new Random(); + int idx = rnd.nextInt(names.length); - log.println("Creating object - " + - ((oObj == null) ? "FAILED" : "OK")); + oObj = (XInterface)NA.getByName(names[idx]); - } catch (Exception e) { - e.printStackTrace(log) ; - throw new StatusException - ("Error getting test object from spreadsheet document",e) ; - } + log.println("Creating object - " + + ((oObj == null) ? "FAILED" : "OK")); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_sc/ScFunctionListObj.java b/qadevOOo/tests/java/mod/_sc/ScFunctionListObj.java index e0743dbab7c7..1bcfa39604fb 100644 --- a/qadevOOo/tests/java/mod/_sc/ScFunctionListObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScFunctionListObj.java @@ -91,7 +91,7 @@ public class ScFunctionListObj extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) throws StatusException { + TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; @@ -102,16 +102,10 @@ public class ScFunctionListObj extends TestCase { log.println("Getting test object ") ; XMultiServiceFactory oDocMSF = Param.getMSF(); - try { - oObj = (XInterface)oDocMSF.createInstance( - "com.sun.star.sheet.FunctionDescriptions"); - log.println("Creating object - " + - ((oObj == null) ? "FAILED" : "OK")); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException( - "Error getting test object from spreadsheet document", e); - } + oObj = (XInterface)oDocMSF.createInstance( + "com.sun.star.sheet.FunctionDescriptions"); + log.println("Creating object - " + + ((oObj == null) ? "FAILED" : "OK")); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_sc/ScHeaderFieldObj.java b/qadevOOo/tests/java/mod/_sc/ScHeaderFieldObj.java index e9206c706648..b18507ae76fc 100644 --- a/qadevOOo/tests/java/mod/_sc/ScHeaderFieldObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScHeaderFieldObj.java @@ -123,7 +123,7 @@ public class ScHeaderFieldObj extends TestCase { * @see com.sun.star.text.XTextContent */ @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { XInterface oObj = null; XPropertySet PropSet; @@ -137,21 +137,10 @@ public class ScHeaderFieldObj extends TestCase { xSpreadsheetDoc ); XNameAccess StyleFamNames = StyleFam.getStyleFamilies(); - try{ - PageStyles = (XNameAccess) AnyConverter.toObject( - new Type(XNameAccess.class),StyleFamNames.getByName("PageStyles")); - StdStyle = (XStyle) AnyConverter.toObject( - new Type(XStyle.class),PageStyles.getByName("Default")); - } catch(com.sun.star.lang.WrappedTargetException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get by name", e); - } catch(com.sun.star.container.NoSuchElementException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get by name", e); - } catch(com.sun.star.lang.IllegalArgumentException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get by name", e); - } + PageStyles = (XNameAccess) AnyConverter.toObject( + new Type(XNameAccess.class),StyleFamNames.getByName("PageStyles")); + StdStyle = (XStyle) AnyConverter.toObject( + new Type(XStyle.class),PageStyles.getByName("Default")); //get the property-set PropSet = UnoRuntime.queryInterface(XPropertySet.class, StdStyle); @@ -160,20 +149,9 @@ public class ScHeaderFieldObj extends TestCase { // creation of testobject here // first we write what we are intend to do to log file log.println( "creating a test environment" ); - try { - RPHC = (XHeaderFooterContent) AnyConverter.toObject( - new Type(XHeaderFooterContent.class), - PropSet.getPropertyValue("RightPageHeaderContent")); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get HeaderContent", e); - } catch (com.sun.star.beans.UnknownPropertyException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get HeaderContent", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get HeaderContent", e); - } + RPHC = (XHeaderFooterContent) AnyConverter.toObject( + new Type(XHeaderFooterContent.class), + PropSet.getPropertyValue("RightPageHeaderContent")); XText left = RPHC.getLeftText(); @@ -182,39 +160,20 @@ public class ScHeaderFieldObj extends TestCase { xSpreadsheetDoc ); XTextContent the_Field = null; - try { - oObj = (XInterface) - oDocMSF.createInstance( "com.sun.star.text.TextField.Time" ); + oObj = (XInterface) + oDocMSF.createInstance( "com.sun.star.text.TextField.Time" ); - the_Field = UnoRuntime.queryInterface(XTextContent.class,oObj); + the_Field = UnoRuntime.queryInterface(XTextContent.class,oObj); - aField = (XInterface) - oDocMSF.createInstance("com.sun.star.text.TextField.Date"); - } catch(com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create instance", e); - } + aField = (XInterface) + oDocMSF.createInstance("com.sun.star.text.TextField.Date"); oContent = UnoRuntime.queryInterface(XTextContent.class, aField); XTextCursor the_Cursor = left.createTextCursor(); - try { - left.insertTextContent(the_Cursor,the_Field, false); - PropSet.setPropertyValue("RightPageHeaderContent", RPHC); - } catch(com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create a test environment", e); - } catch(com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create a test environment", e); - } catch(com.sun.star.beans.PropertyVetoException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create a test environment", e); - } catch(com.sun.star.beans.UnknownPropertyException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create a test environment", e); - } + left.insertTextContent(the_Cursor,the_Field, false); + PropSet.setPropertyValue("RightPageHeaderContent", RPHC); TestEnvironment tEnv = new TestEnvironment(oObj); diff --git a/qadevOOo/tests/java/mod/_sc/ScHeaderFieldsObj.java b/qadevOOo/tests/java/mod/_sc/ScHeaderFieldsObj.java index 2c7aee9d1570..6ce687d9b89f 100644 --- a/qadevOOo/tests/java/mod/_sc/ScHeaderFieldsObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScHeaderFieldsObj.java @@ -111,7 +111,7 @@ public class ScHeaderFieldsObj extends TestCase { * @see com.sun.star.text.XTextContent */ @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { XInterface oObj = null; XPropertySet PropSet; @@ -122,21 +122,10 @@ public class ScHeaderFieldsObj extends TestCase { xSpreadsheetDoc ); XNameAccess StyleFamNames = StyleFam.getStyleFamilies(); - try{ - PageStyles = (XNameAccess) AnyConverter.toObject( - new Type(XNameAccess.class),StyleFamNames.getByName("PageStyles")); - StdStyle = (XStyle) AnyConverter.toObject( - new Type(XStyle.class),PageStyles.getByName("Default")); - } catch(com.sun.star.lang.WrappedTargetException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get by name", e); - } catch(com.sun.star.container.NoSuchElementException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get by name", e); - } catch(com.sun.star.lang.IllegalArgumentException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get by name", e); - } + PageStyles = (XNameAccess) AnyConverter.toObject( + new Type(XNameAccess.class),StyleFamNames.getByName("PageStyles")); + StdStyle = (XStyle) AnyConverter.toObject( + new Type(XStyle.class),PageStyles.getByName("Default")); //get the property-set PropSet = UnoRuntime.queryInterface(XPropertySet.class, StdStyle); @@ -145,20 +134,9 @@ public class ScHeaderFieldsObj extends TestCase { // creation of testobject here // first we write what we are intend to do to log file log.println( "creating a test environment" ); - try { - RPHC = (XHeaderFooterContent) AnyConverter.toObject( - new Type(XHeaderFooterContent.class), - PropSet.getPropertyValue("RightPageHeaderContent")); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get HeaderContent", e); - } catch (com.sun.star.beans.UnknownPropertyException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get HeaderContent", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get HeaderContent", e); - } + RPHC = (XHeaderFooterContent) AnyConverter.toObject( + new Type(XHeaderFooterContent.class), + PropSet.getPropertyValue("RightPageHeaderContent")); XText left = RPHC.getLeftText(); @@ -167,35 +145,15 @@ public class ScHeaderFieldsObj extends TestCase { xSpreadsheetDoc ); XTextContent the_Field = null; - try { - oObj = (XInterface) - oDocMSF.createInstance( "com.sun.star.text.TextField.Time" ); + oObj = (XInterface) + oDocMSF.createInstance( "com.sun.star.text.TextField.Time" ); - the_Field = UnoRuntime.queryInterface(XTextContent.class,oObj); - - } catch(com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create instance", e); - } + the_Field = UnoRuntime.queryInterface(XTextContent.class,oObj); XTextCursor the_Cursor = left.createTextCursor(); - try { - left.insertTextContent(the_Cursor,the_Field, false); - PropSet.setPropertyValue("RightPageHeaderContent", RPHC); - } catch(com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create a test environment", e); - } catch(com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create a test environment", e); - } catch(com.sun.star.beans.PropertyVetoException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create a test environment", e); - } catch(com.sun.star.beans.UnknownPropertyException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create a test environment", e); - } + left.insertTextContent(the_Cursor,the_Field, false); + PropSet.setPropertyValue("RightPageHeaderContent", RPHC); XTextFieldsSupplier xTFSupp = UnoRuntime.queryInterface(XTextFieldsSupplier.class, left); diff --git a/qadevOOo/tests/java/mod/_sc/ScHeaderFooterContentObj.java b/qadevOOo/tests/java/mod/_sc/ScHeaderFooterContentObj.java index 552ee52cb14d..4e3710326e5d 100644 --- a/qadevOOo/tests/java/mod/_sc/ScHeaderFooterContentObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScHeaderFooterContentObj.java @@ -96,7 +96,7 @@ public class ScHeaderFooterContentObj extends TestCase { * @see com.sun.star.sheet.HeaderFooterContent */ @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { XInterface oObj = null; XPropertySet PropSet; @@ -107,21 +107,10 @@ public class ScHeaderFooterContentObj extends TestCase { XStyleFamiliesSupplier.class, xSpreadsheetDoc ); XNameAccess StyleFamNames = StyleFam.getStyleFamilies(); - try{ - PageStyles = (XNameAccess) AnyConverter.toObject( - new Type(XNameAccess.class),StyleFamNames.getByName("PageStyles")); - StdStyle = (XStyle) AnyConverter.toObject( - new Type(XStyle.class),PageStyles.getByName("Default")); - } catch(com.sun.star.lang.WrappedTargetException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get by name", e); - } catch(com.sun.star.container.NoSuchElementException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get by name", e); - } catch(com.sun.star.lang.IllegalArgumentException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get by name", e); - } + PageStyles = (XNameAccess) AnyConverter.toObject( + new Type(XNameAccess.class),StyleFamNames.getByName("PageStyles")); + StdStyle = (XStyle) AnyConverter.toObject( + new Type(XStyle.class),PageStyles.getByName("Default")); //get the property-set PropSet = UnoRuntime.queryInterface(XPropertySet.class, StdStyle); @@ -130,20 +119,9 @@ public class ScHeaderFooterContentObj extends TestCase { // creation of testobject here // first we write what we are intend to do to log file log.println( "creating a test environment" ); - try { - RPHC = (XHeaderFooterContent) AnyConverter.toObject( - new Type(XHeaderFooterContent.class), - PropSet.getPropertyValue("RightPageHeaderContent")); - } catch(com.sun.star.lang.WrappedTargetException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get HeaderContent", e); - } catch(com.sun.star.beans.UnknownPropertyException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get HeaderContent", e); - } catch(com.sun.star.lang.IllegalArgumentException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get HeaderContent", e); - } + RPHC = (XHeaderFooterContent) AnyConverter.toObject( + new Type(XHeaderFooterContent.class), + PropSet.getPropertyValue("RightPageHeaderContent")); XText center = RPHC.getCenterText(); XText left = RPHC.getLeftText(); @@ -153,21 +131,7 @@ public class ScHeaderFooterContentObj extends TestCase { left.setString("LEFT"); right.setString("RIGHT"); - try { - PropSet.setPropertyValue("RightPageHeaderContent", RPHC); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't set HeaderContent", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't set HeaderContent", e); - } catch (com.sun.star.beans.PropertyVetoException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't set HeaderContent", e); - } catch (com.sun.star.beans.UnknownPropertyException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't set HeaderContent", e); - } + PropSet.setPropertyValue("RightPageHeaderContent", RPHC); // create testobject here oObj = RPHC; diff --git a/qadevOOo/tests/java/mod/_sc/ScHeaderFooterTextCursor.java b/qadevOOo/tests/java/mod/_sc/ScHeaderFooterTextCursor.java index ffbcdf33ea49..49d2eb9fc726 100644 --- a/qadevOOo/tests/java/mod/_sc/ScHeaderFooterTextCursor.java +++ b/qadevOOo/tests/java/mod/_sc/ScHeaderFooterTextCursor.java @@ -134,7 +134,7 @@ public class ScHeaderFooterTextCursor extends TestCase { * </ul> */ @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { XInterface oObj = null; XPropertySet PropSet; @@ -146,21 +146,10 @@ public class ScHeaderFooterTextCursor extends TestCase { xSpreadsheetDoc ); XNameAccess StyleFamNames = StyleFam.getStyleFamilies(); - try{ - PageStyles = (XNameAccess) AnyConverter.toObject( - new Type(XNameAccess.class),StyleFamNames.getByName("PageStyles")); - StdStyle = (XStyle) AnyConverter.toObject( - new Type(XStyle.class),PageStyles.getByName("Default")); - } catch(com.sun.star.lang.WrappedTargetException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get by name", e); - } catch(com.sun.star.container.NoSuchElementException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get by name", e); - } catch(com.sun.star.lang.IllegalArgumentException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get by name", e); - } + PageStyles = (XNameAccess) AnyConverter.toObject( + new Type(XNameAccess.class),StyleFamNames.getByName("PageStyles")); + StdStyle = (XStyle) AnyConverter.toObject( + new Type(XStyle.class),PageStyles.getByName("Default")); //get the property-set PropSet = UnoRuntime.queryInterface(XPropertySet.class, StdStyle); @@ -169,39 +158,14 @@ public class ScHeaderFooterTextCursor extends TestCase { // creation of testobject here // first we write what we are intend to do to log file log.println( "creating a test environment" ); - try { - RPHC = (XHeaderFooterContent) AnyConverter.toObject( - new Type(XHeaderFooterContent.class), - PropSet.getPropertyValue("RightPageHeaderContent")); - } catch(com.sun.star.lang.WrappedTargetException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get HeaderContent", e); - } catch(com.sun.star.beans.UnknownPropertyException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get HeaderContent", e); - } catch(com.sun.star.lang.IllegalArgumentException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get HeaderContent", e); - } + RPHC = (XHeaderFooterContent) AnyConverter.toObject( + new Type(XHeaderFooterContent.class), + PropSet.getPropertyValue("RightPageHeaderContent")); XText center = RPHC.getCenterText(); center.setString("CENTER"); - try { - PropSet.setPropertyValue("RightPageHeaderContent",RPHC); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't set HeaderContent", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't set HeaderContent", e); - } catch (com.sun.star.beans.PropertyVetoException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't set HeaderContent", e); - } catch (com.sun.star.beans.UnknownPropertyException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't set HeaderContent", e); - } + PropSet.setPropertyValue("RightPageHeaderContent",RPHC); // create testobject here oObj = center.createTextCursor(); diff --git a/qadevOOo/tests/java/mod/_sc/ScHeaderFooterTextObj.java b/qadevOOo/tests/java/mod/_sc/ScHeaderFooterTextObj.java index 600a5171da67..a0c818bf150f 100644 --- a/qadevOOo/tests/java/mod/_sc/ScHeaderFooterTextObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScHeaderFooterTextObj.java @@ -139,7 +139,7 @@ public class ScHeaderFooterTextObj extends TestCase { * @see com.sun.star.text.Text */ @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { XInterface oObj = null; XPropertySet PropSet; @@ -150,21 +150,10 @@ public class ScHeaderFooterTextObj extends TestCase { XStyleFamiliesSupplier.class, xSpreadsheetDoc ); XNameAccess StyleFamNames = StyleFam.getStyleFamilies(); - try{ - PageStyles = (XNameAccess) AnyConverter.toObject( - new Type(XNameAccess.class),StyleFamNames.getByName("PageStyles")); - StdStyle = (XStyle) AnyConverter.toObject( - new Type(XStyle.class),PageStyles.getByName("Default")); - } catch(com.sun.star.lang.WrappedTargetException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get by name", e); - } catch(com.sun.star.container.NoSuchElementException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get by name", e); - } catch(com.sun.star.lang.IllegalArgumentException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get by name", e); - } + PageStyles = (XNameAccess) AnyConverter.toObject( + new Type(XNameAccess.class),StyleFamNames.getByName("PageStyles")); + StdStyle = (XStyle) AnyConverter.toObject( + new Type(XStyle.class),PageStyles.getByName("Default")); //get the property-set PropSet = UnoRuntime.queryInterface(XPropertySet.class, StdStyle); @@ -173,76 +162,46 @@ public class ScHeaderFooterTextObj extends TestCase { // creation of testobject here // first we write what we are intend to do to log file log.println( "creating a test environment" ); - try { - RPHC = (XHeaderFooterContent) AnyConverter.toObject( - new Type(XHeaderFooterContent.class), - PropSet.getPropertyValue("RightPageHeaderContent")); - } catch(com.sun.star.lang.WrappedTargetException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get HeaderContent", e); - } catch(com.sun.star.beans.UnknownPropertyException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get HeaderContent", e); - } catch(com.sun.star.lang.IllegalArgumentException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get HeaderContent", e); - } + RPHC = (XHeaderFooterContent) AnyConverter.toObject( + new Type(XHeaderFooterContent.class), + PropSet.getPropertyValue("RightPageHeaderContent")); XText center = RPHC.getCenterText(); XTextRange text_to_move = null; log.println( "inserting some lines" ); - try { - XTextCursor oCursor = center.createTextCursor(); - center.insertControlCharacter( - oCursor, ControlCharacter.PARAGRAPH_BREAK, false ); - center.insertControlCharacter( - oCursor, ControlCharacter.LINE_BREAK, false ); - center.insertString(oCursor,"Paragraph 1", false); - center.insertString(oCursor,": ScHeaderFooterTextObj", false); - center.insertControlCharacter( - oCursor, ControlCharacter.PARAGRAPH_BREAK, false ); - center.insertString(oCursor, "THE QUICK BROWN FOX JUMPS OVER THE" + - " LAZY DOG: ScHeaderFooterTextObj", false ); - center.insertControlCharacter( - oCursor, ControlCharacter.PARAGRAPH_BREAK, false ); - center.insertControlCharacter( - oCursor, ControlCharacter.LINE_BREAK, false ); - oCursor.setString("TextForMove"); - text_to_move = oCursor; - - XTextCursor oCursor1 = center.createTextCursorByRange(center.getEnd()); - center.insertString(oCursor1,"Paragraph 2", false); - center.insertString(oCursor1,": ScHeaderFooterTextObj", false); - center.insertControlCharacter( - oCursor1, ControlCharacter.PARAGRAPH_BREAK, false ); - center.insertString( oCursor1, "THE QUICK BROWN FOX JUMPS OVER THE" + - " LAZY DOG: ScHeaderFooterTextObj", false); - center.insertControlCharacter( - oCursor1, ControlCharacter.PARAGRAPH_BREAK, false ); - center.insertControlCharacter( - oCursor1, ControlCharacter.LINE_BREAK, false ); - } catch(com.sun.star.lang.IllegalArgumentException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't insert Text ", e); - } - - try { - PropSet.setPropertyValue("RightPageHeaderContent", RPHC); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't set HeaderContent", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't set HeaderContent", e); - } catch (com.sun.star.beans.PropertyVetoException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't set HeaderContent", e); - } catch (com.sun.star.beans.UnknownPropertyException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't set HeaderContent", e); - } + XTextCursor oCursor = center.createTextCursor(); + center.insertControlCharacter( + oCursor, ControlCharacter.PARAGRAPH_BREAK, false ); + center.insertControlCharacter( + oCursor, ControlCharacter.LINE_BREAK, false ); + center.insertString(oCursor,"Paragraph 1", false); + center.insertString(oCursor,": ScHeaderFooterTextObj", false); + center.insertControlCharacter( + oCursor, ControlCharacter.PARAGRAPH_BREAK, false ); + center.insertString(oCursor, "THE QUICK BROWN FOX JUMPS OVER THE" + + " LAZY DOG: ScHeaderFooterTextObj", false ); + center.insertControlCharacter( + oCursor, ControlCharacter.PARAGRAPH_BREAK, false ); + center.insertControlCharacter( + oCursor, ControlCharacter.LINE_BREAK, false ); + oCursor.setString("TextForMove"); + text_to_move = oCursor; + + XTextCursor oCursor1 = center.createTextCursorByRange(center.getEnd()); + center.insertString(oCursor1,"Paragraph 2", false); + center.insertString(oCursor1,": ScHeaderFooterTextObj", false); + center.insertControlCharacter( + oCursor1, ControlCharacter.PARAGRAPH_BREAK, false ); + center.insertString( oCursor1, "THE QUICK BROWN FOX JUMPS OVER THE" + + " LAZY DOG: ScHeaderFooterTextObj", false); + center.insertControlCharacter( + oCursor1, ControlCharacter.PARAGRAPH_BREAK, false ); + center.insertControlCharacter( + oCursor1, ControlCharacter.LINE_BREAK, false ); + + PropSet.setPropertyValue("RightPageHeaderContent", RPHC); // create testobject here oObj = center; diff --git a/qadevOOo/tests/java/mod/_sc/ScImportDescriptorBase.java b/qadevOOo/tests/java/mod/_sc/ScImportDescriptorBase.java index 6a9e19322ed3..0d8eaba0fb5f 100644 --- a/qadevOOo/tests/java/mod/_sc/ScImportDescriptorBase.java +++ b/qadevOOo/tests/java/mod/_sc/ScImportDescriptorBase.java @@ -105,7 +105,7 @@ public class ScImportDescriptorBase extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters tParam, PrintWriter log ) - throws StatusException { + throws Exception { XInterface oObj = null; XImportable xIMP = null; @@ -123,11 +123,7 @@ public class ScImportDescriptorBase extends TestCase { log.println("getting a sheet"); XIndexAccess oIndexAccess = UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets); - try { - oObj = UnoRuntime.queryInterface(XInterface.class,oIndexAccess.getByIndex(0)); - } catch (Exception e) { - throw new StatusException( "Couldn't get a spreadsheet", e); - } + oObj = UnoRuntime.queryInterface(XInterface.class,oIndexAccess.getByIndex(0)); xIMP = UnoRuntime.queryInterface(XImportable.class,oObj); diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_CellAnnotationsEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_CellAnnotationsEnumeration.java index 402af6a7c92e..6de5b724c06c 100644 --- a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_CellAnnotationsEnumeration.java +++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_CellAnnotationsEnumeration.java @@ -72,7 +72,7 @@ public class ScIndexEnumeration_CellAnnotationsEnumeration extends TestCase { } @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; @@ -82,30 +82,13 @@ public class ScIndexEnumeration_CellAnnotationsEnumeration extends TestCase { log.println("getting a sheet"); XSpreadsheet oSheet = null; XIndexAccess oIndexAccess = UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets); - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); log.println("filling some cells"); - try { - oSheet.getCellByPosition(5, 5).setValue(15); - oSheet.getCellByPosition(1, 4).setValue(10); - oSheet.getCellByPosition(2, 0).setValue(-5.15); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException( - "Exception occurred while filling cells", e); - } + oSheet.getCellByPosition(5, 5).setValue(15); + oSheet.getCellByPosition(1, 4).setValue(10); + oSheet.getCellByPosition(2, 0).setValue(-5.15); XSheetAnnotationsSupplier sas = UnoRuntime.queryInterface(XSheetAnnotationsSupplier.class, oSheet); diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_CellAreaLinksEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_CellAreaLinksEnumeration.java index e7d96f121bae..ea286b4c3b93 100644 --- a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_CellAreaLinksEnumeration.java +++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_CellAreaLinksEnumeration.java @@ -71,52 +71,37 @@ protected void initialize( TestParameters tParam, PrintWriter log ) { @Override - public synchronized TestEnvironment createTestEnvironment - (TestParameters Param, PrintWriter log){ + public synchronized TestEnvironment createTestEnvironment( + TestParameters Param, PrintWriter log) throws Exception { - XInterface oObj = null; - TestEnvironment tEnv = null ; - - try { + XInterface oObj = null; + TestEnvironment tEnv = null; // creation of testobject here - XPropertySet props = UnoRuntime.queryInterface - (XPropertySet.class, xSheetDoc); - oObj = (XInterface) AnyConverter.toObject( - new Type(XInterface.class),props.getPropertyValue("AreaLinks")) ; - XAreaLinks links = null ; + XPropertySet props = UnoRuntime.queryInterface(XPropertySet.class, + xSheetDoc); + oObj = (XInterface) AnyConverter.toObject(new Type(XInterface.class), + props.getPropertyValue("AreaLinks")); + XAreaLinks links = null; // adding one link into collection (for best testing) - links = UnoRuntime.queryInterface(XAreaLinks.class, oObj) ; - CellAddress addr = new CellAddress ((short) 1,2,3) ; + links = UnoRuntime.queryInterface(XAreaLinks.class, oObj); + CellAddress addr = new CellAddress((short) 1, 2, 3); String aSourceArea = util.utils.getFullTestURL("calcshapes.sxc"); - links.insertAtPosition (addr, aSourceArea, "a2:b5", "", "") ; + links.insertAtPosition(addr, aSourceArea, "a2:b5", "", ""); - XEnumerationAccess ea = UnoRuntime.queryInterface(XEnumerationAccess.class,oObj); + XEnumerationAccess ea = UnoRuntime.queryInterface( + XEnumerationAccess.class, oObj); oObj = ea.createEnumeration(); - log.println("ImplementationName: "+util.utils.getImplName(oObj)); + log.println("ImplementationName: " + util.utils.getImplName(oObj)); // creating test environment tEnv = new TestEnvironment(oObj); - tEnv.addObjRelation("ENUM",ea); - - } catch (com.sun.star.beans.UnknownPropertyException e) { - log.println ("Exception occurred while creating test Object.") ; - e.printStackTrace(log) ; - throw new StatusException("Couldn't create test object", e); - } catch (com.sun.star.lang.WrappedTargetException e) { - log.println ("Exception occurred while creating test Object.") ; - e.printStackTrace(log) ; - throw new StatusException("Couldn't create test object", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - log.println ("Exception occurred while creating test Object.") ; - e.printStackTrace(log) ; - throw new StatusException("Couldn't create test object", e); - } - - return tEnv ; + tEnv.addObjRelation("ENUM", ea); + + return tEnv; } } diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DDELinksEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DDELinksEnumeration.java index 7e7072f1026a..eac042891ec8 100644 --- a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DDELinksEnumeration.java +++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DDELinksEnumeration.java @@ -75,7 +75,7 @@ public class ScIndexEnumeration_DDELinksEnumeration extends TestCase { } @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; @@ -89,18 +89,7 @@ public class ScIndexEnumeration_DDELinksEnumeration extends TestCase { // load the predefined testdocument String testdoc = utils.getFullTestURL("ScDDELinksObj.ods"); - try { - oDoc = SOfficeFactory.getFactory(oMSF).loadDocument(testdoc); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Can't load test document", e); - } catch (com.sun.star.io.IOException e) { - e.printStackTrace(log); - throw new StatusException("Can't load test document", e); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Can't load test document", e); - } + oDoc = SOfficeFactory.getFactory(oMSF).loadDocument(testdoc); log.println("getting sheets"); XSpreadsheets xSpreadsheets = xSheetDoc.getSheets(); @@ -108,57 +97,26 @@ public class ScIndexEnumeration_DDELinksEnumeration extends TestCase { log.println("getting a sheet"); XSpreadsheet oSheet = null; XIndexAccess oIndexAccess = UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets); - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( + oSheet = (XSpreadsheet) AnyConverter.toObject( new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } testdoc = utils.getFullTestDocName("ScDDELinksObj.ods"); log.println("filling some cells"); - try { - oSheet.getCellByPosition(5, 5).setFormula( - "=DDE(\"soffice\";\""+testdoc+"\";\"Sheet1.A1\""); - oSheet.getCellByPosition(1, 4).setFormula( - "=DDE(\"soffice\";\""+testdoc+"\";\"Sheet1.A1\""); - oSheet.getCellByPosition(2, 0).setFormula( - "=DDE(\"soffice\";\""+testdoc+"\";\"Sheet1.A1\""); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException( - "Exception occurred while filling cells", e); - } - - try { - log.println("Getting test object ") ; - - // Getting named ranges. - XPropertySet docProps = UnoRuntime.queryInterface(XPropertySet.class, xSheetDoc); - oObj = (XInterface)AnyConverter.toObject( - new Type(XInterface.class),docProps.getPropertyValue("DDELinks")); - log.println("Creating object - " + - ((oObj == null) ? "FAILED" : "OK")); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log) ; - throw new StatusException( - "Error getting test object from spreadsheet document", e) ; - } catch (com.sun.star.beans.UnknownPropertyException e) { - e.printStackTrace(log) ; - throw new StatusException( - "Error getting test object from spreadsheet document", e) ; - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log) ; - throw new StatusException( - "Error getting test object from spreadsheet document", e) ; - } + oSheet.getCellByPosition(5, 5).setFormula( + "=DDE(\"soffice\";\""+testdoc+"\";\"Sheet1.A1\""); + oSheet.getCellByPosition(1, 4).setFormula( + "=DDE(\"soffice\";\""+testdoc+"\";\"Sheet1.A1\""); + oSheet.getCellByPosition(2, 0).setFormula( + "=DDE(\"soffice\";\""+testdoc+"\";\"Sheet1.A1\""); + + log.println("Getting test object ") ; + + // Getting named ranges. + XPropertySet docProps = UnoRuntime.queryInterface(XPropertySet.class, xSheetDoc); + oObj = (XInterface)AnyConverter.toObject( + new Type(XInterface.class),docProps.getPropertyValue("DDELinks")); + log.println("Creating object - " + + ((oObj == null) ? "FAILED" : "OK")); XEnumerationAccess ea = UnoRuntime.queryInterface(XEnumerationAccess.class,oObj); diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DataPilotFieldsEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DataPilotFieldsEnumeration.java index bb26df369b06..b8895515ba3f 100644 --- a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DataPilotFieldsEnumeration.java +++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DataPilotFieldsEnumeration.java @@ -74,7 +74,7 @@ public class ScIndexEnumeration_DataPilotFieldsEnumeration extends TestCase { } @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; @@ -90,36 +90,20 @@ public class ScIndexEnumeration_DataPilotFieldsEnumeration extends TestCase { log.println("getting a sheet"); XSpreadsheet oSheet = null; XIndexAccess oIndexAccess = UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets); - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); + + log.println("Filing a table"); + for (int i = 1; i < 4; i++) { + oSheet.getCellByPosition(i, 0).setFormula("Col" + i); + oSheet.getCellByPosition(0, i).setFormula("Row" + i); } - try { - log.println("Filing a table"); - for (int i = 1; i < 4; i++) { - oSheet.getCellByPosition(i, 0).setFormula("Col" + i); - oSheet.getCellByPosition(0, i).setFormula("Row" + i); + for (int i = 1; i < 4; i++) + for (int j = 1; j < 4; j++) { + oSheet.getCellByPosition(i, j).setValue(i * (j + 1)); } - for (int i = 1; i < 4; i++) - for (int j = 1; j < 4; j++) { - oSheet.getCellByPosition(i, j).setValue(i * (j + 1)); - } - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't fill some cells", e); - } - XDataPilotTablesSupplier DPTS = UnoRuntime.queryInterface(XDataPilotTablesSupplier.class, oSheet); log.println("Getting test object ") ; diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DataPilotItemsEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DataPilotItemsEnumeration.java index 47912e2dbfa9..829cea2d910f 100644 --- a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DataPilotItemsEnumeration.java +++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DataPilotItemsEnumeration.java @@ -121,7 +121,7 @@ public class ScIndexEnumeration_DataPilotItemsEnumeration */ @Override protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; @@ -153,58 +153,36 @@ public class ScIndexEnumeration_DataPilotItemsEnumeration // Make sure there are at least two sheets xSpreadsheets.insertNewByName("Some Sheet", (short)0); - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class), - oIndexAccess.getByIndex(0)); - oSheet2 = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class), - oIndexAccess.getByIndex(1)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(); - throw new StatusException("Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(); - throw new StatusException("Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(); - throw new StatusException("Couldn't get a spreadsheet", e); - } - - try { - log.println("Filling a table"); + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class), + oIndexAccess.getByIndex(0)); + oSheet2 = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class), + oIndexAccess.getByIndex(1)); - for (int i = 1; i < mMaxFieldIndex; i++) { - oSheet.getCellByPosition(i, 0).setFormula("Col" + i); - oSheet.getCellByPosition(0, i).setFormula("Row" + i); - oSheet2.getCellByPosition(i, 0).setFormula("Col" + i); - oSheet2.getCellByPosition(0, i).setFormula("Row" + i); - } + log.println("Filling a table"); - for (int i = 1; i < mMaxFieldIndex; i++) - for (int j = 1; j < mMaxFieldIndex; j++) { - oSheet.getCellByPosition(i, j).setValue(i * (j + 1)); - oSheet2.getCellByPosition(i, j).setValue(i * (j + 2)); - } - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(); - throw new StatusException("Couldn't fill some cells", e); + for (int i = 1; i < mMaxFieldIndex; i++) { + oSheet.getCellByPosition(i, 0).setFormula("Col" + i); + oSheet.getCellByPosition(0, i).setFormula("Row" + i); + oSheet2.getCellByPosition(i, 0).setFormula("Col" + i); + oSheet2.getCellByPosition(0, i).setFormula("Row" + i); } - try { - oSheet.getCellByPosition(1, 5); + for (int i = 1; i < mMaxFieldIndex; i++) + for (int j = 1; j < mMaxFieldIndex; j++) { + oSheet.getCellByPosition(i, j).setValue(i * (j + 1)); + oSheet2.getCellByPosition(i, j).setValue(i * (j + 2)); + } - int x = sCellAdress.Column; - int y = sCellAdress.Row + 3; + oSheet.getCellByPosition(1, 5); + int x = sCellAdress.Column; + int y = sCellAdress.Row + 3; - oSheet.getCellByPosition(x, y); - Integer.valueOf(27); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(); - throw new StatusException("Couldn't get cells for changing.", e); - } + oSheet.getCellByPosition(x, y); + Integer.valueOf(27); // create the test objects log.println("Getting test objects"); @@ -218,36 +196,14 @@ public class ScIndexEnumeration_DataPilotItemsEnumeration XPropertySet fieldPropSet = null; - try { - Object oDataPilotField = DPDsc.getDataPilotFields().getByIndex(0); - fieldPropSet = UnoRuntime.queryInterface( - XPropertySet.class, oDataPilotField); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(); - throw new StatusException("Couldn't create a test environment", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(); - throw new StatusException("Couldn't create a test environment", e); - } + Object oDataPilotField = DPDsc.getDataPilotFields().getByIndex(0); + fieldPropSet = UnoRuntime.queryInterface( + XPropertySet.class, oDataPilotField); - try { - fieldPropSet.setPropertyValue("Function", - com.sun.star.sheet.GeneralFunction.SUM); - fieldPropSet.setPropertyValue("Orientation", - com.sun.star.sheet.DataPilotFieldOrientation.DATA); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(); - throw new StatusException("Couldn't create a test environment", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(); - throw new StatusException("Couldn't create a test environment", e); - } catch (com.sun.star.beans.PropertyVetoException e) { - e.printStackTrace(); - throw new StatusException("Couldn't create a test environment", e); - } catch (com.sun.star.beans.UnknownPropertyException e) { - e.printStackTrace(); - throw new StatusException("Couldn't create a test environment", e); - } + fieldPropSet.setPropertyValue("Function", + com.sun.star.sheet.GeneralFunction.SUM); + fieldPropSet.setPropertyValue("Orientation", + com.sun.star.sheet.DataPilotFieldOrientation.DATA); log.println("Insert the DataPilotTable"); @@ -260,19 +216,8 @@ public class ScIndexEnumeration_DataPilotItemsEnumeration DPT.insertNewByName("DataPilotTable", sCellAdress, DPDsc); - try { - oObj = (XInterface) AnyConverter.toObject( - new Type(XInterface.class), IA.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(); - throw new StatusException("Couldn't get data pilot field", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(); - throw new StatusException("Couldn't get data pilot field", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(); - throw new StatusException("Couldn't get data pilot field", e); - } + oObj = (XInterface) AnyConverter.toObject( + new Type(XInterface.class), IA.getByIndex(0)); log.println("Creating object - " + ((oObj == null) ? "FAILED" : "OK")); diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DataPilotTablesEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DataPilotTablesEnumeration.java index c99b1311bb65..cc14e664502f 100644 --- a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DataPilotTablesEnumeration.java +++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DataPilotTablesEnumeration.java @@ -74,7 +74,7 @@ public class ScIndexEnumeration_DataPilotTablesEnumeration extends TestCase { } @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; @@ -90,36 +90,20 @@ public class ScIndexEnumeration_DataPilotTablesEnumeration extends TestCase { log.println("getting a sheet"); XSpreadsheet oSheet = null; XIndexAccess oIndexAccess = UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets); - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); + + log.println("Filing a table"); + for (int i = 1; i < 4; i++) { + oSheet.getCellByPosition(i, 0).setFormula("Col" + i); + oSheet.getCellByPosition(0, i).setFormula("Row" + i); } - try { - log.println("Filing a table"); - for (int i = 1; i < 4; i++) { - oSheet.getCellByPosition(i, 0).setFormula("Col" + i); - oSheet.getCellByPosition(0, i).setFormula("Row" + i); + for (int i = 1; i < 4; i++) + for (int j = 1; j < 4; j++) { + oSheet.getCellByPosition(i, j).setValue(i * (j + 1)); } - for (int i = 1; i < 4; i++) - for (int j = 1; j < 4; j++) { - oSheet.getCellByPosition(i, j).setValue(i * (j + 1)); - } - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't fill some cells", e); - } - XDataPilotTablesSupplier DPTS = UnoRuntime.queryInterface(XDataPilotTablesSupplier.class, oSheet); log.println("Getting test object ") ; diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_FunctionDescriptionEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_FunctionDescriptionEnumeration.java index 4111ef5f926b..e81e744f9f0b 100644 --- a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_FunctionDescriptionEnumeration.java +++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_FunctionDescriptionEnumeration.java @@ -65,7 +65,7 @@ public class ScIndexEnumeration_FunctionDescriptionEnumeration extends TestCase } @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; @@ -76,16 +76,10 @@ public class ScIndexEnumeration_FunctionDescriptionEnumeration extends TestCase log.println("Getting test object ") ; XMultiServiceFactory oDocMSF = Param.getMSF(); - try { - oObj = (XInterface)oDocMSF.createInstance( - "com.sun.star.sheet.FunctionDescriptions"); - log.println("Creating object - " + + oObj = (XInterface)oDocMSF.createInstance( + "com.sun.star.sheet.FunctionDescriptions"); + log.println("Creating object - " + ((oObj == null) ? "FAILED" : "OK")); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException( - "Error getting test object from spreadsheet document", e); - } XEnumerationAccess ea = UnoRuntime.queryInterface(XEnumerationAccess.class,oObj); diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_LabelRangesEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_LabelRangesEnumeration.java index 910f0d433ded..42a5630e7794 100644 --- a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_LabelRangesEnumeration.java +++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_LabelRangesEnumeration.java @@ -67,7 +67,7 @@ public class ScIndexEnumeration_LabelRangesEnumeration extends TestCase { } @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; @@ -75,27 +75,17 @@ public class ScIndexEnumeration_LabelRangesEnumeration extends TestCase { // first we write what we are intend to do to log file log.println( "Creating a test environment" ); - try { - log.println("Getting test object ") ; - XPropertySet docProps = UnoRuntime.queryInterface(XPropertySet.class, xSheetDoc); - Object ranges = docProps.getPropertyValue("ColumnLabelRanges"); - XLabelRanges lRanges = UnoRuntime.queryInterface(XLabelRanges.class, ranges); - - log.println("Adding at least one element for ElementAccess interface"); - CellRangeAddress aRange2 = new CellRangeAddress((short)0, 0, 1, 0, 6); - CellRangeAddress aRange1 = new CellRangeAddress((short)0, 0, 0, 0, 1); - lRanges.addNew(aRange1, aRange2); - - oObj = lRanges; - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log) ; - throw new StatusException( - "Error getting test object from spreadsheet document",e); - } catch (com.sun.star.beans.UnknownPropertyException e) { - e.printStackTrace(log) ; - throw new StatusException( - "Error getting test object from spreadsheet document",e); - } + log.println("Getting test object ") ; + XPropertySet docProps = UnoRuntime.queryInterface(XPropertySet.class, xSheetDoc); + Object ranges = docProps.getPropertyValue("ColumnLabelRanges"); + XLabelRanges lRanges = UnoRuntime.queryInterface(XLabelRanges.class, ranges); + + log.println("Adding at least one element for ElementAccess interface"); + CellRangeAddress aRange2 = new CellRangeAddress((short)0, 0, 1, 0, 6); + CellRangeAddress aRange1 = new CellRangeAddress((short)0, 0, 0, 0, 1); + lRanges.addNew(aRange1, aRange2); + + oObj = lRanges; log.println("creating a new environment for object"); XEnumerationAccess ea = UnoRuntime.queryInterface(XEnumerationAccess.class,oObj); diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_NamedRangesEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_NamedRangesEnumeration.java index b78a980a7771..639d5d90ba9d 100644 --- a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_NamedRangesEnumeration.java +++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_NamedRangesEnumeration.java @@ -67,7 +67,7 @@ public class ScIndexEnumeration_NamedRangesEnumeration extends TestCase { } @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; @@ -79,16 +79,7 @@ public class ScIndexEnumeration_NamedRangesEnumeration extends TestCase { // Getting named ranges. XPropertySet docProps = UnoRuntime.queryInterface(XPropertySet.class, xSheetDoc); - Object ranges = null; - try { - ranges = docProps.getPropertyValue("NamedRanges"); - } catch(com.sun.star.lang.WrappedTargetException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get NamedRanges", e); - } catch(com.sun.star.beans.UnknownPropertyException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get NamedRanges", e); - } + Object ranges = docProps.getPropertyValue("NamedRanges"); XNamedRanges xNamedRanges = UnoRuntime.queryInterface(XNamedRanges.class, ranges); diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_ScenariosEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_ScenariosEnumeration.java index 14703a65b8f7..5b287c7b87ac 100644 --- a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_ScenariosEnumeration.java +++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_ScenariosEnumeration.java @@ -72,36 +72,20 @@ public class ScIndexEnumeration_ScenariosEnumeration extends TestCase { } @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { log.println("getting sheets"); XSpreadsheets xSpreadsheets = xSpreadsheetDoc.getSheets(); log.println("getting a sheet"); XSpreadsheet oSheet = null; XIndexAccess oIndexAccess = UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets); - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); log.println("filling some cells"); - try { - oSheet.getCellByPosition(5, 5).setValue(15); - oSheet.getCellByPosition(1, 4).setValue(10); - oSheet.getCellByPosition(2, 0).setValue(-5.15); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't fill some cell", e); - } + oSheet.getCellByPosition(5, 5).setValue(15); + oSheet.getCellByPosition(1, 4).setValue(10); + oSheet.getCellByPosition(2, 0).setValue(-5.15); XScenariosSupplier xSupp = UnoRuntime.queryInterface(XScenariosSupplier.class, oSheet); XCellRange oRange = UnoRuntime.queryInterface(XCellRange.class, oSheet); diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SheetCellRangesEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SheetCellRangesEnumeration.java index 6e94cb597870..f81fde3a9f25 100644 --- a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SheetCellRangesEnumeration.java +++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SheetCellRangesEnumeration.java @@ -72,7 +72,7 @@ public class ScIndexEnumeration_SheetCellRangesEnumeration extends TestCase { } @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; Object oRange = null ; @@ -94,49 +94,29 @@ public class ScIndexEnumeration_SheetCellRangesEnumeration extends TestCase { XSpreadsheets oSheets = xSheetDoc.getSheets() ; XIndexAccess oIndSheets = UnoRuntime.queryInterface (XIndexAccess.class, oSheets); XSpreadsheet oSheet = null; - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndSheets.getByIndex(0)); - XNameContainer oRanges = UnoRuntime.queryInterface(XNameContainer.class, oObj); - - oRange = oSheet.getCellRangeByName("C1:D4"); - oRanges.insertByName("Range1", oRange); - oRange = oSheet.getCellRangeByName("E2:F5"); - oRanges.insertByName("Range2", oRange); - oRange = oSheet.getCellRangeByName("G2:H3"); - oRanges.insertByName("Range3", oRange); - oRange = oSheet.getCellRangeByName("I7:J8"); - oRanges.insertByName("Range4", oRange); - } catch(com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create test object", e); - } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create test object", e); - } catch(com.sun.star.container.ElementExistException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create test object", e); - } catch(com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create test object", e); - } + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndSheets.getByIndex(0)); + XNameContainer oRanges = UnoRuntime.queryInterface(XNameContainer.class, oObj); + + oRange = oSheet.getCellRangeByName("C1:D4"); + oRanges.insertByName("Range1", oRange); + oRange = oSheet.getCellRangeByName("E2:F5"); + oRanges.insertByName("Range2", oRange); + oRange = oSheet.getCellRangeByName("G2:H3"); + oRanges.insertByName("Range3", oRange); + oRange = oSheet.getCellRangeByName("I7:J8"); + oRanges.insertByName("Range4", oRange); log.println("filling some cells"); - try { - for (int i = 0; i < 10; i++) { - for (int j = 0; j < 5; j++) { - oSheet.getCellByPosition(i, j).setFormula("a"); - } + for (int i = 0; i < 10; i++) { + for (int j = 0; j < 5; j++) { + oSheet.getCellByPosition(i, j).setFormula("a"); } - for (int i = 0; i < 10; i++) { - for (int j = 5; j < 10; j++) { - oSheet.getCellByPosition(i, j).setValue(i + j); - } + } + for (int i = 0; i < 10; i++) { + for (int j = 5; j < 10; j++) { + oSheet.getCellByPosition(i, j).setValue(i + j); } - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException ( - "Exception occurred while filling cells", e); } XEnumerationAccess ea = UnoRuntime.queryInterface(XEnumerationAccess.class,oObj); diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SheetLinksEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SheetLinksEnumeration.java index 14cdd0d913d9..1b9e690fcc9b 100644 --- a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SheetLinksEnumeration.java +++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SheetLinksEnumeration.java @@ -70,7 +70,7 @@ public class ScIndexEnumeration_SheetLinksEnumeration extends TestCase { } @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; @@ -82,19 +82,8 @@ public class ScIndexEnumeration_SheetLinksEnumeration extends TestCase { log.println("Getting test object ") ; XSpreadsheets oSheets = xSheetDoc.getSheets() ; XIndexAccess oIndexAccess = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); XSheetLinkable SL = UnoRuntime.queryInterface(XSheetLinkable.class, oSheet); @@ -106,16 +95,7 @@ public class ScIndexEnumeration_SheetLinksEnumeration extends TestCase { // Getting links. XPropertySet docProps = UnoRuntime.queryInterface(XPropertySet.class, xSheetDoc); - Object links = null; - try { - links = docProps.getPropertyValue("SheetLinks"); - } catch(com.sun.star.lang.WrappedTargetException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get SheetLinks", e); - } catch(com.sun.star.beans.UnknownPropertyException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get SheetLinks", e); - } + Object links = docProps.getPropertyValue("SheetLinks"); oObj = UnoRuntime.queryInterface(XInterface.class, links); diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SpreadsheetViewPanesEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SpreadsheetViewPanesEnumeration.java index b6ef6302ae67..01e648e4fe51 100644 --- a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SpreadsheetViewPanesEnumeration.java +++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SpreadsheetViewPanesEnumeration.java @@ -70,24 +70,13 @@ public class ScIndexEnumeration_SpreadsheetViewPanesEnumeration extends TestCase } @Override - protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XModel xm = UnoRuntime.queryInterface(XModel.class, xSpreadsheetDoc); XController xc = xm.getCurrentController(); XIndexAccess xIA = UnoRuntime.queryInterface(XIndexAccess.class, xc); - try { - oObj = (XInterface) AnyConverter.toObject( - new Type(XInterface.class),xIA.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get by index", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get by index", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get by index", e); - } + oObj = (XInterface) AnyConverter.toObject( + new Type(XInterface.class),xIA.getByIndex(0)); XEnumerationAccess ea = UnoRuntime.queryInterface(XEnumerationAccess.class,xIA); diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SubTotalFieldsEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SubTotalFieldsEnumeration.java index f0885ad2e70b..aa691de49b9b 100644 --- a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SubTotalFieldsEnumeration.java +++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SubTotalFieldsEnumeration.java @@ -76,7 +76,7 @@ public class ScIndexEnumeration_SubTotalFieldsEnumeration extends TestCase { } @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { log.println("getting sheets"); XSpreadsheets xSpreadsheets = xSpreadsheetDoc.getSheets(); @@ -84,19 +84,8 @@ public class ScIndexEnumeration_SubTotalFieldsEnumeration extends TestCase { log.println("getting a sheet"); XSpreadsheet oSheet = null; XIndexAccess oIndexAccess = UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets); - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); XSubTotalCalculatable xSTC = UnoRuntime.queryInterface(XSubTotalCalculatable.class, oSheet); diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableAutoFormatEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableAutoFormatEnumeration.java index 19f8f15a4132..3bcc7bc4cf1a 100644 --- a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableAutoFormatEnumeration.java +++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableAutoFormatEnumeration.java @@ -65,32 +65,24 @@ public class ScIndexEnumeration_TableAutoFormatEnumeration extends TestCase{ } @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { - XInterface oObj = null; + // creation of testobject here + // get AutoFormats + XInterface oObj = (XInterface)Param.getMSF().createInstance + ("com.sun.star.sheet.TableAutoFormats"); - try { - // creation of testobject here - // get AutoFormats - oObj = (XInterface)Param.getMSF().createInstance - ("com.sun.star.sheet.TableAutoFormats"); - - XEnumerationAccess ea = UnoRuntime.queryInterface(XEnumerationAccess.class,oObj); + XEnumerationAccess ea = UnoRuntime.queryInterface(XEnumerationAccess.class,oObj); - oObj = ea.createEnumeration(); + oObj = ea.createEnumeration(); - log.println("ImplementationName: "+util.utils.getImplName(oObj)); - // creating test environment - TestEnvironment tEnv = new TestEnvironment( oObj ); + log.println("ImplementationName: "+util.utils.getImplName(oObj)); + // creating test environment + TestEnvironment tEnv = new TestEnvironment( oObj ); - tEnv.addObjRelation("ENUM",ea); + tEnv.addObjRelation("ENUM",ea); - return tEnv; - } catch (com.sun.star.uno.Exception e) { - log.println ("Exception occurred while creating test Object."); - e.printStackTrace(log); - throw new StatusException("Couldn't create test object", e); - } + return tEnv; } } // finish class ScAutoFormatsObj diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableChartsEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableChartsEnumeration.java index d35c31f07d9a..08df02198229 100644 --- a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableChartsEnumeration.java +++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableChartsEnumeration.java @@ -76,29 +76,12 @@ public class ScIndexEnumeration_TableChartsEnumeration extends TestCase { } @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { - - XSpreadsheet oSheet=null; - - try { - log.println("Getting spreadsheet") ; - XSpreadsheets oSheets = xSheetDoc.getSheets() ; - XIndexAccess oIndexSheets = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - log.println("Couldn't get Sheet "); - e.printStackTrace(log); - throw new StatusException("Couldn't get sheet", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Couldn't get Sheet "); - e.printStackTrace(log); - throw new StatusException("Couldn't get sheet", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - log.println("Couldn't get Sheet "); - e.printStackTrace(log); - throw new StatusException("Couldn't get sheet", e); - } + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { + log.println("Getting spreadsheet") ; + XSpreadsheets oSheets = xSheetDoc.getSheets() ; + XIndexAccess oIndexSheets = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); + XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); log.println("Creating the Header") ; diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableColumnsEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableColumnsEnumeration.java index 137bd34c2026..c999cc682e04 100644 --- a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableColumnsEnumeration.java +++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableColumnsEnumeration.java @@ -71,7 +71,7 @@ public class ScIndexEnumeration_TableColumnsEnumeration extends TestCase { } @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; @@ -83,20 +83,9 @@ public class ScIndexEnumeration_TableColumnsEnumeration extends TestCase { XSpreadsheets xSpreadsheets = xSheetDoc.getSheets(); XNameAccess oNames = UnoRuntime.queryInterface( XNameAccess.class, xSpreadsheets ); XSpreadsheet xSpreadsheet = null; - try { - xSpreadsheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class), - oNames.getByName(oNames.getElementNames()[0])); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get spreadsheet", e); - } catch (com.sun.star.container.NoSuchElementException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get spreadsheet", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get spreadsheet", e); - } + xSpreadsheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class), + oNames.getByName(oNames.getElementNames()[0])); XColumnRowRange oColumnRowRange = UnoRuntime.queryInterface(XColumnRowRange.class, xSpreadsheet); XTableColumns oColumns = oColumnRowRange.getColumns(); diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableConditionalEntryEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableConditionalEntryEnumeration.java index a31fd05d5236..868b9794aa00 100644 --- a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableConditionalEntryEnumeration.java +++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableConditionalEntryEnumeration.java @@ -75,7 +75,7 @@ public class ScIndexEnumeration_TableConditionalEntryEnumeration extends TestCas } @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; log.println("getting sheets"); @@ -85,19 +85,8 @@ public class ScIndexEnumeration_TableConditionalEntryEnumeration extends TestCas XSpreadsheet oSheet = null; XIndexAccess oIndexAccess = UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets); - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); log.println("filling some cells"); try { @@ -112,42 +101,16 @@ public class ScIndexEnumeration_TableConditionalEntryEnumeration extends TestCas Object CFormat = null; XPropertySet Props = null; - try { - Props = UnoRuntime.queryInterface(XPropertySet.class, oSheet); - CFormat = Props.getPropertyValue("ConditionalFormat"); - if (utils.isVoid(CFormat)) { - log.println("Property 'ConditionalFormat' is void"); - } - } catch (com.sun.star.lang.WrappedTargetException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't create instance", e); - } catch (com.sun.star.beans.UnknownPropertyException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't create instance", e); + Props = UnoRuntime.queryInterface(XPropertySet.class, oSheet); + CFormat = Props.getPropertyValue("ConditionalFormat"); + if (utils.isVoid(CFormat)) { + log.println("Property 'ConditionalFormat' is void"); } - try { - XSheetConditionalEntries xSCE = UnoRuntime.queryInterface(XSheetConditionalEntries.class, CFormat); - xSCE.addNew(Conditions()); - Props.setPropertyValue("ConditionalFormat", xSCE); - oObj = xSCE; - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException( - "Exception occurred while getting Entry", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException( - "Exception occurred while getting Entry", e); - } catch (com.sun.star.beans.PropertyVetoException e) { - e.printStackTrace(log); - throw new StatusException( - "Exception occurred while getting Entry", e); - } catch (com.sun.star.beans.UnknownPropertyException e) { - e.printStackTrace(log); - throw new StatusException( - "Exception occurred while getting Entry", e); - } + XSheetConditionalEntries xSCE = UnoRuntime.queryInterface(XSheetConditionalEntries.class, CFormat); + xSCE.addNew(Conditions()); + Props.setPropertyValue("ConditionalFormat", xSCE); + oObj = xSCE; log.println("creating a new environment for object"); XEnumerationAccess ea = UnoRuntime.queryInterface(XEnumerationAccess.class,oObj); diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableRowsEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableRowsEnumeration.java index f6d55da63db8..94a21b45aed2 100644 --- a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableRowsEnumeration.java +++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableRowsEnumeration.java @@ -70,7 +70,7 @@ public class ScIndexEnumeration_TableRowsEnumeration extends TestCase { } @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; @@ -79,20 +79,9 @@ public class ScIndexEnumeration_TableRowsEnumeration extends TestCase { XSpreadsheets xSpreadsheets = xSheetDoc.getSheets(); XNameAccess oNames = UnoRuntime.queryInterface( XNameAccess.class, xSpreadsheets ); - try { - xSpreadsheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class), - oNames.getByName(oNames.getElementNames()[0])); - } catch(com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get spreadsheet", e); - } catch(com.sun.star.container.NoSuchElementException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get spreadsheet", e); - } catch(com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get spreadsheet", e); - } + xSpreadsheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class), + oNames.getByName(oNames.getElementNames()[0])); XColumnRowRange oColumnRowRange = UnoRuntime.queryInterface(XColumnRowRange.class, xSpreadsheet); diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TextFieldEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TextFieldEnumeration.java index 244d09c3338e..ea5172c39d99 100644 --- a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TextFieldEnumeration.java +++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TextFieldEnumeration.java @@ -94,7 +94,7 @@ public class ScIndexEnumeration_TextFieldEnumeration extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) { + TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; XText oText = null; @@ -102,47 +102,29 @@ public class ScIndexEnumeration_TextFieldEnumeration extends TestCase { XInterface aField = null; XTextFieldsSupplier xTextFieldsSupp = null; - try { - // we want to create an instance of ScCellFieldObj. - // to do this we must get an MultiServiceFactory. - - XMultiServiceFactory _oMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xSheetDoc); - - aField = (XInterface) - _oMSF.createInstance("com.sun.star.text.TextField.URL"); - oContent = UnoRuntime.queryInterface(XTextContent.class, aField); - - XSpreadsheets oSheets = xSheetDoc.getSheets() ; - XIndexAccess oIndexSheets = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); - XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); - - XCell oCell = oSheet.getCellByPosition(2,3); - oText = UnoRuntime.queryInterface(XText.class, oCell); - - oText.insertTextContent( - oText.createTextCursor(), oContent, true); - - xTextFieldsSupp = UnoRuntime.queryInterface(XTextFieldsSupplier.class, oCell); - - oObj = xTextFieldsSupp.getTextFields().createEnumeration(); - } catch (com.sun.star.lang.WrappedTargetException e) { - log.println("Exception occurred while creating test Object."); - e.printStackTrace(log); - throw new StatusException("Couldn't create test object", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Exception occurred while creating test Object."); - e.printStackTrace(log); - throw new StatusException("Couldn't create test object", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - log.println("Exception occurred while creating test Object."); - e.printStackTrace(log); - throw new StatusException("Couldn't create test object", e); - } catch (com.sun.star.uno.Exception e) { - log.println("Exception occurred while creating test Object."); - e.printStackTrace(log); - throw new StatusException("Couldn't create test object", e); - } + // we want to create an instance of ScCellFieldObj. + // to do this we must get an MultiServiceFactory. + + XMultiServiceFactory _oMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xSheetDoc); + + aField = (XInterface) + _oMSF.createInstance("com.sun.star.text.TextField.URL"); + oContent = UnoRuntime.queryInterface(XTextContent.class, aField); + + XSpreadsheets oSheets = xSheetDoc.getSheets() ; + XIndexAccess oIndexSheets = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); + XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); + + XCell oCell = oSheet.getCellByPosition(2,3); + oText = UnoRuntime.queryInterface(XText.class, oCell); + + oText.insertTextContent( + oText.createTextCursor(), oContent, true); + + xTextFieldsSupp = UnoRuntime.queryInterface(XTextFieldsSupplier.class, oCell); + + oObj = xTextFieldsSupp.getTextFields().createEnumeration(); TestEnvironment tEnv = new TestEnvironment(oObj) ; diff --git a/qadevOOo/tests/java/mod/_sc/ScLabelRangeObj.java b/qadevOOo/tests/java/mod/_sc/ScLabelRangeObj.java index f273bda1f124..40131bb408ad 100644 --- a/qadevOOo/tests/java/mod/_sc/ScLabelRangeObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScLabelRangeObj.java @@ -92,7 +92,7 @@ public class ScLabelRangeObj extends TestCase { * @see com.sun.star.sheet.XLabelRanges */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; @@ -100,36 +100,18 @@ public class ScLabelRangeObj extends TestCase { // first we write what we are intend to do to log file log.println( "Creating a test environment" ); - try { - log.println("Getting test object ") ; - XPropertySet docProps = UnoRuntime.queryInterface(XPropertySet.class, xSheetDoc); - Object ranges = docProps.getPropertyValue("ColumnLabelRanges"); - XLabelRanges lRanges = UnoRuntime.queryInterface(XLabelRanges.class, ranges); - - log.println("Adding at least one element for ElementAccess interface"); - CellRangeAddress aRange2 = new CellRangeAddress((short)0, 0, 1, 0, 6); - CellRangeAddress aRange1 = new CellRangeAddress((short)0, 0, 0, 0, 1); - lRanges.addNew(aRange1, aRange2); - - oObj = (XLabelRange) AnyConverter.toObject( - new Type(XLabelRange.class),lRanges.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log) ; - throw new StatusException( - "Error getting test object from spreadsheet document",e) ; - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log) ; - throw new StatusException( - "Error getting test object from spreadsheet document",e) ; - } catch (com.sun.star.beans.UnknownPropertyException e) { - e.printStackTrace(log) ; - throw new StatusException( - "Error getting test object from spreadsheet document",e) ; - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log) ; - throw new StatusException( - "Error getting test object from spreadsheet document",e) ; - } + log.println("Getting test object ") ; + XPropertySet docProps = UnoRuntime.queryInterface(XPropertySet.class, xSheetDoc); + Object ranges = docProps.getPropertyValue("ColumnLabelRanges"); + XLabelRanges lRanges = UnoRuntime.queryInterface(XLabelRanges.class, ranges); + + log.println("Adding at least one element for ElementAccess interface"); + CellRangeAddress aRange2 = new CellRangeAddress((short)0, 0, 1, 0, 6); + CellRangeAddress aRange1 = new CellRangeAddress((short)0, 0, 0, 0, 1); + lRanges.addNew(aRange1, aRange2); + + oObj = (XLabelRange) AnyConverter.toObject( + new Type(XLabelRange.class),lRanges.getByIndex(0)); log.println("creating a new environment for object"); TestEnvironment tEnv = new TestEnvironment(oObj); diff --git a/qadevOOo/tests/java/mod/_sc/ScLabelRangesObj.java b/qadevOOo/tests/java/mod/_sc/ScLabelRangesObj.java index 90aafc328464..a7863f0f52f2 100644 --- a/qadevOOo/tests/java/mod/_sc/ScLabelRangesObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScLabelRangesObj.java @@ -95,7 +95,7 @@ public class ScLabelRangesObj extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) throws StatusException { + TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; @@ -103,27 +103,17 @@ public class ScLabelRangesObj extends TestCase { // first we write what we are intend to do to log file log.println( "Creating a test environment" ); - try { - log.println("Getting test object ") ; - XPropertySet docProps = UnoRuntime.queryInterface(XPropertySet.class, xSheetDoc); - Object ranges = docProps.getPropertyValue("ColumnLabelRanges"); - XLabelRanges lRanges = UnoRuntime.queryInterface(XLabelRanges.class, ranges); - - log.println("Adding at least one element for ElementAccess interface"); - CellRangeAddress aRange2 = new CellRangeAddress((short)0, 0, 1, 0, 6); - CellRangeAddress aRange1 = new CellRangeAddress((short)0, 0, 0, 0, 1); - lRanges.addNew(aRange1, aRange2); - - oObj = lRanges; - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log) ; - throw new StatusException( - "Error getting test object from spreadsheet document",e); - } catch (com.sun.star.beans.UnknownPropertyException e) { - e.printStackTrace(log) ; - throw new StatusException( - "Error getting test object from spreadsheet document",e); - } + log.println("Getting test object ") ; + XPropertySet docProps = UnoRuntime.queryInterface(XPropertySet.class, xSheetDoc); + Object ranges = docProps.getPropertyValue("ColumnLabelRanges"); + XLabelRanges lRanges = UnoRuntime.queryInterface(XLabelRanges.class, ranges); + + log.println("Adding at least one element for ElementAccess interface"); + CellRangeAddress aRange2 = new CellRangeAddress((short)0, 0, 1, 0, 6); + CellRangeAddress aRange1 = new CellRangeAddress((short)0, 0, 0, 0, 1); + lRanges.addNew(aRange1, aRange2); + + oObj = lRanges; log.println("creating a new environment for object"); TestEnvironment tEnv = new TestEnvironment(oObj); diff --git a/qadevOOo/tests/java/mod/_sc/ScModelObj.java b/qadevOOo/tests/java/mod/_sc/ScModelObj.java index 022513c2de2e..4a8e164b552d 100644 --- a/qadevOOo/tests/java/mod/_sc/ScModelObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScModelObj.java @@ -35,7 +35,6 @@ import java.io.File; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -116,7 +115,7 @@ public class ScModelObj extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { // creation of the testobject here // first we write what we are intend to do to log file log.println("craeting a test environment"); @@ -137,14 +136,9 @@ public class ScModelObj extends TestCase { util.DesktopTools.closeDoc(oComp); } - try { - log.println("creating two spreadsheet documents"); - xSpreadsheetDoc = SOF.createCalcDoc(null); - xSecondsheetDoc = SOF.createCalcDoc(null); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create document ", e); - } + log.println("creating two spreadsheet documents"); + xSpreadsheetDoc = SOF.createCalcDoc(null); + xSecondsheetDoc = SOF.createCalcDoc(null); XModel model1 = UnoRuntime.queryInterface(XModel.class, xSpreadsheetDoc); @@ -164,43 +158,29 @@ public class ScModelObj extends TestCase { XCell toSel = null; XCell[] xCalculatableCells = null; - try { - log.println("Getting spreadsheet"); - - XSpreadsheets oSheets = xSpreadsheetDoc.getSheets(); - XIndexAccess oIndexSheets = UnoRuntime.queryInterface( - XIndexAccess.class, oSheets); - XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class), - oIndexSheets.getByIndex(0)); - - log.println("Getting a cell from sheet"); - toSel = oSheet.getCellByPosition(2, 3); - // create a simple formula for XCalculatable - oSheet.getCellByPosition(4, 5).setValue(15); - oSheet.getCellByPosition(5, 5).setValue(10); - oSheet.getCellByPosition(6, 5).setFormula("= E6 * F6"); - xCalculatableCells = new XCell[]{ - oSheet.getCellByPosition(4, 5), - oSheet.getCellByPosition(5, 5), - oSheet.getCellByPosition(6, 5) - }; - - // Make sure there are at least two sheets: - oSheets.insertNewByName("Some Sheet", (short) 1); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException( - "Error getting cell object from spreadsheet document", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException( - "Error getting cell object from spreadsheet document", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException( - "Error getting cell object from spreadsheet document", e); - } + log.println("Getting spreadsheet"); + + XSpreadsheets oSheets = xSpreadsheetDoc.getSheets(); + XIndexAccess oIndexSheets = UnoRuntime.queryInterface( + XIndexAccess.class, oSheets); + XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class), + oIndexSheets.getByIndex(0)); + + log.println("Getting a cell from sheet"); + toSel = oSheet.getCellByPosition(2, 3); + // create a simple formula for XCalculatable + oSheet.getCellByPosition(4, 5).setValue(15); + oSheet.getCellByPosition(5, 5).setValue(10); + oSheet.getCellByPosition(6, 5).setFormula("= E6 * F6"); + xCalculatableCells = new XCell[]{ + oSheet.getCellByPosition(4, 5), + oSheet.getCellByPosition(5, 5), + oSheet.getCellByPosition(6, 5) + }; + + // Make sure there are at least two sheets: + oSheets.insertNewByName("Some Sheet", (short) 1); log.println("Adding SelectionSupplier and Shape to select for XModel"); tEnv.addObjRelation("SELSUPP", sel); diff --git a/qadevOOo/tests/java/mod/_sc/ScNamedRangeObj.java b/qadevOOo/tests/java/mod/_sc/ScNamedRangeObj.java index cbf4ad5452f2..c9520cdcc811 100644 --- a/qadevOOo/tests/java/mod/_sc/ScNamedRangeObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScNamedRangeObj.java @@ -100,7 +100,7 @@ public class ScNamedRangeObj extends TestCase { * </ul> */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; @@ -113,16 +113,7 @@ public class ScNamedRangeObj extends TestCase { // Getting named ranges. XPropertySet docProps = UnoRuntime.queryInterface(XPropertySet.class, xSheetDoc); - Object ranges = null; - try { - ranges = docProps.getPropertyValue("NamedRanges"); - } catch(com.sun.star.lang.WrappedTargetException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get NamedRanges", e); - } catch(com.sun.star.beans.UnknownPropertyException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get NamedRanges", e); - } + Object ranges = docProps.getPropertyValue("NamedRanges"); XNamedRanges xNamedRanges = UnoRuntime.queryInterface(XNamedRanges.class, ranges); @@ -140,19 +131,8 @@ public class ScNamedRangeObj extends TestCase { CellAddress listOutputPosition = new CellAddress((short)0, 1, 1); xNamedRanges.outputList(listOutputPosition); - try { - oObj = (XInterface) AnyConverter.toObject( - new Type(XInterface.class),xNamedRanges.getByName("ANamedRange")); - } catch(com.sun.star.lang.WrappedTargetException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get by name", e); - } catch(com.sun.star.container.NoSuchElementException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get by name", e); - } catch(com.sun.star.lang.IllegalArgumentException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get by name", e); - } + oObj = (XInterface) AnyConverter.toObject( + new Type(XInterface.class),xNamedRanges.getByName("ANamedRange")); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_sc/ScNamedRangesObj.java b/qadevOOo/tests/java/mod/_sc/ScNamedRangesObj.java index 8198abbab250..14d1c596435a 100644 --- a/qadevOOo/tests/java/mod/_sc/ScNamedRangesObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScNamedRangesObj.java @@ -103,7 +103,7 @@ public class ScNamedRangesObj extends TestCase { * @see com.sun.star.sheet.NamedRanges */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; @@ -115,32 +115,12 @@ public class ScNamedRangesObj extends TestCase { log.println("Getting test object "); XSpreadsheets oSheets = xSheetDoc.getSheets(); XIndexAccess oIndexSheets = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); // Getting named ranges. XPropertySet docProps = UnoRuntime.queryInterface(XPropertySet.class, xSheetDoc); - Object ranges = null; - try { - ranges = docProps.getPropertyValue("NamedRanges"); - } catch(com.sun.star.lang.WrappedTargetException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get NamedRanges", e); - } catch(com.sun.star.beans.UnknownPropertyException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get NamedRanges", e); - } + Object ranges = docProps.getPropertyValue("NamedRanges"); XNamedRanges xNamedRanges = UnoRuntime.queryInterface(XNamedRanges.class, ranges); diff --git a/qadevOOo/tests/java/mod/_sc/ScRecentFunctionsObj.java b/qadevOOo/tests/java/mod/_sc/ScRecentFunctionsObj.java index b104297711d8..01567c353220 100644 --- a/qadevOOo/tests/java/mod/_sc/ScRecentFunctionsObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScRecentFunctionsObj.java @@ -87,7 +87,7 @@ public class ScRecentFunctionsObj extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log ) throws StatusException { + TestParameters Param, PrintWriter log ) throws Exception { XInterface oObj = null; XInterface allFunctions = null; @@ -96,20 +96,15 @@ public class ScRecentFunctionsObj extends TestCase { // first we write what we are intend to do to log file log.println( "Creating a test environment" ); - try { - log.println("Getting test object ") ; - XMultiServiceFactory oDocMSF = Param.getMSF(); - oObj = (XInterface)oDocMSF.createInstance( - "com.sun.star.sheet.RecentFunctions"); - allFunctions = (XInterface)oDocMSF.createInstance( - "com.sun.star.sheet.FunctionDescriptions"); - - log.println("Creating object - " + - ((oObj == null) ? "FAILED" : "OK")); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Couldn't create instance", e); - } + log.println("Getting test object ") ; + XMultiServiceFactory oDocMSF = Param.getMSF(); + oObj = (XInterface)oDocMSF.createInstance( + "com.sun.star.sheet.RecentFunctions"); + allFunctions = (XInterface)oDocMSF.createInstance( + "com.sun.star.sheet.FunctionDescriptions"); + + log.println("Creating object - " + + ((oObj == null) ? "FAILED" : "OK")); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_sc/ScScenariosObj.java b/qadevOOo/tests/java/mod/_sc/ScScenariosObj.java index c752ac7de622..89073bf2cacb 100644 --- a/qadevOOo/tests/java/mod/_sc/ScScenariosObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScScenariosObj.java @@ -105,36 +105,20 @@ public class ScScenariosObj extends TestCase { * @see com.sun.star.sheet.XScenariosSupplier */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { log.println("getting sheets"); XSpreadsheets xSpreadsheets = xSpreadsheetDoc.getSheets(); log.println("getting a sheet"); XSpreadsheet oSheet = null; XIndexAccess oIndexAccess = UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets); - try { - oSheet = (XSpreadsheet)AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } + oSheet = (XSpreadsheet)AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); log.println("filling some cells"); - try { - oSheet.getCellByPosition(5, 5).setValue(15); - oSheet.getCellByPosition(1, 4).setValue(10); - oSheet.getCellByPosition(2, 0).setValue(-5.15); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't fill some cell", e); - } + oSheet.getCellByPosition(5, 5).setValue(15); + oSheet.getCellByPosition(1, 4).setValue(10); + oSheet.getCellByPosition(2, 0).setValue(-5.15); XScenariosSupplier xSupp = UnoRuntime.queryInterface(XScenariosSupplier.class, oSheet); XCellRange oRange = UnoRuntime.queryInterface(XCellRange.class, oSheet); diff --git a/qadevOOo/tests/java/mod/_sc/ScSheetLinkObj.java b/qadevOOo/tests/java/mod/_sc/ScSheetLinkObj.java index e387bcf1ebf6..837fd558b31b 100644 --- a/qadevOOo/tests/java/mod/_sc/ScSheetLinkObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScSheetLinkObj.java @@ -106,7 +106,7 @@ public class ScSheetLinkObj extends TestCase { * @see com.sun.star.sheet.XSheetLinkable */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; @@ -118,19 +118,8 @@ public class ScSheetLinkObj extends TestCase { log.println("Getting test object ") ; XSpreadsheets oSheets = xSheetDoc.getSheets() ; XIndexAccess oIndexSheets = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get a spreadsheet", e); - } + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); XSheetLinkable SL = UnoRuntime.queryInterface(XSheetLinkable.class, oSheet); @@ -141,34 +130,14 @@ public class ScSheetLinkObj extends TestCase { // Getting links. XPropertySet docProps = UnoRuntime.queryInterface(XPropertySet.class, xSheetDoc); - Object oLinks = null; - try { - oLinks = docProps.getPropertyValue("SheetLinks"); - } catch(com.sun.star.lang.WrappedTargetException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get SheetLinks", e); - } catch(com.sun.star.beans.UnknownPropertyException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get SheetLinks", e); - } + Object oLinks = docProps.getPropertyValue("SheetLinks"); XNameAccess links = UnoRuntime.queryInterface(XNameAccess.class, oLinks); String[] names = links.getElementNames(); - try { - oObj = (XInterface)AnyConverter.toObject( - new Type(XInterface.class),links.getByName(names[0])); - } catch(com.sun.star.lang.WrappedTargetException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get by name", e); - } catch(com.sun.star.container.NoSuchElementException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get by name", e); - } catch(com.sun.star.lang.IllegalArgumentException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get by name", e); - } + oObj = (XInterface)AnyConverter.toObject( + new Type(XInterface.class),links.getByName(names[0])); log.println("Creating object - " + ((oObj == null) ? "FAILED" : "OK")); diff --git a/qadevOOo/tests/java/mod/_sc/ScSheetLinksObj.java b/qadevOOo/tests/java/mod/_sc/ScSheetLinksObj.java index b60b7ef69de8..0b4061236ab2 100644 --- a/qadevOOo/tests/java/mod/_sc/ScSheetLinksObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScSheetLinksObj.java @@ -94,7 +94,7 @@ public class ScSheetLinksObj extends TestCase { * @see com.sun.star.sheet.XSheetLinkable */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; @@ -106,19 +106,8 @@ public class ScSheetLinksObj extends TestCase { log.println("Getting test object ") ; XSpreadsheets oSheets = xSheetDoc.getSheets() ; XIndexAccess oIndexSheets = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get a spreadsheet", e); - } + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); XSheetLinkable SL = UnoRuntime.queryInterface(XSheetLinkable.class, oSheet); @@ -131,16 +120,7 @@ public class ScSheetLinksObj extends TestCase { // Getting links. XPropertySet docProps = UnoRuntime.queryInterface(XPropertySet.class, xSheetDoc); - Object links = null; - try { - links = docProps.getPropertyValue("SheetLinks"); - } catch(com.sun.star.lang.WrappedTargetException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get SheetLinks", e); - } catch(com.sun.star.beans.UnknownPropertyException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get SheetLinks", e); - } + Object links = docProps.getPropertyValue("SheetLinks"); oObj = UnoRuntime.queryInterface(XInterface.class, links); diff --git a/qadevOOo/tests/java/mod/_sc/ScSortDescriptorBase.java b/qadevOOo/tests/java/mod/_sc/ScSortDescriptorBase.java index 1ee6f3c4c7b4..b20f2b99081c 100644 --- a/qadevOOo/tests/java/mod/_sc/ScSortDescriptorBase.java +++ b/qadevOOo/tests/java/mod/_sc/ScSortDescriptorBase.java @@ -107,7 +107,7 @@ public class ScSortDescriptorBase extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters tParam, PrintWriter log ) - throws StatusException { + throws Exception { XInterface oObj = null; XSortable xSORT = null; @@ -125,11 +125,7 @@ public class ScSortDescriptorBase extends TestCase { log.println("getting a sheet"); XIndexAccess oIndexAccess = UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets); - try { - oObj = UnoRuntime.queryInterface(XInterface.class,oIndexAccess.getByIndex(0)); - } catch (Exception e) { - throw new StatusException( "Couldn't get a spreadsheet", e); - } + oObj = UnoRuntime.queryInterface(XInterface.class,oIndexAccess.getByIndex(0)); xSORT = UnoRuntime.queryInterface(XSortable.class,oObj); diff --git a/qadevOOo/tests/java/mod/_sc/ScSpreadsheetSettings.java b/qadevOOo/tests/java/mod/_sc/ScSpreadsheetSettings.java index 31001ecb595e..f98ad9f7f91b 100644 --- a/qadevOOo/tests/java/mod/_sc/ScSpreadsheetSettings.java +++ b/qadevOOo/tests/java/mod/_sc/ScSpreadsheetSettings.java @@ -20,7 +20,6 @@ package mod._sc; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -49,7 +48,7 @@ public class ScSpreadsheetSettings extends TestCase { */ @Override public TestEnvironment createTestEnvironment( - TestParameters tParam, PrintWriter log) throws StatusException { + TestParameters tParam, PrintWriter log) throws Exception { XInterface oObj = null; @@ -58,13 +57,8 @@ public class ScSpreadsheetSettings extends TestCase { log.println( "creating a test environment" ); // create testobject here - try { - oObj = (XInterface)tParam.getMSF(). - createInstance("com.sun.star.sheet.GlobalSheetSettings"); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create instance", e); - } + oObj = (XInterface)tParam.getMSF(). + createInstance("com.sun.star.sheet.GlobalSheetSettings"); TestEnvironment tEnv = new TestEnvironment(oObj); diff --git a/qadevOOo/tests/java/mod/_sc/ScStyleFamilyObj.java b/qadevOOo/tests/java/mod/_sc/ScStyleFamilyObj.java index 3a840213f7b2..1a211f90e3d2 100644 --- a/qadevOOo/tests/java/mod/_sc/ScStyleFamilyObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScStyleFamilyObj.java @@ -114,7 +114,7 @@ public class ScStyleFamilyObj extends TestCase { * @see com.sun.star.style.CellStyle */ @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { // creation of testobject here // first we write what we are intend to do to log file @@ -128,23 +128,9 @@ public class ScStyleFamilyObj extends TestCase { XNameAccess oStyleFamilies = oStyleFamiliesSupplier.getStyleFamilies(); XIndexAccess oStyleFamiliesIndexAccess = UnoRuntime.queryInterface(XIndexAccess.class, oStyleFamilies); - try { - oStyleFamilyNameAccess = (XNameAccess) AnyConverter.toObject( - new Type(XNameAccess.class), - oStyleFamiliesIndexAccess.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException( - "Exception occurred while getting StyleFamily", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException( - "Exception occurred while getting StyleFamily", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException( - "Exception occurred while getting StyleFamily", e); - } + oStyleFamilyNameAccess = (XNameAccess) AnyConverter.toObject( + new Type(XNameAccess.class), + oStyleFamiliesIndexAccess.getByIndex(0)); SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); XComponent xComp = UnoRuntime.queryInterface(XComponent.class, xSpreadsheetDoc); @@ -155,18 +141,7 @@ public class ScStyleFamilyObj extends TestCase { // insert a Style which can be replaced by name XNameContainer oContainer = UnoRuntime.queryInterface( XNameContainer.class, oStyleFamilyNameAccess); - try { - oContainer.insertByName("ScStyleFamilyObj", oInstance); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't insert new style family", e); - } catch (com.sun.star.container.ElementExistException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't insert new style family", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't insert new style family", e); - } + oContainer.insertByName("ScStyleFamilyObj", oInstance); TestEnvironment tEnv = new TestEnvironment(oStyleFamilyNameAccess); diff --git a/qadevOOo/tests/java/mod/_sc/ScStyleObj.java b/qadevOOo/tests/java/mod/_sc/ScStyleObj.java index 7eec09faf274..37a063b9f781 100644 --- a/qadevOOo/tests/java/mod/_sc/ScStyleObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScStyleObj.java @@ -116,7 +116,7 @@ public class ScStyleObj extends TestCase { * @see com.sun.star.style.XStyleFamiliesSupplier */ @Override - protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { // creation of the testobject here @@ -131,63 +131,32 @@ public class ScStyleObj extends TestCase { XIndexAccess oStyleFamiliesIndexAccess = UnoRuntime.queryInterface(XIndexAccess.class, oStyleFamilies); XNameAccess oStyleFamilyNameAccess = null; XStyle oStyle = null; - try { - oStyleFamilyNameAccess = (XNameAccess) AnyConverter.toObject( - new Type(XNameAccess.class), - oStyleFamiliesIndexAccess.getByIndex(0)); + oStyleFamilyNameAccess = (XNameAccess) AnyConverter.toObject( + new Type(XNameAccess.class), + oStyleFamiliesIndexAccess.getByIndex(0)); - XIndexAccess oStyleFamilyIndexAccess = UnoRuntime.queryInterface(XIndexAccess.class, - oStyleFamilyNameAccess); - oStyle = (XStyle) AnyConverter.toObject( - new Type(XStyle.class),oStyleFamilyIndexAccess.getByIndex(0)); - } catch(com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get by index", e); - } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get by index", e); - } catch(com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get by index", e); - } + XIndexAccess oStyleFamilyIndexAccess = UnoRuntime.queryInterface(XIndexAccess.class, + oStyleFamilyNameAccess); + oStyle = (XStyle) AnyConverter.toObject( + new Type(XStyle.class),oStyleFamilyIndexAccess.getByIndex(0)); log.println("Creating a user-defined style"); XMultiServiceFactory oMSF = UnoRuntime.queryInterface( XMultiServiceFactory.class, xSpreadsheetDoc); - XInterface oInt = null; - try { - oInt = (XInterface) + XInterface oInt = (XInterface) oMSF.createInstance("com.sun.star.style.CellStyle"); - } catch(com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create instance", e); - } XStyle oMyStyle = UnoRuntime.queryInterface(XStyle.class, oInt); XNameContainer oStyleFamilyNameContainer = UnoRuntime. queryInterface(XNameContainer.class, oStyleFamilyNameAccess); - try { - if (oStyleFamilyNameContainer.hasByName("My Style")) { - oStyleFamilyNameContainer.removeByName("My Style"); - } - - oStyleFamilyNameContainer.insertByName("My Style", oMyStyle); - } catch(com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create test environment", e); - } catch(com.sun.star.container.NoSuchElementException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create test environment", e); - } catch(com.sun.star.container.ElementExistException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create test environment", e); - } catch(com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create test environment", e); + if (oStyleFamilyNameContainer.hasByName("My Style")) { + oStyleFamilyNameContainer.removeByName("My Style"); } + oStyleFamilyNameContainer.insertByName("My Style", oMyStyle); + //using the style log.println("Getting spreadsheet") ; @@ -195,39 +164,14 @@ public class ScStyleObj extends TestCase { XIndexAccess oIndexSheets = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); XCell aCell = null; - try { - XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); - log.println("Getting a cell from sheet") ; - aCell = oSheet.getCellByPosition(2,3) ; - } catch(com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get spreadsheet by index", e); - } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get spreadsheet by index", e); - } catch(com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get spreadsheet by index", e); - } + XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); + log.println("Getting a cell from sheet") ; + aCell = oSheet.getCellByPosition(2,3) ; XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class, aCell); - try { - xProp.setPropertyValue("CellStyle", oMyStyle.getName()); - } catch(com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't set property CellStyle", e); - } catch(com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't set property CellStyle", e); - } catch(com.sun.star.beans.PropertyVetoException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't set property CellStyle", e); - } catch(com.sun.star.beans.UnknownPropertyException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't set property CellStyle", e); - } + xProp.setPropertyValue("CellStyle", oMyStyle.getName()); log.println("creating a new environment for object"); TestEnvironment tEnv = new TestEnvironment(oMyStyle); diff --git a/qadevOOo/tests/java/mod/_sc/ScSubTotalDescriptorBase.java b/qadevOOo/tests/java/mod/_sc/ScSubTotalDescriptorBase.java index d4b0dc7cffab..cbd559dbaf7b 100644 --- a/qadevOOo/tests/java/mod/_sc/ScSubTotalDescriptorBase.java +++ b/qadevOOo/tests/java/mod/_sc/ScSubTotalDescriptorBase.java @@ -101,27 +101,15 @@ public class ScSubTotalDescriptorBase extends TestCase { * @see com.sun.star.sheet.SubTotalDescriptor */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { log.println("getting sheets"); XSpreadsheets xSpreadsheets = xSpreadsheetDoc.getSheets(); log.println("getting a sheet"); - XSpreadsheet oSheet = null; XIndexAccess oIndexAccess = UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets); - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } + XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); XSubTotalCalculatable xSTC = UnoRuntime.queryInterface(XSubTotalCalculatable.class, oSheet); diff --git a/qadevOOo/tests/java/mod/_sc/ScSubTotalFieldObj.java b/qadevOOo/tests/java/mod/_sc/ScSubTotalFieldObj.java index 5add5e5a624c..3dc015266ad7 100644 --- a/qadevOOo/tests/java/mod/_sc/ScSubTotalFieldObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScSubTotalFieldObj.java @@ -98,7 +98,7 @@ public class ScSubTotalFieldObj extends TestCase { * @see com.sun.star.sheet.SubTotalField */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { log.println("getting sheets"); XSpreadsheets xSpreadsheets = xSpreadsheetDoc.getSheets(); @@ -106,19 +106,8 @@ public class ScSubTotalFieldObj extends TestCase { log.println("getting a sheet"); XSpreadsheet oSheet = null; XIndexAccess oIndexAccess = UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets); - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type (XSpreadsheet.class),oIndexAccess.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type (XSpreadsheet.class),oIndexAccess.getByIndex(0)); XSubTotalCalculatable xSTC = UnoRuntime.queryInterface(XSubTotalCalculatable.class, oSheet); @@ -135,19 +124,8 @@ public class ScSubTotalFieldObj extends TestCase { XInterface oObj = null; - try { - oObj = ( XSubTotalField ) AnyConverter.toObject( - new Type(XSubTotalField.class),oDescIndex.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get XSubTotalField", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get XSubTotalField", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get XSubTotalField", e); - } + oObj = ( XSubTotalField ) AnyConverter.toObject( + new Type(XSubTotalField.class),oDescIndex.getByIndex(0)); TestEnvironment tEnv = new TestEnvironment(oObj); return tEnv; diff --git a/qadevOOo/tests/java/mod/_sc/ScTabViewObj.java b/qadevOOo/tests/java/mod/_sc/ScTabViewObj.java index 6236b2f7ed55..6a1d9de2a3e4 100644 --- a/qadevOOo/tests/java/mod/_sc/ScTabViewObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScTabViewObj.java @@ -134,7 +134,7 @@ public class ScTabViewObj extends TestCase { * @see com.sun.star.sheet.SpreadsheetView */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XDrawPage oDrawPage = null; XModel aModel = UnoRuntime.queryInterface(XModel.class, xSpreadsheetDoc); @@ -149,19 +149,8 @@ public class ScTabViewObj extends TestCase { log.println("getting a sheet"); XSpreadsheet oSheet = null; XIndexAccess oIndexAccess = UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets); - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class), oIndexAccess.getByIndex(1)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class), oIndexAccess.getByIndex(1)); TestEnvironment tEnv = new TestEnvironment(oObj); @@ -180,16 +169,11 @@ public class ScTabViewObj extends TestCase { XCell cell_1 = null; XCell cell_2 = null; Object cellRange = null; - try { - cellRange = oSheet.getCellRangeByPosition(0, 0, 3, 3); - cell_1 = oSheet.getCellByPosition(5,5); - cell_2 = oSheet.getCellByPosition(7,7); - cell_2.setValue(17.5); - cell_1.setValue(5.5); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get some cell", e); - } + cellRange = oSheet.getCellRangeByPosition(0, 0, 3, 3); + cell_1 = oSheet.getCellByPosition(5,5); + cell_2 = oSheet.getCellByPosition(7,7); + cell_2.setValue(17.5); + cell_1.setValue(5.5); Object[] selections = {oSheet, cellRange, cell_1, cell_2}; tEnv.addObjRelation("Selections", selections); @@ -211,17 +195,10 @@ public class ScTabViewObj extends TestCase { XForm myForm = null; String kindOfControl="CommandButton"; XShape aShape = null; - try{ - log.println("adding contol shape '" + kindOfControl + "'"); - XComponent oComp = UnoRuntime.queryInterface(XComponent.class, xSpreadsheetDoc) ; - - aShape = FormTools.createControlShape(oComp, 3000, 4500, 15000, 10000, kindOfControl); + log.println("adding contol shape '" + kindOfControl + "'"); + XComponent oComp = UnoRuntime.queryInterface(XComponent.class, xSpreadsheetDoc) ; - } catch (Exception e){ - e.printStackTrace(log); - throw new StatusException("Couldn't create following control shape : '" + - kindOfControl + "': ", e); - } + aShape = FormTools.createControlShape(oComp, 3000, 4500, 15000, 10000, kindOfControl); log.println("adding relation for com.sun.star.view.XFormLayerAccess: XForm"); try { diff --git a/qadevOOo/tests/java/mod/_sc/ScTableColumnObj.java b/qadevOOo/tests/java/mod/_sc/ScTableColumnObj.java index 54852919a82d..a9cea311a0ee 100644 --- a/qadevOOo/tests/java/mod/_sc/ScTableColumnObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScTableColumnObj.java @@ -106,7 +106,7 @@ public class ScTableColumnObj extends TestCase { * @see com.sun.star.table.TableColumn */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; @@ -118,37 +118,15 @@ public class ScTableColumnObj extends TestCase { XSpreadsheets xSpreadsheets = xSheetDoc.getSheets(); XNameAccess oNames = UnoRuntime.queryInterface( XNameAccess.class, xSpreadsheets ); - try { - xSpreadsheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class), - oNames.getByName(oNames.getElementNames()[0])); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get element by name", e); - } catch (com.sun.star.container.NoSuchElementException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get element by name", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get element by name", e); - } + xSpreadsheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class), + oNames.getByName(oNames.getElementNames()[0])); XColumnRowRange oColumnRowRange = UnoRuntime.queryInterface(XColumnRowRange.class, xSpreadsheet); XTableColumns oColumns = oColumnRowRange.getColumns(); XIndexAccess oIndexAccess = UnoRuntime.queryInterface(XIndexAccess.class, oColumns); - try { - oObj = (XInterface) AnyConverter.toObject( - new Type(XInterface.class),oIndexAccess.getByIndex(10)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get by index", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get by index", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get by index", e); - } + oObj = (XInterface) AnyConverter.toObject( + new Type(XInterface.class),oIndexAccess.getByIndex(10)); log.println("creating a new environment for object"); TestEnvironment tEnv = new TestEnvironment(oObj); diff --git a/qadevOOo/tests/java/mod/_sc/ScTableColumnsObj.java b/qadevOOo/tests/java/mod/_sc/ScTableColumnsObj.java index cabc51d9de0f..2cd29cda50d2 100644 --- a/qadevOOo/tests/java/mod/_sc/ScTableColumnsObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScTableColumnsObj.java @@ -93,14 +93,14 @@ public class ScTableColumnsObj extends TestCase { /** * Creating a TestEnvironment for the interfaces to be tested. * Retrieves a collection of spreadsheets from the document and takes one of - * them. Obtaines the collection of columns in the range using the interface + * them. Obtains the collection of columns in the range using the interface * <code>XColumnRowRange</code>. This collection is the instance of the * service <code>com.sun.star.table.TableColumns</code>. * @see com.sun.star.table.XColumnRowRange * @see com.sun.star.table.TableColumns */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; @@ -111,21 +111,9 @@ public class ScTableColumnsObj extends TestCase { log.println("getting column"); XSpreadsheets xSpreadsheets = xSheetDoc.getSheets(); XNameAccess oNames = UnoRuntime.queryInterface( XNameAccess.class, xSpreadsheets ); - XSpreadsheet xSpreadsheet = null; - try { - xSpreadsheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class), - oNames.getByName(oNames.getElementNames()[0])); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get spreadsheet", e); - } catch (com.sun.star.container.NoSuchElementException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get spreadsheet", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get spreadsheet", e); - } + XSpreadsheet xSpreadsheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class), + oNames.getByName(oNames.getElementNames()[0])); XColumnRowRange oColumnRowRange = UnoRuntime.queryInterface(XColumnRowRange.class, xSpreadsheet); XTableColumns oColumns = oColumnRowRange.getColumns(); diff --git a/qadevOOo/tests/java/mod/_sc/ScTableConditionalEntry.java b/qadevOOo/tests/java/mod/_sc/ScTableConditionalEntry.java index d2bea889dc5d..97dbbe66f9e1 100644 --- a/qadevOOo/tests/java/mod/_sc/ScTableConditionalEntry.java +++ b/qadevOOo/tests/java/mod/_sc/ScTableConditionalEntry.java @@ -102,7 +102,7 @@ public class ScTableConditionalEntry extends TestCase { * @see com.sun.star.sheet.TableConditionalEntry */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; log.println("getting sheets"); @@ -112,19 +112,8 @@ public class ScTableConditionalEntry extends TestCase { XSpreadsheet oSheet = null; XIndexAccess oIndexAccess = UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets); - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); log.println("filling some cells"); try { @@ -139,47 +128,17 @@ public class ScTableConditionalEntry extends TestCase { Object CFormat = null; XPropertySet Props = null; - try { - Props = UnoRuntime.queryInterface(XPropertySet.class, oSheet); - CFormat = Props.getPropertyValue("ConditionalFormat"); - if (utils.isVoid(CFormat)) { - log.println("Property 'ConditionalFormat' is void"); - } - } catch (com.sun.star.lang.WrappedTargetException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't create instance", e); - } catch (com.sun.star.beans.UnknownPropertyException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't create instance", e); + Props = UnoRuntime.queryInterface(XPropertySet.class, oSheet); + CFormat = Props.getPropertyValue("ConditionalFormat"); + if (utils.isVoid(CFormat)) { + log.println("Property 'ConditionalFormat' is void"); } - try { - XSheetConditionalEntries xSCE = UnoRuntime.queryInterface(XSheetConditionalEntries.class, CFormat); - xSCE.addNew(Conditions()); - Props.setPropertyValue("ConditionalFormat", xSCE); - oObj = (XSheetConditionalEntry) AnyConverter.toObject( - new Type(XSheetConditionalEntry.class),xSCE.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException( - "Exception occurred while getting Entry", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException( - "Exception occurred while getting Entry", e); - } catch (com.sun.star.beans.PropertyVetoException e) { - e.printStackTrace(log); - throw new StatusException( - "Exception occurred while getting Entry", e); - } catch (com.sun.star.beans.UnknownPropertyException e) { - e.printStackTrace(log); - throw new StatusException( - "Exception occurred while getting Entry", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException( - "Exception occurred while getting Entry", e); - } + XSheetConditionalEntries xSCE = UnoRuntime.queryInterface(XSheetConditionalEntries.class, CFormat); + xSCE.addNew(Conditions()); + Props.setPropertyValue("ConditionalFormat", xSCE); + oObj = (XSheetConditionalEntry) AnyConverter.toObject( + new Type(XSheetConditionalEntry.class),xSCE.getByIndex(0)); log.println("creating a new environment for object"); TestEnvironment tEnv = new TestEnvironment(oObj); diff --git a/qadevOOo/tests/java/mod/_sc/ScTableConditionalFormat.java b/qadevOOo/tests/java/mod/_sc/ScTableConditionalFormat.java index a86c6b87518d..39fe491b0fa3 100644 --- a/qadevOOo/tests/java/mod/_sc/ScTableConditionalFormat.java +++ b/qadevOOo/tests/java/mod/_sc/ScTableConditionalFormat.java @@ -105,7 +105,7 @@ public class ScTableConditionalFormat extends TestCase { * @see com.sun.star.sheet.TableConditionalFormat */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; @@ -115,19 +115,8 @@ public class ScTableConditionalFormat extends TestCase { log.println("getting a sheet"); XSpreadsheet oSheet = null; XIndexAccess oIndexAccess = UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets); - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); log.println("filling some cells"); try { @@ -140,20 +129,9 @@ public class ScTableConditionalFormat extends TestCase { } XPropertySet Props = UnoRuntime.queryInterface(XPropertySet.class, oSheet); - try { - oObj = (XInterface) AnyConverter.toObject( - new Type(XInterface.class), - Props.getPropertyValue("ConditionalFormat")); - } catch(com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get ConditionalFromat", e); - } catch(com.sun.star.beans.UnknownPropertyException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get ConditionalFromat", e); - } catch(com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get ConditionalFromat", e); - } + oObj = (XInterface) AnyConverter.toObject( + new Type(XInterface.class), + Props.getPropertyValue("ConditionalFormat")); XSheetConditionalEntries xSCE = UnoRuntime.queryInterface(XSheetConditionalEntries.class, oObj); xSCE.addNew(Conditions(5)); diff --git a/qadevOOo/tests/java/mod/_sc/ScTableRowObj.java b/qadevOOo/tests/java/mod/_sc/ScTableRowObj.java index ca2055ec94f7..4121f6433a90 100644 --- a/qadevOOo/tests/java/mod/_sc/ScTableRowObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScTableRowObj.java @@ -102,7 +102,7 @@ public class ScTableRowObj extends TestCase { * @see com.sun.star.table.TableRow */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; @@ -113,33 +113,15 @@ public class ScTableRowObj extends TestCase { XSpreadsheet xSpreadsheet = null; XSpreadsheets xSpreadsheets = xSheetDoc.getSheets(); XNameAccess oNames = UnoRuntime.queryInterface( XNameAccess.class, xSpreadsheets ); - try { - xSpreadsheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class), - oNames.getByName(oNames.getElementNames()[0])); + xSpreadsheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class), + oNames.getByName(oNames.getElementNames()[0])); - XColumnRowRange oColumnRowRange = UnoRuntime.queryInterface(XColumnRowRange.class, xSpreadsheet); - XTableRows oRows = oColumnRowRange.getRows(); - XIndexAccess oIndexAccess = UnoRuntime.queryInterface(XIndexAccess.class, oRows); - oObj = (XInterface) AnyConverter.toObject( - new Type(XInterface.class),oIndexAccess.getByIndex(6)); - } catch(com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException( - "Exception during creating TestEnvironment", e); - } catch(com.sun.star.container.NoSuchElementException e) { - e.printStackTrace(log); - throw new StatusException( - "Exception during creating TestEnvironment", e); - } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException( - "Exception during creating TestEnvironment", e); - } catch(com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException( - "Exception during creating TestEnvironment", e); - } + XColumnRowRange oColumnRowRange = UnoRuntime.queryInterface(XColumnRowRange.class, xSpreadsheet); + XTableRows oRows = oColumnRowRange.getRows(); + XIndexAccess oIndexAccess = UnoRuntime.queryInterface(XIndexAccess.class, oRows); + oObj = (XInterface) AnyConverter.toObject( + new Type(XInterface.class),oIndexAccess.getByIndex(6)); log.println("creating a new environment for object"); TestEnvironment tEnv = new TestEnvironment(oObj); diff --git a/qadevOOo/tests/java/mod/_sc/ScTableRowsObj.java b/qadevOOo/tests/java/mod/_sc/ScTableRowsObj.java index da3da095caf9..b34dda729191 100644 --- a/qadevOOo/tests/java/mod/_sc/ScTableRowsObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScTableRowsObj.java @@ -96,7 +96,7 @@ public class ScTableRowsObj extends TestCase { * @see com.sun.star.table.TableRows */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; @@ -105,20 +105,9 @@ public class ScTableRowsObj extends TestCase { XSpreadsheets xSpreadsheets = xSheetDoc.getSheets(); XNameAccess oNames = UnoRuntime.queryInterface( XNameAccess.class, xSpreadsheets ); - try { - xSpreadsheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class), - oNames.getByName(oNames.getElementNames()[0])); - } catch(com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get spreadsheet", e); - } catch(com.sun.star.container.NoSuchElementException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get spreadsheet", e); - } catch(com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get spreadsheet", e); - } + xSpreadsheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class), + oNames.getByName(oNames.getElementNames()[0])); XColumnRowRange oColumnRowRange = UnoRuntime.queryInterface(XColumnRowRange.class, xSpreadsheet); diff --git a/qadevOOo/tests/java/mod/_sc/ScTableSheetObj.java b/qadevOOo/tests/java/mod/_sc/ScTableSheetObj.java index 201916449b45..e0d74765f0d6 100644 --- a/qadevOOo/tests/java/mod/_sc/ScTableSheetObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScTableSheetObj.java @@ -180,7 +180,7 @@ public class ScTableSheetObj extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; log.println("getting sheets"); @@ -193,37 +193,21 @@ public class ScTableSheetObj extends TestCase { XIndexAccess oIndexAccess = UnoRuntime.queryInterface( XIndexAccess.class, xSpreadsheets); - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class), - oIndexAccess.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get a spreadsheet", e); - } + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class), + oIndexAccess.getByIndex(0)); log.println("filling some cells"); - try { - oSheet.getCellByPosition(5, 5).setValue(15); - oSheet.getCellByPosition(1, 4).setValue(10); - oSheet.getCellByPosition(2, 0).setValue(-5.15); - oSheet.getCellByPosition(8, 8).setFormula("= B5 + C1"); - // fill cells for XSheetOtline::autoutline - oSheet.getCellByPosition(6, 6).setValue(3); - oSheet.getCellByPosition(7, 6).setValue(3); - oSheet.getCellByPosition(8, 6).setFormula("= SUM(G7:H7)"); - oSheet.getCellByPosition(9, 6).setFormula("= G7*I7"); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException("Exception occurred while filling cells", e); - } + oSheet.getCellByPosition(5, 5).setValue(15); + oSheet.getCellByPosition(1, 4).setValue(10); + oSheet.getCellByPosition(2, 0).setValue(-5.15); + oSheet.getCellByPosition(8, 8).setFormula("= B5 + C1"); + // fill cells for XSheetOtline::autoutline + oSheet.getCellByPosition(6, 6).setValue(3); + oSheet.getCellByPosition(7, 6).setValue(3); + oSheet.getCellByPosition(8, 6).setFormula("= SUM(G7:H7)"); + oSheet.getCellByPosition(9, 6).setFormula("= G7*I7"); oObj = UnoRuntime.queryInterface(XInterface.class, oSheet); diff --git a/qadevOOo/tests/java/mod/_sc/ScTableValidationObj.java b/qadevOOo/tests/java/mod/_sc/ScTableValidationObj.java index a4567d80fcdd..3e1c0eb38729 100644 --- a/qadevOOo/tests/java/mod/_sc/ScTableValidationObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScTableValidationObj.java @@ -93,7 +93,7 @@ public class ScTableValidationObj extends TestCase { * @see com.sun.star.sheet.TableValidation */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; @@ -103,47 +103,19 @@ public class ScTableValidationObj extends TestCase { log.println("getting a sheet"); XSpreadsheet oSheet = null; XIndexAccess oIndexAccess = UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets); - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException( "Couldn't get a spreadsheet", e); - } + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); log.println("filling some cells"); - try { - oSheet.getCellByPosition(5, 5).setValue(15); - oSheet.getCellByPosition(1, 4).setValue(10); - oSheet.getCellByPosition(2, 0).setValue(-5.15); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException( - "Exception occurred while filling cells", e); - } + oSheet.getCellByPosition(5, 5).setValue(15); + oSheet.getCellByPosition(1, 4).setValue(10); + oSheet.getCellByPosition(2, 0).setValue(-5.15); XPropertySet Props = null; - try { - Props = UnoRuntime.queryInterface(XPropertySet.class, oSheet); - oObj = (XInterface) AnyConverter.toObject( - new Type(XInterface.class),Props.getPropertyValue("Validation")); - } catch (com.sun.star.lang.WrappedTargetException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get property 'Validation'", e); - } catch (com.sun.star.beans.UnknownPropertyException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get property 'Validation'", e); - } catch (com.sun.star.lang.IllegalArgumentException e){ - e.printStackTrace(log); - throw new StatusException("Couldn't get property 'Validation'", e); - } + Props = UnoRuntime.queryInterface(XPropertySet.class, oSheet); + oObj = (XInterface) AnyConverter.toObject( + new Type(XInterface.class),Props.getPropertyValue("Validation")); log.println("creating a new environment for object"); TestEnvironment tEnv = new TestEnvironment(oObj); diff --git a/qadevOOo/tests/java/mod/_sc/ScUniqueCellFormatsEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScUniqueCellFormatsEnumeration.java index bc656322b9aa..49164287ab31 100644 --- a/qadevOOo/tests/java/mod/_sc/ScUniqueCellFormatsEnumeration.java +++ b/qadevOOo/tests/java/mod/_sc/ScUniqueCellFormatsEnumeration.java @@ -72,22 +72,14 @@ public class ScUniqueCellFormatsEnumeration extends TestCase { @Override protected TestEnvironment createTestEnvironment(TestParameters tParam, - PrintWriter log) { + PrintWriter log) throws Exception { log.println("Getting the first sheet"); XIndexAccess xIA = UnoRuntime.queryInterface( XIndexAccess.class, xSheetDoc.getSheets()); - try { - oSheet = UnoRuntime.queryInterface( - XSpreadsheet.class, xIA.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get a spreadsheet", e); - } + oSheet = UnoRuntime.queryInterface( + XSpreadsheet.class, xIA.getByIndex(0)); changeColor("A1:A5", 0, 255, 0); changeColor("A6:B10", 255, 0, 0); diff --git a/qadevOOo/tests/java/mod/_sc/ScUniqueCellFormatsObj.java b/qadevOOo/tests/java/mod/_sc/ScUniqueCellFormatsObj.java index 94a27645c078..713ea5e66ce3 100644 --- a/qadevOOo/tests/java/mod/_sc/ScUniqueCellFormatsObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScUniqueCellFormatsObj.java @@ -71,22 +71,14 @@ public class ScUniqueCellFormatsObj extends TestCase { @Override protected TestEnvironment createTestEnvironment(TestParameters tParam, - PrintWriter log) { + PrintWriter log) throws Exception { log.println("Getting the first sheet"); XIndexAccess xIA = UnoRuntime.queryInterface( XIndexAccess.class, xSheetDoc.getSheets()); - try { - oSheet = UnoRuntime.queryInterface( - XSpreadsheet.class, xIA.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get a spreadsheet", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get a spreadsheet", e); - } + oSheet = UnoRuntime.queryInterface( + XSpreadsheet.class, xIA.getByIndex(0)); changeColor("A1:A5", 0, 255, 0); changeColor("A6:B10", 255, 0, 0); diff --git a/qadevOOo/tests/java/mod/_sc/ScViewPaneObj.java b/qadevOOo/tests/java/mod/_sc/ScViewPaneObj.java index ede7ab68c1e5..643e6fb384d8 100644 --- a/qadevOOo/tests/java/mod/_sc/ScViewPaneObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScViewPaneObj.java @@ -95,7 +95,7 @@ public class ScViewPaneObj extends TestCase { /** * Creating a TestEnvironment for the interfaces to be tested. - * Retieves the current controller of the spreadsheet document using the + * Retrieves the current controller of the spreadsheet document using the * interface <code>XModel</code>. The controller contains the collection * of the view panes so retrieves the view pane with index 0 from * the collection. The retrieved view pane is the instance of the service @@ -109,25 +109,14 @@ public class ScViewPaneObj extends TestCase { * @see com.sun.star.frame.XModel */ @Override - protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XDrawPage oDrawPage; XModel xm = UnoRuntime.queryInterface(XModel.class, xSpreadsheetDoc); XController xc = xm.getCurrentController(); XIndexAccess xIA = UnoRuntime.queryInterface(XIndexAccess.class, xc); - try { - oObj = (XInterface) AnyConverter.toObject( - new Type(XInterface.class),xIA.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get by index", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get by index", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get by index", e); - } + oObj = (XInterface) AnyConverter.toObject( + new Type(XInterface.class),xIA.getByIndex(0)); TestEnvironment tEnv = new TestEnvironment(oObj); @@ -145,17 +134,10 @@ public class ScViewPaneObj extends TestCase { XForm myForm = null; String kindOfControl="CommandButton"; XShape aShape = null; - try{ - log.println("adding contol shape '" + kindOfControl + "'"); - XComponent oComp = UnoRuntime.queryInterface(XComponent.class, xSpreadsheetDoc) ; + log.println("adding contol shape '" + kindOfControl + "'"); + XComponent oComp = UnoRuntime.queryInterface(XComponent.class, xSpreadsheetDoc) ; - aShape = FormTools.createControlShape(oComp, 3000, 4500, 15000, 10000, kindOfControl); - - } catch (Exception e){ - e.printStackTrace(log); - throw new StatusException("Couldn't create following control shape : '" + - kindOfControl + "': ", e); - } + aShape = FormTools.createControlShape(oComp, 3000, 4500, 15000, 10000, kindOfControl); try { log.println( "getting Drawpages" ); diff --git a/qadevOOo/tests/java/mod/_sc/XMLContentExporter.java b/qadevOOo/tests/java/mod/_sc/XMLContentExporter.java index 359ab4cc9d30..159d0a9d4ac3 100644 --- a/qadevOOo/tests/java/mod/_sc/XMLContentExporter.java +++ b/qadevOOo/tests/java/mod/_sc/XMLContentExporter.java @@ -114,7 +114,7 @@ public class XMLContentExporter extends TestCase { * </ul> */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF() ; XInterface oObj = null; @@ -123,33 +123,24 @@ public class XMLContentExporter extends TestCase { ContentFilterChecker Filter = new ContentFilterChecker(log); Any arg = new Any(new Type(XDocumentHandler.class), Filter); - try { - oObj = (XInterface) xMSF.createInstanceWithArguments( - "com.sun.star.comp.Calc.XMLContentExporter", - new Object[] {arg} ); - XExporter xEx = UnoRuntime.queryInterface - (XExporter.class,oObj); - xEx.setSourceDocument(xSheetDoc); - - // Setting some string to a cell - XSpreadsheetDocument xSpreadsheetDoc = UnoRuntime.queryInterface(XSpreadsheetDocument.class, xSheetDoc); - XSpreadsheets xSpreadsheets = xSpreadsheetDoc.getSheets(); - XIndexAccess xSheetsIndexArray = UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets); - XSpreadsheet xSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),xSheetsIndexArray.getByIndex(0)); - XCell xCell = xSheet.getCellByPosition(0, 0); - xCell.setFormula(CELL_TEXT); - - log.println("fill sheet 1 with contnet..."); - util.CalcTools.fillCalcSheetWithContent(xSheetDoc, 1, 1, 1, 5, 5); - - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } catch (java.lang.Exception e) { - e.printStackTrace(log); - throw new StatusException("Can't create environment.", e); - } + oObj = (XInterface) xMSF.createInstanceWithArguments( + "com.sun.star.comp.Calc.XMLContentExporter", + new Object[] {arg} ); + XExporter xEx = UnoRuntime.queryInterface + (XExporter.class,oObj); + xEx.setSourceDocument(xSheetDoc); + + // Setting some string to a cell + XSpreadsheetDocument xSpreadsheetDoc = UnoRuntime.queryInterface(XSpreadsheetDocument.class, xSheetDoc); + XSpreadsheets xSpreadsheets = xSpreadsheetDoc.getSheets(); + XIndexAccess xSheetsIndexArray = UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets); + XSpreadsheet xSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),xSheetsIndexArray.getByIndex(0)); + XCell xCell = xSheet.getCellByPosition(0, 0); + xCell.setFormula(CELL_TEXT); + + log.println("fill sheet 1 with contnet..."); + util.CalcTools.fillCalcSheetWithContent(xSheetDoc, 1, 1, 1, 5, 5); // adding tags which must be contained in XML output Filter.addTag("office:document-content"); diff --git a/qadevOOo/tests/java/mod/_sc/XMLContentImporter.java b/qadevOOo/tests/java/mod/_sc/XMLContentImporter.java index 5d80f728c5a3..d15369925913 100644 --- a/qadevOOo/tests/java/mod/_sc/XMLContentImporter.java +++ b/qadevOOo/tests/java/mod/_sc/XMLContentImporter.java @@ -115,7 +115,7 @@ public class XMLContentImporter extends TestCase { @Override public synchronized TestEnvironment createTestEnvironment( TestParameters tParam, PrintWriter log ) - throws StatusException { + throws Exception { XInterface oObj = null; Object oInt = null ; @@ -126,16 +126,11 @@ public class XMLContentImporter extends TestCase { XMultiServiceFactory xMSF = tParam.getMSF() ; - try { - oInt = xMSF.createInstance - ("com.sun.star.comp.Calc.XMLContentImporter") ; - XImporter imp = UnoRuntime.queryInterface - (XImporter.class, oInt) ; - imp.setTargetDocument(comp); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oInt = xMSF.createInstance + ("com.sun.star.comp.Calc.XMLContentImporter") ; + XImporter imp = UnoRuntime.queryInterface + (XImporter.class, oInt) ; + imp.setTargetDocument(comp); oObj = (XInterface) oInt ; diff --git a/qadevOOo/tests/java/mod/_sc/XMLExporter.java b/qadevOOo/tests/java/mod/_sc/XMLExporter.java index b65fd17c40fb..f0618c3289c1 100644 --- a/qadevOOo/tests/java/mod/_sc/XMLExporter.java +++ b/qadevOOo/tests/java/mod/_sc/XMLExporter.java @@ -113,7 +113,7 @@ public class XMLExporter extends TestCase { * </ul> */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF() ; XInterface oObj = null; @@ -121,32 +121,23 @@ public class XMLExporter extends TestCase { Any arg = new Any(new Type(XDocumentHandler.class), Filter); final String SHEET_NAME = "XMLExporter_SheetTestName"; - try { - oObj = (XInterface) xMSF.createInstanceWithArguments( - "com.sun.star.comp.Calc.XMLExporter", new Object[] {arg} ); - XExporter xEx = UnoRuntime.queryInterface - (XExporter.class,oObj); - xEx.setSourceDocument(xSheetDoc); - - //set name of sheet - XSpreadsheetDocument xSpreadsheetDoc = UnoRuntime.queryInterface(XSpreadsheetDocument.class, xSheetDoc); - XSpreadsheets xSpreadsheets = xSpreadsheetDoc.getSheets(); - XIndexAccess xSheetsIndexArray = UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets); - XSpreadsheet xSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),xSheetsIndexArray.getByIndex(0)); - XNamed xSheetNamed = UnoRuntime.queryInterface(XNamed.class, xSheet); - xSheetNamed.setName(SHEET_NAME); - - log.println("fill sheet with contnet..."); - util.CalcTools.fillCalcSheetWithContent(xSheet, 3, 3, 50, 50); - - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } catch (java.lang.Exception e) { - e.printStackTrace(log); - throw new StatusException("Can't create environment.", e); - } + oObj = (XInterface) xMSF.createInstanceWithArguments( + "com.sun.star.comp.Calc.XMLExporter", new Object[] {arg} ); + XExporter xEx = UnoRuntime.queryInterface + (XExporter.class,oObj); + xEx.setSourceDocument(xSheetDoc); + + //set name of sheet + XSpreadsheetDocument xSpreadsheetDoc = UnoRuntime.queryInterface(XSpreadsheetDocument.class, xSheetDoc); + XSpreadsheets xSpreadsheets = xSpreadsheetDoc.getSheets(); + XIndexAccess xSheetsIndexArray = UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets); + XSpreadsheet xSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),xSheetsIndexArray.getByIndex(0)); + XNamed xSheetNamed = UnoRuntime.queryInterface(XNamed.class, xSheet); + xSheetNamed.setName(SHEET_NAME); + + log.println("fill sheet with contnet..."); + util.CalcTools.fillCalcSheetWithContent(xSheet, 3, 3, 50, 50); // adding tags which must be contained in XML output Filter.addTag( new XMLTools.Tag("office:document") ); diff --git a/qadevOOo/tests/java/mod/_sc/XMLImporter.java b/qadevOOo/tests/java/mod/_sc/XMLImporter.java index 7f755027ea44..be35eb66e8a5 100644 --- a/qadevOOo/tests/java/mod/_sc/XMLImporter.java +++ b/qadevOOo/tests/java/mod/_sc/XMLImporter.java @@ -113,7 +113,7 @@ public class XMLImporter extends TestCase { @Override public synchronized TestEnvironment createTestEnvironment( TestParameters tParam, PrintWriter log ) - throws StatusException { + throws Exception { XInterface oObj = null; Object oInt = null ; @@ -125,15 +125,10 @@ public class XMLImporter extends TestCase { XMultiServiceFactory xMSF = tParam.getMSF() ; - try { - oInt = xMSF.createInstance("com.sun.star.comp.Calc.XMLImporter") ; - XImporter imp = UnoRuntime.queryInterface - (XImporter.class, oInt) ; - imp.setTargetDocument(xSheetDoc); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oInt = xMSF.createInstance("com.sun.star.comp.Calc.XMLImporter") ; + XImporter imp = UnoRuntime.queryInterface + (XImporter.class, oInt) ; + imp.setTargetDocument(xSheetDoc); oObj = (XInterface) oInt ; diff --git a/qadevOOo/tests/java/mod/_sc/XMLMetaExporter.java b/qadevOOo/tests/java/mod/_sc/XMLMetaExporter.java index 1729726ba48f..a4888a1b8b1e 100644 --- a/qadevOOo/tests/java/mod/_sc/XMLMetaExporter.java +++ b/qadevOOo/tests/java/mod/_sc/XMLMetaExporter.java @@ -115,7 +115,7 @@ public class XMLMetaExporter extends TestCase { @Override public synchronized TestEnvironment createTestEnvironment( TestParameters tParam, PrintWriter log ) - throws StatusException { + throws Exception { XMultiServiceFactory xMSF = tParam.getMSF() ; XInterface oObj = null; @@ -128,29 +128,20 @@ public class XMLMetaExporter extends TestCase { filter.addCharactersEnclosed("TestDocument", new XMLTools.Tag ("dc:title")); - try { - oObj = (XInterface) xMSF.createInstanceWithArguments( - "com.sun.star.comp.Calc.XMLMetaExporter", new Object[] {arg}); - XExporter xEx = UnoRuntime.queryInterface - (XExporter.class,oObj); - xEx.setSourceDocument(xSheetDoc); - - // Obtaining and changing property values - XDocumentPropertiesSupplier xPropSup = UnoRuntime.queryInterface - (XDocumentPropertiesSupplier.class, xSheetDoc); - final XDocumentProperties xDocProps = xPropSup.getDocumentProperties(); - xDocProps.setTitle("TestDocument"); - - log.println("fill sheet 1 with contnet..."); - util.CalcTools.fillCalcSheetWithContent(xSheetDoc,1, 3, 3, 50, 50); - - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create environment.", e) ; - } catch (java.lang.Exception e) { - e.printStackTrace(log); - throw new StatusException("Can't create environment.", e); - } + oObj = (XInterface) xMSF.createInstanceWithArguments( + "com.sun.star.comp.Calc.XMLMetaExporter", new Object[] {arg}); + XExporter xEx = UnoRuntime.queryInterface + (XExporter.class,oObj); + xEx.setSourceDocument(xSheetDoc); + + // Obtaining and changing property values + XDocumentPropertiesSupplier xPropSup = UnoRuntime.queryInterface + (XDocumentPropertiesSupplier.class, xSheetDoc); + final XDocumentProperties xDocProps = xPropSup.getDocumentProperties(); + xDocProps.setTitle("TestDocument"); + + log.println("fill sheet 1 with contnet..."); + util.CalcTools.fillCalcSheetWithContent(xSheetDoc,1, 3, 3, 50, 50); // create testobject here log.println( "creating a new environment" ); diff --git a/qadevOOo/tests/java/mod/_sc/XMLMetaImporter.java b/qadevOOo/tests/java/mod/_sc/XMLMetaImporter.java index fcf006c6ae6b..0fe886e72ead 100644 --- a/qadevOOo/tests/java/mod/_sc/XMLMetaImporter.java +++ b/qadevOOo/tests/java/mod/_sc/XMLMetaImporter.java @@ -116,7 +116,7 @@ public class XMLMetaImporter extends TestCase { @Override public synchronized TestEnvironment createTestEnvironment( TestParameters tParam, PrintWriter log ) - throws StatusException { + throws Exception { XInterface oObj = null; Object oInt = null ; @@ -128,16 +128,11 @@ public class XMLMetaImporter extends TestCase { XMultiServiceFactory xMSF = tParam.getMSF() ; - try { - oInt = xMSF.createInstance - ("com.sun.star.comp.Calc.XMLMetaImporter") ; - XImporter imp = UnoRuntime.queryInterface - (XImporter.class, oInt) ; - imp.setTargetDocument(comp) ; - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oInt = xMSF.createInstance + ("com.sun.star.comp.Calc.XMLMetaImporter") ; + XImporter imp = UnoRuntime.queryInterface + (XImporter.class, oInt) ; + imp.setTargetDocument(comp) ; oObj = (XInterface) oInt ; diff --git a/qadevOOo/tests/java/mod/_sc/XMLSettingsExporter.java b/qadevOOo/tests/java/mod/_sc/XMLSettingsExporter.java index 6a87353b9a6d..b575c6b52389 100644 --- a/qadevOOo/tests/java/mod/_sc/XMLSettingsExporter.java +++ b/qadevOOo/tests/java/mod/_sc/XMLSettingsExporter.java @@ -114,35 +114,26 @@ public class XMLSettingsExporter extends TestCase { @Override public synchronized TestEnvironment createTestEnvironment( TestParameters tParam, PrintWriter log ) - throws StatusException { + throws Exception { XMultiServiceFactory xMSF = tParam.getMSF() ; XInterface oObj = null; SettingsFilterChecker filter = new SettingsFilterChecker(log); Any arg = new Any(new Type(XDocumentHandler.class), filter); - try { - oObj = (XInterface) xMSF.createInstanceWithArguments( - "com.sun.star.comp.Calc.XMLSettingsExporter", - new Object[] {arg} ); - XExporter xEx = UnoRuntime.queryInterface - (XExporter.class,oObj); - xEx.setSourceDocument(xSheetDoc); - - //set some settings - XModel xSheetModel = UnoRuntime.queryInterface(XModel.class, xSheetDoc); - XController xController = xSheetModel.getCurrentController(); - XPropertySet xPropSet = UnoRuntime.queryInterface(XPropertySet.class, xController); - xPropSet.setPropertyValue("ShowGrid", "false"); - - util.CalcTools.fillCalcSheetWithContent(xSheetDoc, 0, 3, 3, 50, 50); - - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } catch (java.lang.Exception e) { - e.printStackTrace(log); - throw new StatusException("Can't create environment.", e); - } + oObj = (XInterface) xMSF.createInstanceWithArguments( + "com.sun.star.comp.Calc.XMLSettingsExporter", + new Object[] {arg} ); + XExporter xEx = UnoRuntime.queryInterface + (XExporter.class,oObj); + xEx.setSourceDocument(xSheetDoc); + + //set some settings + XModel xSheetModel = UnoRuntime.queryInterface(XModel.class, xSheetDoc); + XController xController = xSheetModel.getCurrentController(); + XPropertySet xPropSet = UnoRuntime.queryInterface(XPropertySet.class, xController); + xPropSet.setPropertyValue("ShowGrid", "false"); + + util.CalcTools.fillCalcSheetWithContent(xSheetDoc, 0, 3, 3, 50, 50); //Create and prepare filter // adding tags which must be contained in XML output diff --git a/qadevOOo/tests/java/mod/_sc/XMLSettingsImporter.java b/qadevOOo/tests/java/mod/_sc/XMLSettingsImporter.java index 514e4b61a277..25fad3c8a28c 100644 --- a/qadevOOo/tests/java/mod/_sc/XMLSettingsImporter.java +++ b/qadevOOo/tests/java/mod/_sc/XMLSettingsImporter.java @@ -117,7 +117,7 @@ public class XMLSettingsImporter extends TestCase { @Override public synchronized TestEnvironment createTestEnvironment( TestParameters tParam, PrintWriter log ) - throws StatusException { + throws Exception { XInterface oObj = null; Object oInt = null ; @@ -129,20 +129,15 @@ public class XMLSettingsImporter extends TestCase { XMultiServiceFactory xMSF = tParam.getMSF() ; final XPropertySet xPropSet ; - try { - oInt = xMSF.createInstance - ("com.sun.star.comp.Calc.XMLSettingsImporter") ; - XImporter imp = UnoRuntime.queryInterface - (XImporter.class, oInt) ; - imp.setTargetDocument(comp) ; - - XModel xSheetModel = UnoRuntime.queryInterface(XModel.class, xSheetDoc); - XController xController = xSheetModel.getCurrentController(); - xPropSet = UnoRuntime.queryInterface(XPropertySet.class, xController); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oInt = xMSF.createInstance + ("com.sun.star.comp.Calc.XMLSettingsImporter") ; + XImporter imp = UnoRuntime.queryInterface + (XImporter.class, oInt) ; + imp.setTargetDocument(comp) ; + + XModel xSheetModel = UnoRuntime.queryInterface(XModel.class, xSheetDoc); + XController xController = xSheetModel.getCurrentController(); + xPropSet = UnoRuntime.queryInterface(XPropertySet.class, xController); oObj = (XInterface) oInt ; diff --git a/qadevOOo/tests/java/mod/_sc/XMLStylesExporter.java b/qadevOOo/tests/java/mod/_sc/XMLStylesExporter.java index cfb32172637e..b83289226609 100644 --- a/qadevOOo/tests/java/mod/_sc/XMLStylesExporter.java +++ b/qadevOOo/tests/java/mod/_sc/XMLStylesExporter.java @@ -115,7 +115,7 @@ public class XMLStylesExporter extends TestCase { * </ul> */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF() ); XMultiServiceFactory xMSF = tParam.getMSF() ; @@ -128,35 +128,26 @@ public class XMLStylesExporter extends TestCase { filter.addTag(new XMLTools.Tag("office:document-styles")); filter.addTag(new XMLTools.Tag("style:style","style:name", newName)); - try { - oObj = (XInterface) xMSF.createInstanceWithArguments( - "com.sun.star.comp.Calc.XMLStylesExporter", new Object[] {arg}); - XExporter xEx = UnoRuntime.queryInterface(XExporter.class,oObj); - xEx.setSourceDocument(xSheetDoc); - - // Obtaining and changing property values - XStyleFamiliesSupplier styleSup = UnoRuntime.queryInterface( - XStyleFamiliesSupplier.class, xSheetDoc); - XNameAccess StyleFamilies = styleSup.getStyleFamilies(); - String[] styleFamiliesNames = StyleFamilies.getElementNames(); - XNameContainer StyleFamilyName = (XNameContainer) - AnyConverter.toObject(new Type(XNameContainer.class), - StyleFamilies.getByName(styleFamiliesNames[0])); - Object SC = SOF.createInstance( - xSheetDoc, "com.sun.star.style.CellStyle"); - XStyle StyleCell = UnoRuntime.queryInterface(XStyle.class,SC); - StyleFamilyName.insertByName(newName, StyleCell); - - log.println("fill sheet 1 with content..."); - util.CalcTools.fillCalcSheetWithContent(xSheetDoc, 0, 3, 3, 50, 100); - - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Can't create environment.", e); - } catch (java.lang.Exception e) { - e.printStackTrace(log); - throw new StatusException("Can't create environment.", e); - } + oObj = (XInterface) xMSF.createInstanceWithArguments( + "com.sun.star.comp.Calc.XMLStylesExporter", new Object[] {arg}); + XExporter xEx = UnoRuntime.queryInterface(XExporter.class,oObj); + xEx.setSourceDocument(xSheetDoc); + + // Obtaining and changing property values + XStyleFamiliesSupplier styleSup = UnoRuntime.queryInterface( + XStyleFamiliesSupplier.class, xSheetDoc); + XNameAccess StyleFamilies = styleSup.getStyleFamilies(); + String[] styleFamiliesNames = StyleFamilies.getElementNames(); + XNameContainer StyleFamilyName = (XNameContainer) + AnyConverter.toObject(new Type(XNameContainer.class), + StyleFamilies.getByName(styleFamiliesNames[0])); + Object SC = SOF.createInstance( + xSheetDoc, "com.sun.star.style.CellStyle"); + XStyle StyleCell = UnoRuntime.queryInterface(XStyle.class,SC); + StyleFamilyName.insertByName(newName, StyleCell); + + log.println("fill sheet 1 with content..."); + util.CalcTools.fillCalcSheetWithContent(xSheetDoc, 0, 3, 3, 50, 100); // create testobject here log.println( "creating a new environment" ); diff --git a/qadevOOo/tests/java/mod/_sc/XMLStylesImporter.java b/qadevOOo/tests/java/mod/_sc/XMLStylesImporter.java index 75e44fb5f69a..f027766aad41 100644 --- a/qadevOOo/tests/java/mod/_sc/XMLStylesImporter.java +++ b/qadevOOo/tests/java/mod/_sc/XMLStylesImporter.java @@ -116,7 +116,7 @@ public class XMLStylesImporter extends TestCase { @Override public synchronized TestEnvironment createTestEnvironment( TestParameters tParam, PrintWriter log ) - throws StatusException { + throws Exception { XInterface oObj = null; Object oInt = null ; @@ -127,16 +127,11 @@ public class XMLStylesImporter extends TestCase { XMultiServiceFactory xMSF = tParam.getMSF() ; - try { - oInt = xMSF.createInstance - ("com.sun.star.comp.Calc.XMLStylesImporter") ; - XImporter imp = UnoRuntime.queryInterface - (XImporter.class, oInt) ; - imp.setTargetDocument(comp) ; - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oInt = xMSF.createInstance + ("com.sun.star.comp.Calc.XMLStylesImporter") ; + XImporter imp = UnoRuntime.queryInterface + (XImporter.class, oInt) ; + imp.setTargetDocument(comp) ; oObj = (XInterface) oInt ; diff --git a/qadevOOo/tests/java/mod/_sch/AccArea.java b/qadevOOo/tests/java/mod/_sch/AccArea.java index 716de219d501..19cf04550b17 100644 --- a/qadevOOo/tests/java/mod/_sch/AccArea.java +++ b/qadevOOo/tests/java/mod/_sch/AccArea.java @@ -19,7 +19,6 @@ package mod._sch; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -43,19 +42,13 @@ public class AccArea extends TestCase { @Override protected TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) { + TestParameters Param, PrintWriter log) throws Exception { if (xChartDoc != null) cleanup(Param, log); log.println( "creating a chart document" ); SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF()); - try { - log.println( "creating a chartdocument" ); - xChartDoc = SOF.createChartDoc(); - } catch (com.sun.star.uno.Exception e) { - // Some exception occurs.FAILED - e.printStackTrace( log ); - throw new StatusException( "Couldn't create document", e ); - } + log.println( "creating a chartdocument" ); + xChartDoc = SOF.createChartDoc(); XInterface oObj = null; diff --git a/qadevOOo/tests/java/mod/_sch/AccAxis.java b/qadevOOo/tests/java/mod/_sch/AccAxis.java index 456e3b056060..8b3eb65c43c4 100644 --- a/qadevOOo/tests/java/mod/_sch/AccAxis.java +++ b/qadevOOo/tests/java/mod/_sch/AccAxis.java @@ -19,7 +19,6 @@ package mod._sch; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -43,19 +42,13 @@ public class AccAxis extends TestCase { @Override protected TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) { + TestParameters Param, PrintWriter log) throws Exception { if (xChartDoc != null) cleanup(Param, log); log.println( "creating a chart document" ); SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF()); - try { - log.println( "creating a chartdocument" ); - xChartDoc = SOF.createChartDoc(); - } catch (com.sun.star.uno.Exception e) { - // Some exception occurs.FAILED - e.printStackTrace( log ); - throw new StatusException( "Couldn't create document", e ); - } + log.println( "creating a chartdocument" ); + xChartDoc = SOF.createChartDoc(); XInterface oObj = null; diff --git a/qadevOOo/tests/java/mod/_sch/AccDataPoint.java b/qadevOOo/tests/java/mod/_sch/AccDataPoint.java index 32b201deb2b4..b5ce67dfc40f 100644 --- a/qadevOOo/tests/java/mod/_sch/AccDataPoint.java +++ b/qadevOOo/tests/java/mod/_sch/AccDataPoint.java @@ -19,7 +19,6 @@ package mod._sch; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -43,19 +42,13 @@ public class AccDataPoint extends TestCase { @Override protected TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) { + TestParameters Param, PrintWriter log) throws Exception { if (xChartDoc != null) cleanup(Param, log); log.println( "creating a chart document" ); SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF()); - try { - log.println( "creating a chartdocument" ); - xChartDoc = SOF.createChartDoc(); - } catch (com.sun.star.uno.Exception e) { - // Some exception occurs.FAILED - e.printStackTrace( log ); - throw new StatusException( "Couldn't create document", e ); - } + log.println( "creating a chartdocument" ); + xChartDoc = SOF.createChartDoc(); XInterface oObj = null; diff --git a/qadevOOo/tests/java/mod/_sch/AccDataSeries.java b/qadevOOo/tests/java/mod/_sch/AccDataSeries.java index 57d8cbbf3466..007ef7d58424 100644 --- a/qadevOOo/tests/java/mod/_sch/AccDataSeries.java +++ b/qadevOOo/tests/java/mod/_sch/AccDataSeries.java @@ -19,7 +19,6 @@ package mod._sch; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -43,19 +42,13 @@ public class AccDataSeries extends TestCase { @Override protected TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) { + TestParameters Param, PrintWriter log) throws Exception { if (xChartDoc != null) cleanup(Param, log); log.println( "creating a chart document" ); SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF()); - try { - log.println( "creating a chartdocument" ); - xChartDoc = SOF.createChartDoc(); - } catch (com.sun.star.uno.Exception e) { - // Some exception occurs.FAILED - e.printStackTrace( log ); - throw new StatusException( "Couldn't create document", e ); - } + log.println( "creating a chartdocument" ); + xChartDoc = SOF.createChartDoc(); XInterface oObj = null; diff --git a/qadevOOo/tests/java/mod/_sch/AccDiagram.java b/qadevOOo/tests/java/mod/_sch/AccDiagram.java index d6bd1893c3d6..55593914ce9e 100644 --- a/qadevOOo/tests/java/mod/_sch/AccDiagram.java +++ b/qadevOOo/tests/java/mod/_sch/AccDiagram.java @@ -19,7 +19,6 @@ package mod._sch; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -43,19 +42,13 @@ public class AccDiagram extends TestCase { @Override protected TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) { + TestParameters Param, PrintWriter log) throws Exception { if (xChartDoc != null) cleanup(Param, log); log.println( "creating a chart document" ); SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF()); - try { - log.println( "creating a chartdocument" ); - xChartDoc = SOF.createChartDoc(); - } catch (com.sun.star.uno.Exception e) { - // Some exception occurs.FAILED - e.printStackTrace( log ); - throw new StatusException( "Couldn't create document", e ); - } + log.println( "creating a chartdocument" ); + xChartDoc = SOF.createChartDoc(); XInterface oObj = null; diff --git a/qadevOOo/tests/java/mod/_sch/AccFloor.java b/qadevOOo/tests/java/mod/_sch/AccFloor.java index ae4b1a129f13..3d5426faba21 100644 --- a/qadevOOo/tests/java/mod/_sch/AccFloor.java +++ b/qadevOOo/tests/java/mod/_sch/AccFloor.java @@ -19,7 +19,6 @@ package mod._sch; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -44,41 +43,17 @@ public class AccFloor extends TestCase { @Override protected TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) { + TestParameters Param, PrintWriter log) throws Exception { if (xChartDoc != null) cleanup(Param, log); log.println( "creating a chart document" ); SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF()); - try { - log.println( "creating a chartdocument" ); - xChartDoc = SOF.createChartDoc(); - } catch (com.sun.star.uno.Exception e) { - // Some exception occurs.FAILED - e.printStackTrace( log ); - throw new StatusException( "Couldn't create document", e ); - } + log.println( "creating a chartdocument" ); + xChartDoc = SOF.createChartDoc(); log.println("Change Diagram to 3D"); XPropertySet ChartProps = UnoRuntime.queryInterface( XPropertySet.class, xChartDoc.getDiagram() ); - try { - ChartProps.setPropertyValue("Dim3D", Boolean.TRUE); - } catch(com.sun.star.lang.WrappedTargetException e) { - log.println("Couldn't change Diagram to 3D"); - e.printStackTrace(log); - throw new StatusException("Couldn't change Diagram to 3D", e); - } catch(com.sun.star.lang.IllegalArgumentException e) { - log.println("Couldn't change Diagram to 3D"); - e.printStackTrace(log); - throw new StatusException("Couldn't change Diagram to 3D", e); - } catch(com.sun.star.beans.PropertyVetoException e) { - log.println("Couldn't change Diagram to 3D"); - e.printStackTrace(log); - throw new StatusException("Couldn't change Diagram to 3D", e); - } catch(com.sun.star.beans.UnknownPropertyException e) { - log.println("Couldn't change Diagram to 3D"); - e.printStackTrace(log); - throw new StatusException("Couldn't change Diagram to 3D", e); - } + ChartProps.setPropertyValue("Dim3D", Boolean.TRUE); XInterface oObj = null; diff --git a/qadevOOo/tests/java/mod/_sch/AccGrid.java b/qadevOOo/tests/java/mod/_sch/AccGrid.java index 7682b9b248e2..c0d6e6c207ed 100644 --- a/qadevOOo/tests/java/mod/_sch/AccGrid.java +++ b/qadevOOo/tests/java/mod/_sch/AccGrid.java @@ -19,7 +19,6 @@ package mod._sch; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -43,19 +42,13 @@ public class AccGrid extends TestCase { @Override protected TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) { + TestParameters Param, PrintWriter log) throws Exception { if (xChartDoc != null) cleanup(Param, log); log.println( "creating a chart document" ); SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF()); - try { - log.println( "creating a chartdocument" ); - xChartDoc = SOF.createChartDoc(); - } catch (com.sun.star.uno.Exception e) { - // Some exception occurs.FAILED - e.printStackTrace( log ); - throw new StatusException( "Couldn't create document", e ); - } + log.println( "creating a chartdocument" ); + xChartDoc = SOF.createChartDoc(); XInterface oObj = null; diff --git a/qadevOOo/tests/java/mod/_sch/AccLegend.java b/qadevOOo/tests/java/mod/_sch/AccLegend.java index b9d78b2d6b10..5cda48c80ac4 100644 --- a/qadevOOo/tests/java/mod/_sch/AccLegend.java +++ b/qadevOOo/tests/java/mod/_sch/AccLegend.java @@ -19,7 +19,6 @@ package mod._sch; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -43,19 +42,13 @@ public class AccLegend extends TestCase { @Override protected TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) { + TestParameters Param, PrintWriter log) throws Exception { if (xChartDoc != null) cleanup(Param, log); log.println( "creating a chart document" ); SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF()); - try { - log.println( "creating a chartdocument" ); - xChartDoc = SOF.createChartDoc(); - } catch (com.sun.star.uno.Exception e) { - // Some exception occurs.FAILED - e.printStackTrace( log ); - throw new StatusException( "Couldn't create document", e ); - } + log.println( "creating a chartdocument" ); + xChartDoc = SOF.createChartDoc(); XInterface oObj = null; diff --git a/qadevOOo/tests/java/mod/_sch/AccLegendEntry.java b/qadevOOo/tests/java/mod/_sch/AccLegendEntry.java index eee38c452471..28635af5ccff 100644 --- a/qadevOOo/tests/java/mod/_sch/AccLegendEntry.java +++ b/qadevOOo/tests/java/mod/_sch/AccLegendEntry.java @@ -19,7 +19,6 @@ package mod._sch; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -43,19 +42,13 @@ public class AccLegendEntry extends TestCase { @Override protected TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) { + TestParameters Param, PrintWriter log) throws Exception { if (xChartDoc != null) cleanup(Param, log); log.println( "creating a chart document" ); SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF()); - try { - log.println( "creating a chartdocument" ); - xChartDoc = SOF.createChartDoc(); - } catch (com.sun.star.uno.Exception e) { - // Some exception occurs.FAILED - e.printStackTrace( log ); - throw new StatusException( "Couldn't create document", e ); - } + log.println( "creating a chartdocument" ); + xChartDoc = SOF.createChartDoc(); XInterface oObj = null; diff --git a/qadevOOo/tests/java/mod/_sch/AccStatisticsObject.java b/qadevOOo/tests/java/mod/_sch/AccStatisticsObject.java index d1cbf720e97b..82f380cc02a9 100644 --- a/qadevOOo/tests/java/mod/_sch/AccStatisticsObject.java +++ b/qadevOOo/tests/java/mod/_sch/AccStatisticsObject.java @@ -19,7 +19,6 @@ package mod._sch; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -44,22 +43,16 @@ public class AccStatisticsObject extends TestCase { @Override protected TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) { + TestParameters Param, PrintWriter log) throws Exception { if (xChartDoc != null) cleanup(Param, log); log.println( "creating a chart document" ); SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF()); - try { - log.println( "creating a chartdocument" ); - xChartDoc = SOF.createChartDoc(); - log.println("Display MeanValue"); - XPropertySet diagProps = UnoRuntime.queryInterface(XPropertySet.class, xChartDoc.getDiagram()); - diagProps.setPropertyValue("MeanValue",Boolean.TRUE); - } catch (com.sun.star.uno.Exception e) { - // Some exception occurs.FAILED - e.printStackTrace( log ); - throw new StatusException( "Couldn't create document", e ); - } + log.println( "creating a chartdocument" ); + xChartDoc = SOF.createChartDoc(); + log.println("Display MeanValue"); + XPropertySet diagProps = UnoRuntime.queryInterface(XPropertySet.class, xChartDoc.getDiagram()); + diagProps.setPropertyValue("MeanValue",Boolean.TRUE); XInterface oObj = null; diff --git a/qadevOOo/tests/java/mod/_sch/AccTitle.java b/qadevOOo/tests/java/mod/_sch/AccTitle.java index 47e57dbce262..27486a00ef83 100644 --- a/qadevOOo/tests/java/mod/_sch/AccTitle.java +++ b/qadevOOo/tests/java/mod/_sch/AccTitle.java @@ -19,7 +19,6 @@ package mod._sch; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -43,19 +42,13 @@ public class AccTitle extends TestCase { @Override protected TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) { + TestParameters Param, PrintWriter log) throws Exception { if (xChartDoc != null) cleanup(Param, log); log.println( "creating a chart document" ); SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF()); - try { - log.println( "creating a chartdocument" ); - xChartDoc = SOF.createChartDoc(); - } catch (com.sun.star.uno.Exception e) { - // Some exception occurs.FAILED - e.printStackTrace( log ); - throw new StatusException( "Couldn't create document", e ); - } + log.println( "creating a chartdocument" ); + xChartDoc = SOF.createChartDoc(); XInterface oObj = null; diff --git a/qadevOOo/tests/java/mod/_sch/AccWall.java b/qadevOOo/tests/java/mod/_sch/AccWall.java index b83f6f2e07c7..fe3f0388e108 100644 --- a/qadevOOo/tests/java/mod/_sch/AccWall.java +++ b/qadevOOo/tests/java/mod/_sch/AccWall.java @@ -19,7 +19,6 @@ package mod._sch; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -44,41 +43,17 @@ public class AccWall extends TestCase { @Override protected TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) { + TestParameters Param, PrintWriter log) throws Exception { if (xChartDoc != null) cleanup(Param, log); log.println( "creating a chart document" ); SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF()); - try { - log.println( "creating a chartdocument" ); - xChartDoc = SOF.createChartDoc(); - } catch (com.sun.star.uno.Exception e) { - // Some exception occurs.FAILED - e.printStackTrace( log ); - throw new StatusException( "Couldn't create document", e ); - } + log.println( "creating a chartdocument" ); + xChartDoc = SOF.createChartDoc(); log.println("Change Diagram to 3D"); XPropertySet ChartProps = UnoRuntime.queryInterface( XPropertySet.class, xChartDoc.getDiagram() ); - try { - ChartProps.setPropertyValue("Dim3D", Boolean.TRUE); - } catch(com.sun.star.lang.WrappedTargetException e) { - log.println("Couldn't change Diagram to 3D"); - e.printStackTrace(log); - throw new StatusException("Couldn't change Diagram to 3D", e); - } catch(com.sun.star.lang.IllegalArgumentException e) { - log.println("Couldn't change Diagram to 3D"); - e.printStackTrace(log); - throw new StatusException("Couldn't change Diagram to 3D", e); - } catch(com.sun.star.beans.PropertyVetoException e) { - log.println("Couldn't change Diagram to 3D"); - e.printStackTrace(log); - throw new StatusException("Couldn't change Diagram to 3D", e); - } catch(com.sun.star.beans.UnknownPropertyException e) { - log.println("Couldn't change Diagram to 3D"); - e.printStackTrace(log); - throw new StatusException("Couldn't change Diagram to 3D", e); - } + ChartProps.setPropertyValue("Dim3D", Boolean.TRUE); XInterface oObj = null; diff --git a/qadevOOo/tests/java/mod/_sch/ChXChartDocument.java b/qadevOOo/tests/java/mod/_sch/ChXChartDocument.java index e28cea816265..9c52dd94d939 100644 --- a/qadevOOo/tests/java/mod/_sch/ChXChartDocument.java +++ b/qadevOOo/tests/java/mod/_sch/ChXChartDocument.java @@ -26,11 +26,9 @@ import com.sun.star.view.XSelectionSupplier; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.SOfficeFactory; @@ -108,21 +106,15 @@ public class ChXChartDocument extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment(TestParameters tParam, - PrintWriter log) { + PrintWriter log) throws Exception { // get a soffice factory object SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); - try { - log.println("creating a chartdocument"); - xChartDoc = SOF.createChartDoc(); - log.println("Waiting before opening second document"); - doc2 = SOF.createChartDoc(); - } catch (com.sun.star.uno.Exception e) { - // Some exception occurs.FAILED - e.printStackTrace(log); - throw new StatusException("Couldn't create document", e); - } + log.println("creating a chartdocument"); + xChartDoc = SOF.createChartDoc(); + log.println("Waiting before opening second document"); + doc2 = SOF.createChartDoc(); // get the chartdocument diff --git a/qadevOOo/tests/java/mod/_sch/ChXDataPoint.java b/qadevOOo/tests/java/mod/_sch/ChXDataPoint.java index 4561585adcf5..66e841f92f96 100644 --- a/qadevOOo/tests/java/mod/_sch/ChXDataPoint.java +++ b/qadevOOo/tests/java/mod/_sch/ChXDataPoint.java @@ -117,7 +117,7 @@ public class ChXDataPoint extends TestCase { * </ul> */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XPropertySet oObj = null; XDiagram oDiagram = null; @@ -125,15 +125,9 @@ public class ChXDataPoint extends TestCase { SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF()); // get the DataRowPoint_Point - try { - log.println( "getting ChXDataRowPoint_Point" ); - oDiagram = xChartDoc.getDiagram(); - oObj = oDiagram.getDataPointProperties(1,1); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - // Some exception occurs.FAILED - e.printStackTrace( log ); - throw new StatusException( "Couldn't get ChXDataRowPoint_Point", e ); - } + log.println( "getting ChXDataRowPoint_Point" ); + oDiagram = xChartDoc.getDiagram(); + oObj = oDiagram.getDataPointProperties(1,1); log.println( "creating a new environment for chartdocument object" ); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_sch/ChXDataRow.java b/qadevOOo/tests/java/mod/_sch/ChXDataRow.java index b23c48aad626..1988c54cc14e 100644 --- a/qadevOOo/tests/java/mod/_sch/ChXDataRow.java +++ b/qadevOOo/tests/java/mod/_sch/ChXDataRow.java @@ -124,20 +124,14 @@ public class ChXDataRow extends TestCase { * </ul> */ @Override - protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XPropertySet oObj = null; XDiagram oDiagram = null; // get the ChXDataRowPoint_Row - try { - log.println( "getting ChXDataRowPoint_Row" ); - oDiagram = xChartDoc.getDiagram(); - oObj = oDiagram.getDataRowProperties(1); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - // Some exception occurs.FAILED - e.printStackTrace( log ); - throw new StatusException( "Couldn't get ChXDataRowPoint_Row", e ); - } + log.println( "getting ChXDataRowPoint_Row" ); + oDiagram = xChartDoc.getDiagram(); + oObj = oDiagram.getDataRowProperties(1); log.println( "creating a new environment for chartdocument object" ); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_sch/ChXDiagram.java b/qadevOOo/tests/java/mod/_sch/ChXDiagram.java index fb8225a94503..283acdbaefa0 100644 --- a/qadevOOo/tests/java/mod/_sch/ChXDiagram.java +++ b/qadevOOo/tests/java/mod/_sch/ChXDiagram.java @@ -211,7 +211,7 @@ public class ChXDiagram extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment - (TestParameters Param, PrintWriter log) { + (TestParameters Param, PrintWriter log) throws Exception { XSpreadsheet oSheet=null; XChartDocument xChartDoc=null; @@ -220,19 +220,8 @@ public class ChXDiagram extends TestCase { System.out.println("Getting spreadsheet") ; XSpreadsheets oSheets = xSheetDoc.getSheets() ; XIndexAccess oIndexSheets = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); - } catch(com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get sheet", e); - } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get sheet", e); - } catch(com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get sheet", e); - } + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); log.println("Creating the Header") ; @@ -318,21 +307,9 @@ public class ChXDiagram extends TestCase { } // get the TableChart - XTableChart oChart = null; - try { - oChart = (XTableChart) AnyConverter.toObject( - new Type(XTableChart.class),UnoRuntime.queryInterface( - XNameAccess.class, oCharts).getByName("ChXDiagram")); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get TableChart", e); - } catch (com.sun.star.container.NoSuchElementException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get TableChart", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get TableChart", e); - } + XTableChart oChart = (XTableChart) AnyConverter.toObject( + new Type(XTableChart.class),UnoRuntime.queryInterface( + XNameAccess.class, oCharts).getByName("ChXDiagram")); XEmbeddedObjectSupplier oEOS = UnoRuntime.queryInterface(XEmbeddedObjectSupplier.class, oChart); XInterface oInt = oEOS.getEmbeddedObject(); diff --git a/qadevOOo/tests/java/mod/_sch/ChartLine.java b/qadevOOo/tests/java/mod/_sch/ChartLine.java index 1bb69b2db7c7..dfc71fdbaf6d 100644 --- a/qadevOOo/tests/java/mod/_sch/ChartLine.java +++ b/qadevOOo/tests/java/mod/_sch/ChartLine.java @@ -87,7 +87,7 @@ public class ChartLine extends TestCase { * @see com.sun.star.chart.ChartLine */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XPropertySet oObj = null; XDiagram oDiagram = null; @@ -101,35 +101,12 @@ public class ChartLine extends TestCase { xChartDoc.setDiagram(oDiagram); // get the Line - try { - log.println( "getting Line" ); - XPropertySet RowProps = oDiagram.getDataRowProperties(1); - RowProps.setPropertyValue("MeanValue", Boolean.TRUE); - oObj = (XPropertySet) AnyConverter.toObject( - new Type(XPropertySet.class), - RowProps.getPropertyValue("DataMeanValueProperties")); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - // Some exception occurs.FAILED - e.printStackTrace( log ); - throw new StatusException( "Couldn't get Line", e ); - } catch (com.sun.star.lang.WrappedTargetException e) { - // Some exception occurs.FAILED - e.printStackTrace( log ); - throw new StatusException( "Couldn't get Line", e ); - } catch (com.sun.star.beans.UnknownPropertyException e) { - // Some exception occurs.FAILED - e.printStackTrace( log ); - throw new StatusException( "Couldn't get Line", e ); - } catch (com.sun.star.lang.IllegalArgumentException e) { - // Some exception occurs.FAILED - e.printStackTrace( log ); - throw new StatusException( "Couldn't get Line", e ); - } - catch(com.sun.star.beans.PropertyVetoException e) { - // Some exception occurs.FAILED - e.printStackTrace( log ); - throw new StatusException( "Couldn't get Line", e ); - } + log.println( "getting Line" ); + XPropertySet RowProps = oDiagram.getDataRowProperties(1); + RowProps.setPropertyValue("MeanValue", Boolean.TRUE); + oObj = (XPropertySet) AnyConverter.toObject( + new Type(XPropertySet.class), + RowProps.getPropertyValue("DataMeanValueProperties")); log.println( "creating a new environment for chartdocument object" ); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_sd/AccessibleDrawDocumentView.java b/qadevOOo/tests/java/mod/_sd/AccessibleDrawDocumentView.java index 68cc9bec0a03..e987d29a7b46 100644 --- a/qadevOOo/tests/java/mod/_sd/AccessibleDrawDocumentView.java +++ b/qadevOOo/tests/java/mod/_sd/AccessibleDrawDocumentView.java @@ -63,7 +63,7 @@ public class AccessibleDrawDocumentView extends TestCase { */ @Override protected TestEnvironment createTestEnvironment - (TestParameters Param, PrintWriter log) { + (TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; // get a soffice factory object @@ -76,20 +76,8 @@ public class AccessibleDrawDocumentView extends TestCase { XDrawPages oDPn = oDPS.getDrawPages(); final XDrawPage fDP2 = oDPn.insertNewByIndex(1); XIndexAccess oDPi = UnoRuntime.queryInterface(XIndexAccess.class, oDPn); - XDrawPage oDP = null; - try { - oDP = (XDrawPage) AnyConverter.toObject( - new Type(XDrawPage.class),oDPi.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't get by index", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't get by index", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't get by index", e); - } + XDrawPage oDP = (XDrawPage) AnyConverter.toObject( + new Type(XDrawPage.class),oDPi.getByIndex(0)); //get a Shape log.println( "inserting a Shape" ); diff --git a/qadevOOo/tests/java/mod/_sd/DrawController_DrawView.java b/qadevOOo/tests/java/mod/_sd/DrawController_DrawView.java index 00cdff813920..af4ac33601a8 100644 --- a/qadevOOo/tests/java/mod/_sd/DrawController_DrawView.java +++ b/qadevOOo/tests/java/mod/_sd/DrawController_DrawView.java @@ -21,8 +21,6 @@ package mod._sd; import java.io.PrintWriter; import java.util.Comparator; -import lib.Status; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -128,7 +126,7 @@ public class DrawController_DrawView extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment - (TestParameters Param, PrintWriter log) { + (TestParameters Param, PrintWriter log) throws Exception { log.println( "creating a test environment" ); @@ -136,16 +134,11 @@ public class DrawController_DrawView extends TestCase { SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF()); - try { - log.println( "creating two impress documents" ); - xDrawDoc = SOF.createDrawDoc(null); - util.utils.pause(1000); - xSecondDrawDoc = SOF.createDrawDoc(null); - util.utils.pause(1000); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't create document", e); - } + log.println( "creating two impress documents" ); + xDrawDoc = SOF.createDrawDoc(null); + util.utils.pause(1000); + xSecondDrawDoc = SOF.createDrawDoc(null); + util.utils.pause(1000); // get the drawpage of drawing here log.println( "getting Drawpage" ); @@ -153,20 +146,8 @@ public class DrawController_DrawView extends TestCase { XDrawPages the_pages = oDPS.getDrawPages(); XIndexAccess oDPi = UnoRuntime.queryInterface(XIndexAccess.class,the_pages); - XDrawPage oDrawPage = null; - try { - oDrawPage = (XDrawPage) AnyConverter.toObject( + XDrawPage oDrawPage = (XDrawPage) AnyConverter.toObject( new Type(XDrawPage.class),oDPi.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't get DrawPage", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't get DrawPage", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't get DrawPage", e); - } //put something on the drawpage log.println( "inserting some Shapes" ); @@ -201,14 +182,10 @@ public class DrawController_DrawView extends TestCase { Object oShapeCol1 = null; Object oShapeCol2 = null; - try { - oShapeCol1 = Param.getMSF(). - createInstance("com.sun.star.drawing.ShapeCollection"); - oShapeCol2 = Param.getMSF(). - createInstance("com.sun.star.drawing.ShapeCollection"); - } catch(com.sun.star.uno.Exception e) { - throw new StatusException(e, Status.failed("Couldn't create instance")); - } + oShapeCol1 = Param.getMSF(). + createInstance("com.sun.star.drawing.ShapeCollection"); + oShapeCol2 = Param.getMSF(). + createInstance("com.sun.star.drawing.ShapeCollection"); XShapes xShapes1 = UnoRuntime.queryInterface(XShapes.class, oShapeCol1); XShapes xShapes2 = UnoRuntime.queryInterface(XShapes.class, oShapeCol2); diff --git a/qadevOOo/tests/java/mod/_sd/DrawController_HandoutView.java b/qadevOOo/tests/java/mod/_sd/DrawController_HandoutView.java index 68cf6a1e8886..e9becac73cff 100644 --- a/qadevOOo/tests/java/mod/_sd/DrawController_HandoutView.java +++ b/qadevOOo/tests/java/mod/_sd/DrawController_HandoutView.java @@ -21,8 +21,6 @@ package mod._sd; import java.io.PrintWriter; import java.util.Comparator; -import lib.Status; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -147,23 +145,18 @@ public class DrawController_HandoutView extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment - (TestParameters Param, PrintWriter log) { + (TestParameters Param, PrintWriter log) throws Exception { log.println( "creating a test environment" ); XMultiServiceFactory xMSF = Param.getMSF(); // get a soffice factory object SOfficeFactory SOF = SOfficeFactory.getFactory(xMSF); - try { - log.println( "creating two impress documents" ); - xSecondDrawDoc = SOF.createImpressDoc(null); - util.utils.pause(1000); - xDrawDoc = SOF.createImpressDoc(null); - util.utils.pause(1000); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't create document", e); - } + log.println( "creating two impress documents" ); + xSecondDrawDoc = SOF.createImpressDoc(null); + util.utils.pause(1000); + xDrawDoc = SOF.createImpressDoc(null); + util.utils.pause(1000); // get the drawpage of drawing here log.println( "getting Drawpage" ); @@ -174,20 +167,8 @@ public class DrawController_HandoutView extends TestCase { } XIndexAccess oDPi = UnoRuntime.queryInterface(XIndexAccess.class,the_pages); - XDrawPage oDrawPage = null; - try { - oDrawPage = (XDrawPage) AnyConverter.toObject( - new Type(XDrawPage.class),oDPi.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't get DrawPage", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't get DrawPage", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't get DrawPage", e); - } + XDrawPage oDrawPage = (XDrawPage) AnyConverter.toObject( + new Type(XDrawPage.class),oDPi.getByIndex(0)); //put something on the drawpage log.println( "inserting some Shapes" ); @@ -204,12 +185,7 @@ public class DrawController_HandoutView extends TestCase { util.utils.pause(1000); log.println("switch to HandoutView..."); - try{ - utils.dispatchURL(xMSF, xDrawDoc, ".uno:HandoutMode"); - } catch (Exception e){ - e.printStackTrace(log); - throw new StatusException(e, Status.failed(e.getMessage())); - } + utils.dispatchURL(xMSF, xDrawDoc, ".uno:HandoutMode"); utils.pause(500); @@ -234,14 +210,10 @@ public class DrawController_HandoutView extends TestCase { Object oShapeCol1 = null; Object oShapeCol2 = null; - try { - oShapeCol1 = xMSF. - createInstance("com.sun.star.drawing.ShapeCollection"); - oShapeCol2 = xMSF. - createInstance("com.sun.star.drawing.ShapeCollection"); - } catch(com.sun.star.uno.Exception e) { - throw new StatusException(e, Status.failed("Couldn't create instance")); - } + oShapeCol1 = xMSF. + createInstance("com.sun.star.drawing.ShapeCollection"); + oShapeCol2 = xMSF. + createInstance("com.sun.star.drawing.ShapeCollection"); XShapes xShapes1 = UnoRuntime.queryInterface(XShapes.class, oShapeCol1); XShapes xShapes2 = UnoRuntime.queryInterface(XShapes.class, oShapeCol2); diff --git a/qadevOOo/tests/java/mod/_sd/DrawController_NotesView.java b/qadevOOo/tests/java/mod/_sd/DrawController_NotesView.java index eba83bbf24ce..e4d891413da1 100644 --- a/qadevOOo/tests/java/mod/_sd/DrawController_NotesView.java +++ b/qadevOOo/tests/java/mod/_sd/DrawController_NotesView.java @@ -21,8 +21,6 @@ package mod._sd; import java.io.PrintWriter; import java.util.Comparator; -import lib.Status; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -147,23 +145,18 @@ public class DrawController_NotesView extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment - (TestParameters Param, PrintWriter log) { + (TestParameters Param, PrintWriter log) throws Exception { log.println( "creating a test environment" ); XMultiServiceFactory xMSF = Param.getMSF(); // get a soffice factory object SOfficeFactory SOF = SOfficeFactory.getFactory(xMSF); - try { - log.println( "creating two impress documents" ); - xSecondDrawDoc = SOF.createImpressDoc(null); - util.utils.pause(1000); - xDrawDoc = SOF.createImpressDoc(null); - util.utils.pause(1000); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't create document", e); - } + log.println( "creating two impress documents" ); + xSecondDrawDoc = SOF.createImpressDoc(null); + util.utils.pause(1000); + xDrawDoc = SOF.createImpressDoc(null); + util.utils.pause(1000); // get the drawpage of drawing here log.println( "getting Drawpage" ); @@ -171,20 +164,8 @@ public class DrawController_NotesView extends TestCase { XDrawPages the_pages = oDPS.getDrawPages(); XIndexAccess oDPi = UnoRuntime.queryInterface(XIndexAccess.class,the_pages); - XDrawPage oDrawPage = null; - try { - oDrawPage = (XDrawPage) AnyConverter.toObject( + XDrawPage oDrawPage = (XDrawPage) AnyConverter.toObject( new Type(XDrawPage.class),oDPi.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't get DrawPage", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't get DrawPage", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't get DrawPage", e); - } //put something on the drawpage log.println( "inserting some Shapes" ); @@ -201,12 +182,7 @@ public class DrawController_NotesView extends TestCase { util.utils.pause(1000); log.println("switch to HandoutView..."); - try{ - utils.dispatchURL(xMSF, xDrawDoc, ".uno:NotesMode"); - } catch (Exception e){ - e.printStackTrace(log); - throw new StatusException(e, Status.failed(e.getMessage())); - } + utils.dispatchURL(xMSF, xDrawDoc, ".uno:NotesMode"); utils.pause(500); @@ -231,14 +207,10 @@ public class DrawController_NotesView extends TestCase { Object oShapeCol1 = null; Object oShapeCol2 = null; - try { - oShapeCol1 = xMSF. - createInstance("com.sun.star.drawing.ShapeCollection"); - oShapeCol2 = xMSF. - createInstance("com.sun.star.drawing.ShapeCollection"); - } catch(com.sun.star.uno.Exception e) { - throw new StatusException(e, Status.failed("Couldn't create instance")); - } + oShapeCol1 = xMSF. + createInstance("com.sun.star.drawing.ShapeCollection"); + oShapeCol2 = xMSF. + createInstance("com.sun.star.drawing.ShapeCollection"); XShapes xShapes1 = UnoRuntime.queryInterface(XShapes.class, oShapeCol1); XShapes xShapes2 = UnoRuntime.queryInterface(XShapes.class, oShapeCol2); diff --git a/qadevOOo/tests/java/mod/_sd/DrawController_OutlineView.java b/qadevOOo/tests/java/mod/_sd/DrawController_OutlineView.java index c07db130da75..5ea062d56ab4 100644 --- a/qadevOOo/tests/java/mod/_sd/DrawController_OutlineView.java +++ b/qadevOOo/tests/java/mod/_sd/DrawController_OutlineView.java @@ -21,8 +21,6 @@ package mod._sd; import java.io.PrintWriter; import java.util.Comparator; -import lib.Status; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -147,23 +145,18 @@ public class DrawController_OutlineView extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment - (TestParameters Param, PrintWriter log) { + (TestParameters Param, PrintWriter log) throws Exception { log.println( "creating a test environment" ); XMultiServiceFactory xMSF = Param.getMSF(); // get a soffice factory object SOfficeFactory SOF = SOfficeFactory.getFactory(xMSF); - try { - log.println( "creating two impress documents" ); - xSecondDrawDoc = SOF.createImpressDoc(null); - util.utils.pause(1000); - xDrawDoc = SOF.createImpressDoc(null); - util.utils.pause(1000); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't create document", e); - } + log.println( "creating two impress documents" ); + xSecondDrawDoc = SOF.createImpressDoc(null); + util.utils.pause(1000); + xDrawDoc = SOF.createImpressDoc(null); + util.utils.pause(1000); // get the drawpage of drawing here log.println( "getting Drawpage" ); @@ -171,20 +164,8 @@ public class DrawController_OutlineView extends TestCase { XDrawPages the_pages = oDPS.getDrawPages(); XIndexAccess oDPi = UnoRuntime.queryInterface(XIndexAccess.class,the_pages); - XDrawPage oDrawPage = null; - try { - oDrawPage = (XDrawPage) AnyConverter.toObject( + XDrawPage oDrawPage = (XDrawPage) AnyConverter.toObject( new Type(XDrawPage.class),oDPi.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't get DrawPage", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't get DrawPage", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't get DrawPage", e); - } //put something on the drawpage log.println( "inserting some Shapes" ); @@ -201,12 +182,7 @@ public class DrawController_OutlineView extends TestCase { util.utils.pause(1000); log.println("switch to HandoutView..."); - try{ - utils.dispatchURL(xMSF, xDrawDoc, ".uno:OutlineMode"); - } catch (Exception e){ - e.printStackTrace(log); - throw new StatusException(e, Status.failed(e.getMessage())); - } + utils.dispatchURL(xMSF, xDrawDoc, ".uno:OutlineMode"); utils.pause(500); @@ -231,14 +207,10 @@ public class DrawController_OutlineView extends TestCase { Object oShapeCol1 = null; Object oShapeCol2 = null; - try { - oShapeCol1 = xMSF. - createInstance("com.sun.star.drawing.ShapeCollection"); - oShapeCol2 = xMSF. - createInstance("com.sun.star.drawing.ShapeCollection"); - } catch(com.sun.star.uno.Exception e) { - throw new StatusException(e, Status.failed("Couldn't create instance")); - } + oShapeCol1 = xMSF. + createInstance("com.sun.star.drawing.ShapeCollection"); + oShapeCol2 = xMSF. + createInstance("com.sun.star.drawing.ShapeCollection"); XShapes xShapes1 = UnoRuntime.queryInterface(XShapes.class, oShapeCol1); XShapes xShapes2 = UnoRuntime.queryInterface(XShapes.class, oShapeCol2); diff --git a/qadevOOo/tests/java/mod/_sd/DrawController_PresentationView.java b/qadevOOo/tests/java/mod/_sd/DrawController_PresentationView.java index 437b3f01ce61..efae4cdd98bf 100644 --- a/qadevOOo/tests/java/mod/_sd/DrawController_PresentationView.java +++ b/qadevOOo/tests/java/mod/_sd/DrawController_PresentationView.java @@ -21,8 +21,6 @@ package mod._sd; import java.io.PrintWriter; import java.util.Comparator; -import lib.Status; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -147,23 +145,18 @@ public class DrawController_PresentationView extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment - (TestParameters Param, PrintWriter log) { + (TestParameters Param, PrintWriter log) throws Exception { log.println( "creating a test environment" ); XMultiServiceFactory xMSF = Param.getMSF(); // get a soffice factory object SOfficeFactory SOF = SOfficeFactory.getFactory(xMSF); - try { - log.println( "creating two impress documents" ); - xSecondDrawDoc = SOF.createImpressDoc(null); - util.utils.pause(1000); - xDrawDoc = SOF.createImpressDoc(null); - util.utils.pause(1000); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't create document", e); - } + log.println( "creating two impress documents" ); + xSecondDrawDoc = SOF.createImpressDoc(null); + util.utils.pause(1000); + xDrawDoc = SOF.createImpressDoc(null); + util.utils.pause(1000); // get the drawpage of drawing here log.println( "getting Drawpage" ); @@ -171,20 +164,8 @@ public class DrawController_PresentationView extends TestCase { XDrawPages the_pages = oDPS.getDrawPages(); XIndexAccess oDPi = UnoRuntime.queryInterface(XIndexAccess.class,the_pages); - XDrawPage oDrawPage = null; - try { - oDrawPage = (XDrawPage) AnyConverter.toObject( - new Type(XDrawPage.class),oDPi.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't get DrawPage", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't get DrawPage", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't get DrawPage", e); - } + XDrawPage oDrawPage = (XDrawPage) AnyConverter.toObject( + new Type(XDrawPage.class),oDPi.getByIndex(0)); //put something on the drawpage log.println( "inserting some Shapes" ); @@ -201,12 +182,7 @@ public class DrawController_PresentationView extends TestCase { util.utils.pause(1000); log.println("switch to PresentationView..."); - try{ - utils.dispatchURL(xMSF, xDrawDoc, ".uno:DiaMode"); - } catch (Exception e){ - e.printStackTrace(log); - throw new StatusException(e, Status.failed(e.getMessage())); - } + utils.dispatchURL(xMSF, xDrawDoc, ".uno:DiaMode"); utils.pause(500); @@ -231,14 +207,10 @@ public class DrawController_PresentationView extends TestCase { Object oShapeCol1 = null; Object oShapeCol2 = null; - try { - oShapeCol1 = xMSF. - createInstance("com.sun.star.drawing.ShapeCollection"); - oShapeCol2 = xMSF. - createInstance("com.sun.star.drawing.ShapeCollection"); - } catch(com.sun.star.uno.Exception e) { - throw new StatusException(e, Status.failed("Couldn't create instance")); - } + oShapeCol1 = xMSF. + createInstance("com.sun.star.drawing.ShapeCollection"); + oShapeCol2 = xMSF. + createInstance("com.sun.star.drawing.ShapeCollection"); XShapes xShapes1 = UnoRuntime.queryInterface(XShapes.class, oShapeCol1); XShapes xShapes2 = UnoRuntime.queryInterface(XShapes.class, oShapeCol2); diff --git a/qadevOOo/tests/java/mod/_sd/SdDrawPage.java b/qadevOOo/tests/java/mod/_sd/SdDrawPage.java index 98fcdd754dfc..d3a3c93de774 100644 --- a/qadevOOo/tests/java/mod/_sd/SdDrawPage.java +++ b/qadevOOo/tests/java/mod/_sd/SdDrawPage.java @@ -138,7 +138,7 @@ public class SdDrawPage extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) { + TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; @@ -154,19 +154,8 @@ public class SdDrawPage extends TestCase { XDrawPagesSupplier oDPS = UnoRuntime.queryInterface(XDrawPagesSupplier.class, xDrawDoc); XDrawPages oDPn = oDPS.getDrawPages(); XIndexAccess oDPi = UnoRuntime.queryInterface(XIndexAccess.class,oDPn); - try { - oObj = (XDrawPage) AnyConverter.toObject( - new Type(XDrawPage.class),oDPi.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace( log ); - throw new StatusException( "Couldn't get DrawPage", e ); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace( log ); - throw new StatusException( "Couldn't get DrawPage", e ); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace( log ); - throw new StatusException( "Couldn't get DrawPage", e ); - } + oObj = (XDrawPage) AnyConverter.toObject( + new Type(XDrawPage.class),oDPi.getByIndex(0)); //put something on the drawpage log.println( "inserting some Shapes" ); diff --git a/qadevOOo/tests/java/mod/_sd/SdGenericDrawPage.java b/qadevOOo/tests/java/mod/_sd/SdGenericDrawPage.java index 5e848b609c9a..4c3c2ce6b9a4 100644 --- a/qadevOOo/tests/java/mod/_sd/SdGenericDrawPage.java +++ b/qadevOOo/tests/java/mod/_sd/SdGenericDrawPage.java @@ -127,7 +127,7 @@ public class SdGenericDrawPage extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) { + TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; XShapes oShapes = null; @@ -145,13 +145,8 @@ public class SdGenericDrawPage extends TestCase { XDrawPages oDPn = oDPS.getDrawPages(); XIndexAccess oDPi = UnoRuntime.queryInterface (XIndexAccess.class,oDPn); - try { - oObj = (XDrawPage) AnyConverter.toObject( - new Type(XDrawPage.class),oDPi.getByIndex(0)); - } catch(com.sun.star.uno.Exception e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't get DrawPage", e); - } + oObj = (XDrawPage) AnyConverter.toObject( + new Type(XDrawPage.class),oDPi.getByIndex(0)); //put something on the drawpage log.println( "inserting some Shapes" ); diff --git a/qadevOOo/tests/java/mod/_sd/SdLayer.java b/qadevOOo/tests/java/mod/_sd/SdLayer.java index 9e1a38ff40f6..3d55be4e4832 100644 --- a/qadevOOo/tests/java/mod/_sd/SdLayer.java +++ b/qadevOOo/tests/java/mod/_sd/SdLayer.java @@ -89,7 +89,7 @@ public class SdLayer extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) { + TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; XLayerManager oLM = null; @@ -105,19 +105,8 @@ public class SdLayer extends TestCase { oLM = UnoRuntime.queryInterface(XLayerManager.class, oNA); XIndexAccess oIA = UnoRuntime.queryInterface(XIndexAccess.class,oLM); log.println( "getting LayerManager" ); - try { - oObj = (XLayer) AnyConverter.toObject( - new Type(XLayer.class),oIA.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't get by index", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't get by index", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't get by index", e); - } + oObj = (XLayer) AnyConverter.toObject( + new Type(XLayer.class),oIA.getByIndex(0)); log.println( "creating a new environment for drawpage object" ); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_sd/SdLayerManager.java b/qadevOOo/tests/java/mod/_sd/SdLayerManager.java index 4d2f7c4568cd..895beb26f09a 100644 --- a/qadevOOo/tests/java/mod/_sd/SdLayerManager.java +++ b/qadevOOo/tests/java/mod/_sd/SdLayerManager.java @@ -109,7 +109,7 @@ public class SdLayerManager extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) { + TestParameters Param, PrintWriter log) throws Exception { // creation of testobject here // first we write what we are intend to do to log file @@ -133,20 +133,8 @@ public class SdLayerManager extends TestCase { XDrawPages oDPn = oDPS.getDrawPages(); XIndexAccess oDPi = UnoRuntime.queryInterface(XIndexAccess.class,oDPn); - XDrawPage oDP = null; - try { - oDP = (XDrawPage) AnyConverter.toObject( - new Type(XDrawPage.class),oDPi.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't get by index", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't get by index", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't get by index", e); - } + XDrawPage oDP = (XDrawPage) AnyConverter.toObject( + new Type(XDrawPage.class),oDPi.getByIndex(0)); XShapes oShapes = UnoRuntime.queryInterface(XShapes.class, oDP); diff --git a/qadevOOo/tests/java/mod/_sd/SdMasterPage.java b/qadevOOo/tests/java/mod/_sd/SdMasterPage.java index 4be449b03f81..fb833c24d541 100644 --- a/qadevOOo/tests/java/mod/_sd/SdMasterPage.java +++ b/qadevOOo/tests/java/mod/_sd/SdMasterPage.java @@ -128,7 +128,7 @@ public class SdMasterPage extends TestCase { */ @Override protected TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) { + TestParameters Param, PrintWriter log) throws Exception { log.println( "creating a test environment" ); @@ -139,20 +139,8 @@ public class SdMasterPage extends TestCase { XIndexAccess oMPi = UnoRuntime.queryInterface(XIndexAccess.class, oMPn); log.println( "getting MasterPage" ); - XInterface oObj = null; - try { - oObj = (XDrawPage) AnyConverter.toObject( - new Type(XDrawPage.class),oMPi.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't get MasterPage by index", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't get MasterPage by index", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't get MasterPage by index", e); - } + XInterface oObj = (XDrawPage) AnyConverter.toObject( + new Type(XDrawPage.class),oMPi.getByIndex(0)); // get a soffice factory object SOfficeFactory SOF = SOfficeFactory.getFactory( diff --git a/qadevOOo/tests/java/mod/_sd/SdPageLinkTargets.java b/qadevOOo/tests/java/mod/_sd/SdPageLinkTargets.java index 1569fea0613c..294fdfb111f9 100644 --- a/qadevOOo/tests/java/mod/_sd/SdPageLinkTargets.java +++ b/qadevOOo/tests/java/mod/_sd/SdPageLinkTargets.java @@ -93,7 +93,7 @@ public class SdPageLinkTargets extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) throws StatusException { + TestParameters Param, PrintWriter log) throws Exception { // creation of testobject here // first we write what we are intend to do to log file @@ -116,22 +116,8 @@ public class SdPageLinkTargets extends TestCase { log.println("Inserting a Chart"); - try { - shape_props. - setPropertyValue("CLSID","12DCAE26-281F-416F-a234-c3086127382e"); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("WrappedTarget: couldn't change property CLSID", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("IllegalArgument: couldn't change property CLSID", e); - } catch (com.sun.star.beans.PropertyVetoException e) { - e.printStackTrace(log); - throw new StatusException("PropertyVeto: couldn't change property CLSID", e); - } catch (com.sun.star.beans.UnknownPropertyException e) { - e.printStackTrace(log); - throw new StatusException("UnknownProperty: couldn't change property CLSID", e); - } + shape_props. + setPropertyValue("CLSID","12DCAE26-281F-416F-a234-c3086127382e"); log.println( "creating a new environment for LinkTargets object" ); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_sd/SdUnoDrawView.java b/qadevOOo/tests/java/mod/_sd/SdUnoDrawView.java index 86f242c31552..9f71eb65d993 100644 --- a/qadevOOo/tests/java/mod/_sd/SdUnoDrawView.java +++ b/qadevOOo/tests/java/mod/_sd/SdUnoDrawView.java @@ -21,7 +21,6 @@ package mod._sd; import java.io.PrintWriter; import java.util.Comparator; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -142,7 +141,7 @@ public class SdUnoDrawView extends TestCase { */ @Override public synchronized lib.TestEnvironment createTestEnvironment - (TestParameters Param, PrintWriter log) { + (TestParameters Param, PrintWriter log) throws Exception { log.println( "creating a test environment" ); @@ -150,16 +149,11 @@ public class SdUnoDrawView extends TestCase { SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF()); - try { - log.println( "creating two draw documents" ); - xDrawDoc = SOF.createDrawDoc(null); - util.utils.pause(1000); - xSecondDrawDoc = SOF.createDrawDoc(null); - util.utils.pause(1000); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't create document", e); - } + log.println( "creating two draw documents" ); + xDrawDoc = SOF.createDrawDoc(null); + util.utils.pause(1000); + xSecondDrawDoc = SOF.createDrawDoc(null); + util.utils.pause(1000); // get the drawpage of drawing here log.println( "getting Drawpage" ); @@ -167,20 +161,8 @@ public class SdUnoDrawView extends TestCase { XDrawPages the_pages = oDPS.getDrawPages(); XIndexAccess oDPi = UnoRuntime.queryInterface(XIndexAccess.class,the_pages); - XDrawPage oDrawPage = null; - try { - oDrawPage = (XDrawPage) AnyConverter.toObject( - new Type(XDrawPage.class),oDPi.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't get DrawPage", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't get DrawPage", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't get DrawPage", e); - } + XDrawPage oDrawPage = (XDrawPage) AnyConverter.toObject( + new Type(XDrawPage.class),oDPi.getByIndex(0)); //put something on the drawpage log.println( "inserting some Shapes" ); diff --git a/qadevOOo/tests/java/mod/_sd/SdUnoOutlineView.java b/qadevOOo/tests/java/mod/_sd/SdUnoOutlineView.java index 69fb8b7ea7c1..c155b123bbb5 100644 --- a/qadevOOo/tests/java/mod/_sd/SdUnoOutlineView.java +++ b/qadevOOo/tests/java/mod/_sd/SdUnoOutlineView.java @@ -20,7 +20,6 @@ package mod._sd; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -127,21 +126,16 @@ public class SdUnoOutlineView extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment - (TestParameters Param, PrintWriter log) { + (TestParameters Param, PrintWriter log) throws Exception { log.println( "creating a test environment" ); // get a soffice factory object SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF()); - try { - log.println( "creating a impress document" ); - xImpressDoc = SOF.createImpressDoc(null); - util.utils.pause(5000); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't create document", e); - } + log.println( "creating a impress document" ); + xImpressDoc = SOF.createImpressDoc(null); + util.utils.pause(5000); XDrawPagesSupplier oDPS = UnoRuntime.queryInterface(XDrawPagesSupplier.class, xImpressDoc); XDrawPages the_pages = oDPS.getDrawPages(); @@ -156,7 +150,7 @@ public class SdUnoOutlineView extends TestCase { String aSlotID = "slot:27010"; XDispatchProvider xDispProv = UnoRuntime.queryInterface( XDispatchProvider.class, oObj ); XURLTransformer xParser = UnoRuntime.queryInterface(XURLTransformer.class, - Param.getMSF().createInstance("com.sun.star.util.URLTransformer")); + Param.getMSF().createInstance("com.sun.star.util.URLTransformer")); // Because it's an in/out parameter we must use an array of URL objects. URL[] aParseURL = new URL[1]; aParseURL[0] = new URL(); @@ -170,14 +164,9 @@ public class SdUnoOutlineView extends TestCase { log.println("Couldn't change mode"); } - try { - log.println( "creating a second impress document" ); - xSecondDrawDoc = SOF.createImpressDoc(null); - util.utils.pause(5000); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't create document", e); - } + log.println( "creating a second impress document" ); + xSecondDrawDoc = SOF.createImpressDoc(null); + util.utils.pause(5000); XModel aModel2 = UnoRuntime.queryInterface(XModel.class, xSecondDrawDoc); diff --git a/qadevOOo/tests/java/mod/_sd/SdUnoPresView.java b/qadevOOo/tests/java/mod/_sd/SdUnoPresView.java index 788a17630611..2c0f1eb38bd5 100644 --- a/qadevOOo/tests/java/mod/_sd/SdUnoPresView.java +++ b/qadevOOo/tests/java/mod/_sd/SdUnoPresView.java @@ -21,7 +21,6 @@ package mod._sd; import java.io.PrintWriter; import java.util.Comparator; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -140,7 +139,7 @@ public class SdUnoPresView extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment - (TestParameters Param, PrintWriter log) { + (TestParameters Param, PrintWriter log) throws Exception { log.println( "creating a test environment" ); @@ -148,15 +147,10 @@ public class SdUnoPresView extends TestCase { SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF()); - try { - log.println( "creating two impress documents" ); - xImpressDoc = SOF.createImpressDoc(null); - xSecondDrawDoc = SOF.createImpressDoc(null); - util.utils.pause(5000); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't create document", e); - } + log.println( "creating two impress documents" ); + xImpressDoc = SOF.createImpressDoc(null); + xSecondDrawDoc = SOF.createImpressDoc(null); + util.utils.pause(5000); // get the drawpage of drawing here log.println( "getting Drawpage" ); @@ -166,25 +160,14 @@ public class SdUnoPresView extends TestCase { XDrawPage oDrawPage = null; XDrawPage secondDrawPage = null; - try { - oDrawPage = (XDrawPage) AnyConverter.toObject( - new Type(XDrawPage.class),oDPi.getByIndex(0)); - the_pages.insertNewByIndex(0); - the_pages.insertNewByIndex(0); - the_pages.insertNewByIndex(0); - the_pages.insertNewByIndex(0); - secondDrawPage = (XDrawPage) AnyConverter.toObject( - new Type(XDrawPage.class),oDPi.getByIndex(3)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't get DrawPage", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't get DrawPage", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't get DrawPage", e); - } + oDrawPage = (XDrawPage) AnyConverter.toObject( + new Type(XDrawPage.class),oDPi.getByIndex(0)); + the_pages.insertNewByIndex(0); + the_pages.insertNewByIndex(0); + the_pages.insertNewByIndex(0); + the_pages.insertNewByIndex(0); + secondDrawPage = (XDrawPage) AnyConverter.toObject( + new Type(XDrawPage.class),oDPi.getByIndex(3)); //put something on the drawpage log.println( "inserting some Shapes" ); diff --git a/qadevOOo/tests/java/mod/_sd/SdUnoSlideView.java b/qadevOOo/tests/java/mod/_sd/SdUnoSlideView.java index f55a37059432..769f58f17418 100644 --- a/qadevOOo/tests/java/mod/_sd/SdUnoSlideView.java +++ b/qadevOOo/tests/java/mod/_sd/SdUnoSlideView.java @@ -19,9 +19,9 @@ package mod._sd; import com.sun.star.drawing.XDrawPages; + import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -99,24 +99,19 @@ public class SdUnoSlideView extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment - (TestParameters Param, PrintWriter log) { + (TestParameters Param, PrintWriter log) throws Exception { log.println( "creating a test environment" ); // get a soffice factory object SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF()); XDrawPages xDP = null; - try { - log.println( "creating a impress document" ); - xImpressDoc = SOF.createImpressDoc(null); - util.utils.pause(1000); - xDP = DrawTools.getDrawPages(xImpressDoc); - xDP.insertNewByIndex(0); - xDP.insertNewByIndex(0); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't create document", e); - } + log.println( "creating a impress document" ); + xImpressDoc = SOF.createImpressDoc(null); + util.utils.pause(1000); + xDP = DrawTools.getDrawPages(xImpressDoc); + xDP.insertNewByIndex(0); + xDP.insertNewByIndex(0); XModel aModel = UnoRuntime.queryInterface(XModel.class, xImpressDoc); @@ -127,7 +122,7 @@ public class SdUnoSlideView extends TestCase { String aSlotID = "slot:27011"; XDispatchProvider xDispProv = UnoRuntime.queryInterface( XDispatchProvider.class, oObj ); XURLTransformer xParser = UnoRuntime.queryInterface(XURLTransformer.class, - Param.getMSF().createInstance("com.sun.star.util.URLTransformer")); + Param.getMSF().createInstance("com.sun.star.util.URLTransformer")); // Because it's an in/out parameter we must use an array of URL objects. URL[] aParseURL = new URL[1]; aParseURL[0] = new URL(); @@ -141,14 +136,9 @@ public class SdUnoSlideView extends TestCase { log.println("Couldn't change to slide view"); } - try { - log.println( "creating a second impress document" ); - xSecondDrawDoc = SOF.createImpressDoc(null); - util.utils.pause(1000); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't create document", e); - } + log.println( "creating a second impress document" ); + xSecondDrawDoc = SOF.createImpressDoc(null); + util.utils.pause(1000); XModel aModel2 = UnoRuntime.queryInterface(XModel.class, xSecondDrawDoc); diff --git a/qadevOOo/tests/java/mod/_sd/SdXCustomPresentation.java b/qadevOOo/tests/java/mod/_sd/SdXCustomPresentation.java index 9c2a4acc8875..db7027d790bb 100644 --- a/qadevOOo/tests/java/mod/_sd/SdXCustomPresentation.java +++ b/qadevOOo/tests/java/mod/_sd/SdXCustomPresentation.java @@ -118,7 +118,7 @@ public class SdXCustomPresentation extends TestCase { */ @Override protected TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) { + TestParameters Param, PrintWriter log) throws Exception { log.println( "creating a test environment" ); @@ -130,28 +130,11 @@ public class SdXCustomPresentation extends TestCase { XSingleServiceFactory oSingleMSF = UnoRuntime.queryInterface(XSingleServiceFactory.class, oObj); - XInterface oInstance = null; - try { - oInstance = (XInterface) oSingleMSF.createInstance(); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create instance", e); - } + XInterface oInstance = (XInterface) oSingleMSF.createInstance(); XNameContainer aContainer = UnoRuntime.queryInterface(XNameContainer.class, oObj); - try { - aContainer.insertByName("FirstPresentation", oInstance); - } catch (com.sun.star.lang.WrappedTargetException e){ - e.printStackTrace(log); - throw new StatusException("Could't insert Presentation", e); - } catch (com.sun.star.container.ElementExistException e){ - e.printStackTrace(log); - throw new StatusException("Could't insert Presentation", e); - } catch (com.sun.star.lang.IllegalArgumentException e){ - e.printStackTrace(log); - throw new StatusException("Could't insert Presentation", e); - } + aContainer.insertByName("FirstPresentation", oInstance); // get the drawpage of drawing here log.println( "getting Drawpage" ); @@ -159,35 +142,12 @@ public class SdXCustomPresentation extends TestCase { XDrawPages oDPn = oDPS.getDrawPages(); XIndexAccess oDPi = UnoRuntime.queryInterface(XIndexAccess.class, oDPn); - XDrawPage oDrawPage = null; - try { - oDrawPage = (XDrawPage) AnyConverter.toObject( - new Type(XDrawPage.class),oDPi.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get by index", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get by index", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get by index", e); - } + XDrawPage oDrawPage = (XDrawPage) AnyConverter.toObject( + new Type(XDrawPage.class),oDPi.getByIndex(0)); XIndexContainer aIContainer = UnoRuntime.queryInterface(XIndexContainer.class,oInstance); - try { - aIContainer.insertByIndex(0, oDrawPage); - } catch (com.sun.star.lang.WrappedTargetException e){ - e.printStackTrace(log); - throw new StatusException("Could't insert DrawPage", e); - } catch (com.sun.star.lang.IllegalArgumentException e){ - e.printStackTrace(log); - throw new StatusException("Could't insert DrawPage", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException("Could't insert DrawPage", e); - } + aIContainer.insertByIndex(0, oDrawPage); log.println( "creating a new environment for XPresentation object" ); TestEnvironment tEnv = new TestEnvironment( oInstance ); @@ -203,24 +163,13 @@ public class SdXCustomPresentation extends TestCase { // INSTANCEn : _XNameContainer; _XNameReplace log.println( "adding INSTANCEn as mod relation to environment" ); - try { - for (int n = 1; n < (2*THRCNT+1) ;n++ ) { - log.println( "adding INSTANCE" + n - +" as mod relation to environment" ); - oDPn.insertNewByIndex(0); - oDrawPage = (XDrawPage) AnyConverter.toObject( - new Type(XDrawPage.class),oDPi.getByIndex(0)); - tEnv.addObjRelation("INSTANCE" + n, oDrawPage); - } - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Could't adding INSTANCEn", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace(log); - throw new StatusException("Could't adding INSTANCEn", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Could't adding INSTANCEn", e); + for (int n = 1; n < (2*THRCNT+1) ;n++ ) { + log.println( "adding INSTANCE" + n + +" as mod relation to environment" ); + oDPn.insertNewByIndex(0); + oDrawPage = (XDrawPage) AnyConverter.toObject( + new Type(XDrawPage.class),oDPi.getByIndex(0)); + tEnv.addObjRelation("INSTANCE" + n, oDrawPage); } return tEnv; diff --git a/qadevOOo/tests/java/mod/_sd/SdXCustomPresentationAccess.java b/qadevOOo/tests/java/mod/_sd/SdXCustomPresentationAccess.java index d97a8cbc02af..aba6c0617752 100644 --- a/qadevOOo/tests/java/mod/_sd/SdXCustomPresentationAccess.java +++ b/qadevOOo/tests/java/mod/_sd/SdXCustomPresentationAccess.java @@ -116,7 +116,7 @@ public class SdXCustomPresentationAccess extends TestCase { */ @Override public TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) throws StatusException { + TestParameters Param, PrintWriter log) throws Exception { log.println( "creating a test environment" ); @@ -131,40 +131,16 @@ public class SdXCustomPresentationAccess extends TestCase { XInterface oInstance = null; XInterface oSecondInstance = null; - try{ - oInstance = (XInterface) oSingleMSF.createInstance(); - oSecondInstance = (XInterface) oSingleMSF.createInstance(); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create instance", e); - } + oInstance = (XInterface) oSingleMSF.createInstance(); + oSecondInstance = (XInterface) oSingleMSF.createInstance(); XNameContainer aContainer = UnoRuntime.queryInterface(XNameContainer.class, oObj); if (aContainer.hasByName("FirstPresentation")) { - try { - aContainer.removeByName("FirstPresentation"); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Exception while removing instance", e); - } catch (com.sun.star.container.NoSuchElementException e) { - e.printStackTrace(log); - throw new StatusException("Exception while removing instance", e); - } + aContainer.removeByName("FirstPresentation"); } - try { - aContainer.insertByName("FirstPresentation",oInstance); - } catch (com.sun.star.lang.WrappedTargetException e){ - e.printStackTrace(log); - throw new StatusException("Could't insert Instance", e); - } catch (com.sun.star.container.ElementExistException e){ - e.printStackTrace(log); - throw new StatusException("Could't insert Instance", e); - } catch (com.sun.star.lang.IllegalArgumentException e){ - e.printStackTrace(log); - throw new StatusException("Could't insert Instance", e); - } + aContainer.insertByName("FirstPresentation",oInstance); log.println( "creating a new environment for XPresentation object" ); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_sd/SdXImpressDocument.java b/qadevOOo/tests/java/mod/_sd/SdXImpressDocument.java index feabe390ec06..6b565156963e 100644 --- a/qadevOOo/tests/java/mod/_sd/SdXImpressDocument.java +++ b/qadevOOo/tests/java/mod/_sd/SdXImpressDocument.java @@ -17,13 +17,10 @@ */ package mod._sd; -import com.sun.star.beans.PropertyVetoException; -import com.sun.star.beans.UnknownPropertyException; import com.sun.star.beans.XPropertySet; import com.sun.star.drawing.XShape; import com.sun.star.frame.XController; import com.sun.star.frame.XModel; -import com.sun.star.lang.WrappedTargetException; import com.sun.star.lang.XComponent; import com.sun.star.uno.UnoRuntime; import com.sun.star.view.XSelectionSupplier; @@ -32,7 +29,6 @@ import java.io.File; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -109,21 +105,16 @@ public class SdXImpressDocument extends TestCase { @Override public synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) - throws StatusException { + throws Exception { log.println("creating a test environment"); // get a soffice factory object SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF()); - try { - log.println("creating two impress documents"); - xImpressDoc2 = SOF.createImpressDoc(null); - xImpressDoc = SOF.createImpressDoc(null); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create documents", e); - } + log.println("creating two impress documents"); + xImpressDoc2 = SOF.createImpressDoc(null); + xImpressDoc = SOF.createImpressDoc(null); XModel xModel1 = UnoRuntime.queryInterface(XModel.class, xImpressDoc); @@ -145,22 +136,8 @@ public class SdXImpressDocument extends TestCase { XPropertySet xShapeProps = UnoRuntime.queryInterface(XPropertySet.class, aShape); - try { - xShapeProps.setPropertyValue("FillStyle", com.sun.star.drawing.FillStyle.SOLID); - xShapeProps.setPropertyValue("FillTransparence", Integer.valueOf(50)); - } catch (UnknownPropertyException ex) { - ex.printStackTrace(log); - throw new StatusException("Couldn't make shape transparent", ex); - } catch (PropertyVetoException ex) { - ex.printStackTrace(log); - throw new StatusException("Couldn't make shape transparent", ex); - } catch (com.sun.star.lang.IllegalArgumentException ex) { - ex.printStackTrace(log); - throw new StatusException("Couldn't make shape transparent", ex); - } catch (WrappedTargetException ex) { - ex.printStackTrace(log); - throw new StatusException("Couldn't make shape transparent", ex); - } + xShapeProps.setPropertyValue("FillStyle", com.sun.star.drawing.FillStyle.SOLID); + xShapeProps.setPropertyValue("FillTransparence", Integer.valueOf(50)); DrawTools.getDrawPage(xImpressDoc, 0).add(aShape); diff --git a/qadevOOo/tests/java/mod/_sd/SdXPresentation.java b/qadevOOo/tests/java/mod/_sd/SdXPresentation.java index ec541a3c3a05..110d755ea9b8 100644 --- a/qadevOOo/tests/java/mod/_sd/SdXPresentation.java +++ b/qadevOOo/tests/java/mod/_sd/SdXPresentation.java @@ -100,7 +100,7 @@ public class SdXPresentation extends TestCase { */ @Override public TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) throws StatusException { + TestParameters Param, PrintWriter log) throws Exception { // creation of testobject here // first we write what we are intend to do to log file @@ -120,27 +120,11 @@ public class SdXPresentation extends TestCase { XSingleServiceFactory oSingleMSF = UnoRuntime.queryInterface(XSingleServiceFactory.class, xCP); - try{ - oInstance = (XInterface) oSingleMSF.createInstance(); - oInstance2 = (XInterface) oSingleMSF.createInstance(); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create instance", e); - } + oInstance = (XInterface) oSingleMSF.createInstance(); + oInstance2 = (XInterface) oSingleMSF.createInstance(); - try { - xCP.insertByName("FirstPresentation",oInstance); - xCP.insertByName("SecondPresentation", oInstance2); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Could't insert Instance", e); - } catch (com.sun.star.container.ElementExistException e) { - e.printStackTrace(log); - throw new StatusException("Could't insert Instance", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Could't insert Instance", e); - } + xCP.insertByName("FirstPresentation",oInstance); + xCP.insertByName("SecondPresentation", oInstance2); log.println( "creating a new environment for XPresentation object" ); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_sd/SdXShape.java b/qadevOOo/tests/java/mod/_sd/SdXShape.java index b8586fd16646..9fb0bc0b0f41 100644 --- a/qadevOOo/tests/java/mod/_sd/SdXShape.java +++ b/qadevOOo/tests/java/mod/_sd/SdXShape.java @@ -116,7 +116,7 @@ public class SdXShape extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) { + TestParameters Param, PrintWriter log) throws Exception { log.println( "creating a test environment" ); @@ -129,20 +129,8 @@ public class SdXShape extends TestCase { XDrawPagesSupplier oDPS = UnoRuntime.queryInterface(XDrawPagesSupplier.class, xDrawDoc); XDrawPages oDPn = oDPS.getDrawPages(); XIndexAccess oDPi = UnoRuntime.queryInterface(XIndexAccess.class, oDPn); - XDrawPage oDP = null; - try { - oDP = (XDrawPage) AnyConverter.toObject( - new Type(XDrawPage.class),oDPi.getByIndex(0)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't get by index", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't get by index", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't get by index", e); - } + XDrawPage oDP = (XDrawPage) AnyConverter.toObject( + new Type(XDrawPage.class),oDPi.getByIndex(0)); //get a Shape log.println( "getting Shape" ); @@ -166,39 +154,14 @@ public class SdXShape extends TestCase { log.println( "adding two style as ObjRelation for ShapeDescriptor" ); XPropertySet oShapeProps = UnoRuntime.queryInterface(XPropertySet.class, oObj); XStyle aStyle = null; - try { - aStyle = (XStyle) AnyConverter.toObject( - new Type(XStyle.class),oShapeProps.getPropertyValue("Style")); - oShapeProps.setPropertyValue("ZOrder", Integer.valueOf(1)); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't set or get property value", e); - } catch (com.sun.star.beans.UnknownPropertyException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't set or get property value", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't set or get property value", e); - } catch (com.sun.star.beans.PropertyVetoException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't set or get property value", e); - } + aStyle = (XStyle) AnyConverter.toObject( + new Type(XStyle.class),oShapeProps.getPropertyValue("Style")); + oShapeProps.setPropertyValue("ZOrder", Integer.valueOf(1)); tEnv.addObjRelation("Style1", aStyle); oShapeProps = UnoRuntime.queryInterface(XPropertySet.class, oShape); - try { - aStyle = (XStyle) AnyConverter.toObject( - new Type(XStyle.class),oShapeProps.getPropertyValue("Style")); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get property value", e); - } catch (com.sun.star.beans.UnknownPropertyException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get property value", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get property value", e); - } + aStyle = (XStyle) AnyConverter.toObject( + new Type(XStyle.class),oShapeProps.getPropertyValue("Style")); tEnv.addObjRelation("Style2", aStyle); diff --git a/qadevOOo/tests/java/mod/_servicemgr/uno/OServiceManager.java b/qadevOOo/tests/java/mod/_servicemgr/uno/OServiceManager.java index 21dc1fb26fc6..3e904d74a722 100644 --- a/qadevOOo/tests/java/mod/_servicemgr/uno/OServiceManager.java +++ b/qadevOOo/tests/java/mod/_servicemgr/uno/OServiceManager.java @@ -25,11 +25,13 @@ import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XComponentContext; import com.sun.star.uno.XInterface; + import java.io.PrintWriter; -import lib.StatusException; + import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; + import com.sun.star.uno.AnyConverter; import com.sun.star.uno.Type; @@ -88,7 +90,7 @@ public class OServiceManager extends TestCase { */ @Override protected TestEnvironment createTestEnvironment - (TestParameters Param, PrintWriter log) { + (TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; Object oInterface = null; @@ -115,28 +117,23 @@ public class OServiceManager extends TestCase { ex.printStackTrace(log); } - try { - XSet set = UnoRuntime.queryInterface - (XSet.class, oInterface) ; - XSet set1 = UnoRuntime.queryInterface - (XSet.class, srvMan) ; - XEnumeration oEnum = set1.createEnumeration(); - Object srv = oEnum.nextElement(); - - set.insert(srv) ; - - newElement = oEnum.nextElement(); - - XPropertySet xProp = UnoRuntime.queryInterface( - XPropertySet.class, oInterface); - if (xProp != null) { - xContext = (XComponentContext) AnyConverter.toObject( - new Type(XComponentContext.class), - xProp.getPropertyValue("DefaultContext")); - } - } catch (com.sun.star.uno.Exception e) { - log.println("Can't insert a service to the ServiceManager") ; - throw new StatusException("Can't create object environment", e) ; + XSet set = UnoRuntime.queryInterface + (XSet.class, oInterface) ; + XSet set1 = UnoRuntime.queryInterface + (XSet.class, srvMan) ; + XEnumeration oEnum = set1.createEnumeration(); + Object srv = oEnum.nextElement(); + + set.insert(srv) ; + + newElement = oEnum.nextElement(); + + XPropertySet xProp = UnoRuntime.queryInterface( + XPropertySet.class, oInterface); + if (xProp != null) { + xContext = (XComponentContext) AnyConverter.toObject( + new Type(XComponentContext.class), + xProp.getPropertyValue("DefaultContext")); } oObj = (XInterface) oInterface; diff --git a/qadevOOo/tests/java/mod/_sfx/AppDispatchProvider.java b/qadevOOo/tests/java/mod/_sfx/AppDispatchProvider.java index 8a8b69b850da..b2516f95003a 100644 --- a/qadevOOo/tests/java/mod/_sfx/AppDispatchProvider.java +++ b/qadevOOo/tests/java/mod/_sfx/AppDispatchProvider.java @@ -59,19 +59,13 @@ public class AppDispatchProvider extends TestCase { */ @Override protected TestEnvironment createTestEnvironment - (TestParameters Param, PrintWriter log) { + (TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; Object oInterface = null ; //now get the OButtonControl - try { - oInterface = Param.getMSF().createInstance - ("com.sun.star.comp.sfx2.AppDispatchProvider") ; - } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't get service"); - e.printStackTrace(log); - throw new StatusException("Couldn't get GridControl", e ); - } + oInterface = Param.getMSF().createInstance + ("com.sun.star.comp.sfx2.AppDispatchProvider") ; if (oInterface == null) { log.println("Service wasn't created") ; diff --git a/qadevOOo/tests/java/mod/_sfx/DocumentTemplates.java b/qadevOOo/tests/java/mod/_sfx/DocumentTemplates.java index 668cb2cc619d..082d861b34e2 100644 --- a/qadevOOo/tests/java/mod/_sfx/DocumentTemplates.java +++ b/qadevOOo/tests/java/mod/_sfx/DocumentTemplates.java @@ -20,7 +20,6 @@ package mod._sfx; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -64,21 +63,16 @@ public class DocumentTemplates extends TestCase { */ @Override protected TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log) { + (TestParameters tParam, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF(); XInterface oObj = null; XStorable store = null; - try { - oObj = (XInterface)xMSF.createInstance - ("com.sun.star.frame.DocumentTemplates"); - store = UnoRuntime.queryInterface - (XStorable.class,xTextDoc); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Unexpected exception", e); - } + oObj = (XInterface)xMSF.createInstance + ("com.sun.star.frame.DocumentTemplates"); + store = UnoRuntime.queryInterface + (XStorable.class,xTextDoc); String Iname = util.utils.getImplName(oObj); log.println("Implementation Name: "+Iname); diff --git a/qadevOOo/tests/java/mod/_sfx/FrameLoader.java b/qadevOOo/tests/java/mod/_sfx/FrameLoader.java index 6b4d0219f128..7822d9208239 100644 --- a/qadevOOo/tests/java/mod/_sfx/FrameLoader.java +++ b/qadevOOo/tests/java/mod/_sfx/FrameLoader.java @@ -20,8 +20,6 @@ package mod._sfx; import java.io.PrintWriter; -import lib.Status; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -56,26 +54,13 @@ public class FrameLoader extends TestCase { */ @Override protected TestEnvironment createTestEnvironment - (TestParameters Param, PrintWriter log) { + (TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; Object oInterface = null ; //now get the OButtonControl - try { - oInterface = Param.getMSF().createInstance - ("com.sun.star.comp.office.FrameLoader") ; - - } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't get service"); - e.printStackTrace(log); - throw new StatusException("Couldn't get GridControl", e ); - } - - if (oInterface == null) { - log.println("Service wasn't created") ; - throw new StatusException - (Status.failed("Service wasn't created")) ; - } + oInterface = Param.getMSF().createInstance + ("com.sun.star.comp.office.FrameLoader") ; oObj = (XInterface) oInterface ; System.out.println("ImplName: "+utils.getImplName(oObj)); diff --git a/qadevOOo/tests/java/mod/_sfx/SfxMacroLoader.java b/qadevOOo/tests/java/mod/_sfx/SfxMacroLoader.java index bf574d46f0a2..9d2fbb4d9b3b 100644 --- a/qadevOOo/tests/java/mod/_sfx/SfxMacroLoader.java +++ b/qadevOOo/tests/java/mod/_sfx/SfxMacroLoader.java @@ -20,8 +20,6 @@ package mod._sfx; import java.io.PrintWriter; -import lib.Status; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -59,24 +57,13 @@ public class SfxMacroLoader extends TestCase { */ @Override protected TestEnvironment createTestEnvironment - (TestParameters Param, PrintWriter log) { + (TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; Object oInterface = null ; //now get the OButtonControl - try { - oInterface = Param.getMSF().createInstance - ("com.sun.star.comp.sfx2.SfxMacroLoader"); - } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't get service"); - e.printStackTrace(log); - throw new StatusException("Couldn't get GridControl", e ); - } - - if (oInterface == null) { - log.println("Service wasn't created") ; - throw new StatusException(Status.failed("Service wasn't created")) ; - } + oInterface = Param.getMSF().createInstance + ("com.sun.star.comp.sfx2.SfxMacroLoader"); oObj = (XInterface) oInterface ; System.out.println("ImplName: "+utils.getImplName(oObj)); diff --git a/qadevOOo/tests/java/mod/_sm/SmEditAccessible.java b/qadevOOo/tests/java/mod/_sm/SmEditAccessible.java index 68ad155820d8..f82c64c1b740 100644 --- a/qadevOOo/tests/java/mod/_sm/SmEditAccessible.java +++ b/qadevOOo/tests/java/mod/_sm/SmEditAccessible.java @@ -20,7 +20,6 @@ package mod._sm; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -67,41 +66,16 @@ public class SmEditAccessible extends TestCase { * component with the role <code>AccessibleRole.PANEL</code>. */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF() ); - try { - xMathDoc = SOF.openDoc("smath","_blank"); - } catch (com.sun.star.lang.IllegalArgumentException ex) { - ex.printStackTrace( log ); - throw new StatusException( "Couldn't create document", ex ); - } catch (com.sun.star.io.IOException ex) { - ex.printStackTrace( log ); - throw new StatusException( "Couldn't create document", ex ); - } catch (com.sun.star.uno.Exception ex) { - ex.printStackTrace( log ); - throw new StatusException( "Couldn't create document", ex ); - } + xMathDoc = SOF.openDoc("smath","_blank"); // setting a formula in document final String expFormula = "sum hat a"; final XPropertySet xPS = UnoRuntime.queryInterface (XPropertySet.class, xMathDoc); - try { - xPS.setPropertyValue("Formula", expFormula); - } catch(com.sun.star.lang.WrappedTargetException e) { - log.println("Couldn't set property value"); - e.printStackTrace(log); - } catch(com.sun.star.lang.IllegalArgumentException e) { - log.println("Couldn't set property value"); - e.printStackTrace(log); - } catch(com.sun.star.beans.PropertyVetoException e) { - log.println("Couldn't set property value"); - e.printStackTrace(log); - } catch(com.sun.star.beans.UnknownPropertyException e) { - log.println("Couldn't set property value"); - e.printStackTrace(log); - } + xPS.setPropertyValue("Formula", expFormula); XInterface oObj = null; diff --git a/qadevOOo/tests/java/mod/_sm/SmGraphicAccessible.java b/qadevOOo/tests/java/mod/_sm/SmGraphicAccessible.java index 6c9bc29a4917..8a960b088f39 100644 --- a/qadevOOo/tests/java/mod/_sm/SmGraphicAccessible.java +++ b/qadevOOo/tests/java/mod/_sm/SmGraphicAccessible.java @@ -20,7 +20,6 @@ package mod._sm; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -69,41 +68,16 @@ public class SmGraphicAccessible extends TestCase { * component with the role <code>AccessibleRole.PANEL</code>. */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF() ); - try { - xMathDoc = SOF.openDoc("smath","_blank"); - } catch (com.sun.star.lang.IllegalArgumentException ex) { - ex.printStackTrace( log ); - throw new StatusException( "Couldn't create document", ex ); - } catch (com.sun.star.io.IOException ex) { - ex.printStackTrace( log ); - throw new StatusException( "Couldn't create document", ex ); - } catch (com.sun.star.uno.Exception ex) { - ex.printStackTrace( log ); - throw new StatusException( "Couldn't create document", ex ); - } + xMathDoc = SOF.openDoc("smath","_blank"); // setting a formula in document final String expFormula = "sum a cdot b"; final XPropertySet xPS = UnoRuntime.queryInterface (XPropertySet.class, xMathDoc); - try { - xPS.setPropertyValue("Formula", expFormula); - } catch(com.sun.star.lang.WrappedTargetException e) { - log.println("Couldn't set property value"); - e.printStackTrace(log); - } catch(com.sun.star.lang.IllegalArgumentException e) { - log.println("Couldn't set property value"); - e.printStackTrace(log); - } catch(com.sun.star.beans.PropertyVetoException e) { - log.println("Couldn't set property value"); - e.printStackTrace(log); - } catch(com.sun.star.beans.UnknownPropertyException e) { - log.println("Couldn't set property value"); - e.printStackTrace(log); - } + xPS.setPropertyValue("Formula", expFormula); XInterface oObj = null; diff --git a/qadevOOo/tests/java/mod/_sm/SmModel.java b/qadevOOo/tests/java/mod/_sm/SmModel.java index ea02d12f4044..d2db6f0d13a1 100644 --- a/qadevOOo/tests/java/mod/_sm/SmModel.java +++ b/qadevOOo/tests/java/mod/_sm/SmModel.java @@ -20,7 +20,6 @@ package mod._sm; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -54,21 +53,10 @@ public class SmModel extends TestCase { @Override public synchronized TestEnvironment createTestEnvironment ( TestParameters Param, PrintWriter log ) - throws StatusException { + throws Exception { SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF() ); - try { - xMathDoc = SOF.openDoc("smath","_blank"); - } catch (com.sun.star.lang.IllegalArgumentException ex) { - ex.printStackTrace( log ); - throw new StatusException( "Couldn't create document", ex ); - } catch (com.sun.star.io.IOException ex) { - ex.printStackTrace( log ); - throw new StatusException( "Couldn't create document", ex ); - } catch (com.sun.star.uno.Exception ex) { - ex.printStackTrace( log ); - throw new StatusException( "Couldn't create document", ex ); - } + xMathDoc = SOF.openDoc("smath","_blank"); String Iname = util.utils.getImplName(xMathDoc); log.println("Implementation Name: "+Iname); diff --git a/qadevOOo/tests/java/mod/_sm/XMLImporter.java b/qadevOOo/tests/java/mod/_sm/XMLImporter.java index 52973b5f3b7d..9b5547764acb 100644 --- a/qadevOOo/tests/java/mod/_sm/XMLImporter.java +++ b/qadevOOo/tests/java/mod/_sm/XMLImporter.java @@ -107,19 +107,14 @@ public class XMLImporter extends TestCase { @Override public synchronized TestEnvironment createTestEnvironment ( TestParameters Param, PrintWriter log ) - throws StatusException { + throws Exception { XMultiServiceFactory xMSF = Param.getMSF(); XInterface oObj = null; final String impFormula = "a - b" ; - try { - oObj = (XInterface)xMSF.createInstance( - "com.sun.star.comp.Math.XMLImporter"); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Unexpected exception", e); - } + oObj = (XInterface)xMSF.createInstance( + "com.sun.star.comp.Math.XMLImporter"); TestEnvironment tEnv = new TestEnvironment(oObj); diff --git a/qadevOOo/tests/java/mod/_sm/XMLMetaExporter.java b/qadevOOo/tests/java/mod/_sm/XMLMetaExporter.java index fe11cca5e911..ce65362014ff 100644 --- a/qadevOOo/tests/java/mod/_sm/XMLMetaExporter.java +++ b/qadevOOo/tests/java/mod/_sm/XMLMetaExporter.java @@ -113,7 +113,7 @@ public class XMLMetaExporter extends TestCase { */ @Override protected TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log) { + (TestParameters tParam, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF() ; XInterface oObj = null; final String expName = "XMLMetaExporterName" ; @@ -122,23 +122,18 @@ public class XMLMetaExporter extends TestCase { FilterChecker filter = new FilterChecker(log); Any arg = new Any(new Type(XDocumentHandler.class), filter); - try { - oObj = (XInterface) xMSF.createInstanceWithArguments( - "com.sun.star.comp.Math.XMLMetaExporter", new Object[] {arg}); - XExporter xEx = UnoRuntime.queryInterface - (XExporter.class,oObj); - xEx.setSourceDocument(xMathDoc); - - // setting a new name and value for user info field - XDocumentPropertiesSupplier xPropSup = UnoRuntime.queryInterface - (XDocumentPropertiesSupplier.class, xMathDoc); - final XDocumentProperties xDocProps = xPropSup.getDocumentProperties(); - XPropertyContainer xProps = xDocProps.getUserDefinedProperties(); - xProps.addProperty(expName, (short)0, expValue); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oObj = (XInterface) xMSF.createInstanceWithArguments( + "com.sun.star.comp.Math.XMLMetaExporter", new Object[] {arg}); + XExporter xEx = UnoRuntime.queryInterface + (XExporter.class,oObj); + xEx.setSourceDocument(xMathDoc); + + // setting a new name and value for user info field + XDocumentPropertiesSupplier xPropSup = UnoRuntime.queryInterface + (XDocumentPropertiesSupplier.class, xMathDoc); + final XDocumentProperties xDocProps = xPropSup.getDocumentProperties(); + XPropertyContainer xProps = xDocProps.getUserDefinedProperties(); + xProps.addProperty(expName, (short)0, expValue); // checking tags required filter.addTag(new XMLTools.Tag("office:document-meta")) ; diff --git a/qadevOOo/tests/java/mod/_sm/XMLMetaImporter.java b/qadevOOo/tests/java/mod/_sm/XMLMetaImporter.java index 12e076255741..5c93a185f536 100644 --- a/qadevOOo/tests/java/mod/_sm/XMLMetaImporter.java +++ b/qadevOOo/tests/java/mod/_sm/XMLMetaImporter.java @@ -111,7 +111,7 @@ public class XMLMetaImporter extends TestCase { @Override public synchronized TestEnvironment createTestEnvironment ( TestParameters Param, PrintWriter log ) - throws StatusException { + throws Exception { XMultiServiceFactory xMSF = Param.getMSF(); XInterface oObj = null; @@ -119,13 +119,8 @@ public class XMLMetaImporter extends TestCase { final String impValue = "XMLMetaImporter_Value" ; final String impTitle = "XMLMetaImporter Title" ; - try { - oObj = (XInterface)xMSF.createInstance( - "com.sun.star.comp.Math.XMLMetaImporter"); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Unexpected exception", e); - } + oObj = (XInterface)xMSF.createInstance( + "com.sun.star.comp.Math.XMLMetaImporter"); TestEnvironment tEnv = new TestEnvironment(oObj); diff --git a/qadevOOo/tests/java/mod/_sm/XMLSettingsExporter.java b/qadevOOo/tests/java/mod/_sm/XMLSettingsExporter.java index 0f3b5a9add2b..ca2aa1939471 100644 --- a/qadevOOo/tests/java/mod/_sm/XMLSettingsExporter.java +++ b/qadevOOo/tests/java/mod/_sm/XMLSettingsExporter.java @@ -112,7 +112,7 @@ public class XMLSettingsExporter extends TestCase { */ @Override protected TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log) { + (TestParameters tParam, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF() ; XInterface oObj = null; final short expMargin = 67 ; @@ -120,23 +120,18 @@ public class XMLSettingsExporter extends TestCase { FilterChecker filter = new FilterChecker(log); Any arg = new Any(new Type(XDocumentHandler.class), filter); - try { - oObj = (XInterface) xMSF.createInstanceWithArguments( - "com.sun.star.comp.Math.XMLSettingsExporter", - new Object[] {arg}); - XExporter xEx = UnoRuntime.queryInterface - (XExporter.class,oObj); - xEx.setSourceDocument(xMathDoc); - - // setting a formula in document - XPropertySet xPS = UnoRuntime.queryInterface - (XPropertySet.class, xMathDoc) ; - - xPS.setPropertyValue("TopMargin", Short.valueOf(expMargin)) ; - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oObj = (XInterface) xMSF.createInstanceWithArguments( + "com.sun.star.comp.Math.XMLSettingsExporter", + new Object[] {arg}); + XExporter xEx = UnoRuntime.queryInterface + (XExporter.class,oObj); + xEx.setSourceDocument(xMathDoc); + + // setting a formula in document + XPropertySet xPS = UnoRuntime.queryInterface + (XPropertySet.class, xMathDoc) ; + + xPS.setPropertyValue("TopMargin", Short.valueOf(expMargin)) ; // checking tags required diff --git a/qadevOOo/tests/java/mod/_sm/XMLSettingsImporter.java b/qadevOOo/tests/java/mod/_sm/XMLSettingsImporter.java index 934d1db4d238..90cd9b68d1b4 100644 --- a/qadevOOo/tests/java/mod/_sm/XMLSettingsImporter.java +++ b/qadevOOo/tests/java/mod/_sm/XMLSettingsImporter.java @@ -107,20 +107,14 @@ public class XMLSettingsImporter extends TestCase { @Override public synchronized TestEnvironment createTestEnvironment ( TestParameters Param, PrintWriter log ) - throws StatusException { + throws Exception { XMultiServiceFactory xMSF = Param.getMSF(); XInterface oObj = null; final short impMargin = 67 ; - try { - oObj = (XInterface)xMSF.createInstance( - "com.sun.star.comp.Math.XMLSettingsImporter"); - - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Unexpected exception", e); - } + oObj = (XInterface)xMSF.createInstance( + "com.sun.star.comp.Math.XMLSettingsImporter"); TestEnvironment tEnv = new TestEnvironment(oObj); diff --git a/qadevOOo/tests/java/mod/_smgr/OServiceManager.java b/qadevOOo/tests/java/mod/_smgr/OServiceManager.java index 4ca5d032e384..797246b2ce41 100644 --- a/qadevOOo/tests/java/mod/_smgr/OServiceManager.java +++ b/qadevOOo/tests/java/mod/_smgr/OServiceManager.java @@ -20,7 +20,6 @@ package mod._smgr; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -90,7 +89,7 @@ public class OServiceManager extends TestCase { */ @Override protected TestEnvironment createTestEnvironment - (TestParameters Param, PrintWriter log) { + (TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; Object oInterface = null; @@ -117,28 +116,23 @@ public class OServiceManager extends TestCase { ex.printStackTrace(log); } - try { - XSet set = UnoRuntime.queryInterface - (XSet.class, oInterface) ; - XSet set1 = UnoRuntime.queryInterface - (XSet.class, srvMan) ; - XEnumeration oEnum = set1.createEnumeration(); - Object srv = oEnum.nextElement(); - - set.insert(srv) ; - - newElement = oEnum.nextElement(); - - XPropertySet xProp = UnoRuntime.queryInterface( - XPropertySet.class, oInterface); - if (xProp != null) { - xContext = (XComponentContext) AnyConverter.toObject( - new Type(XComponentContext.class), - xProp.getPropertyValue("DefaultContext")); - } - } catch (com.sun.star.uno.Exception e) { - log.println("Can't insert a service to the ServiceManager") ; - throw new StatusException("Can't create object environment", e) ; + XSet set = UnoRuntime.queryInterface + (XSet.class, oInterface) ; + XSet set1 = UnoRuntime.queryInterface + (XSet.class, srvMan) ; + XEnumeration oEnum = set1.createEnumeration(); + Object srv = oEnum.nextElement(); + + set.insert(srv) ; + + newElement = oEnum.nextElement(); + + XPropertySet xProp = UnoRuntime.queryInterface( + XPropertySet.class, oInterface); + if (xProp != null) { + xContext = (XComponentContext) AnyConverter.toObject( + new Type(XComponentContext.class), + xProp.getPropertyValue("DefaultContext")); } oObj = (XInterface) oInterface; diff --git a/qadevOOo/tests/java/mod/_smplmail/SimpleSystemMail.java b/qadevOOo/tests/java/mod/_smplmail/SimpleSystemMail.java index 7b58e6da0a0b..6e0d1037a8a1 100644 --- a/qadevOOo/tests/java/mod/_smplmail/SimpleSystemMail.java +++ b/qadevOOo/tests/java/mod/_smplmail/SimpleSystemMail.java @@ -20,7 +20,6 @@ package mod._smplmail; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -68,7 +67,7 @@ public class SimpleSystemMail extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { + throws Exception { XInterface oObj = null; Object oInterface = null; boolean isWinOS = false ; @@ -82,19 +81,14 @@ public class SimpleSystemMail extends TestCase { ((String) Param.get("test.system.mail.isExist")) ; XMultiServiceFactory xMSF = Param.getMSF(); - try { - if (isWinOS) { - log.println("The OS is Win : trying to create service"); - oInterface = xMSF.createInstance - ( "com.sun.star.system.SimpleSystemMail" ); - } else { - log.println("The OS is NOT Win, SKIPPING this component"); - log.println("Creating Dummy object ..."); - oInterface = xMSF.createInstance( "com.sun.star.io.Pipe" ); - } - } catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); + if (isWinOS) { + log.println("The OS is Win : trying to create service"); + oInterface = xMSF.createInstance + ( "com.sun.star.system.SimpleSystemMail" ); + } else { + log.println("The OS is NOT Win, SKIPPING this component"); + log.println("Creating Dummy object ..."); + oInterface = xMSF.createInstance( "com.sun.star.io.Pipe" ); } oObj = (XInterface) oInterface; diff --git a/qadevOOo/tests/java/mod/_stm/DataInputStream.java b/qadevOOo/tests/java/mod/_stm/DataInputStream.java index 16c30a0f2428..ee55f57fa99d 100644 --- a/qadevOOo/tests/java/mod/_stm/DataInputStream.java +++ b/qadevOOo/tests/java/mod/_stm/DataInputStream.java @@ -21,7 +21,6 @@ package mod._stm; import java.io.PrintWriter; import java.util.ArrayList; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -81,17 +80,12 @@ public class DataInputStream extends TestCase { */ @Override public TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) throws StatusException { + 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; @@ -99,26 +93,14 @@ public class DataInputStream extends TestCase { // DataInputStream created through the Pipe XActiveDataSink xDataSink = UnoRuntime.queryInterface(XActiveDataSink.class, oObj); - XInterface oPipe = null; - try { - oPipe = (XInterface) + XInterface 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); - } 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) ; @@ -140,27 +122,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/_stm/DataOutputStream.java b/qadevOOo/tests/java/mod/_stm/DataOutputStream.java index 05fe0fe64d51..ead4fc671bb2 100644 --- a/qadevOOo/tests/java/mod/_stm/DataOutputStream.java +++ b/qadevOOo/tests/java/mod/_stm/DataOutputStream.java @@ -21,7 +21,6 @@ package mod._stm; import java.io.PrintWriter; import java.util.ArrayList; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -78,22 +77,17 @@ public class DataOutputStream extends TestCase { */ @Override public TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) throws StatusException { + 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/_stm/MarkableInputStream.java b/qadevOOo/tests/java/mod/_stm/MarkableInputStream.java index 08916e076f1e..a86369867456 100644 --- a/qadevOOo/tests/java/mod/_stm/MarkableInputStream.java +++ b/qadevOOo/tests/java/mod/_stm/MarkableInputStream.java @@ -20,7 +20,6 @@ package mod._stm; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -82,7 +81,7 @@ public class MarkableInputStream extends TestCase { */ @Override public TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) throws StatusException { + TestParameters Param, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = Param.getMSF(); @@ -90,15 +89,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/_stm/MarkableOutputStream.java b/qadevOOo/tests/java/mod/_stm/MarkableOutputStream.java index f42c5c63d4df..6765ba721ef0 100644 --- a/qadevOOo/tests/java/mod/_stm/MarkableOutputStream.java +++ b/qadevOOo/tests/java/mod/_stm/MarkableOutputStream.java @@ -21,7 +21,6 @@ package mod._stm; import java.io.PrintWriter; import java.util.ArrayList; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -88,7 +87,7 @@ public class MarkableOutputStream extends TestCase { */ @Override public TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) throws StatusException { + TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; @@ -98,18 +97,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/_stm/ObjectInputStream.java b/qadevOOo/tests/java/mod/_stm/ObjectInputStream.java index 7852685ecc11..d07fe3aead5b 100644 --- a/qadevOOo/tests/java/mod/_stm/ObjectInputStream.java +++ b/qadevOOo/tests/java/mod/_stm/ObjectInputStream.java @@ -172,7 +172,7 @@ public class ObjectInputStream extends TestCase { */ @Override public TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) throws StatusException { + TestParameters Param, PrintWriter log) throws Exception { System.out.println("create TestEnvironment started."); XMultiServiceFactory xMSF = Param.getMSF(); @@ -182,24 +182,19 @@ 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") ; + 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); - } // Creating construction : // ObjectOutputStream -> MarkableOutputStream -> Pipe -> // -> MarkableInputStream -> ObjectInputStream @@ -229,16 +224,9 @@ public class ObjectInputStream extends TestCase { // creating Persist 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); // all data types for writing to an XDataInputStream ArrayList<Object> data = new ArrayList<Object>() ; diff --git a/qadevOOo/tests/java/mod/_stm/ObjectOutputStream.java b/qadevOOo/tests/java/mod/_stm/ObjectOutputStream.java index 817c577a41ba..47c0a906970e 100644 --- a/qadevOOo/tests/java/mod/_stm/ObjectOutputStream.java +++ b/qadevOOo/tests/java/mod/_stm/ObjectOutputStream.java @@ -164,7 +164,7 @@ public class ObjectOutputStream extends TestCase { */ @Override public TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) throws StatusException { + TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; @@ -177,22 +177,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); @@ -218,14 +213,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/_stm/Pipe.java b/qadevOOo/tests/java/mod/_stm/Pipe.java index f7a810be942c..facd2cafe86c 100644 --- a/qadevOOo/tests/java/mod/_stm/Pipe.java +++ b/qadevOOo/tests/java/mod/_stm/Pipe.java @@ -20,7 +20,6 @@ package mod._stm; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -60,18 +59,13 @@ public class Pipe extends TestCase { */ @Override public TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) throws StatusException { + 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/_stm/Pump.java b/qadevOOo/tests/java/mod/_stm/Pump.java index 7076a8170322..d53d6ea1efa7 100644 --- a/qadevOOo/tests/java/mod/_stm/Pump.java +++ b/qadevOOo/tests/java/mod/_stm/Pump.java @@ -20,7 +20,6 @@ package mod._stm; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -68,20 +67,15 @@ public class Pump extends TestCase { */ @Override public TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) throws StatusException { + 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; 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; diff --git a/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBox.java b/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBox.java index bc34cc9c0f86..79011ebb0066 100644 --- a/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBox.java +++ b/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBox.java @@ -19,7 +19,6 @@ package mod._svtools; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -84,7 +83,7 @@ public class AccessibleBrowseBox extends TestCase { * @see #getTestEnvironment */ @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { log.println("creating a test environment"); @@ -93,14 +92,8 @@ public class AccessibleBrowseBox extends TestCase { } SOfficeFactory SOF = SOfficeFactory.getFactory(tParam.getMSF()); - try { - log.println("creating a text document"); - xTextDoc = SOF.createTextDoc(null); - } catch (com.sun.star.uno.Exception e) { - // Some exception occurs.FAILED - e.printStackTrace(log); - throw new StatusException("Couldn't create document", e); - } + log.println("creating a text document"); + xTextDoc = SOF.createTextDoc(null); util.utils.pause(5000); diff --git a/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxHeaderBar.java b/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxHeaderBar.java index 8a4d3c2fb857..d622fc74188a 100644 --- a/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxHeaderBar.java +++ b/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxHeaderBar.java @@ -18,11 +18,11 @@ package mod._svtools; import com.sun.star.view.XSelectionSupplier; + import java.awt.Robot; import java.awt.event.InputEvent; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -113,7 +113,7 @@ public class AccessibleBrowseBoxHeaderBar extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters tParam, - PrintWriter log) { + PrintWriter log) throws Exception { log.println("creating a test environment"); if (xTextDoc != null) { @@ -123,14 +123,8 @@ public class AccessibleBrowseBoxHeaderBar extends TestCase { // get a soffice factory object SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); - try { - log.println("creating a text document"); - xTextDoc = SOF.createTextDoc(null); - } catch (com.sun.star.uno.Exception e) { - // Some exception occurs.FAILED - e.printStackTrace(log); - throw new StatusException("Couldn't create document", e); - } + log.println("creating a text document"); + xTextDoc = SOF.createTextDoc(null); util.utils.pause(5000); @@ -188,11 +182,7 @@ public class AccessibleBrowseBoxHeaderBar extends TestCase { XSelectionSupplier xSelect = UnoRuntime.queryInterface( XSelectionSupplier.class, xCont); - try { - xSelect.select(params); - } catch (com.sun.star.lang.IllegalArgumentException ex) { - throw new StatusException("Could not select Biblio-Database", ex); - } + xSelect.select(params); XInterface oObj = null; diff --git a/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxHeaderCell.java b/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxHeaderCell.java index 373307306db9..12d1071b2c9b 100644 --- a/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxHeaderCell.java +++ b/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxHeaderCell.java @@ -19,9 +19,9 @@ package mod._svtools; import com.sun.star.view.XSelectionSupplier; + import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -114,7 +114,7 @@ public class AccessibleBrowseBoxHeaderCell extends TestCase { */ @Override protected TestEnvironment createTestEnvironment( - TestParameters tParam, PrintWriter log) { + TestParameters tParam, PrintWriter log) throws Exception { log.println( "creating a test environment" ); @@ -123,14 +123,8 @@ public class AccessibleBrowseBoxHeaderCell extends TestCase { // get a soffice factory object SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); - try { - log.println( "creating a text document" ); - xTextDoc = SOF.createTextDoc(null); - } catch ( com.sun.star.uno.Exception e ) { - // Some exception occurs.FAILED - e.printStackTrace( log ); - throw new StatusException( "Couldn't create document", e ); - } + log.println( "creating a text document" ); + xTextDoc = SOF.createTextDoc(null); util.utils.pause(5000); @@ -186,11 +180,7 @@ public class AccessibleBrowseBoxHeaderCell extends TestCase { XSelectionSupplier xSelect = UnoRuntime.queryInterface( XSelectionSupplier.class, xCont); - try { - xSelect.select(params); - } catch (com.sun.star.lang.IllegalArgumentException ex) { - throw new StatusException("Could not select Biblio-Database", ex); - } + xSelect.select(params); XWindow xWindow = secondController.getFrame().getContainerWindow(); diff --git a/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxTable.java b/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxTable.java index 6cf139093d53..ef5867daf9e6 100644 --- a/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxTable.java +++ b/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxTable.java @@ -18,9 +18,9 @@ package mod._svtools; import com.sun.star.view.XSelectionSupplier; + import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -112,7 +112,7 @@ public class AccessibleBrowseBoxTable extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters tParam, - PrintWriter log) { + PrintWriter log) throws Exception { log.println("creating a test environment"); if (xTextDoc != null) { @@ -123,14 +123,8 @@ public class AccessibleBrowseBoxTable extends TestCase { SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); - try { - log.println("creating a text document"); - xTextDoc = SOF.createTextDoc(null); - } catch (com.sun.star.uno.Exception e) { - // Some exception occurs.FAILED - e.printStackTrace(log); - throw new StatusException("Couldn't create document", e); - } + log.println("creating a text document"); + xTextDoc = SOF.createTextDoc(null); util.utils.pause(5000); diff --git a/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxTableCell.java b/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxTableCell.java index 94627bb96bf4..7e3fb29c88e5 100644 --- a/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxTableCell.java +++ b/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxTableCell.java @@ -20,7 +20,6 @@ package mod._svtools; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -111,7 +110,7 @@ public class AccessibleBrowseBoxTableCell extends TestCase { * @see com.sun.star.accessibility.XAccessibleEventBroadcaster */ @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { log.println( "creating a test environment" ); @@ -120,14 +119,8 @@ public class AccessibleBrowseBoxTableCell extends TestCase { // get a soffice factory object SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); - try { - log.println( "creating a text document" ); - xTextDoc = SOF.createTextDoc(null); - } catch ( com.sun.star.uno.Exception e ) { - // Some exception occurs.FAILED - e.printStackTrace( log ); - throw new StatusException( "Couldn't create document", e ); - } + log.println( "creating a text document" ); + xTextDoc = SOF.createTextDoc(null); util.utils.pause(5000); diff --git a/qadevOOo/tests/java/mod/_svtools/AccessibleIconChoiceCtrl.java b/qadevOOo/tests/java/mod/_svtools/AccessibleIconChoiceCtrl.java index da90e9fe0501..cb2be82c6b43 100644 --- a/qadevOOo/tests/java/mod/_svtools/AccessibleIconChoiceCtrl.java +++ b/qadevOOo/tests/java/mod/_svtools/AccessibleIconChoiceCtrl.java @@ -19,7 +19,6 @@ package mod._svtools; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -133,7 +132,7 @@ public class AccessibleIconChoiceCtrl extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters tParam, - PrintWriter log) { + PrintWriter log) throws Exception { log.println("creating a test environment"); if (xTextDoc != null) { @@ -143,14 +142,8 @@ public class AccessibleIconChoiceCtrl extends TestCase { // get a soffice factory object SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); - try { - log.println("creating a text document"); - xTextDoc = SOF.createTextDoc(null); - } catch (com.sun.star.uno.Exception e) { - // Some exception occurs.FAILED - e.printStackTrace(log); - throw new StatusException("Couldn't create document", e); - } + log.println("creating a text document"); + xTextDoc = SOF.createTextDoc(null); util.utils.pause(5000); @@ -165,15 +158,10 @@ public class AccessibleIconChoiceCtrl extends TestCase { XURLTransformer urlTransf = null; - try { - XInterface transf = (XInterface) tParam.getMSF() - .createInstance("com.sun.star.util.URLTransformer"); - urlTransf = UnoRuntime.queryInterface( - XURLTransformer.class, transf); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create URLTransformer", e); - } + XInterface transf = (XInterface) tParam.getMSF() + .createInstance("com.sun.star.util.URLTransformer"); + urlTransf = UnoRuntime.queryInterface( + XURLTransformer.class, transf); XDispatch getting = null; log.println("opening HyperlinkDialog"); @@ -189,16 +177,8 @@ public class AccessibleIconChoiceCtrl extends TestCase { util.utils.pause(5000); - XInterface oObj = null; - - try { - oObj = (XInterface) tParam.getMSF() + XInterface oObj = (XInterface) tParam.getMSF() .createInstance("com.sun.star.awt.Toolkit"); - } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't get toolkit"); - e.printStackTrace(log); - throw new StatusException("Couldn't get toolkit", e); - } XExtendedToolkit tk = UnoRuntime.queryInterface( XExtendedToolkit.class, oObj); diff --git a/qadevOOo/tests/java/mod/_svtools/AccessibleIconChoiceCtrlEntry.java b/qadevOOo/tests/java/mod/_svtools/AccessibleIconChoiceCtrlEntry.java index b979ec1088ad..8499e80459d5 100644 --- a/qadevOOo/tests/java/mod/_svtools/AccessibleIconChoiceCtrlEntry.java +++ b/qadevOOo/tests/java/mod/_svtools/AccessibleIconChoiceCtrlEntry.java @@ -20,7 +20,6 @@ package mod._svtools; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -138,7 +137,7 @@ public class AccessibleIconChoiceCtrlEntry extends TestCase { */ @Override protected TestEnvironment createTestEnvironment( - TestParameters tParam, PrintWriter log) { + TestParameters tParam, PrintWriter log) throws Exception { log.println( "creating a test environment" ); @@ -147,14 +146,8 @@ public class AccessibleIconChoiceCtrlEntry extends TestCase { // get a soffice factory object SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); - try { - log.println( "creating a text document" ); - xTextDoc = SOF.createTextDoc(null); - } catch ( com.sun.star.uno.Exception e ) { - // Some exception occurs.FAILED - e.printStackTrace( log ); - throw new StatusException( "Couldn't create document", e ); - } + log.println( "creating a text document" ); + xTextDoc = SOF.createTextDoc(null); util.utils.pause(5000); @@ -165,17 +158,10 @@ public class AccessibleIconChoiceCtrlEntry extends TestCase { XDispatchProvider aProv = UnoRuntime. queryInterface(XDispatchProvider.class, secondController); - XURLTransformer urlTransf = null; - - try { - XInterface transf = (XInterface)tParam.getMSF().createInstance - ("com.sun.star.util.URLTransformer"); - urlTransf = UnoRuntime.queryInterface - (XURLTransformer.class, transf); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create URLTransformer", e ); - } + XInterface transf = (XInterface)tParam.getMSF().createInstance + ("com.sun.star.util.URLTransformer"); + XURLTransformer urlTransf = UnoRuntime.queryInterface + (XURLTransformer.class, transf); XDispatch getting = null; log.println( "opening HyperlinkDialog" ); @@ -189,15 +175,8 @@ public class AccessibleIconChoiceCtrlEntry extends TestCase { util.utils.pause(5000); - XInterface oObj = null; - try { - oObj = (XInterface) tParam.getMSF().createInstance + XInterface oObj = (XInterface) tParam.getMSF().createInstance ("com.sun.star.awt.Toolkit") ; - } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't get toolkit"); - e.printStackTrace(log); - throw new StatusException("Couldn't get toolkit", e ); - } XExtendedToolkit tk = UnoRuntime.queryInterface(XExtendedToolkit.class, oObj); diff --git a/qadevOOo/tests/java/mod/_svtools/AccessibleTabBar.java b/qadevOOo/tests/java/mod/_svtools/AccessibleTabBar.java index 9803a450272a..d3ee8b392d47 100644 --- a/qadevOOo/tests/java/mod/_svtools/AccessibleTabBar.java +++ b/qadevOOo/tests/java/mod/_svtools/AccessibleTabBar.java @@ -19,7 +19,6 @@ package mod._svtools; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -74,7 +73,7 @@ public class AccessibleTabBar extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters tParam, - PrintWriter log) { + PrintWriter log) throws Exception { log.println("creating a test environment"); if (xDoc != null) { @@ -86,16 +85,10 @@ public class AccessibleTabBar extends TestCase { // get a soffice factory object SOfficeFactory SOF = SOfficeFactory.getFactory(msf); - try { - log.println("creating a calc document"); - xDoc = UnoRuntime.queryInterface(XComponent.class, - SOF.createCalcDoc( - null)); - } catch (com.sun.star.uno.Exception e) { - // Some exception occurs.FAILED - e.printStackTrace(log); - throw new StatusException("Couldn't create document", e); - } + log.println("creating a calc document"); + xDoc = UnoRuntime.queryInterface(XComponent.class, + SOF.createCalcDoc( + null)); util.utils.pause(5000); diff --git a/qadevOOo/tests/java/mod/_svtools/AccessibleTabBarPage.java b/qadevOOo/tests/java/mod/_svtools/AccessibleTabBarPage.java index 73226ab751dc..cf08f7f5298b 100644 --- a/qadevOOo/tests/java/mod/_svtools/AccessibleTabBarPage.java +++ b/qadevOOo/tests/java/mod/_svtools/AccessibleTabBarPage.java @@ -22,11 +22,11 @@ import com.sun.star.accessibility.AccessibleRole; import com.sun.star.accessibility.XAccessibleComponent; import com.sun.star.accessibility.XAccessibleContext; import com.sun.star.awt.Point; + import java.awt.Robot; import java.awt.event.InputEvent; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -100,7 +100,7 @@ public class AccessibleTabBarPage extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters tParam, - PrintWriter log) { + PrintWriter log) throws Exception { log.println( "creating a test environment" ); @@ -109,27 +109,13 @@ public class AccessibleTabBarPage extends TestCase { // get a soffice factory object SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); - try { - log.println( "creating a calc document" ); - xDoc = UnoRuntime.queryInterface(XComponent.class, SOF.createCalcDoc(null));// SOF.createDrawDoc(null); - } catch ( com.sun.star.uno.Exception e ) { - // Some exception occurs.FAILED - e.printStackTrace( log ); - throw new StatusException( "Couldn't create document", e ); - } + log.println( "creating a calc document" ); + xDoc = UnoRuntime.queryInterface(XComponent.class, SOF.createCalcDoc(null));// SOF.createDrawDoc(null); util.utils.pause(5000); - XInterface oObj = null; - - try { - oObj = (XInterface) tParam.getMSF().createInstance + XInterface oObj = (XInterface) tParam.getMSF().createInstance ("com.sun.star.awt.Toolkit") ; - } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't get toolkit"); - e.printStackTrace(log); - throw new StatusException("Couldn't get toolkit", e ); - } XExtendedToolkit tk = UnoRuntime.queryInterface(XExtendedToolkit.class, oObj); diff --git a/qadevOOo/tests/java/mod/_svtools/AccessibleTabBarPageList.java b/qadevOOo/tests/java/mod/_svtools/AccessibleTabBarPageList.java index 5290e65bcd5d..e66b35e2aa10 100644 --- a/qadevOOo/tests/java/mod/_svtools/AccessibleTabBarPageList.java +++ b/qadevOOo/tests/java/mod/_svtools/AccessibleTabBarPageList.java @@ -19,9 +19,9 @@ package mod._svtools; import com.sun.star.drawing.XLayerManager; import com.sun.star.drawing.XLayerSupplier; + import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -101,7 +101,7 @@ public class AccessibleTabBarPageList extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters tParam, - PrintWriter log) { + PrintWriter log) throws Exception { log.println("creating a test environment"); if (xDoc != null) { @@ -111,27 +111,13 @@ public class AccessibleTabBarPageList extends TestCase { // get a soffice factory object SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); - try { - log.println("creating a draw document"); - xDoc = SOF.createDrawDoc(null); - } catch (com.sun.star.uno.Exception e) { - // Some exception occurs.FAILED - e.printStackTrace(log); - throw new StatusException("Couldn't create document", e); - } + log.println("creating a draw document"); + xDoc = SOF.createDrawDoc(null); util.utils.pause(5000); - XInterface oObj = null; - - try { - oObj = (XInterface) tParam.getMSF() + XInterface oObj = (XInterface) tParam.getMSF() .createInstance("com.sun.star.awt.Toolkit"); - } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't get toolkit"); - e.printStackTrace(log); - throw new StatusException("Couldn't get toolkit", e); - } XExtendedToolkit tk = UnoRuntime.queryInterface( XExtendedToolkit.class, oObj); diff --git a/qadevOOo/tests/java/mod/_svtools/AccessibleTreeListBox.java b/qadevOOo/tests/java/mod/_svtools/AccessibleTreeListBox.java index 40fe66ad8e71..14785f368241 100644 --- a/qadevOOo/tests/java/mod/_svtools/AccessibleTreeListBox.java +++ b/qadevOOo/tests/java/mod/_svtools/AccessibleTreeListBox.java @@ -20,7 +20,6 @@ package mod._svtools; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -120,7 +119,7 @@ public class AccessibleTreeListBox extends TestCase { */ @Override protected TestEnvironment createTestEnvironment( - TestParameters tParam, PrintWriter log) { + TestParameters tParam, PrintWriter log) throws Exception { log.println( "creating a test environment" ); @@ -129,14 +128,8 @@ public class AccessibleTreeListBox extends TestCase { // get a soffice factory object SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); - try { - log.println( "creating a text document" ); - xTextDoc = SOF.createTextDoc(null); - } catch ( com.sun.star.uno.Exception e ) { - // Some exception occurs.FAILED - e.printStackTrace( log ); - throw new StatusException( "Couldn't create document", e ); - } + log.println( "creating a text document" ); + xTextDoc = SOF.createTextDoc(null); util.utils.pause(5000); diff --git a/qadevOOo/tests/java/mod/_svtools/AccessibleTreeListBoxEntry.java b/qadevOOo/tests/java/mod/_svtools/AccessibleTreeListBoxEntry.java index 996ef88b43c4..85226f42daf2 100644 --- a/qadevOOo/tests/java/mod/_svtools/AccessibleTreeListBoxEntry.java +++ b/qadevOOo/tests/java/mod/_svtools/AccessibleTreeListBoxEntry.java @@ -18,9 +18,9 @@ package mod._svtools; import com.sun.star.view.XSelectionSupplier; + import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -137,7 +137,7 @@ public class AccessibleTreeListBoxEntry extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters tParam, - PrintWriter log) { + PrintWriter log) throws Exception { log.println("creating a test environment"); if (xTextDoc != null) { @@ -147,14 +147,8 @@ public class AccessibleTreeListBoxEntry extends TestCase { // get a soffice factory object SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); - try { - log.println("creating a text document"); - xTextDoc = SOF.createTextDoc(null); - } catch (com.sun.star.uno.Exception e) { - // Some exception occurs.FAILED - e.printStackTrace(log); - throw new StatusException("Couldn't create document", e); - } + log.println("creating a text document"); + xTextDoc = SOF.createTextDoc(null); util.utils.pause(5000); @@ -217,11 +211,7 @@ public class AccessibleTreeListBoxEntry extends TestCase { XSelectionSupplier xSelect = UnoRuntime.queryInterface( XSelectionSupplier.class, xCont); - try { - xSelect.select(params); - } catch (com.sun.star.lang.IllegalArgumentException ex) { - throw new StatusException("Could not select Biblio-Database", ex); - } + xSelect.select(params); util.utils.pause(5000); diff --git a/qadevOOo/tests/java/mod/_svx/AccessibleOLEShape.java b/qadevOOo/tests/java/mod/_svx/AccessibleOLEShape.java index 16f9d9984737..d44d927a5777 100644 --- a/qadevOOo/tests/java/mod/_svx/AccessibleOLEShape.java +++ b/qadevOOo/tests/java/mod/_svx/AccessibleOLEShape.java @@ -73,7 +73,7 @@ public class AccessibleOLEShape extends TestCase { @Override protected TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log) { + (TestParameters tParam, PrintWriter log) throws Exception { XInterface oObj = null; @@ -91,22 +91,8 @@ public class AccessibleOLEShape extends TestCase { log.println("Inserting a Chart"); - try { - shape_props. - setPropertyValue("CLSID","12DCAE26-281F-416F-a234-c3086127382e"); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't change property", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't change property", e); - } catch (com.sun.star.beans.PropertyVetoException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't change property", e); - } catch (com.sun.star.beans.UnknownPropertyException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't change property", e); - } + shape_props. + setPropertyValue("CLSID","12DCAE26-281F-416F-a234-c3086127382e"); XWindow xWindow = AccessibilityTools.getCurrentWindow (aModel); XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); diff --git a/qadevOOo/tests/java/mod/_svx/AccessiblePresentationGraphicShape.java b/qadevOOo/tests/java/mod/_svx/AccessiblePresentationGraphicShape.java index f0aec37e2538..8e526a6b0f25 100644 --- a/qadevOOo/tests/java/mod/_svx/AccessiblePresentationGraphicShape.java +++ b/qadevOOo/tests/java/mod/_svx/AccessiblePresentationGraphicShape.java @@ -74,7 +74,7 @@ public class AccessiblePresentationGraphicShape extends TestCase { @Override protected TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log) { + (TestParameters tParam, PrintWriter log) throws Exception { XInterface oObj = null; XShape oShape = null; @@ -84,13 +84,9 @@ public class AccessiblePresentationGraphicShape extends TestCase { log.println( "creating a test environment" ); XMultiServiceFactory docMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xDoc); - try { - oShape = UnoRuntime.queryInterface(XShape.class, - docMSF.createInstance - ("com.sun.star.presentation.GraphicObjectShape")); - } catch (com.sun.star.uno.Exception e) { - throw new StatusException("couldn't create component", e); - } + oShape = UnoRuntime.queryInterface(XShape.class, + docMSF.createInstance + ("com.sun.star.presentation.GraphicObjectShape")); DrawTools.getShapes(DrawTools.getDrawPage(xDoc,0)).add(oShape); diff --git a/qadevOOo/tests/java/mod/_svx/AccessiblePresentationOLEShape.java b/qadevOOo/tests/java/mod/_svx/AccessiblePresentationOLEShape.java index 16722f2a9040..2446d70a24b1 100644 --- a/qadevOOo/tests/java/mod/_svx/AccessiblePresentationOLEShape.java +++ b/qadevOOo/tests/java/mod/_svx/AccessiblePresentationOLEShape.java @@ -74,7 +74,7 @@ public class AccessiblePresentationOLEShape extends TestCase { @Override protected TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log) { + (TestParameters tParam, PrintWriter log) throws Exception { XInterface oObj = null; XShape oShape = null; @@ -84,12 +84,8 @@ public class AccessiblePresentationOLEShape extends TestCase { log.println( "creating a test environment" ); XMultiServiceFactory docMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xDrawDoc); - try { - oShape = UnoRuntime.queryInterface(XShape.class, - docMSF.createInstance("com.sun.star.presentation.OLE2Shape")); - } catch (com.sun.star.uno.Exception e) { - throw new StatusException("couldn't create component", e); - } + oShape = UnoRuntime.queryInterface(XShape.class, + docMSF.createInstance("com.sun.star.presentation.OLE2Shape")); XPropertySet oShapeProps = UnoRuntime.queryInterface(XPropertySet.class,oShape); diff --git a/qadevOOo/tests/java/mod/_svx/AccessiblePresentationShape.java b/qadevOOo/tests/java/mod/_svx/AccessiblePresentationShape.java index 7a118b5929a9..7dd7ae11d414 100644 --- a/qadevOOo/tests/java/mod/_svx/AccessiblePresentationShape.java +++ b/qadevOOo/tests/java/mod/_svx/AccessiblePresentationShape.java @@ -74,7 +74,7 @@ public class AccessiblePresentationShape extends TestCase { @Override protected TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log) { + (TestParameters tParam, PrintWriter log) throws Exception { XInterface oObj = null; XShape oShape = null; @@ -84,13 +84,9 @@ public class AccessiblePresentationShape extends TestCase { log.println( "creating a test environment" ); XMultiServiceFactory docMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xDrawDoc); - try { - oShape = UnoRuntime.queryInterface(XShape.class, - docMSF.createInstance - ("com.sun.star.presentation.HandoutShape")); - } catch (com.sun.star.uno.Exception e) { - throw new StatusException("couldn't create component", e); - } + oShape = UnoRuntime.queryInterface(XShape.class, + docMSF.createInstance + ("com.sun.star.presentation.HandoutShape")); DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape); diff --git a/qadevOOo/tests/java/mod/_svx/GraphicExporter.java b/qadevOOo/tests/java/mod/_svx/GraphicExporter.java index 9a1459e0590c..127d77a9bce0 100644 --- a/qadevOOo/tests/java/mod/_svx/GraphicExporter.java +++ b/qadevOOo/tests/java/mod/_svx/GraphicExporter.java @@ -28,7 +28,6 @@ import com.sun.star.util.URL; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -118,7 +117,7 @@ public class GraphicExporter extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters tParam, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; XShape oShape = null; Object go = null; @@ -147,29 +146,15 @@ public class GraphicExporter extends TestCase { XPropertySet.class, oShape); XComponent xComp = null; - try { - oShapeProps.setPropertyValue("GraphicURL", - util.utils.getFullTestURL( - "space-metal.jpg")); - xComp = UnoRuntime.queryInterface(XComponent.class, - oShape); - - XExporter xEx = UnoRuntime.queryInterface( - XExporter.class, go); - xEx.setSourceDocument(xComp); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log); - throw new StatusException("Error while preparing component", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Error while preparing component", e); - } catch (com.sun.star.beans.PropertyVetoException e) { - e.printStackTrace(log); - throw new StatusException("Error while preparing component", e); - } catch (com.sun.star.beans.UnknownPropertyException e) { - e.printStackTrace(log); - throw new StatusException("Error while preparing component", e); - } + oShapeProps.setPropertyValue("GraphicURL", + util.utils.getFullTestURL( + "space-metal.jpg")); + xComp = UnoRuntime.queryInterface(XComponent.class, + oShape); + + XExporter xEx = UnoRuntime.queryInterface( + XExporter.class, go); + xEx.setSourceDocument(xComp); final URL aURL = new URL(); aURL.Complete = util.utils.getOfficeTemp( @@ -178,19 +163,13 @@ public class GraphicExporter extends TestCase { final XSimpleFileAccess fAcc; - try { - Object oFAcc = tParam.getMSF().createInstance( - "com.sun.star.ucb.SimpleFileAccess"); - fAcc = UnoRuntime.queryInterface( - XSimpleFileAccess.class, oFAcc); + Object oFAcc = tParam.getMSF().createInstance( + "com.sun.star.ucb.SimpleFileAccess"); + fAcc = UnoRuntime.queryInterface( + XSimpleFileAccess.class, oFAcc); - if (fAcc.exists(aURL.Complete)) { - fAcc.kill(aURL.Complete); - } - } catch (com.sun.star.uno.Exception e) { - log.println("Error accessing file system :"); - e.printStackTrace(log); - throw new StatusException("Error accessing file system.", e); + if (fAcc.exists(aURL.Complete)) { + fAcc.kill(aURL.Complete); } oObj = (XInterface) go; diff --git a/qadevOOo/tests/java/mod/_svx/SvxDrawPage.java b/qadevOOo/tests/java/mod/_svx/SvxDrawPage.java index 53a4034baf4a..11fea48fa59c 100644 --- a/qadevOOo/tests/java/mod/_svx/SvxDrawPage.java +++ b/qadevOOo/tests/java/mod/_svx/SvxDrawPage.java @@ -34,7 +34,6 @@ import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.DrawTools; import util.FormTools; import util.InstCreator; @@ -138,7 +137,7 @@ public class SvxDrawPage extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters tParam, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; XShape oShape = null; XDrawPages oDP = null; @@ -151,40 +150,26 @@ public class SvxDrawPage extends TestCase { // first we write what we are intend to do to log file log.println("creating a test environment"); - try { - log.println("getting Drawpages"); - - XDrawPagesSupplier oDPS = UnoRuntime.queryInterface( - XDrawPagesSupplier.class, xDoc); - oDP = oDPS.getDrawPages(); - oDP.insertNewByIndex(1); - oDP.insertNewByIndex(2); - oObj = (XDrawPage) AnyConverter.toObject(new Type(XDrawPage.class), - oDP.getByIndex(0)); - - SOfficeFactory SOF = SOfficeFactory.getFactory( - tParam.getMSF()); - - oShape = SOF.createShape(xComp, 5000, 3500, 7500, 5000, - "Rectangle"); - DrawTools.getShapes((XDrawPage) oObj).add(oShape); - - XShape oShape1 = SOF.createShape(xComp, 5000, 5500, 5000, 5000, - "Rectangle"); - DrawTools.getShapes((XDrawPage) oObj).add(oShape1); - } catch (com.sun.star.lang.WrappedTargetException e) { - log.println("Couldn't create insance"); - e.printStackTrace(log); - throw new StatusException("Can't create environment", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Couldn't create insance"); - e.printStackTrace(log); - throw new StatusException("Can't create environment", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - log.println("Couldn't create insance"); - e.printStackTrace(log); - throw new StatusException("Can't create environment", e); - } + log.println("getting Drawpages"); + + XDrawPagesSupplier oDPS = UnoRuntime.queryInterface( + XDrawPagesSupplier.class, xDoc); + oDP = oDPS.getDrawPages(); + oDP.insertNewByIndex(1); + oDP.insertNewByIndex(2); + oObj = (XDrawPage) AnyConverter.toObject(new Type(XDrawPage.class), + oDP.getByIndex(0)); + + SOfficeFactory SOF = SOfficeFactory.getFactory( + tParam.getMSF()); + + oShape = SOF.createShape(xComp, 5000, 3500, 7500, 5000, + "Rectangle"); + DrawTools.getShapes((XDrawPage) oObj).add(oShape); + + XShape oShape1 = SOF.createShape(xComp, 5000, 5500, 5000, 5000, + "Rectangle"); + DrawTools.getShapes((XDrawPage) oObj).add(oShape1); // create test environment here TestEnvironment tEnv = new TestEnvironment(oObj); diff --git a/qadevOOo/tests/java/mod/_svx/SvxGraphCtrlAccessibleContext.java b/qadevOOo/tests/java/mod/_svx/SvxGraphCtrlAccessibleContext.java index 1249ef898420..7b0c4591761e 100644 --- a/qadevOOo/tests/java/mod/_svx/SvxGraphCtrlAccessibleContext.java +++ b/qadevOOo/tests/java/mod/_svx/SvxGraphCtrlAccessibleContext.java @@ -64,7 +64,7 @@ public class SvxGraphCtrlAccessibleContext extends TestCase{ */ @Override protected TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) { + TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; @@ -120,14 +120,8 @@ public class SvxGraphCtrlAccessibleContext extends TestCase{ } - try { - oObj = (XInterface) Param.getMSF().createInstance - ("com.sun.star.awt.Toolkit") ; - } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't get toolkit"); - e.printStackTrace(log); - throw new StatusException("Couldn't get toolkit", e ); - } + oObj = (XInterface) Param.getMSF().createInstance + ("com.sun.star.awt.Toolkit") ; XExtendedToolkit tk = UnoRuntime.queryInterface(XExtendedToolkit.class,oObj); diff --git a/qadevOOo/tests/java/mod/_svx/SvxShapeCircle.java b/qadevOOo/tests/java/mod/_svx/SvxShapeCircle.java index 97c54a87edb4..4a67b6ec7e72 100644 --- a/qadevOOo/tests/java/mod/_svx/SvxShapeCircle.java +++ b/qadevOOo/tests/java/mod/_svx/SvxShapeCircle.java @@ -160,7 +160,7 @@ public class SvxShapeCircle extends TestCase { * </ul> */ @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { XInterface oObj = null; XShape oShape = null; @@ -176,23 +176,8 @@ public class SvxShapeCircle extends TestCase { (XPropertySet.class, oShape) ; DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape) ; - try { - props.setPropertyValue("CircleKind", - com.sun.star.drawing.CircleKind.FULL) ; - } catch (com.sun.star.lang.WrappedTargetException e) { - log.println("Cann't set 'CircleKind' property : " + e); - throw new StatusException("Can't create component", e) ; - } catch (com.sun.star.lang.IllegalArgumentException e) { - log.println("Cann't set 'CircleKind' property : " + e); - throw new StatusException("Can't create component", e) ; - } catch (com.sun.star.beans.PropertyVetoException e) { - log.println("Cann't set 'CircleKind' property : " + e); - throw new StatusException("Can't create component", e) ; - } catch (com.sun.star.beans.UnknownPropertyException e) { - log.println("Cann't set 'CircleKind' property : " + e); - throw new StatusException("Can't create component", e) ; - } - + props.setPropertyValue("CircleKind", + com.sun.star.drawing.CircleKind.FULL) ; oObj = oShape ; diff --git a/qadevOOo/tests/java/mod/_svx/SvxShapeGroup.java b/qadevOOo/tests/java/mod/_svx/SvxShapeGroup.java index 03c9755edb79..57f277630571 100644 --- a/qadevOOo/tests/java/mod/_svx/SvxShapeGroup.java +++ b/qadevOOo/tests/java/mod/_svx/SvxShapeGroup.java @@ -92,7 +92,7 @@ public class SvxShapeGroup extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment - (TestParameters Param, PrintWriter log ) { + (TestParameters Param, PrintWriter log ) throws Exception { XInterface oObj = null; XShapes oShapes = null; @@ -104,18 +104,12 @@ public class SvxShapeGroup extends TestCase { SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF()); // get the drawpage of drawing here - try { - log.println( "getting Drawpage" ); - XDrawPagesSupplier oDPS = UnoRuntime.queryInterface(XDrawPagesSupplier.class,xDrawDoc); - XDrawPages oDPn = oDPS.getDrawPages(); - XIndexAccess oDPi = UnoRuntime.queryInterface(XIndexAccess.class,oDPn); - oObj = (XDrawPage) AnyConverter.toObject( - new Type(XDrawPage.class),oDPi.getByIndex(0)); - } catch ( Exception e ) { - // Some exception occurs.FAILED - e.printStackTrace( log ); - throw new StatusException( "Couldn't get DrawPage", e ); - } + log.println( "getting Drawpage" ); + XDrawPagesSupplier oDPS = UnoRuntime.queryInterface(XDrawPagesSupplier.class,xDrawDoc); + XDrawPages oDPn = oDPS.getDrawPages(); + XIndexAccess oDPi = UnoRuntime.queryInterface(XIndexAccess.class,oDPn); + oObj = (XDrawPage) AnyConverter.toObject( + new Type(XDrawPage.class),oDPi.getByIndex(0)); if (oObj == null) { System.out.println("**************************"); @@ -151,15 +145,10 @@ public class SvxShapeGroup extends TestCase { //get the XShapeGrouper - try{ - log.println("get XShapeGroup"); - XShapeGrouper oSG = UnoRuntime.queryInterface - (XShapeGrouper.class, oObj); - oObj = oSG.group(oShapes); - } catch ( Exception e) { - e.printStackTrace( log ); - throw new StatusException(" Couldn't get XShapeGroup: ", e); - } + log.println("get XShapeGroup"); + XShapeGrouper oSG = UnoRuntime.queryInterface + (XShapeGrouper.class, oObj); + oObj = oSG.group(oShapes); log.println( "creating a new environment for drawpage object" ); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_svx/SvxUnoNumberingRules.java b/qadevOOo/tests/java/mod/_svx/SvxUnoNumberingRules.java index 646a14c191b1..258bcedee4f9 100644 --- a/qadevOOo/tests/java/mod/_svx/SvxUnoNumberingRules.java +++ b/qadevOOo/tests/java/mod/_svx/SvxUnoNumberingRules.java @@ -20,17 +20,14 @@ package mod._svx; import com.sun.star.container.XIndexAccess; import com.sun.star.lang.XComponent; import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.uno.Exception; 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; - import util.DrawTools; @@ -46,19 +43,12 @@ public class SvxUnoNumberingRules extends TestCase { @Override protected TestEnvironment createTestEnvironment(TestParameters tParam, - PrintWriter log) { + PrintWriter log) throws Exception { XMultiServiceFactory docMSF = UnoRuntime.queryInterface( XMultiServiceFactory.class, xDrawDoc); - XInterface oObj = null; - - try { - oObj = (XInterface) docMSF.createInstance( + XInterface oObj = (XInterface) docMSF.createInstance( "com.sun.star.text.NumberingRules"); - } catch (Exception e) { - e.printStackTrace(log); - throw new StatusException("Unexpected exception", e); - } TestEnvironment tEnv = new TestEnvironment(oObj); diff --git a/qadevOOo/tests/java/mod/_svx/SvxUnoTextContent.java b/qadevOOo/tests/java/mod/_svx/SvxUnoTextContent.java index 6060f9a83f94..4f8bceb6596c 100644 --- a/qadevOOo/tests/java/mod/_svx/SvxUnoTextContent.java +++ b/qadevOOo/tests/java/mod/_svx/SvxUnoTextContent.java @@ -95,43 +95,37 @@ public class SvxUnoTextContent extends TestCase { * @see PrintWriter */ @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { XInterface oObj = null; // create testobject here XEnumerationAccess xEA = null ; - try { - SOfficeFactory SOF = SOfficeFactory.getFactory(tParam.getMSF()) ; - XShape oShape = SOF.createShape(xDrawDoc, - 5000,3500,7500,5000,"Text"); - DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape) ; - - XSimpleText text = UnoRuntime.queryInterface - (XSimpleText.class, oShape) ; - - XTextCursor cursor = text.createTextCursor() ; - - text.insertString(cursor, "Paragraph 1", false) ; - text.insertControlCharacter(cursor, - ControlCharacter.PARAGRAPH_BREAK, false) ; - text.insertString(cursor, "Paragraph 2", false) ; - text.insertControlCharacter(cursor, - ControlCharacter.PARAGRAPH_BREAK, false) ; - text.insertString(cursor, "Paragraph 3", false) ; - text.insertControlCharacter(cursor, - ControlCharacter.PARAGRAPH_BREAK, false) ; - - xEA = UnoRuntime.queryInterface - (XEnumerationAccess.class, text) ; - - oObj = (XInterface) AnyConverter.toObject( - new Type(XInterface.class),xEA.createEnumeration().nextElement()); - } catch (Exception e) { - log.println("Can't create test object") ; - e.printStackTrace(log) ; - throw new StatusException("Unexpected exception", e); - } + SOfficeFactory SOF = SOfficeFactory.getFactory(tParam.getMSF()) ; + XShape oShape = SOF.createShape(xDrawDoc, + 5000,3500,7500,5000,"Text"); + DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape) ; + + XSimpleText text = UnoRuntime.queryInterface + (XSimpleText.class, oShape) ; + + XTextCursor cursor = text.createTextCursor() ; + + text.insertString(cursor, "Paragraph 1", false) ; + text.insertControlCharacter(cursor, + ControlCharacter.PARAGRAPH_BREAK, false) ; + text.insertString(cursor, "Paragraph 2", false) ; + text.insertControlCharacter(cursor, + ControlCharacter.PARAGRAPH_BREAK, false) ; + text.insertString(cursor, "Paragraph 3", false) ; + text.insertControlCharacter(cursor, + ControlCharacter.PARAGRAPH_BREAK, false) ; + + xEA = UnoRuntime.queryInterface + (XEnumerationAccess.class, text) ; + + oObj = (XInterface) AnyConverter.toObject( + new Type(XInterface.class),xEA.createEnumeration().nextElement()); // create test environment here TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_svx/SvxUnoTextContentEnum.java b/qadevOOo/tests/java/mod/_svx/SvxUnoTextContentEnum.java index 0db1e1466dab..a4a6f417a5d8 100644 --- a/qadevOOo/tests/java/mod/_svx/SvxUnoTextContentEnum.java +++ b/qadevOOo/tests/java/mod/_svx/SvxUnoTextContentEnum.java @@ -101,36 +101,30 @@ public class SvxUnoTextContentEnum extends TestCase { // create testobject here XEnumerationAccess xEA = null ; - try { - SOfficeFactory SOF = SOfficeFactory.getFactory(tParam.getMSF()) ; - XShape oShape = SOF.createShape - (xDrawDoc,5000,3500,7500,5000,"Text"); - DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape) ; - - XSimpleText text = UnoRuntime.queryInterface - (XSimpleText.class, oShape) ; - - XTextCursor cursor = text.createTextCursor() ; - - text.insertString(cursor, "Paragraph 1", false) ; - text.insertControlCharacter(cursor, - ControlCharacter.PARAGRAPH_BREAK, false) ; - text.insertString(cursor, "Paragraph 2", false) ; - text.insertControlCharacter(cursor, - ControlCharacter.PARAGRAPH_BREAK, false) ; - text.insertString(cursor, "Paragraph 3", false) ; - text.insertControlCharacter(cursor, - ControlCharacter.PARAGRAPH_BREAK, false) ; - - xEA = UnoRuntime.queryInterface - (XEnumerationAccess.class, text) ; - - oObj = xEA.createEnumeration() ; - } catch (Exception e) { - log.println("Can't create test object") ; - e.printStackTrace(log) ; - throw new StatusException("Unexpected exception", e); - } + SOfficeFactory SOF = SOfficeFactory.getFactory(tParam.getMSF()) ; + XShape oShape = SOF.createShape + (xDrawDoc,5000,3500,7500,5000,"Text"); + DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape) ; + + XSimpleText text = UnoRuntime.queryInterface + (XSimpleText.class, oShape) ; + + XTextCursor cursor = text.createTextCursor() ; + + text.insertString(cursor, "Paragraph 1", false) ; + text.insertControlCharacter(cursor, + ControlCharacter.PARAGRAPH_BREAK, false) ; + text.insertString(cursor, "Paragraph 2", false) ; + text.insertControlCharacter(cursor, + ControlCharacter.PARAGRAPH_BREAK, false) ; + text.insertString(cursor, "Paragraph 3", false) ; + text.insertControlCharacter(cursor, + ControlCharacter.PARAGRAPH_BREAK, false) ; + + xEA = UnoRuntime.queryInterface + (XEnumerationAccess.class, text) ; + + oObj = xEA.createEnumeration() ; // create test environment here TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_svx/SvxUnoTextField.java b/qadevOOo/tests/java/mod/_svx/SvxUnoTextField.java index c95f0ca74222..94a9e5d43ab9 100644 --- a/qadevOOo/tests/java/mod/_svx/SvxUnoTextField.java +++ b/qadevOOo/tests/java/mod/_svx/SvxUnoTextField.java @@ -101,7 +101,7 @@ public class SvxUnoTextField extends TestCase { * @see PrintWriter */ @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { XInterface oObj = null; XShape oShape = null; @@ -109,38 +109,22 @@ public class SvxUnoTextField extends TestCase { // creation of testobject here // first we write what we are intend to do to log file log.println( "creating a test environment" ); - try { - - SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); - oShape = SOF.createShape(xDrawDoc,5000,3500,7500,5000,"Rectangle"); - DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape); - } - catch (Exception e) { - log.println("Couldn't create Shape"); - e.printStackTrace(log); - throw new StatusException("Couldn't create Shape ",e); - } + SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); + oShape = SOF.createShape(xDrawDoc,5000,3500,7500,5000,"Rectangle"); + DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape); XTextCursor the_Cursor = null; - // create testobject here - try { - - XText the_Text = UnoRuntime.queryInterface(XText.class,oShape); - XMultiServiceFactory oDocMSF = UnoRuntime.queryInterface( XMultiServiceFactory.class, xDrawDoc ); - the_Cursor = the_Text.createTextCursor(); - oObj = (XInterface) - oDocMSF.createInstance( "com.sun.star.text.TextField.DateTime" ); - XTextContent the_Field = UnoRuntime.queryInterface(XTextContent.class,oObj); + // create testobject here + XText the_Text = UnoRuntime.queryInterface(XText.class,oShape); + XMultiServiceFactory oDocMSF = UnoRuntime.queryInterface( XMultiServiceFactory.class, xDrawDoc ); + the_Cursor = the_Text.createTextCursor(); + oObj = (XInterface) + oDocMSF.createInstance( "com.sun.star.text.TextField.DateTime" ); + XTextContent the_Field = UnoRuntime.queryInterface(XTextContent.class,oObj); - the_Text.insertTextContent(the_Cursor,the_Field,false); - } - catch (Exception ex) { - log.println("Couldn't create Textfield"); - ex.printStackTrace(log); - throw new StatusException("Couldn't create TextField ",ex); - } + the_Text.insertTextContent(the_Cursor,the_Field,false); log.println( "creating a new environment for FieldMaster object" ); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_sw/CharacterStyle.java b/qadevOOo/tests/java/mod/_sw/CharacterStyle.java index d74b2d0e62e8..34271e7b2b1c 100644 --- a/qadevOOo/tests/java/mod/_sw/CharacterStyle.java +++ b/qadevOOo/tests/java/mod/_sw/CharacterStyle.java @@ -31,7 +31,9 @@ import com.sun.star.text.XTextCursor; import com.sun.star.text.XTextDocument; 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; @@ -92,7 +94,7 @@ public class CharacterStyle extends TestCase { * </ul> */ @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { TestEnvironment tEnv = null; XNameAccess oSFNA = null; @@ -101,38 +103,22 @@ public class CharacterStyle extends TestCase { log.println("creating a test environment"); - try { - log.println("getting style"); - XStyleFamiliesSupplier oSFS = UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, - xTextDoc); - XNameAccess oSF = oSFS.getStyleFamilies(); - XIndexAccess oSFsIA = UnoRuntime.queryInterface(XIndexAccess.class, oSF); - oSFNA = UnoRuntime.queryInterface( - XNameAccess.class,oSFsIA.getByIndex(0)); - XIndexAccess oSFIA = UnoRuntime.queryInterface(XIndexAccess.class, oSFNA); - oStyle = UnoRuntime.queryInterface( - XStyle.class,oSFIA.getByIndex(0)); - } catch ( com.sun.star.lang.WrappedTargetException e ) { - log.println("Error: exception occurred."); - e.printStackTrace(log); - throw new StatusException( "Couldn't create environment ", e ); - } catch ( com.sun.star.lang.IndexOutOfBoundsException e ) { - log.println("Error: exception occurred."); - e.printStackTrace(log); - throw new StatusException( "Couldn't create environment ", e ); - } + log.println("getting style"); + XStyleFamiliesSupplier oSFS = UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, + xTextDoc); + XNameAccess oSF = oSFS.getStyleFamilies(); + XIndexAccess oSFsIA = UnoRuntime.queryInterface(XIndexAccess.class, oSF); + oSFNA = UnoRuntime.queryInterface( + XNameAccess.class,oSFsIA.getByIndex(0)); + XIndexAccess oSFIA = UnoRuntime.queryInterface(XIndexAccess.class, oSFNA); + oStyle = UnoRuntime.queryInterface( + XStyle.class,oSFIA.getByIndex(0)); - try { - log.print("Creating a user-defined style... "); - XMultiServiceFactory oMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDoc); - XInterface oInt = (XInterface) - oMSF.createInstance("com.sun.star.style.CharacterStyle"); - oMyStyle = UnoRuntime.queryInterface(XStyle.class, oInt); - } catch ( com.sun.star.uno.Exception e ) { - log.println("Error: exception occurred."); - e.printStackTrace(log); - throw new StatusException( "Couldn't create environment ", e ); - } + log.print("Creating a user-defined style... "); + XMultiServiceFactory oMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDoc); + XInterface oInt = (XInterface) + oMSF.createInstance("com.sun.star.style.CharacterStyle"); + oMyStyle = UnoRuntime.queryInterface(XStyle.class, oInt); if (oMyStyle == null) @@ -141,43 +127,15 @@ public class CharacterStyle extends TestCase { log.println("OK"); XNameContainer oSFNC = UnoRuntime.queryInterface(XNameContainer.class, oSFNA); - try { - if ( oSFNC.hasByName("My Style") ) - oSFNC.removeByName("My Style"); - oSFNC.insertByName("My Style", oMyStyle); - } catch ( com.sun.star.lang.WrappedTargetException e ) { - e.printStackTrace(log); - throw new StatusException( "Couldn't create environment ", e ); - } catch ( com.sun.star.lang.IllegalArgumentException e ) { - e.printStackTrace(log); - throw new StatusException( "Couldn't create environment ", e ); - } catch ( com.sun.star.container.NoSuchElementException e ) { - e.printStackTrace(log); - throw new StatusException( "Couldn't create environment ", e ); - } catch ( com.sun.star.container.ElementExistException e ) { - e.printStackTrace(log); - throw new StatusException( "Couldn't create environment ", e ); - } + if ( oSFNC.hasByName("My Style") ) + oSFNC.removeByName("My Style"); + oSFNC.insertByName("My Style", oMyStyle); XText oText = xTextDoc.getText(); XTextCursor oCursor = oText.createTextCursor(); XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class, oCursor); - try { - xProp.setPropertyValue("CharStyleName", oMyStyle.getName()); - } catch ( com.sun.star.lang.WrappedTargetException e ) { - e.printStackTrace( log ); - throw new StatusException( "Couldn't create environment ", e ); - } catch ( com.sun.star.lang.IllegalArgumentException e ) { - e.printStackTrace( log ); - throw new StatusException( "Couldn't create environment ", e ); - } catch ( com.sun.star.beans.PropertyVetoException e ) { - e.printStackTrace( log ); - throw new StatusException( "Couldn't create environment ", e ); - } catch ( com.sun.star.beans.UnknownPropertyException e ) { - e.printStackTrace( log ); - throw new StatusException( "Couldn't create environment ", e ); - } + xProp.setPropertyValue("CharStyleName", oMyStyle.getName()); log.println("creating a new environment for object"); tEnv = new TestEnvironment(oMyStyle); diff --git a/qadevOOo/tests/java/mod/_sw/ConditionalParagraphStyle.java b/qadevOOo/tests/java/mod/_sw/ConditionalParagraphStyle.java index ee7f2f4e4d27..6c98dfd16f8c 100644 --- a/qadevOOo/tests/java/mod/_sw/ConditionalParagraphStyle.java +++ b/qadevOOo/tests/java/mod/_sw/ConditionalParagraphStyle.java @@ -30,7 +30,9 @@ import com.sun.star.text.XTextCursor; import com.sun.star.text.XTextDocument; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XInterface; + import java.io.PrintWriter; + import lib.Status; import lib.StatusException; import lib.TestCase; @@ -82,7 +84,7 @@ public class ConditionalParagraphStyle extends TestCase { * @param log The log writer. */ @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { TestEnvironment tEnv = null; XNameAccess oSFNA = null; XStyle oStyle = null; @@ -90,41 +92,21 @@ public class ConditionalParagraphStyle extends TestCase { log.println("creating a test environment"); - try { - log.println("getting style"); - XStyleFamiliesSupplier oSFS = UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, - xTextDoc); - XNameAccess oSF = oSFS.getStyleFamilies(); - oSFNA = UnoRuntime.queryInterface( - XNameAccess.class,oSF.getByName("ParagraphStyles")); - XIndexAccess oSFIA = UnoRuntime.queryInterface(XIndexAccess.class, oSFNA); - oStyle = UnoRuntime.queryInterface( - XStyle.class,oSFIA.getByIndex(1)); - } catch ( com.sun.star.lang.WrappedTargetException e ) { - log.println("Error: exception occurred."); - e.printStackTrace(log); - throw new StatusException( "Couldn't create environment ", e ); - } catch ( com.sun.star.lang.IndexOutOfBoundsException e ) { - log.println("Error: exception occurred."); - e.printStackTrace(log); - throw new StatusException( "Couldn't create environment ", e ); - } catch ( com.sun.star.container.NoSuchElementException e ) { - log.println("Error: exception occurred."); - e.printStackTrace(log); - throw new StatusException( "Couldn't create environment ", e ); - } + log.println("getting style"); + XStyleFamiliesSupplier oSFS = UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, + xTextDoc); + XNameAccess oSF = oSFS.getStyleFamilies(); + oSFNA = UnoRuntime.queryInterface( + XNameAccess.class,oSF.getByName("ParagraphStyles")); + XIndexAccess oSFIA = UnoRuntime.queryInterface(XIndexAccess.class, oSFNA); + oStyle = UnoRuntime.queryInterface( + XStyle.class,oSFIA.getByIndex(1)); - try { - log.print("Creating a user-defined style... "); - XMultiServiceFactory oMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDoc); - XInterface oInt = (XInterface) - oMSF.createInstance("com.sun.star.style.ConditionalParagraphStyle"); - oMyStyle = UnoRuntime.queryInterface(XStyle.class, oInt); - } catch ( com.sun.star.uno.Exception e ) { - log.println("Error: exception occurred."); - e.printStackTrace(log); - throw new StatusException( "Couldn't create environment ", e ); - } + log.print("Creating a user-defined style... "); + XMultiServiceFactory oMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDoc); + XInterface oInt = (XInterface) + oMSF.createInstance("com.sun.star.style.ConditionalParagraphStyle"); + oMyStyle = UnoRuntime.queryInterface(XStyle.class, oInt); if (oMyStyle == null) { @@ -137,42 +119,14 @@ public class ConditionalParagraphStyle extends TestCase { XNameContainer oSFNC = UnoRuntime.queryInterface(XNameContainer.class, oSFNA); - try { - if ( oSFNC.hasByName("My Style") ) - oSFNC.removeByName("My Style"); - oSFNC.insertByName("My Style", oMyStyle); - } catch ( com.sun.star.lang.WrappedTargetException e ) { - e.printStackTrace(log); - throw new StatusException( "Couldn't create environment ", e ); - } catch ( com.sun.star.lang.IllegalArgumentException e ) { - e.printStackTrace(log); - throw new StatusException( "Couldn't create environment ", e ); - } catch ( com.sun.star.container.NoSuchElementException e ) { - e.printStackTrace(log); - throw new StatusException( "Couldn't create environment ", e ); - } catch ( com.sun.star.container.ElementExistException e ) { - e.printStackTrace(log); - throw new StatusException( "Couldn't create environment ", e ); - } + if ( oSFNC.hasByName("My Style") ) + oSFNC.removeByName("My Style"); + oSFNC.insertByName("My Style", oMyStyle); XText oText = xTextDoc.getText(); XTextCursor oCursor = oText.createTextCursor(); XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class, oCursor); - try { - xProp.setPropertyValue("ParaStyleName", oMyStyle.getName()); - } catch ( com.sun.star.lang.WrappedTargetException e ) { - e.printStackTrace( log ); - throw new StatusException( "Couldn't create environment ", e ); - } catch ( com.sun.star.lang.IllegalArgumentException e ) { - e.printStackTrace( log ); - throw new StatusException( "Couldn't create environment ", e ); - } catch ( com.sun.star.beans.PropertyVetoException e ) { - e.printStackTrace( log ); - throw new StatusException( "Couldn't create environment ", e ); - } catch ( com.sun.star.beans.UnknownPropertyException e ) { - e.printStackTrace( log ); - throw new StatusException( "Couldn't create environment ", e ); - } + xProp.setPropertyValue("ParaStyleName", oMyStyle.getName()); log.println("creating a new environment for object"); tEnv = new TestEnvironment(oMyStyle); diff --git a/qadevOOo/tests/java/mod/_sw/PageStyle.java b/qadevOOo/tests/java/mod/_sw/PageStyle.java index 1e989ecf5cbd..30b12f03baaf 100644 --- a/qadevOOo/tests/java/mod/_sw/PageStyle.java +++ b/qadevOOo/tests/java/mod/_sw/PageStyle.java @@ -31,7 +31,9 @@ import com.sun.star.text.XTextCursor; import com.sun.star.text.XTextDocument; 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; @@ -75,7 +77,7 @@ public class PageStyle extends TestCase { } @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { TestEnvironment tEnv = null; XNameAccess oSFNA = null; XStyle oStyle = null; @@ -83,43 +85,22 @@ public class PageStyle extends TestCase { log.println("creating a test environment"); - try { - log.println("getting style"); - XStyleFamiliesSupplier oSFS = UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, - xTextDoc); - XNameAccess oSF = oSFS.getStyleFamilies(); - oSFNA = UnoRuntime.queryInterface( - XNameAccess.class,oSF.getByName("PageStyles")); // get the page style - XIndexAccess oSFIA = UnoRuntime.queryInterface(XIndexAccess.class, oSFNA); - oStyle = UnoRuntime.queryInterface( - XStyle.class,oSFIA.getByIndex(0)); - log.println("Chosen pool style: "+oStyle.getName()); - - } catch ( com.sun.star.lang.WrappedTargetException e ) { - log.println("Error: exception occurred."); - e.printStackTrace(log); - throw new StatusException( "Couldn't create environment ", e ); - } catch ( com.sun.star.lang.IndexOutOfBoundsException e ) { - log.println("Error: exception occurred."); - e.printStackTrace(log); - throw new StatusException( "Couldn't create environment ", e ); - } catch ( com.sun.star.container.NoSuchElementException e ) { - log.println("Error: exception occurred."); - e.printStackTrace(log); - throw new StatusException( "Couldn't create environment ", e ); - } + log.println("getting style"); + XStyleFamiliesSupplier oSFS = UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, + xTextDoc); + XNameAccess oSF = oSFS.getStyleFamilies(); + oSFNA = UnoRuntime.queryInterface( + XNameAccess.class,oSF.getByName("PageStyles")); // get the page style + XIndexAccess oSFIA = UnoRuntime.queryInterface(XIndexAccess.class, oSFNA); + oStyle = UnoRuntime.queryInterface( + XStyle.class,oSFIA.getByIndex(0)); + log.println("Chosen pool style: "+oStyle.getName()); - try { - log.print("Creating a user-defined style... "); - XMultiServiceFactory oMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDoc); - XInterface oInt = (XInterface) - oMSF.createInstance("com.sun.star.style.PageStyle"); - oMyStyle = UnoRuntime.queryInterface(XStyle.class, oInt); - } catch ( com.sun.star.uno.Exception e ) { - log.println("Error: exception occurred."); - e.printStackTrace(log); - throw new StatusException( "Couldn't create environment ", e ); - } + log.print("Creating a user-defined style... "); + XMultiServiceFactory oMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDoc); + XInterface oInt = (XInterface) + oMSF.createInstance("com.sun.star.style.PageStyle"); + oMyStyle = UnoRuntime.queryInterface(XStyle.class, oInt); if (oMyStyle == null) @@ -130,23 +111,9 @@ public class PageStyle extends TestCase { XNameContainer oSFNC = UnoRuntime.queryInterface(XNameContainer.class, oSFNA); - try { - if ( oSFNC.hasByName("My Style") ) - oSFNC.removeByName("My Style"); - oSFNC.insertByName("My Style", oMyStyle); - } catch ( com.sun.star.lang.WrappedTargetException e ) { - e.printStackTrace(log); - throw new StatusException( "Couldn't create environment ", e ); - } catch ( com.sun.star.lang.IllegalArgumentException e ) { - e.printStackTrace(log); - throw new StatusException( "Couldn't create environment ", e ); - } catch ( com.sun.star.container.NoSuchElementException e ) { - e.printStackTrace(log); - throw new StatusException( "Couldn't create environment ", e ); - } catch ( com.sun.star.container.ElementExistException e ) { - e.printStackTrace(log); - throw new StatusException( "Couldn't create environment ", e ); - } + if ( oSFNC.hasByName("My Style") ) + oSFNC.removeByName("My Style"); + oSFNC.insertByName("My Style", oMyStyle); XText oText = xTextDoc.getText(); XTextCursor oCursor = oText.createTextCursor(); @@ -154,21 +121,7 @@ public class PageStyle extends TestCase { Property[] props = xProp.getPropertySetInfo().getProperties(); for (int i=0; i<props.length; i++) System.out.println("# Property: " + props[i].Name + " val: " + props[i].Type.toString() + " attr: " + props[i].Attributes); - try { - xProp.setPropertyValue("PageDescName", oMyStyle.getName()); - } catch ( com.sun.star.lang.WrappedTargetException e ) { - e.printStackTrace( log ); - throw new StatusException( "Couldn't create environment ", e ); - } catch ( com.sun.star.lang.IllegalArgumentException e ) { - e.printStackTrace( log ); - throw new StatusException( "Couldn't create environment ", e ); - } catch ( com.sun.star.beans.PropertyVetoException e ) { - e.printStackTrace( log ); - throw new StatusException( "Couldn't create environment ", e ); - } catch ( com.sun.star.beans.UnknownPropertyException e ) { - e.printStackTrace( log ); - throw new StatusException( "Couldn't create environment ", e ); - } + xProp.setPropertyValue("PageDescName", oMyStyle.getName()); // oMyStyle = oStyle; log.println("creating a new environment for object"); diff --git a/qadevOOo/tests/java/mod/_sw/ParagraphStyle.java b/qadevOOo/tests/java/mod/_sw/ParagraphStyle.java index aad213a58d2c..5c4ca3b200cf 100644 --- a/qadevOOo/tests/java/mod/_sw/ParagraphStyle.java +++ b/qadevOOo/tests/java/mod/_sw/ParagraphStyle.java @@ -30,7 +30,9 @@ import com.sun.star.text.XTextCursor; import com.sun.star.text.XTextDocument; 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; @@ -75,7 +77,7 @@ public class ParagraphStyle extends TestCase { } @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { TestEnvironment tEnv = null; XNameAccess oSFNA = null; XStyle oStyle = null; @@ -83,42 +85,22 @@ public class ParagraphStyle extends TestCase { log.println("creating a test environment"); - try { - log.println("getting style"); - XStyleFamiliesSupplier oSFS = UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, - xTextDoc); - XNameAccess oSF = oSFS.getStyleFamilies(); - oSFNA = UnoRuntime.queryInterface( - XNameAccess.class,oSF.getByName("ParagraphStyles")); - XIndexAccess oSFIA = UnoRuntime.queryInterface(XIndexAccess.class, oSFNA); - oSFNA.getElementNames(); - oStyle = UnoRuntime.queryInterface( - XStyle.class,oSFIA.getByIndex(1)); - } catch ( com.sun.star.lang.WrappedTargetException e ) { - log.println("Error: exception occurred."); - e.printStackTrace(log); - throw new StatusException( "Couldn't create environment ", e ); - } catch ( com.sun.star.lang.IndexOutOfBoundsException e ) { - log.println("Error: exception occurred."); - e.printStackTrace(log); - throw new StatusException( "Couldn't create environment ", e ); - } catch ( com.sun.star.container.NoSuchElementException e ) { - log.println("Error: exception occurred."); - e.printStackTrace(log); - throw new StatusException( "Couldn't create environment ", e ); - } + log.println("getting style"); + XStyleFamiliesSupplier oSFS = UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, + xTextDoc); + XNameAccess oSF = oSFS.getStyleFamilies(); + oSFNA = UnoRuntime.queryInterface( + XNameAccess.class,oSF.getByName("ParagraphStyles")); + XIndexAccess oSFIA = UnoRuntime.queryInterface(XIndexAccess.class, oSFNA); + oSFNA.getElementNames(); + oStyle = UnoRuntime.queryInterface( + XStyle.class,oSFIA.getByIndex(1)); - try { - log.print("Creating a user-defined style... "); - XMultiServiceFactory oMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDoc); - XInterface oInt = (XInterface) - oMSF.createInstance("com.sun.star.style.ParagraphStyle"); - oMyStyle = UnoRuntime.queryInterface(XStyle.class, oInt); - } catch ( com.sun.star.uno.Exception e ) { - log.println("Error: exception occurred."); - e.printStackTrace(log); - throw new StatusException( "Couldn't create environment ", e ); - } + log.print("Creating a user-defined style... "); + XMultiServiceFactory oMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDoc); + XInterface oInt = (XInterface) + oMSF.createInstance("com.sun.star.style.ParagraphStyle"); + oMyStyle = UnoRuntime.queryInterface(XStyle.class, oInt); if (oMyStyle == null) @@ -127,43 +109,15 @@ public class ParagraphStyle extends TestCase { log.println("OK"); XNameContainer oSFNC = UnoRuntime.queryInterface(XNameContainer.class, oSFNA); - try { - if ( oSFNC.hasByName("My Style") ) - oSFNC.removeByName("My Style"); - oSFNC.insertByName("My Style", oMyStyle); - } catch ( com.sun.star.lang.WrappedTargetException e ) { - e.printStackTrace(log); - throw new StatusException( "Couldn't create environment ", e ); - } catch ( com.sun.star.lang.IllegalArgumentException e ) { - e.printStackTrace(log); - throw new StatusException( "Couldn't create environment ", e ); - } catch ( com.sun.star.container.NoSuchElementException e ) { - e.printStackTrace(log); - throw new StatusException( "Couldn't create environment ", e ); - } catch ( com.sun.star.container.ElementExistException e ) { - e.printStackTrace(log); - throw new StatusException( "Couldn't create environment ", e ); - } + if ( oSFNC.hasByName("My Style") ) + oSFNC.removeByName("My Style"); + oSFNC.insertByName("My Style", oMyStyle); XText oText = xTextDoc.getText(); XTextCursor oCursor = oText.createTextCursor(); XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class, oCursor); - try { - xProp.setPropertyValue("ParaStyleName", oMyStyle.getName()); - } catch ( com.sun.star.lang.WrappedTargetException e ) { - e.printStackTrace( log ); - throw new StatusException( "Couldn't create environment ", e ); - } catch ( com.sun.star.lang.IllegalArgumentException e ) { - e.printStackTrace( log ); - throw new StatusException( "Couldn't create environment ", e ); - } catch ( com.sun.star.beans.PropertyVetoException e ) { - e.printStackTrace( log ); - throw new StatusException( "Couldn't create environment ", e ); - } catch ( com.sun.star.beans.UnknownPropertyException e ) { - e.printStackTrace( log ); - throw new StatusException( "Couldn't create environment ", e ); - } + xProp.setPropertyValue("ParaStyleName", oMyStyle.getName()); log.println("creating a new environment for object"); tEnv = new TestEnvironment(oMyStyle); diff --git a/qadevOOo/tests/java/mod/_sw/SwAccessibleDocumentPageView.java b/qadevOOo/tests/java/mod/_sw/SwAccessibleDocumentPageView.java index 9348e86f041b..64c1dc7913d1 100644 --- a/qadevOOo/tests/java/mod/_sw/SwAccessibleDocumentPageView.java +++ b/qadevOOo/tests/java/mod/_sw/SwAccessibleDocumentPageView.java @@ -19,8 +19,6 @@ package mod._sw; import java.io.PrintWriter; -import lib.Status; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -62,7 +60,7 @@ public class SwAccessibleDocumentPageView extends TestCase { */ @Override protected TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) { + TestParameters Param, PrintWriter log) throws Exception{ XInterface oObj = null; @@ -70,25 +68,20 @@ public class SwAccessibleDocumentPageView extends TestCase { XTextCursor oCursor = oText.createTextCursor(); log.println( "inserting some lines" ); - try { - for (int i=0; i<25; i++){ - oText.insertString( oCursor,"Paragraph Number: " + i, false); - oText.insertString( oCursor, - " The quick brown fox jumps over the lazy Dog: SwAccessibleDocumentPageView", - false); - oText.insertControlCharacter( - oCursor, ControlCharacter.PARAGRAPH_BREAK, false ); - oText.insertString( oCursor, - "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG: SwAccessibleDocumentPageView", - false); - oText.insertControlCharacter(oCursor, - ControlCharacter.PARAGRAPH_BREAK, false ); - oText.insertControlCharacter( - oCursor, ControlCharacter.LINE_BREAK, false ); - } - } catch ( com.sun.star.lang.IllegalArgumentException e ){ - e.printStackTrace(log); - throw new StatusException( "Couldn't insert lines", e ); + for (int i=0; i<25; i++){ + oText.insertString( oCursor,"Paragraph Number: " + i, false); + oText.insertString( oCursor, + " The quick brown fox jumps over the lazy Dog: SwAccessibleDocumentPageView", + false); + oText.insertControlCharacter( + oCursor, ControlCharacter.PARAGRAPH_BREAK, false ); + oText.insertString( oCursor, + "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG: SwAccessibleDocumentPageView", + false); + oText.insertControlCharacter(oCursor, + ControlCharacter.PARAGRAPH_BREAK, false ); + oText.insertControlCharacter( + oCursor, ControlCharacter.LINE_BREAK, false ); } XController xController = xTextDoc.getCurrentController(); @@ -96,22 +89,18 @@ public class SwAccessibleDocumentPageView extends TestCase { XModel aModel = UnoRuntime.queryInterface(XModel.class, xTextDoc); //switch to 'Print Preview' mode - try { - XDispatchProvider xDispProv = UnoRuntime.queryInterface(XDispatchProvider.class, xController); - XURLTransformer xParser = UnoRuntime.queryInterface(XURLTransformer.class, - Param.getMSF().createInstance("com.sun.star.util.URLTransformer")); - // Because it's an in/out parameter we must use an array of URL objects. - URL[] aParseURL = new URL[1]; - aParseURL[0] = new URL(); - aParseURL[0].Complete = ".uno:PrintPreview"; - xParser.parseStrict(aParseURL); - URL aURL = aParseURL[0]; - XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", 0); - if(xDispatcher != null) - xDispatcher.dispatch( aURL, null ); - } catch (com.sun.star.uno.Exception e) { - throw new StatusException(e, Status.failed("Couldn't change mode")); - } + XDispatchProvider xDispProv = UnoRuntime.queryInterface(XDispatchProvider.class, xController); + XURLTransformer xParser = UnoRuntime.queryInterface(XURLTransformer.class, + Param.getMSF().createInstance("com.sun.star.util.URLTransformer")); + // Because it's an in/out parameter we must use an array of URL objects. + URL[] aParseURL = new URL[1]; + aParseURL[0] = new URL(); + aParseURL[0].Complete = ".uno:PrintPreview"; + xParser.parseStrict(aParseURL); + URL aURL = aParseURL[0]; + XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", 0); + if(xDispatcher != null) + xDispatcher.dispatch( aURL, null ); util.utils.pause(2000); diff --git a/qadevOOo/tests/java/mod/_sw/SwAccessibleDocumentView.java b/qadevOOo/tests/java/mod/_sw/SwAccessibleDocumentView.java index dcc6fc889427..5d62551fc91d 100644 --- a/qadevOOo/tests/java/mod/_sw/SwAccessibleDocumentView.java +++ b/qadevOOo/tests/java/mod/_sw/SwAccessibleDocumentView.java @@ -19,7 +19,6 @@ package mod._sw; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -74,25 +73,20 @@ public class SwAccessibleDocumentView extends TestCase { XTextCursor oCursor = oText.createTextCursor(); log.println( "inserting some lines" ); - try { - for (int i=0; i<5; i++){ - oText.insertString( oCursor,"Paragraph Number: " + i, false); - oText.insertString( oCursor, - " The quick brown fox jumps over the lazy Dog: SwXParagraph", - false); - oText.insertControlCharacter( - oCursor, ControlCharacter.PARAGRAPH_BREAK, false ); - oText.insertString( oCursor, - "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG: SwXParagraph", - false); - oText.insertControlCharacter(oCursor, - ControlCharacter.PARAGRAPH_BREAK, false ); - oText.insertControlCharacter( - oCursor, ControlCharacter.LINE_BREAK, false ); - } - } catch ( com.sun.star.lang.IllegalArgumentException e ){ - e.printStackTrace(log); - throw new StatusException( "Couldn't insert lines", e ); + for (int i=0; i<5; i++){ + oText.insertString( oCursor,"Paragraph Number: " + i, false); + oText.insertString( oCursor, + " The quick brown fox jumps over the lazy Dog: SwXParagraph", + false); + oText.insertControlCharacter( + oCursor, ControlCharacter.PARAGRAPH_BREAK, false ); + oText.insertString( oCursor, + "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG: SwXParagraph", + false); + oText.insertControlCharacter(oCursor, + ControlCharacter.PARAGRAPH_BREAK, false ); + oText.insertControlCharacter( + oCursor, ControlCharacter.LINE_BREAK, false ); } XModel aModel = UnoRuntime.queryInterface(XModel.class, xTextDoc); diff --git a/qadevOOo/tests/java/mod/_sw/SwAccessibleEndnoteView.java b/qadevOOo/tests/java/mod/_sw/SwAccessibleEndnoteView.java index a1858786eb74..9b47147f4983 100644 --- a/qadevOOo/tests/java/mod/_sw/SwAccessibleEndnoteView.java +++ b/qadevOOo/tests/java/mod/_sw/SwAccessibleEndnoteView.java @@ -19,7 +19,6 @@ package mod._sw; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -61,7 +60,7 @@ public class SwAccessibleEndnoteView extends TestCase { */ @Override protected TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) { + TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; XInterface oEndnote = null; @@ -69,48 +68,24 @@ public class SwAccessibleEndnoteView extends TestCase { log.println( "Creating a test environment" ); XMultiServiceFactory msf = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDoc); log.println("creating a endnote"); - try { - oEndnote = UnoRuntime.queryInterface(XInterface.class, - msf.createInstance("com.sun.star.text.Endnote")); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create endnote", e); - } + oEndnote = UnoRuntime.queryInterface(XInterface.class, + msf.createInstance("com.sun.star.text.Endnote")); XText oText = xTextDoc.getText(); XTextCursor oCursor = oText.createTextCursor(); log.println("inserting the footnote into text document"); XTextContent xTC = UnoRuntime.queryInterface(XTextContent.class, oEndnote); - try { - oText.insertTextContent(oCursor, xTC, false); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't insert the endnote", e); - } + oText.insertTextContent(oCursor, xTC, false); XController xController = xTextDoc.getCurrentController(); XViewSettingsSupplier xViewSetSup = UnoRuntime.queryInterface(XViewSettingsSupplier.class, xController); XPropertySet xPropSet = xViewSetSup.getViewSettings(); - try { - //change zoom value to 10% - //footer should be in the vissible area of the document - xPropSet.setPropertyValue("ZoomValue", Short.valueOf("10")); - } catch ( com.sun.star.lang.WrappedTargetException e ) { - e.printStackTrace(log); - throw new StatusException("Couldn't set propertyValue...", e); - } catch ( com.sun.star.lang.IllegalArgumentException e ) { - e.printStackTrace(log); - throw new StatusException("Couldn't set propertyValue...", e); - } catch ( com.sun.star.beans.PropertyVetoException e ) { - e.printStackTrace(log); - throw new StatusException("Couldn't set propertyValue...", e); - } catch ( com.sun.star.beans.UnknownPropertyException e ) { - e.printStackTrace(log); - throw new StatusException("Couldn't set propertyValue...", e); - } + //change zoom value to 10% + //footer should be in the vissible area of the document + xPropSet.setPropertyValue("ZoomValue", Short.valueOf("10")); XModel aModel = UnoRuntime.queryInterface(XModel.class, xTextDoc); diff --git a/qadevOOo/tests/java/mod/_sw/SwAccessibleFooterView.java b/qadevOOo/tests/java/mod/_sw/SwAccessibleFooterView.java index d48ea8c730b8..2e6e52d9efdf 100644 --- a/qadevOOo/tests/java/mod/_sw/SwAccessibleFooterView.java +++ b/qadevOOo/tests/java/mod/_sw/SwAccessibleFooterView.java @@ -71,7 +71,7 @@ public class SwAccessibleFooterView extends TestCase { */ @Override protected TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) { + TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; XNameAccess PageStyles = null; @@ -81,49 +81,24 @@ public class SwAccessibleFooterView extends TestCase { XNameAccess StyleFamNames = StyleFam.getStyleFamilies(); // obtains style 'Standard' from style family 'PageStyles' - try { - PageStyles = (XNameAccess) AnyConverter.toObject( - new Type(XNameAccess.class),StyleFamNames.getByName("PageStyles")); - StdStyle = (XStyle) AnyConverter.toObject( - new Type(XStyle.class),PageStyles.getByName("Standard")); - } catch ( com.sun.star.lang.WrappedTargetException e ) { - e.printStackTrace(log); - throw new StatusException("Error getting style by name!", e); - } catch ( com.sun.star.container.NoSuchElementException e ) { - e.printStackTrace(log); - throw new StatusException("Error, no such style name! ", e); - } catch ( com.sun.star.lang.IllegalArgumentException e ) { - e.printStackTrace(log); - throw new StatusException("Error getting style by name!", e); - } + PageStyles = (XNameAccess) AnyConverter.toObject( + new Type(XNameAccess.class),StyleFamNames.getByName("PageStyles")); + StdStyle = (XStyle) AnyConverter.toObject( + new Type(XStyle.class),PageStyles.getByName("Standard")); final XPropertySet PropSet = UnoRuntime.queryInterface( XPropertySet.class, StdStyle); // changing/getting some properties - try { - log.println( "Switching on footer" ); - PropSet.setPropertyValue("FooterIsOn", Boolean.TRUE); - - //change zoom value to 10% - //footer should be in the vissible area of the document - XController xController = xTextDoc.getCurrentController(); - XViewSettingsSupplier xViewSetSup = UnoRuntime.queryInterface(XViewSettingsSupplier.class, - xController); - XPropertySet xPropSet = xViewSetSup.getViewSettings(); - xPropSet.setPropertyValue("ZoomValue", Short.valueOf("20")); - } catch ( com.sun.star.lang.WrappedTargetException e ) { - e.printStackTrace(log); - throw new StatusException("Couldn't set propertyValue...", e); - } catch ( com.sun.star.lang.IllegalArgumentException e ) { - e.printStackTrace(log); - throw new StatusException("Couldn't set propertyValue...", e); - } catch ( com.sun.star.beans.PropertyVetoException e ) { - e.printStackTrace(log); - throw new StatusException("Couldn't set propertyValue...", e); - } catch ( com.sun.star.beans.UnknownPropertyException e ) { - e.printStackTrace(log); - throw new StatusException("Couldn't set propertyValue...", e); - } + log.println( "Switching on footer" ); + PropSet.setPropertyValue("FooterIsOn", Boolean.TRUE); + + //change zoom value to 10% + //footer should be in the vissible area of the document + XController xController = xTextDoc.getCurrentController(); + XViewSettingsSupplier xViewSetSup = UnoRuntime.queryInterface(XViewSettingsSupplier.class, + xController); + XPropertySet xPropSet = xViewSetSup.getViewSettings(); + xPropSet.setPropertyValue("ZoomValue", Short.valueOf("20")); XModel aModel = UnoRuntime.queryInterface(XModel.class, xTextDoc); diff --git a/qadevOOo/tests/java/mod/_sw/SwAccessibleFootnoteView.java b/qadevOOo/tests/java/mod/_sw/SwAccessibleFootnoteView.java index b487b62d196e..6a0319b11330 100644 --- a/qadevOOo/tests/java/mod/_sw/SwAccessibleFootnoteView.java +++ b/qadevOOo/tests/java/mod/_sw/SwAccessibleFootnoteView.java @@ -19,7 +19,6 @@ package mod._sw; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -61,7 +60,7 @@ public class SwAccessibleFootnoteView extends TestCase { */ @Override protected TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) { + TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; XFootnote oFootnote = null; @@ -71,47 +70,23 @@ public class SwAccessibleFootnoteView extends TestCase { XMultiServiceFactory msf = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDoc); log.println("creating a footnote"); - try { - oFootnote = UnoRuntime.queryInterface(XFootnote.class, - msf.createInstance("com.sun.star.text.Footnote")); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create footnote", e); - } + oFootnote = UnoRuntime.queryInterface(XFootnote.class, + msf.createInstance("com.sun.star.text.Footnote")); XText oText = xTextDoc.getText(); XTextCursor oCursor = oText.createTextCursor(); log.println("inserting the footnote into text document"); - try { - oText.insertTextContent(oCursor, oFootnote, false); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't insert the footnote", e); - } + oText.insertTextContent(oCursor, oFootnote, false); XController xController = xTextDoc.getCurrentController(); XViewSettingsSupplier xViewSetSup = UnoRuntime.queryInterface(XViewSettingsSupplier.class, xController); XPropertySet xPropSet = xViewSetSup.getViewSettings(); - try { - //change zoom value to 10% - //footer should be in the vissible area of the document - xPropSet.setPropertyValue("ZoomValue", Short.valueOf("10")); - } catch ( com.sun.star.lang.WrappedTargetException e ) { - e.printStackTrace(log); - throw new StatusException("Couldn't set propertyValue...", e); - } catch ( com.sun.star.lang.IllegalArgumentException e ) { - e.printStackTrace(log); - throw new StatusException("Couldn't set propertyValue...", e); - } catch ( com.sun.star.beans.PropertyVetoException e ) { - e.printStackTrace(log); - throw new StatusException("Couldn't set propertyValue...", e); - } catch ( com.sun.star.beans.UnknownPropertyException e ) { - e.printStackTrace(log); - throw new StatusException("Couldn't set propertyValue...", e); - } + //change zoom value to 10% + //footer should be in the vissible area of the document + xPropSet.setPropertyValue("ZoomValue", Short.valueOf("10")); XModel aModel = UnoRuntime.queryInterface(XModel.class, xTextDoc); diff --git a/qadevOOo/tests/java/mod/_sw/SwAccessibleHeaderView.java b/qadevOOo/tests/java/mod/_sw/SwAccessibleHeaderView.java index b3a8297a4172..7353251f3881 100644 --- a/qadevOOo/tests/java/mod/_sw/SwAccessibleHeaderView.java +++ b/qadevOOo/tests/java/mod/_sw/SwAccessibleHeaderView.java @@ -69,7 +69,7 @@ public class SwAccessibleHeaderView extends TestCase { */ @Override protected TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) { + TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; XNameAccess PageStyles = null; @@ -79,41 +79,16 @@ public class SwAccessibleHeaderView extends TestCase { XNameAccess StyleFamNames = StyleFam.getStyleFamilies(); // obtains style 'Standatd' from style family 'PageStyles' - try { - PageStyles = (XNameAccess) AnyConverter.toObject( - new Type(XNameAccess.class),StyleFamNames.getByName("PageStyles")); - StdStyle = (XStyle) AnyConverter.toObject( - new Type(XStyle.class),PageStyles.getByName("Standard")); - } catch ( com.sun.star.lang.WrappedTargetException e ) { - e.printStackTrace(log); - throw new StatusException("Error getting style by name!", e); - } catch ( com.sun.star.container.NoSuchElementException e ) { - e.printStackTrace(log); - throw new StatusException("Error, no such style name! ", e); - } catch ( com.sun.star.lang.IllegalArgumentException e ) { - e.printStackTrace(log); - throw new StatusException("Error getting style by name!", e); - } + PageStyles = (XNameAccess) AnyConverter.toObject( + new Type(XNameAccess.class),StyleFamNames.getByName("PageStyles")); + StdStyle = (XStyle) AnyConverter.toObject( + new Type(XStyle.class),PageStyles.getByName("Standard")); final XPropertySet PropSet = UnoRuntime.queryInterface( XPropertySet.class, StdStyle); // changing/getting some properties - try { - log.println( "Switching on header" ); - PropSet.setPropertyValue("HeaderIsOn", Boolean.TRUE); - } catch ( com.sun.star.lang.WrappedTargetException e ) { - e.printStackTrace(log); - throw new StatusException("Couldn't set propertyValue...", e); - } catch ( com.sun.star.lang.IllegalArgumentException e ) { - e.printStackTrace(log); - throw new StatusException("Couldn't set propertyValue...", e); - } catch ( com.sun.star.beans.PropertyVetoException e ) { - e.printStackTrace(log); - throw new StatusException("Couldn't set propertyValue...", e); - } catch ( com.sun.star.beans.UnknownPropertyException e ) { - e.printStackTrace(log); - throw new StatusException("Couldn't set propertyValue...", e); - } + log.println( "Switching on header" ); + PropSet.setPropertyValue("HeaderIsOn", Boolean.TRUE); XModel aModel = UnoRuntime.queryInterface(XModel.class, xTextDoc); diff --git a/qadevOOo/tests/java/mod/_sw/SwAccessiblePageView.java b/qadevOOo/tests/java/mod/_sw/SwAccessiblePageView.java index 84fa8139cf68..b15621045c19 100644 --- a/qadevOOo/tests/java/mod/_sw/SwAccessiblePageView.java +++ b/qadevOOo/tests/java/mod/_sw/SwAccessiblePageView.java @@ -19,8 +19,6 @@ package mod._sw; import java.io.PrintWriter; -import lib.Status; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -69,7 +67,7 @@ public class SwAccessiblePageView extends TestCase { */ @Override protected TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) { + TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; XInterface port = null; @@ -79,70 +77,36 @@ public class SwAccessiblePageView extends TestCase { XTextCursor oCursor = oText.createTextCursor(); log.println( "inserting some lines" ); - try { - for (int i=0; i<2; i++){ - oText.insertString( oCursor,"Paragraph Number: " + i, false); - oText.insertString( oCursor, - " The quick brown fox jumps over the lazy Dog: SwXParagraph", - false); - oText.insertControlCharacter( - oCursor, ControlCharacter.PARAGRAPH_BREAK, false ); - oText.insertString( oCursor, - "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG: SwXParagraph", - false); - oText.insertControlCharacter(oCursor, - ControlCharacter.PARAGRAPH_BREAK, false ); - oText.insertControlCharacter( - oCursor, ControlCharacter.LINE_BREAK, false ); - } - } catch ( com.sun.star.lang.IllegalArgumentException e ){ - e.printStackTrace(log); - throw new StatusException( "Couldn't insert lines", e ); + for (int i=0; i<2; i++){ + oText.insertString( oCursor,"Paragraph Number: " + i, false); + oText.insertString( oCursor, + " The quick brown fox jumps over the lazy Dog: SwXParagraph", + false); + oText.insertControlCharacter( + oCursor, ControlCharacter.PARAGRAPH_BREAK, false ); + oText.insertString( oCursor, + "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG: SwXParagraph", + false); + oText.insertControlCharacter(oCursor, + ControlCharacter.PARAGRAPH_BREAK, false ); + oText.insertControlCharacter( + oCursor, ControlCharacter.LINE_BREAK, false ); } // Enumeration XEnumerationAccess oEnumA = UnoRuntime.queryInterface(XEnumerationAccess.class, oText ); XEnumeration oEnum = oEnumA.createEnumeration(); - try { - para = (XInterface) AnyConverter.toObject( - new Type(XInterface.class),oEnum.nextElement()); - XEnumerationAccess oEnumB = UnoRuntime.queryInterface( XEnumerationAccess.class, para ); - XEnumeration oEnum2 = oEnumB.createEnumeration(); - port = (XInterface) AnyConverter.toObject( - new Type(XInterface.class),oEnum2.nextElement()); - } catch ( com.sun.star.lang.WrappedTargetException e ) { - e.printStackTrace(log); - log.println("Error: exception occurred..."); - } catch ( com.sun.star.container.NoSuchElementException e ) { - e.printStackTrace(log); - log.println("Error: exception occurred..."); - } catch ( com.sun.star.lang.IllegalArgumentException e ) { - e.printStackTrace(log); - log.println("Error: exception occurred..."); - } + para = (XInterface) AnyConverter.toObject( + new Type(XInterface.class),oEnum.nextElement()); + XEnumerationAccess oEnumB = UnoRuntime.queryInterface( XEnumerationAccess.class, para ); + XEnumeration oEnum2 = oEnumB.createEnumeration(); + port = (XInterface) AnyConverter.toObject( + new Type(XInterface.class),oEnum2.nextElement()); - try { - UnoRuntime.queryInterface(XPropertySet.class, port); - paraP = UnoRuntime.queryInterface(XPropertySet.class, para); - paraP.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_AFTER); - } catch ( com.sun.star.lang.WrappedTargetException e ) { - log.println("Error, exception occurred..."); - e.printStackTrace(log); - throw new StatusException( "Couldn't get Paragraph", e ); - } catch ( com.sun.star.lang.IllegalArgumentException e ) { - log.println("Error, exception occurred..."); - e.printStackTrace(log); - throw new StatusException( "Couldn't get Paragraph", e ); - } catch ( com.sun.star.beans.UnknownPropertyException e ) { - log.println("Error, exception occurred..."); - e.printStackTrace(log); - throw new StatusException( "Couldn't get Paragraph", e ); - } catch ( com.sun.star.beans.PropertyVetoException e ) { - log.println("Error, exception occurred..."); - e.printStackTrace(log); - throw new StatusException( "Couldn't get Paragraph", e ); - } + UnoRuntime.queryInterface(XPropertySet.class, port); + paraP = UnoRuntime.queryInterface(XPropertySet.class, para); + paraP.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_AFTER); util.utils.pause(500); @@ -151,22 +115,18 @@ public class SwAccessiblePageView extends TestCase { XModel aModel = UnoRuntime.queryInterface(XModel.class, xTextDoc); //switch to 'Print Preview' mode - try { - XDispatchProvider xDispProv = UnoRuntime.queryInterface(XDispatchProvider.class, xController); - XURLTransformer xParser = UnoRuntime.queryInterface(XURLTransformer.class, - Param.getMSF().createInstance("com.sun.star.util.URLTransformer")); - // Because it's an in/out parameter we must use an array of URL objects. - URL[] aParseURL = new URL[1]; - aParseURL[0] = new URL(); - aParseURL[0].Complete = ".uno:PrintPreview"; - xParser.parseStrict(aParseURL); - URL aURL = aParseURL[0]; - XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", 0); - if(xDispatcher != null) - xDispatcher.dispatch( aURL, null ); - } catch (com.sun.star.uno.Exception e) { - throw new StatusException(e, Status.failed("Couldn't change mode")); - } + XDispatchProvider xDispProv = UnoRuntime.queryInterface(XDispatchProvider.class, xController); + XURLTransformer xParser = UnoRuntime.queryInterface(XURLTransformer.class, + Param.getMSF().createInstance("com.sun.star.util.URLTransformer")); + // Because it's an in/out parameter we must use an array of URL objects. + URL[] aParseURL = new URL[1]; + aParseURL[0] = new URL(); + aParseURL[0].Complete = ".uno:PrintPreview"; + xParser.parseStrict(aParseURL); + URL aURL = aParseURL[0]; + XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", 0); + if(xDispatcher != null) + xDispatcher.dispatch( aURL, null ); util.utils.pause(500); diff --git a/qadevOOo/tests/java/mod/_sw/SwAccessibleTableCellView.java b/qadevOOo/tests/java/mod/_sw/SwAccessibleTableCellView.java index 337d0d60a1f4..fac1a8659753 100644 --- a/qadevOOo/tests/java/mod/_sw/SwAccessibleTableCellView.java +++ b/qadevOOo/tests/java/mod/_sw/SwAccessibleTableCellView.java @@ -19,7 +19,6 @@ package mod._sw; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -72,13 +71,7 @@ public class SwAccessibleTableCellView extends TestCase { oTable = SOfficeFactory.createTextTable(xTextDoc); - try { - SOfficeFactory.insertTextContent(xTextDoc, oTable); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't insert text content :" + - e.getMessage(), e); - } + SOfficeFactory.insertTextContent(xTextDoc, oTable); XModel aModel = UnoRuntime.queryInterface(XModel.class, xTextDoc); diff --git a/qadevOOo/tests/java/mod/_sw/SwAccessibleTableView.java b/qadevOOo/tests/java/mod/_sw/SwAccessibleTableView.java index 9a51003d6501..f8aa53ca8be1 100644 --- a/qadevOOo/tests/java/mod/_sw/SwAccessibleTableView.java +++ b/qadevOOo/tests/java/mod/_sw/SwAccessibleTableView.java @@ -19,7 +19,6 @@ package mod._sw; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -74,13 +73,7 @@ public class SwAccessibleTableView extends TestCase { SOfficeFactory.getFactory(Param.getMSF()); oTable = SOfficeFactory.createTextTable( xTextDoc ); - try { - SOfficeFactory.insertTextContent(xTextDoc, oTable ); - } catch ( com.sun.star.lang.IllegalArgumentException e ) { - e.printStackTrace( log ); - throw new StatusException("Couldn't insert text content :" - + e.getMessage(), e); - } + SOfficeFactory.insertTextContent(xTextDoc, oTable ); XModel aModel = UnoRuntime.queryInterface(XModel.class, xTextDoc); diff --git a/qadevOOo/tests/java/mod/_sw/SwAccessibleTextFrameView.java b/qadevOOo/tests/java/mod/_sw/SwAccessibleTextFrameView.java index 4692fa0e13d1..72498e32506f 100644 --- a/qadevOOo/tests/java/mod/_sw/SwAccessibleTextFrameView.java +++ b/qadevOOo/tests/java/mod/_sw/SwAccessibleTextFrameView.java @@ -19,7 +19,6 @@ package mod._sw; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -70,7 +69,7 @@ public class SwAccessibleTextFrameView extends TestCase { */ @Override protected TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) { + TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; XTextFrame oFrame1 = null; @@ -82,22 +81,17 @@ public class SwAccessibleTextFrameView extends TestCase { SOfficeFactory.getFactory( Param.getMSF() ); // creating Frames log.println( "creating Frames" ); - try { - oFrame1 = SOfficeFactory.createTextFrame(xTextDoc, 500, 500); - oPropSet = UnoRuntime.queryInterface( - XPropertySet.class, oFrame1 ); - oPropSet.setPropertyValue("AnchorType", - TextContentAnchorType.AS_CHARACTER); - oText = xTextDoc.getText(); - oCursor = oText.createTextCursor(); - - log.println( "inserting Frame1" ); - XTextContent the_content = UnoRuntime.queryInterface(XTextContent.class, oFrame1); - oText.insertTextContent(oCursor, the_content, true); - } catch (Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't insert TextFrame", e); - } + oFrame1 = SOfficeFactory.createTextFrame(xTextDoc, 500, 500); + oPropSet = UnoRuntime.queryInterface( + XPropertySet.class, oFrame1 ); + oPropSet.setPropertyValue("AnchorType", + TextContentAnchorType.AS_CHARACTER); + oText = xTextDoc.getText(); + oCursor = oText.createTextCursor(); + + log.println( "inserting Frame1" ); + XTextContent the_content = UnoRuntime.queryInterface(XTextContent.class, oFrame1); + oText.insertTextContent(oCursor, the_content, true); XModel aModel = UnoRuntime.queryInterface(XModel.class, xTextDoc); diff --git a/qadevOOo/tests/java/mod/_sw/SwAccessibleTextGraphicObject.java b/qadevOOo/tests/java/mod/_sw/SwAccessibleTextGraphicObject.java index 73a53f29981e..9458e0e42b72 100644 --- a/qadevOOo/tests/java/mod/_sw/SwAccessibleTextGraphicObject.java +++ b/qadevOOo/tests/java/mod/_sw/SwAccessibleTextGraphicObject.java @@ -19,7 +19,6 @@ package mod._sw; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -81,12 +80,7 @@ public class SwAccessibleTextGraphicObject extends TestCase { XTextContent the_content = UnoRuntime.queryInterface(XTextContent.class, oGraphObj); log.println( "inserting graphic" ); - try { - the_text.insertTextContent(the_cursor, the_content, true); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(); - throw new StatusException("Couldn't insert Content", e); - } + the_text.insertTextContent(the_cursor, the_content, true); XModel aModel = UnoRuntime.queryInterface(XModel.class, xTextDoc); diff --git a/qadevOOo/tests/java/mod/_sw/SwXAutoTextContainer.java b/qadevOOo/tests/java/mod/_sw/SwXAutoTextContainer.java index 8744d79c518e..b529133f6538 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXAutoTextContainer.java +++ b/qadevOOo/tests/java/mod/_sw/SwXAutoTextContainer.java @@ -20,7 +20,6 @@ package mod._sw; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -55,22 +54,17 @@ public class SwXAutoTextContainer extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log ) throws StatusException { + TestParameters Param, PrintWriter log ) throws Exception { XAutoTextContainer oContainer = null; // creation of testobject here // first we write what we are intend to do to log file log.println("creating a AutoTextContainer"); - try { - XMultiServiceFactory myMSF = Param.getMSF(); - Object oInst = myMSF.createInstance - ("com.sun.star.text.AutoTextContainer"); - oContainer = UnoRuntime.queryInterface - (XAutoTextContainer.class,oInst); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create AutoTextContainer", e); - } + XMultiServiceFactory myMSF = Param.getMSF(); + Object oInst = myMSF.createInstance + ("com.sun.star.text.AutoTextContainer"); + oContainer = UnoRuntime.queryInterface + (XAutoTextContainer.class,oInst); TestEnvironment tEnv = new TestEnvironment(oContainer); diff --git a/qadevOOo/tests/java/mod/_sw/SwXAutoTextEntry.java b/qadevOOo/tests/java/mod/_sw/SwXAutoTextEntry.java index 676ec4560098..c53a7a8cd91f 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXAutoTextEntry.java +++ b/qadevOOo/tests/java/mod/_sw/SwXAutoTextEntry.java @@ -27,6 +27,7 @@ import lib.TestParameters; import util.DefaultDsc; import util.InstCreator; import util.SOfficeFactory; + import com.sun.star.container.XNameAccess; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.text.XAutoTextContainer; @@ -120,21 +121,16 @@ public class SwXAutoTextEntry extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment - (TestParameters Param, PrintWriter log) { + (TestParameters Param, PrintWriter log) throws Exception { XAutoTextEntry oEntry = null; XAutoTextContainer oContainer; XInterface oObj = null; log.println( "creating a test environment" ); - try { - XMultiServiceFactory myMSF = Param.getMSF(); - Object oInst = myMSF.createInstance - ("com.sun.star.text.AutoTextContainer"); - oContainer = UnoRuntime.queryInterface(XAutoTextContainer.class,oInst); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create AutoTextContainer", e); - } + XMultiServiceFactory myMSF = Param.getMSF(); + Object oInst = myMSF.createInstance + ("com.sun.star.text.AutoTextContainer"); + oContainer = UnoRuntime.queryInterface(XAutoTextContainer.class,oInst); XNameAccess oContNames = UnoRuntime.queryInterface(XNameAccess.class, oContainer); @@ -143,12 +139,7 @@ public class SwXAutoTextEntry extends TestCase { log.println("ContainerNames[ "+ i + "]: " + contNames[i]); } - try{ - oObj = (XInterface) AnyConverter.toObject(new Type(XInterface.class),oContNames.getByName("mytexts")); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get AutoTextGroup", e); - } + oObj = (XInterface) AnyConverter.toObject(new Type(XInterface.class),oContNames.getByName("mytexts")); oGroup = UnoRuntime.queryInterface (XAutoTextGroup.class, oObj); diff --git a/qadevOOo/tests/java/mod/_sw/SwXAutoTextGroup.java b/qadevOOo/tests/java/mod/_sw/SwXAutoTextGroup.java index 8410cf7c5468..be70947a8e4e 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXAutoTextGroup.java +++ b/qadevOOo/tests/java/mod/_sw/SwXAutoTextGroup.java @@ -18,8 +18,8 @@ package mod._sw; -import com.sun.star.container.ElementExistException; import com.sun.star.container.XNameAccess; + import java.io.PrintWriter; import lib.StatusException; @@ -27,6 +27,7 @@ import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; import util.SOfficeFactory; + import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.text.XAutoTextContainer; import com.sun.star.text.XText; @@ -35,6 +36,7 @@ import com.sun.star.uno.AnyConverter; import com.sun.star.uno.Type; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XInterface; + import util.utils; @@ -102,20 +104,15 @@ public class SwXAutoTextGroup extends TestCase { * </ul> */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; XAutoTextContainer oContainer; log.println( "creating a test environment" ); - try { - XMultiServiceFactory myMSF = Param.getMSF(); - Object oInst = myMSF.createInstance("com.sun.star.text.AutoTextContainer"); - oContainer = UnoRuntime.queryInterface(XAutoTextContainer.class,oInst); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create AutoTextContainer", e); - } + XMultiServiceFactory myMSF = Param.getMSF(); + Object oInst = myMSF.createInstance("com.sun.star.text.AutoTextContainer"); + oContainer = UnoRuntime.queryInterface(XAutoTextContainer.class,oInst); String myGroupName="myNewGroup2*1"; XAutoTextContainer xATC = UnoRuntime.queryInterface(XAutoTextContainer.class, oContainer); @@ -126,17 +123,8 @@ public class SwXAutoTextGroup extends TestCase { } catch (com.sun.star.container.NoSuchElementException e) { } - try { - log.println("adding element with name '" + myGroupName + "'"); - xATC.insertNewByName(myGroupName); - } catch (ElementExistException ex) { - ex.printStackTrace(log); - throw new StatusException("could not insert '"+myGroupName+"' into container",ex); - } catch (com.sun.star.lang.IllegalArgumentException ex) { - ex.printStackTrace(log); - throw new StatusException("could not insert '"+myGroupName+"' into container",ex); - } - + log.println("adding element with name '" + myGroupName + "'"); + xATC.insertNewByName(myGroupName); XNameAccess oContNames = UnoRuntime.queryInterface(XNameAccess.class, oContainer); @@ -147,12 +135,7 @@ public class SwXAutoTextGroup extends TestCase { } } - try{ - oObj = (XInterface) AnyConverter.toObject(new Type(XInterface.class),oContNames.getByName(myGroupName)); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get AutoTextGroup '"+myGroupName + "'", e); - } + oObj = (XInterface) AnyConverter.toObject(new Type(XInterface.class),oContNames.getByName(myGroupName)); log.println("ImplementationName " + utils.getImplName(oObj)); diff --git a/qadevOOo/tests/java/mod/_sw/SwXCellRange.java b/qadevOOo/tests/java/mod/_sw/SwXCellRange.java index 235a60d29c5d..7cb5c3ad01b9 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXCellRange.java +++ b/qadevOOo/tests/java/mod/_sw/SwXCellRange.java @@ -91,7 +91,7 @@ public class SwXCellRange extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log) { + (TestParameters tParam, PrintWriter log) throws Exception { XTextTable the_table = null; XInterface oObj = null; @@ -99,22 +99,10 @@ public class SwXCellRange extends TestCase { the_table.initialize(5, 5); if( SOfficeFactory.getTableCollection( xTextDoc ).getCount() == 0 ) { - try { - SOfficeFactory.insertTextContent(xTextDoc, the_table ); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't create TextTable : " - + e.getMessage(), e); - } - } - try { - XCellRange the_Range = UnoRuntime.queryInterface(XCellRange.class, the_table); - oObj = the_Range.getCellRangeByPosition(0, 0, 3, 4); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace( log ); - throw new StatusException("Couldn't get CellRange : " - + e.getMessage(), e); + SOfficeFactory.insertTextContent(xTextDoc, the_table ); } + XCellRange the_Range = UnoRuntime.queryInterface(XCellRange.class, the_table); + oObj = the_Range.getCellRangeByPosition(0, 0, 3, 4); log.println("Creating instance..."); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_sw/SwXDocumentIndex.java b/qadevOOo/tests/java/mod/_sw/SwXDocumentIndex.java index 4c5624b1e051..f0022d98a547 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXDocumentIndex.java +++ b/qadevOOo/tests/java/mod/_sw/SwXDocumentIndex.java @@ -93,31 +93,20 @@ public class SwXDocumentIndex extends TestCase { * */ @Override - protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { XTextContent xTC = null; Object instance = null; SOfficeFactory.getFactory(tParam.getMSF()); log.println( "creating a test environment" ); - try { - xTC = SOfficeFactory.createIndex(xTextDoc, "com.sun.star.text.DocumentIndex"); - instance = SOfficeFactory.createIndex(xTextDoc, "com.sun.star.text.DocumentIndex"); - } - catch ( com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create the Index", e); - } + xTC = SOfficeFactory.createIndex(xTextDoc, "com.sun.star.text.DocumentIndex"); + instance = SOfficeFactory.createIndex(xTextDoc, "com.sun.star.text.DocumentIndex"); XText oText = xTextDoc.getText(); XTextCursor oCursor = oText.createTextCursor(); log.println("inserting the Index into text document"); - try { - oText.insertTextContent(oCursor, xTC, false); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't insert the Index", e); - } + oText.insertTextContent(oCursor, xTC, false); TestEnvironment tEnv = new TestEnvironment(xTC); diff --git a/qadevOOo/tests/java/mod/_sw/SwXDocumentIndexMark.java b/qadevOOo/tests/java/mod/_sw/SwXDocumentIndexMark.java index 0b654905d000..8d02891be7b6 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXDocumentIndexMark.java +++ b/qadevOOo/tests/java/mod/_sw/SwXDocumentIndexMark.java @@ -115,13 +115,7 @@ public class SwXDocumentIndexMark extends TestCase { XDocumentIndexMark xDIM = UnoRuntime.queryInterface(XDocumentIndexMark.class, oDIM); - try { - oText.insertTextContent(oCursor, xDIM, false); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException - ("Couldn't insert the DocumentIndexMark", e); - } + oText.insertTextContent(oCursor, xDIM, false); TestEnvironment tEnv = new TestEnvironment(xDIM); diff --git a/qadevOOo/tests/java/mod/_sw/SwXDocumentIndexes.java b/qadevOOo/tests/java/mod/_sw/SwXDocumentIndexes.java index 7ca935efd647..06079771642b 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXDocumentIndexes.java +++ b/qadevOOo/tests/java/mod/_sw/SwXDocumentIndexes.java @@ -89,31 +89,18 @@ public class SwXDocumentIndexes extends TestCase { */ @Override public TestEnvironment createTestEnvironment( - TestParameters tParam, PrintWriter log ) throws StatusException { + TestParameters tParam, PrintWriter log ) throws Exception { XInterface oObj = null; SOfficeFactory.getFactory( tParam.getMSF() ); log.println( "creating a test environment" ); - XTextContent xTC = null; - - try { - xTC = SOfficeFactory.createIndex(xTextDoc,"com.sun.star.text.ContentIndex"); - } - catch ( com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create the Index", e); - } + XTextContent xTC = SOfficeFactory.createIndex(xTextDoc,"com.sun.star.text.ContentIndex"); XText oText = xTextDoc.getText(); XTextCursor oCursor = oText.createTextCursor(); log.println("inserting the Index into text document"); - try { - oText.insertTextContent(oCursor, xTC, false); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't insert the Index", e); - } + oText.insertTextContent(oCursor, xTC, false); XDocumentIndexesSupplier xDocInd = UnoRuntime.queryInterface(XDocumentIndexesSupplier.class,xTextDoc); diff --git a/qadevOOo/tests/java/mod/_sw/SwXEndnoteProperties.java b/qadevOOo/tests/java/mod/_sw/SwXEndnoteProperties.java index 240437b88e2d..bf515c183f92 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXEndnoteProperties.java +++ b/qadevOOo/tests/java/mod/_sw/SwXEndnoteProperties.java @@ -85,7 +85,7 @@ public class SwXEndnoteProperties extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log ) throws StatusException { + TestParameters Param, PrintWriter log ) throws Exception { XEndnotesSupplier oInterface = null; XInterface oObj = null; XInterface oEndnote; @@ -93,25 +93,15 @@ public class SwXEndnoteProperties extends TestCase { log.println( "Creating a test environment" ); XMultiServiceFactory msf = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDoc); log.println("creating a endnote"); - try { - oEndnote = UnoRuntime.queryInterface(XInterface.class, - msf.createInstance("com.sun.star.text.Endnote")); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create endnote", e); - } + oEndnote = UnoRuntime.queryInterface(XInterface.class, + msf.createInstance("com.sun.star.text.Endnote")); XText oText = xTextDoc.getText(); XTextCursor oCursor = oText.createTextCursor(); log.println("inserting the footnote into text document"); XTextContent xTC = UnoRuntime.queryInterface(XTextContent.class, oEndnote); - try { - oText.insertTextContent(oCursor, xTC, false); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't insert the endnote", e); - } + oText.insertTextContent(oCursor, xTC, false); oInterface = UnoRuntime.queryInterface(XEndnotesSupplier.class, xTextDoc); oObj = oInterface.getEndnoteSettings(); diff --git a/qadevOOo/tests/java/mod/_sw/SwXFieldEnumeration.java b/qadevOOo/tests/java/mod/_sw/SwXFieldEnumeration.java index 59e642253d79..4d7ace0e9651 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXFieldEnumeration.java +++ b/qadevOOo/tests/java/mod/_sw/SwXFieldEnumeration.java @@ -141,13 +141,8 @@ public class SwXFieldEnumeration extends TestCase { the_Cursor = the_Text.createTextCursor(); the_Field = UnoRuntime.queryInterface(XTextContent.class, oObj); - try { - xTF.attachTextFieldMaster(PFieldMaster); - the_Text.insertTextContent(the_Cursor,the_Field,false); - } catch ( com.sun.star.lang.IllegalArgumentException e ) { - e.printStackTrace(log); - throw new StatusException( "Couldn't create TextField", e ); - } + xTF.attachTextFieldMaster(PFieldMaster); + the_Text.insertTextContent(the_Cursor,the_Field,false); // create testobject here XTextFieldsSupplier oTFS = UnoRuntime.queryInterface( XTextFieldsSupplier.class, xTextDoc ); diff --git a/qadevOOo/tests/java/mod/_sw/SwXFootnote.java b/qadevOOo/tests/java/mod/_sw/SwXFootnote.java index 911fa368e684..c675eb355f31 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXFootnote.java +++ b/qadevOOo/tests/java/mod/_sw/SwXFootnote.java @@ -105,7 +105,7 @@ public class SwXFootnote extends TestCase { * </ul> */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XFootnote oFootnote; log.println( "Creating a test environment" ); @@ -113,25 +113,15 @@ public class SwXFootnote extends TestCase { XMultiServiceFactory msf = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDoc); log.println("creating a footnote"); Object instance = null; - try { - oFootnote = UnoRuntime.queryInterface(XFootnote.class, - msf.createInstance("com.sun.star.text.Footnote")); - instance = msf.createInstance("com.sun.star.text.Footnote"); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create footnote", e); - } + oFootnote = UnoRuntime.queryInterface(XFootnote.class, + msf.createInstance("com.sun.star.text.Footnote")); + instance = msf.createInstance("com.sun.star.text.Footnote"); XText oText = xTextDoc.getText(); XTextCursor oCursor = oText.createTextCursor(); log.println("inserting the footnote into text document"); - try { - oText.insertTextContent(oCursor, oFootnote, false); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't insert the footnote", e); - } + oText.insertTextContent(oCursor, oFootnote, false); TestEnvironment tEnv = new TestEnvironment(oFootnote); diff --git a/qadevOOo/tests/java/mod/_sw/SwXFootnoteProperties.java b/qadevOOo/tests/java/mod/_sw/SwXFootnoteProperties.java index 1660cf88185b..214e06c5870b 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXFootnoteProperties.java +++ b/qadevOOo/tests/java/mod/_sw/SwXFootnoteProperties.java @@ -84,7 +84,7 @@ public class SwXFootnoteProperties extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log ) throws StatusException { + TestParameters Param, PrintWriter log ) throws Exception { XFootnotesSupplier oInterface = null; XInterface oObj = null; XFootnote oFootnote; @@ -94,24 +94,14 @@ public class SwXFootnoteProperties extends TestCase { XMultiServiceFactory msf = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDoc); log.println("creating a footnote"); - try { - oFootnote = UnoRuntime.queryInterface(XFootnote.class, - msf.createInstance("com.sun.star.text.Footnote")); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create footnote", e); - } + oFootnote = UnoRuntime.queryInterface(XFootnote.class, + msf.createInstance("com.sun.star.text.Footnote")); XText oText = xTextDoc.getText(); XTextCursor oCursor = oText.createTextCursor(); log.println("inserting the footnote into text document"); - try { - oText.insertTextContent(oCursor, oFootnote, false); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't insert the footnote", e); - } + oText.insertTextContent(oCursor, oFootnote, false); oInterface = UnoRuntime.queryInterface(XFootnotesSupplier.class, xTextDoc); oObj = oInterface.getFootnoteSettings(); diff --git a/qadevOOo/tests/java/mod/_sw/SwXFootnoteText.java b/qadevOOo/tests/java/mod/_sw/SwXFootnoteText.java index 363a4485877c..5229611d780e 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXFootnoteText.java +++ b/qadevOOo/tests/java/mod/_sw/SwXFootnoteText.java @@ -116,7 +116,7 @@ public class SwXFootnoteText extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment( - TestParameters tParam, PrintWriter log ) throws StatusException { + TestParameters tParam, PrintWriter log ) throws Exception { XInterface oObj = null; XFootnote oFootnote; @@ -124,24 +124,14 @@ public class SwXFootnoteText extends TestCase { XMultiServiceFactory msf = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDoc); log.println("creating a footnote"); - try { - oFootnote = UnoRuntime.queryInterface(XFootnote.class, - msf.createInstance("com.sun.star.text.Footnote")); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create footnote", e); - } + oFootnote = UnoRuntime.queryInterface(XFootnote.class, + msf.createInstance("com.sun.star.text.Footnote")); XText oText = xTextDoc.getText(); XTextCursor oCursor = oText.createTextCursor(); log.println("inserting the footnote into text document"); - try { - oText.insertTextContent(oCursor, oFootnote, false); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't insert the footnote", e); - } + oText.insertTextContent(oCursor, oFootnote, false); XSimpleText oFootText = UnoRuntime.queryInterface(XSimpleText.class, oFootnote); oFootText.setString("SwXFootnoteText"); diff --git a/qadevOOo/tests/java/mod/_sw/SwXFootnotes.java b/qadevOOo/tests/java/mod/_sw/SwXFootnotes.java index dbc271dc61db..7e9d25b8388a 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXFootnotes.java +++ b/qadevOOo/tests/java/mod/_sw/SwXFootnotes.java @@ -87,7 +87,7 @@ public class SwXFootnotes extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log ) throws StatusException { + TestParameters Param, PrintWriter log ) throws Exception { XFootnotesSupplier oInterface = null; XInterface oObj = null; @@ -96,24 +96,14 @@ public class SwXFootnotes extends TestCase { log.println("creating a footnote"); XFootnote oFootnote; - try { - oFootnote = UnoRuntime.queryInterface(XFootnote.class, - msf.createInstance("com.sun.star.text.Footnote")); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create footnote", e); - } + oFootnote = UnoRuntime.queryInterface(XFootnote.class, + msf.createInstance("com.sun.star.text.Footnote")); XText oText = xTextDoc.getText(); XTextCursor oCursor = oText.createTextCursor(); log.println("inserting the footnote into text document"); - try { - oText.insertTextContent(oCursor, oFootnote, false); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't insert the footnote", e); - } + oText.insertTextContent(oCursor, oFootnote, false); oInterface = UnoRuntime.queryInterface(XFootnotesSupplier.class, xTextDoc); oObj = oInterface.getFootnotes(); diff --git a/qadevOOo/tests/java/mod/_sw/SwXFrames.java b/qadevOOo/tests/java/mod/_sw/SwXFrames.java index 89966150e1ca..93349669056c 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXFrames.java +++ b/qadevOOo/tests/java/mod/_sw/SwXFrames.java @@ -90,7 +90,7 @@ public class SwXFrames extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log ) throws StatusException { + TestParameters Param, PrintWriter log ) throws Exception { XInterface oObj = null; XTextFrame oFrame1 = null; XText oText = null; @@ -99,26 +99,14 @@ public class SwXFrames extends TestCase { XTextFramesSupplier oInterface = null; log.println( "creating a test environment" ); - try { - oDocMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDoc); - Object oInt = oDocMSF.createInstance("com.sun.star.text.TextFrame"); - oFrame1 = UnoRuntime.queryInterface( XTextFrame.class, oInt ); - } catch ( com.sun.star.uno.Exception e ) { - e.printStackTrace(log); - throw new StatusException - ("Couldn't create instance of TextFrame", e); - } + oDocMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDoc); + Object oInt = oDocMSF.createInstance("com.sun.star.text.TextFrame"); + oFrame1 = UnoRuntime.queryInterface( XTextFrame.class, oInt ); oText = xTextDoc.getText(); oCursor = oText.createTextCursor(); - try { - oText.insertTextContent(oCursor, oFrame1, false); - } catch ( com.sun.star.lang.IllegalArgumentException e ) { - e.printStackTrace(log); - throw new StatusException - ("Error: can't insert text content to text document", e); - } + oText.insertTextContent(oCursor, oFrame1, false); oInterface = UnoRuntime.queryInterface( XTextFramesSupplier.class, xTextDoc ); diff --git a/qadevOOo/tests/java/mod/_sw/SwXHeadFootText.java b/qadevOOo/tests/java/mod/_sw/SwXHeadFootText.java index 6b8eab9144cf..209d959590f3 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXHeadFootText.java +++ b/qadevOOo/tests/java/mod/_sw/SwXHeadFootText.java @@ -116,7 +116,7 @@ public class SwXHeadFootText extends TestCase { * </ul> */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; XPropertySet PropSet; XNameAccess PageStyles = null; @@ -127,46 +127,21 @@ public class SwXHeadFootText extends TestCase { XNameAccess StyleFamNames = StyleFam.getStyleFamilies(); // obtains style 'Standatd' from style family 'PageStyles' - try { - PageStyles = (XNameAccess) AnyConverter.toObject( - new Type(XNameAccess.class),StyleFamNames.getByName("PageStyles")); - StdStyle = (XStyle) AnyConverter.toObject( - new Type(XStyle.class),PageStyles.getByName("Standard")); - } catch ( com.sun.star.lang.WrappedTargetException e ) { - e.printStackTrace(log); - throw new StatusException("Error getting style by name!", e); - } catch ( com.sun.star.container.NoSuchElementException e ) { - e.printStackTrace(log); - throw new StatusException("Error, no such style name! ", e); - } catch ( com.sun.star.lang.IllegalArgumentException e ) { - e.printStackTrace(log); - throw new StatusException("Error getting style by name!", e); - } + PageStyles = (XNameAccess) AnyConverter.toObject( + new Type(XNameAccess.class),StyleFamNames.getByName("PageStyles")); + StdStyle = (XStyle) AnyConverter.toObject( + new Type(XStyle.class),PageStyles.getByName("Standard")); PropSet = UnoRuntime.queryInterface( XPropertySet.class, StdStyle); // changing/getting some properties - try { - log.println( "Switching on header" ); - PropSet.setPropertyValue("HeaderIsOn", Boolean.TRUE); - log.println( "Switching on footer" ); - PropSet.setPropertyValue("FooterIsOn", Boolean.TRUE); - log.println( "Get header text" ); - oObj = UnoRuntime.queryInterface( - XText.class, PropSet.getPropertyValue("HeaderText")); - } catch ( com.sun.star.lang.WrappedTargetException e ) { - e.printStackTrace(log); - throw new StatusException("Couldn't set/get propertyValue...", e); - } catch ( com.sun.star.lang.IllegalArgumentException e ) { - e.printStackTrace(log); - throw new StatusException("Couldn't set/get propertyValue...", e); - } catch ( com.sun.star.beans.PropertyVetoException e ) { - e.printStackTrace(log); - throw new StatusException("Couldn't set/get propertyValue...", e); - } catch ( com.sun.star.beans.UnknownPropertyException e ) { - e.printStackTrace(log); - throw new StatusException("Couldn't set/get propertyValue...", e); - } + log.println( "Switching on header" ); + PropSet.setPropertyValue("HeaderIsOn", Boolean.TRUE); + log.println( "Switching on footer" ); + PropSet.setPropertyValue("FooterIsOn", Boolean.TRUE); + log.println( "Get header text" ); + oObj = UnoRuntime.queryInterface( + XText.class, PropSet.getPropertyValue("HeaderText")); log.println( "creating a new environment for bodytext object" ); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_sw/SwXMailMerge.java b/qadevOOo/tests/java/mod/_sw/SwXMailMerge.java index c13f6918962c..5ce0153224ac 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXMailMerge.java +++ b/qadevOOo/tests/java/mod/_sw/SwXMailMerge.java @@ -22,8 +22,6 @@ import com.sun.star.beans.NamedValue; import util.DBTools; import util.utils; -import com.sun.star.beans.PropertyVetoException; -import com.sun.star.beans.UnknownPropertyException; import com.sun.star.beans.XPropertySet; import com.sun.star.container.NoSuchElementException; import com.sun.star.container.XNameAccess; @@ -72,19 +70,15 @@ public class SwXMailMerge extends TestCase { * </ul> */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; XInterface oRowSet = null; XJob Job = null; log.println(" instantiate MailMerge service"); - try { - oObj = (XInterface) Param.getMSF().createInstance - ("com.sun.star.text.MailMerge"); - } catch (Exception e) { - throw new StatusException("Can't create object environment", e) ; - } + oObj = (XInterface) Param.getMSF().createInstance + ("com.sun.star.text.MailMerge"); // <set some variables> String cTestDoc = utils.getFullTestURL("MailMerge.sxw"); @@ -100,32 +94,14 @@ public class SwXMailMerge extends TestCase { // <create XResultSet> log.println("create a XResultSet"); - try { - oRowSet = (XInterface) Param.getMSF().createInstance - ("com.sun.star.sdb.RowSet"); - } catch (Exception e) { - throw new StatusException("Can't create com.sun.star.sdb.RowSet", e); - } + oRowSet = (XInterface) Param.getMSF().createInstance + ("com.sun.star.sdb.RowSet"); XPropertySet oRowSetProps = UnoRuntime.queryInterface(XPropertySet.class, oRowSet); XRowSet xRowSet = UnoRuntime.queryInterface(XRowSet.class, oRowSet); - try { - oRowSetProps.setPropertyValue("DataSourceName",cDataSourceName); - oRowSetProps.setPropertyValue("Command",cDataCommand); - oRowSetProps.setPropertyValue("CommandType", Integer.valueOf(CommandType.TABLE)); - } catch (UnknownPropertyException e) { - throw new StatusException("Can't set properties on oRowSet", e); - } catch (PropertyVetoException e) { - throw new StatusException("Can't set properties on oRowSet", e); - } catch (IllegalArgumentException e) { - throw new StatusException("Can't set properties on oRowSet", e); - } catch (WrappedTargetException e) { - throw new StatusException("Can't set properties on oRowSet", e); - } - try { - xRowSet.execute(); - } catch (SQLException e) { - throw new StatusException("Can't execute oRowSet", e); - } + oRowSetProps.setPropertyValue("DataSourceName",cDataSourceName); + oRowSetProps.setPropertyValue("Command",cDataCommand); + oRowSetProps.setPropertyValue("CommandType", Integer.valueOf(CommandType.TABLE)); + xRowSet.execute(); XResultSet oResultSet = UnoRuntime.queryInterface(XResultSet.class, oRowSet); @@ -134,16 +110,12 @@ public class SwXMailMerge extends TestCase { // <create Bookmarks> log.println("create bookmarks"); - try { - XRowLocate oRowLocate = UnoRuntime.queryInterface( - XRowLocate.class, oResultSet); - oResultSet.first(); - myBookMarks[0] = oRowLocate.getBookmark(); - oResultSet.next(); - myBookMarks[1] = oRowLocate.getBookmark(); - } catch (SQLException e) { - throw new StatusException("Can't get Bookmarks", e); - } + XRowLocate oRowLocate = UnoRuntime.queryInterface( + XRowLocate.class, oResultSet); + oResultSet.first(); + myBookMarks[0] = oRowLocate.getBookmark(); + oResultSet.next(); + myBookMarks[1] = oRowLocate.getBookmark(); // </create Bookmarks> // <fill object with values> @@ -151,27 +123,17 @@ public class SwXMailMerge extends TestCase { log.println("fill MailMerge with default connection"); XPropertySet oObjProps = UnoRuntime.queryInterface(XPropertySet.class, oObj); - try { - oObjProps.setPropertyValue("ActiveConnection", getLocalXConnection(Param)); - oObjProps.setPropertyValue("DataSourceName", cDataSourceName); - oObjProps.setPropertyValue("Command", cDataCommand); - oObjProps.setPropertyValue("CommandType", Integer.valueOf(CommandType.TABLE)); - oObjProps.setPropertyValue("OutputType", Short.valueOf(MailMergeType.FILE)); - oObjProps.setPropertyValue("DocumentURL", cTestDoc); - oObjProps.setPropertyValue("OutputURL", cOutputURL); - oObjProps.setPropertyValue("FileNamePrefix", "Author"); - oObjProps.setPropertyValue("FileNameFromColumn", Boolean.FALSE); - oObjProps.setPropertyValue("Selection", new Object[0]); - - } catch (UnknownPropertyException e) { - throw new StatusException("Can't set properties on oObj", e); - } catch (PropertyVetoException e) { - throw new StatusException("Can't set properties on oObj", e); - } catch (IllegalArgumentException e) { - throw new StatusException("Can't set properties on oObj", e); - } catch (WrappedTargetException e) { - throw new StatusException("Can't set properties on oObj", e); - } + oObjProps.setPropertyValue("ActiveConnection", getLocalXConnection(Param)); + oObjProps.setPropertyValue("DataSourceName", cDataSourceName); + oObjProps.setPropertyValue("Command", cDataCommand); + oObjProps.setPropertyValue("CommandType", Integer.valueOf(CommandType.TABLE)); + oObjProps.setPropertyValue("OutputType", Short.valueOf(MailMergeType.FILE)); + oObjProps.setPropertyValue("DocumentURL", cTestDoc); + oObjProps.setPropertyValue("OutputURL", cOutputURL); + oObjProps.setPropertyValue("FileNamePrefix", "Author"); + oObjProps.setPropertyValue("FileNameFromColumn", Boolean.FALSE); + oObjProps.setPropertyValue("Selection", new Object[0]); + // </fill object with values> @@ -234,45 +196,22 @@ public class SwXMailMerge extends TestCase { // <create XResultSet> log.println("create XResultSet"); - try { - oRowSet = (XInterface) Param.getMSF().createInstance - ("com.sun.star.sdb.RowSet"); - } catch (Exception e) { - throw new StatusException("Can't create com.sun.star.sdb.RowSet", e); - } + oRowSet = (XInterface) Param.getMSF().createInstance + ("com.sun.star.sdb.RowSet"); oRowSetProps = UnoRuntime.queryInterface(XPropertySet.class, oRowSet); xRowSet = UnoRuntime.queryInterface(XRowSet.class, oRowSet); - try { - oRowSetProps.setPropertyValue("DataSourceName",cDataSourceName); - oRowSetProps.setPropertyValue("Command",cDataCommand); - oRowSetProps.setPropertyValue("CommandType", Integer.valueOf(CommandType.TABLE)); - } catch (UnknownPropertyException e) { - throw new StatusException("Can't set properties on oRowSet", e); - } catch (PropertyVetoException e) { - throw new StatusException("Can't set properties on oRowSet", e); - } catch (IllegalArgumentException e) { - throw new StatusException("Can't set properties on oRowSet", e); - } catch (WrappedTargetException e) { - throw new StatusException("Can't set properties on oRowSet", e); - } - try { - xRowSet.execute(); - } catch (SQLException e) { - throw new StatusException("Can't execute oRowSet", e); - } + oRowSetProps.setPropertyValue("DataSourceName",cDataSourceName); + oRowSetProps.setPropertyValue("Command",cDataCommand); + oRowSetProps.setPropertyValue("CommandType", Integer.valueOf(CommandType.TABLE)); + xRowSet.execute(); oResultSet = UnoRuntime.queryInterface(XResultSet.class, oRowSet); XResultSet oMMXResultSet = null; - try { - oMMXResultSet = UnoRuntime.queryInterface(XResultSet.class, - Param.getMSF().createInstance("com.sun.star.sdb.RowSet")); - - } catch (Exception e) { - throw new StatusException("Can't create com.sun.star.sdb.RowSet", e); - } + oMMXResultSet = UnoRuntime.queryInterface(XResultSet.class, + Param.getMSF().createInstance("com.sun.star.sdb.RowSet")); // </create object relations> TestEnvironment tEnv = new TestEnvironment(oObj) ; diff --git a/qadevOOo/tests/java/mod/_sw/SwXModule.java b/qadevOOo/tests/java/mod/_sw/SwXModule.java index 12648611e8cf..6d074c86f6f4 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXModule.java +++ b/qadevOOo/tests/java/mod/_sw/SwXModule.java @@ -20,7 +20,6 @@ package mod._sw; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -51,25 +50,10 @@ public class SwXModule extends TestCase { */ @Override public TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log ) throws StatusException { - XInterface oObj = null; - Object oInterface = null; - - try { - oInterface = Param.getMSF().createInstance( - "com.sun.star.text.GlobalSettings" ); - } catch ( com.sun.star.uno.Exception e ) { - log.println("Service not available" ); - throw new StatusException("Service not available", e) ; - } - - if (oInterface == null) { - log.println("Service wasn't created") ; - throw new StatusException("Service wasn't created", - new NullPointerException()) ; - } - - oObj = (XInterface) oInterface; + TestParameters Param, PrintWriter log ) throws Exception { + Object oInterface = Param.getMSF().createInstance( + "com.sun.star.text.GlobalSettings" ); + XInterface oObj = (XInterface) oInterface; log.println( " creating a new environment for object" ); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_sw/SwXParagraph.java b/qadevOOo/tests/java/mod/_sw/SwXParagraph.java index 275788174a9d..255c52ab1c1d 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXParagraph.java +++ b/qadevOOo/tests/java/mod/_sw/SwXParagraph.java @@ -20,7 +20,6 @@ package mod._sw; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -132,7 +131,7 @@ public class SwXParagraph extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log) { + (TestParameters tParam, PrintWriter log) throws Exception { if (xTextDoc != null) { log.println(" disposing xTextDoc "); @@ -148,13 +147,8 @@ public class SwXParagraph extends TestCase { } } SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF() ); - try { - log.println( "creating a textdocument" ); - xTextDoc = SOF.createTextDoc( null ); - } catch ( com.sun.star.uno.Exception e ) { - e.printStackTrace( log ); - throw new StatusException( "Couldn't create document", e ); - } + log.println( "creating a textdocument" ); + xTextDoc = SOF.createTextDoc( null ); XInterface oObj = null; XPropertySet paraP = null; @@ -170,25 +164,20 @@ public class SwXParagraph extends TestCase { XTextCursor oCursor = oText.createTextCursor(); log.println( "inserting some lines" ); - try { - for (int i=0; i<5; i++){ - oText.insertString( oCursor,"Paragraph Number: " + i, false); - oText.insertString( oCursor, - " The quick brown fox jumps over the lazy Dog: SwXParagraph", - false); - oText.insertControlCharacter( - oCursor, ControlCharacter.PARAGRAPH_BREAK, false ); - oText.insertString( oCursor, - "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG: SwXParagraph", - false); - oText.insertControlCharacter(oCursor, - ControlCharacter.PARAGRAPH_BREAK, false ); - oText.insertControlCharacter( - oCursor, ControlCharacter.LINE_BREAK, false ); - } - } catch ( com.sun.star.lang.IllegalArgumentException e ){ - e.printStackTrace(log); - throw new StatusException( "Couldn't insert lines", e ); + for (int i=0; i<5; i++){ + oText.insertString( oCursor,"Paragraph Number: " + i, false); + oText.insertString( oCursor, + " The quick brown fox jumps over the lazy Dog: SwXParagraph", + false); + oText.insertControlCharacter( + oCursor, ControlCharacter.PARAGRAPH_BREAK, false ); + oText.insertString( oCursor, + "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG: SwXParagraph", + false); + oText.insertControlCharacter(oCursor, + ControlCharacter.PARAGRAPH_BREAK, false ); + oText.insertControlCharacter( + oCursor, ControlCharacter.LINE_BREAK, false ); } // Enumeration @@ -213,38 +202,14 @@ public class SwXParagraph extends TestCase { log.println("Error: exception occurred..."); } - try { - portP = UnoRuntime.queryInterface(XPropertySet.class, port); - paraP = UnoRuntime.queryInterface(XPropertySet.class, para); - paraP.setPropertyValue("NumberingStyleName","Numbering 4"); - nRules = paraP.getPropertyValue("NumberingRules"); - } catch ( com.sun.star.lang.WrappedTargetException e ) { - log.println("Error, exception occurred..."); - e.printStackTrace(log); - throw new StatusException( "Couldn't get Paragraph", e ); - } catch ( com.sun.star.lang.IllegalArgumentException e ) { - log.println("Error, exception occurred..."); - e.printStackTrace(log); - throw new StatusException( "Couldn't get Paragraph", e ); - } catch ( com.sun.star.beans.UnknownPropertyException e ) { - log.println("Error, exception occurred..."); - e.printStackTrace(log); - throw new StatusException( "Couldn't get Paragraph", e ); - } catch ( com.sun.star.beans.PropertyVetoException e ) { - log.println("Error, exception occurred..."); - e.printStackTrace(log); - throw new StatusException( "Couldn't get Paragraph", e ); - } + portP = UnoRuntime.queryInterface(XPropertySet.class, port); + paraP = UnoRuntime.queryInterface(XPropertySet.class, para); + paraP.setPropertyValue("NumberingStyleName","Numbering 4"); + nRules = paraP.getPropertyValue("NumberingRules"); - try { - oObj = (XInterface) AnyConverter.toObject( - new Type(XInterface.class),oEnum.nextElement()); - } catch ( Exception e) { - log.println("Error, exception occurred..."); - e.printStackTrace(log); - throw new StatusException( "Couldn't get Paragraph", e ); - } + oObj = (XInterface) AnyConverter.toObject( + new Type(XInterface.class),oEnum.nextElement()); log.println( "creating a new environment for Paragraph object" ); diff --git a/qadevOOo/tests/java/mod/_sw/SwXPrintSettings.java b/qadevOOo/tests/java/mod/_sw/SwXPrintSettings.java index 7d2062021a9c..5c749b9b1920 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXPrintSettings.java +++ b/qadevOOo/tests/java/mod/_sw/SwXPrintSettings.java @@ -79,19 +79,13 @@ public class SwXPrintSettings extends TestCase { */ @Override public TestEnvironment createTestEnvironment( - TestParameters tParam, PrintWriter log ) throws StatusException { + TestParameters tParam, PrintWriter log ) throws Exception { XInterface oObj = null; Object oInst = null; log.println( "creating a test environment" ); - try { - XMultiServiceFactory myMSF = tParam.getMSF(); - oInst = myMSF.createInstance("com.sun.star.text.GlobalSettings"); - } catch ( com.sun.star.uno.Exception e ){ - log.println("Couldn't create instance!" + e); - e.printStackTrace( log ); - throw new StatusException( "Couldn't create instance!", e ); - } + XMultiServiceFactory myMSF = tParam.getMSF(); + oInst = myMSF.createInstance("com.sun.star.text.GlobalSettings"); XPrintSettingsSupplier xPSS = UnoRuntime.queryInterface(XPrintSettingsSupplier.class, oInst); oObj = xPSS.getPrintSettings(); diff --git a/qadevOOo/tests/java/mod/_sw/SwXPropertySet.java b/qadevOOo/tests/java/mod/_sw/SwXPropertySet.java index 0e5b33ad3f60..d3b8ff497401 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXPropertySet.java +++ b/qadevOOo/tests/java/mod/_sw/SwXPropertySet.java @@ -20,7 +20,6 @@ package mod._sw; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -57,17 +56,12 @@ public class SwXPropertySet extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log ) throws StatusException { + TestParameters Param, PrintWriter log ) throws Exception { log.println( "creating a test environment" ); SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF() ); - try { - log.println( "creating a text document" ); - xTextDoc = SOF.createTextDoc( null ); - } catch ( com.sun.star.uno.Exception e ) { - e.printStackTrace( log ); - throw new StatusException( "Couldn't create text document", e ); - } + log.println( "creating a text document" ); + xTextDoc = SOF.createTextDoc( null ); TestEnvironment tEnv = new TestEnvironment( xTextDoc ); return tEnv; diff --git a/qadevOOo/tests/java/mod/_sw/SwXPropertySetInfo.java b/qadevOOo/tests/java/mod/_sw/SwXPropertySetInfo.java index 8d67f0cc5e30..1848e9307567 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXPropertySetInfo.java +++ b/qadevOOo/tests/java/mod/_sw/SwXPropertySetInfo.java @@ -20,7 +20,6 @@ package mod._sw; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -62,18 +61,13 @@ public class SwXPropertySetInfo extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log ) throws StatusException { + TestParameters Param, PrintWriter log ) throws Exception { XInterface oObj = null; log.println( "creating a test environment" ); SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF() ); - try { - log.println( "creating a textdocument" ); - xTextDoc = SOF.createTextDoc( null ); - } catch ( com.sun.star.uno.Exception e ) { - e.printStackTrace( log ); - throw new StatusException( "Couldn't create document", e ); - } + log.println( "creating a textdocument" ); + xTextDoc = SOF.createTextDoc( null ); log.println( " getting the XPropertySetInfo" ); XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class, xTextDoc); diff --git a/qadevOOo/tests/java/mod/_sw/SwXReferenceMark.java b/qadevOOo/tests/java/mod/_sw/SwXReferenceMark.java index 6a68965f1cd6..98e4a48818c5 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXReferenceMark.java +++ b/qadevOOo/tests/java/mod/_sw/SwXReferenceMark.java @@ -90,7 +90,7 @@ public class SwXReferenceMark extends TestCase { * document as a text content. */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception{ XInterface oObj = null; XText oText = null; String Name = "SwXReferenceMark"; @@ -99,27 +99,17 @@ public class SwXReferenceMark extends TestCase { oText = xTextDoc.getText(); XMultiServiceFactory oDocMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDoc); Object instance = null; - try { - oObj = (XInterface) oDocMSF.createInstance - ("com.sun.star.text.ReferenceMark"); - instance = oDocMSF.createInstance - ("com.sun.star.text.ReferenceMark"); - } catch ( com.sun.star.uno.Exception e ) { - e.printStackTrace( log ); - throw new StatusException( "Couldn't get ReferenceMark", e); - } + oObj = (XInterface) oDocMSF.createInstance + ("com.sun.star.text.ReferenceMark"); + instance = oDocMSF.createInstance + ("com.sun.star.text.ReferenceMark"); XNamed oObjN = UnoRuntime.queryInterface(XNamed.class, oObj); oObjN.setName(Name); XTextContent oObjTC = UnoRuntime.queryInterface(XTextContent.class, oObj); XTextCursor oCursor = oText.createTextCursor(); - try { - oText.insertTextContent(oCursor, oObjTC, false); - } catch ( com.sun.star.lang.IllegalArgumentException e ){ - e.printStackTrace( log ); - throw new StatusException(" Couldn't insert ReferenceMark", e); - } + oText.insertTextContent(oCursor, oObjTC, false); TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_sw/SwXReferenceMarks.java b/qadevOOo/tests/java/mod/_sw/SwXReferenceMarks.java index 9c04061330af..3e265e0987b5 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXReferenceMarks.java +++ b/qadevOOo/tests/java/mod/_sw/SwXReferenceMarks.java @@ -93,7 +93,7 @@ public class SwXReferenceMarks extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment( - TestParameters tParam, PrintWriter log ) throws StatusException { + TestParameters tParam, PrintWriter log ) throws Exception { XInterface oObj = null; XText oText = null; String Name = "SwXReferenceMark01"; @@ -105,42 +105,22 @@ public class SwXReferenceMarks extends TestCase { XMultiServiceFactory oDocMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDoc); // Creation and insertion of ReferenceMark01 - try { - oObj = (XInterface) - oDocMSF.createInstance( "com.sun.star.text.ReferenceMark" ); - } catch ( com.sun.star.uno.Exception e ) { - e.printStackTrace( log ); - throw new StatusException( "Couldn't get ReferenceMark", e); - } + oObj = (XInterface) + oDocMSF.createInstance( "com.sun.star.text.ReferenceMark" ); XNamed oObjN = UnoRuntime.queryInterface(XNamed.class, oObj); oObjN.setName(Name); XTextContent oObjTC = UnoRuntime.queryInterface(XTextContent.class, oObj); XTextCursor oCursor = oText.createTextCursor(); - try { - oText.insertTextContent(oCursor, oObjTC, false); - } catch ( com.sun.star.lang.IllegalArgumentException e ){ - e.printStackTrace( log ); - throw new StatusException(" Couldn't insert ReferenceMark01", e); - } + oText.insertTextContent(oCursor, oObjTC, false); // Creation and insertion of ReferenceMark02 - try { - oObj = (XInterface) - oDocMSF.createInstance( "com.sun.star.text.ReferenceMark" ); - } catch ( com.sun.star.uno.Exception e ) { - e.printStackTrace( log ); - throw new StatusException( "Couldn't get ReferenceMark", e); - } + oObj = (XInterface) + oDocMSF.createInstance( "com.sun.star.text.ReferenceMark" ); XNamed oObjN2 = UnoRuntime.queryInterface(XNamed.class, oObj); oObjN2.setName(Name2); XTextContent oObjTC2 = UnoRuntime.queryInterface(XTextContent.class, oObj); - try { - oText.insertTextContent(oCursor, oObjTC2, false); - } catch ( com.sun.star.lang.IllegalArgumentException e ){ - e.printStackTrace( log ); - throw new StatusException(" Couldn't insert ReferenceMark02", e); - } + oText.insertTextContent(oCursor, oObjTC2, false); // getting ReferenceMarks from text document XReferenceMarksSupplier oRefSupp = UnoRuntime.queryInterface(XReferenceMarksSupplier.class, xTextDoc); diff --git a/qadevOOo/tests/java/mod/_sw/SwXStyle.java b/qadevOOo/tests/java/mod/_sw/SwXStyle.java index eb6ef3488d27..e5bf7b62efb6 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXStyle.java +++ b/qadevOOo/tests/java/mod/_sw/SwXStyle.java @@ -110,7 +110,7 @@ public class SwXStyle extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment - (TestParameters Param, PrintWriter log) { + (TestParameters Param, PrintWriter log) throws Exception { TestEnvironment tEnv = null; XNameAccess oSFNA = null; @@ -119,42 +119,22 @@ public class SwXStyle extends TestCase { log.println("creating a test environment"); - try { - log.println("getting style"); - XStyleFamiliesSupplier oSFS = UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, - xTextDoc); - XNameAccess oSF = oSFS.getStyleFamilies(); - XIndexAccess oSFsIA = UnoRuntime.queryInterface(XIndexAccess.class, oSF); - oSFNA = (XNameAccess) AnyConverter.toObject( - new Type(XNameAccess.class),oSFsIA.getByIndex(0)); - XIndexAccess oSFIA = UnoRuntime.queryInterface(XIndexAccess.class, oSFNA); - oStyle = (XStyle) AnyConverter.toObject( - new Type(XStyle.class),oSFIA.getByIndex(10)); - } catch ( com.sun.star.lang.WrappedTargetException e ) { - log.println("Error: exception occurred."); - e.printStackTrace(log); - throw new StatusException( "Couldn't create environment ", e ); - } catch ( com.sun.star.lang.IndexOutOfBoundsException e ) { - log.println("Error: exception occurred."); - e.printStackTrace(log); - throw new StatusException( "Couldn't create environment ", e ); - } catch ( com.sun.star.lang.IllegalArgumentException e ) { - log.println("Error: exception occurred."); - e.printStackTrace(log); - throw new StatusException( "Couldn't create environment ", e ); - } + log.println("getting style"); + XStyleFamiliesSupplier oSFS = UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, + xTextDoc); + XNameAccess oSF = oSFS.getStyleFamilies(); + XIndexAccess oSFsIA = UnoRuntime.queryInterface(XIndexAccess.class, oSF); + oSFNA = (XNameAccess) AnyConverter.toObject( + new Type(XNameAccess.class),oSFsIA.getByIndex(0)); + XIndexAccess oSFIA = UnoRuntime.queryInterface(XIndexAccess.class, oSFNA); + oStyle = (XStyle) AnyConverter.toObject( + new Type(XStyle.class),oSFIA.getByIndex(10)); - try { - log.print("Creating a user-defined style... "); - XMultiServiceFactory oMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDoc); - XInterface oInt = (XInterface) - oMSF.createInstance("com.sun.star.style.CharacterStyle"); - oMyStyle = UnoRuntime.queryInterface(XStyle.class, oInt); - } catch ( com.sun.star.uno.Exception e ) { - log.println("Error: exception occurred."); - e.printStackTrace(log); - throw new StatusException( "Couldn't create environment ", e ); - } + log.print("Creating a user-defined style... "); + XMultiServiceFactory oMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDoc); + XInterface oInt = (XInterface) + oMSF.createInstance("com.sun.star.style.CharacterStyle"); + oMyStyle = UnoRuntime.queryInterface(XStyle.class, oInt); if (oMyStyle == null) @@ -163,43 +143,15 @@ public class SwXStyle extends TestCase { log.println("OK"); XNameContainer oSFNC = UnoRuntime.queryInterface(XNameContainer.class, oSFNA); - try { - if ( oSFNC.hasByName("My Style") ) - oSFNC.removeByName("My Style"); - oSFNC.insertByName("My Style", oMyStyle); - } catch ( com.sun.star.lang.WrappedTargetException e ) { - e.printStackTrace(log); - throw new StatusException( "Couldn't create environment ", e ); - } catch ( com.sun.star.lang.IllegalArgumentException e ) { - e.printStackTrace(log); - throw new StatusException( "Couldn't create environment ", e ); - } catch ( com.sun.star.container.NoSuchElementException e ) { - e.printStackTrace(log); - throw new StatusException( "Couldn't create environment ", e ); - } catch ( com.sun.star.container.ElementExistException e ) { - e.printStackTrace(log); - throw new StatusException( "Couldn't create environment ", e ); - } + if ( oSFNC.hasByName("My Style") ) + oSFNC.removeByName("My Style"); + oSFNC.insertByName("My Style", oMyStyle); XText oText = xTextDoc.getText(); XTextCursor oCursor = oText.createTextCursor(); XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class, oCursor); - try { - xProp.setPropertyValue("CharStyleName", oMyStyle.getName()); - } catch ( com.sun.star.lang.WrappedTargetException e ) { - e.printStackTrace( log ); - throw new StatusException( "Couldn't create environment ", e ); - } catch ( com.sun.star.lang.IllegalArgumentException e ) { - e.printStackTrace( log ); - throw new StatusException( "Couldn't create environment ", e ); - } catch ( com.sun.star.beans.PropertyVetoException e ) { - e.printStackTrace( log ); - throw new StatusException( "Couldn't create environment ", e ); - } catch ( com.sun.star.beans.UnknownPropertyException e ) { - e.printStackTrace( log ); - throw new StatusException( "Couldn't create environment ", e ); - } + xProp.setPropertyValue("CharStyleName", oMyStyle.getName()); log.println("creating a new environment for object"); tEnv = new TestEnvironment(oMyStyle); diff --git a/qadevOOo/tests/java/mod/_sw/SwXStyleFamily.java b/qadevOOo/tests/java/mod/_sw/SwXStyleFamily.java index f7cf1de8ebd3..782822d82326 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXStyleFamily.java +++ b/qadevOOo/tests/java/mod/_sw/SwXStyleFamily.java @@ -116,7 +116,7 @@ public class SwXStyleFamily extends TestCase { * </ul> */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XNameAccess oSFNA = null; @@ -130,19 +130,8 @@ public class SwXStyleFamily extends TestCase { XNameAccess oSF = oSFsS.getStyleFamilies(); XIndexAccess oSFIA = UnoRuntime.queryInterface(XIndexAccess.class, oSF); - try { - oSFNA = (XNameAccess) AnyConverter.toObject( - new Type(XNameAccess.class),oSFIA.getByIndex(0)); - } catch ( com.sun.star.lang.IndexOutOfBoundsException e ) { - e.printStackTrace(log); - throw new StatusException("Unexpected exception. ", e); - } catch ( com.sun.star.lang.WrappedTargetException e ) { - e.printStackTrace(log); - throw new StatusException("Unexpected exception. ", e); - } catch ( com.sun.star.lang.IllegalArgumentException e ) { - e.printStackTrace(log); - throw new StatusException("Unexpected exception. ", e); - } + oSFNA = (XNameAccess) AnyConverter.toObject( + new Type(XNameAccess.class),oSFIA.getByIndex(0)); XNameContainer oContainer = UnoRuntime.queryInterface(XNameContainer.class, oSFNA); diff --git a/qadevOOo/tests/java/mod/_sw/SwXTableCellText.java b/qadevOOo/tests/java/mod/_sw/SwXTableCellText.java index 359d2ec4c84c..a8ba04cd475c 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXTableCellText.java +++ b/qadevOOo/tests/java/mod/_sw/SwXTableCellText.java @@ -122,13 +122,7 @@ public class SwXTableCellText extends TestCase { log.println( "Creating a test environment" ); oTable = SOfficeFactory.createTextTable( xTextDoc ); - try { - SOfficeFactory.insertTextContent(xTextDoc, oTable ); - } catch ( com.sun.star.lang.IllegalArgumentException e ) { - e.printStackTrace( log ); - throw new StatusException("Couldn't insert text content : " - +e.getMessage(),e); - } + SOfficeFactory.insertTextContent(xTextDoc, oTable ); XCell oCell = oTable.getCellByName("A1"); XSimpleText oCellText = UnoRuntime.queryInterface(XSimpleText.class, oCell); diff --git a/qadevOOo/tests/java/mod/_sw/SwXTableColumns.java b/qadevOOo/tests/java/mod/_sw/SwXTableColumns.java index 808308fe4d6d..72a9b3163a1e 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXTableColumns.java +++ b/qadevOOo/tests/java/mod/_sw/SwXTableColumns.java @@ -97,13 +97,7 @@ public class SwXTableColumns extends TestCase { oTable = SOfficeFactory.createTextTable( xTextDoc ); - try { - SOfficeFactory.insertTextContent(xTextDoc, oTable ); - } catch ( com.sun.star.lang.IllegalArgumentException e ) { - e.printStackTrace( log ); - throw new StatusException("Couldn't insert text content: " - +e.getMessage(),e); - } + SOfficeFactory.insertTextContent(xTextDoc, oTable ); oObj = oTable.getColumns(); diff --git a/qadevOOo/tests/java/mod/_sw/SwXTableRows.java b/qadevOOo/tests/java/mod/_sw/SwXTableRows.java index 86229695afa9..edf297043290 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXTableRows.java +++ b/qadevOOo/tests/java/mod/_sw/SwXTableRows.java @@ -92,13 +92,7 @@ public class SwXTableRows extends TestCase { SOfficeFactory.getFactory( tParam.getMSF() ); oTable = SOfficeFactory.createTextTable( xTextDoc ); - try { - SOfficeFactory.insertTextContent(xTextDoc, oTable ); - } catch ( com.sun.star.lang.IllegalArgumentException e ) { - e.printStackTrace( log ); - throw new StatusException("Couldn't insert text content: " - +e.getMessage(),e); - } + SOfficeFactory.insertTextContent(xTextDoc, oTable ); oObj = oTable.getRows(); log.println( "creating a new environment for TableColumns object" ); diff --git a/qadevOOo/tests/java/mod/_sw/SwXTextDefaults.java b/qadevOOo/tests/java/mod/_sw/SwXTextDefaults.java index b2c4013d12c5..e5befe70c58d 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXTextDefaults.java +++ b/qadevOOo/tests/java/mod/_sw/SwXTextDefaults.java @@ -72,18 +72,14 @@ public class SwXTextDefaults extends TestCase { */ @Override protected TestEnvironment createTestEnvironment( - TestParameters tParam, PrintWriter log) { + TestParameters tParam, PrintWriter log) throws Exception { XInterface oObj = null; XMultiServiceFactory docMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class,xTextDoc); - try { - oObj = (XInterface) - docMSF.createInstance("com.sun.star.text.Defaults"); - } catch (com.sun.star.uno.Exception e) { - throw new StatusException("Couldn't create Object",e); - } + oObj = (XInterface) + docMSF.createInstance("com.sun.star.text.Defaults"); TestEnvironment tEnv = new TestEnvironment(oObj); diff --git a/qadevOOo/tests/java/mod/_sw/SwXTextDocument.java b/qadevOOo/tests/java/mod/_sw/SwXTextDocument.java index 78a24cfdb60c..78086e2fbb64 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXTextDocument.java +++ b/qadevOOo/tests/java/mod/_sw/SwXTextDocument.java @@ -39,7 +39,6 @@ import com.sun.star.view.XSelectionSupplier; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -48,7 +47,6 @@ import util.DesktopTools; import util.SOfficeFactory; import util.WriterTools; - public class SwXTextDocument extends TestCase { XTextDocument xTextDoc; XTextDocument xSecondTextDoc; @@ -65,167 +63,136 @@ public class SwXTextDocument extends TestCase { } /** - * creating a TestEnvironment for the interfaces to be tested + * creating a TestEnvironment for the interfaces to be tested */ @Override - public synchronized TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) - throws StatusException { + public synchronized TestEnvironment createTestEnvironment( + TestParameters Param, PrintWriter log) throws Exception { TestEnvironment tEnv = null; XTextTable the_table = null; - try { - log.println("creating a textdocument"); - xTextDoc = WriterTools.createTextDoc( - Param.getMSF()); - - XText oText = xTextDoc.getText(); - XTextCursor oCursor = oText.createTextCursor(); - - log.println("inserting some lines"); - - try { - for (int i = 0; i < 5; i++) { - oText.insertString(oCursor, "Paragraph Number: " + i, - false); - oText.insertString(oCursor, - " The quick brown fox jumps over the lazy Dog: SwXParagraph", - false); - oText.insertControlCharacter(oCursor, - ControlCharacter.PARAGRAPH_BREAK, - false); - oText.insertString(oCursor, - "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG: SwXParagraph", - false); - oText.insertControlCharacter(oCursor, - ControlCharacter.PARAGRAPH_BREAK, - false); - oText.insertControlCharacter(oCursor, - ControlCharacter.LINE_BREAK, - false); - } - for (int i = 0; i < 11; i++) { - oText.insertString(oCursor, "xTextDoc ", false); - - } - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log); - throw new StatusException("Couldn't insert lines", e); - } + log.println("creating a textdocument"); + xTextDoc = WriterTools.createTextDoc(Param.getMSF()); + + XText oText = xTextDoc.getText(); + XTextCursor oCursor = oText.createTextCursor(); + + log.println("inserting some lines"); + + for (int i = 0; i < 5; i++) { + oText.insertString(oCursor, "Paragraph Number: " + i, false); + oText.insertString( + oCursor, + " The quick brown fox jumps over the lazy Dog: SwXParagraph", + false); + oText.insertControlCharacter(oCursor, + ControlCharacter.PARAGRAPH_BREAK, false); + oText.insertString( + oCursor, + "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG: SwXParagraph", + false); + oText.insertControlCharacter(oCursor, + ControlCharacter.PARAGRAPH_BREAK, false); + oText.insertControlCharacter(oCursor, ControlCharacter.LINE_BREAK, + false); + } + for (int i = 0; i < 11; i++) { + oText.insertString(oCursor, "xTextDoc ", false); - //insert two sections parent and child - XMultiServiceFactory oDocMSF = UnoRuntime.queryInterface( - XMultiServiceFactory.class, - xTextDoc); - - XInterface oTS; - XTextSection xTS; - - XTextSectionsSupplier oTSSupp = UnoRuntime.queryInterface( - XTextSectionsSupplier.class, - xTextDoc); - XNameAccess oTSSuppName = oTSSupp.getTextSections(); - - oTS = (XInterface) oDocMSF.createInstance( - "com.sun.star.text.TextSection"); - - XTextContent oTSC = UnoRuntime.queryInterface( - XTextContent.class, oTS); - oText.insertTextContent(oCursor, oTSC, false); - - XWordCursor oWordC = UnoRuntime.queryInterface( - XWordCursor.class, oCursor); - oCursor.setString("End of TextSection"); - oCursor.gotoStart(false); - oCursor.setString("Start of TextSection "); - oWordC.gotoEndOfWord(false); - - XInterface oTS2 = (XInterface) oDocMSF.createInstance( - "com.sun.star.text.TextSection"); - oTSC = UnoRuntime.queryInterface(XTextContent.class, - oTS2); - oText.insertTextContent(oCursor, oTSC, false); - - XIndexAccess oTSSuppIndex = UnoRuntime.queryInterface( - XIndexAccess.class, - oTSSuppName); - log.println( - "getting a TextSection with the XTextSectionSupplier()"); - xTS = UnoRuntime.queryInterface(XTextSection.class, - oTSSuppIndex.getByIndex(0)); - - XNamed xTSName = UnoRuntime.queryInterface(XNamed.class, - xTS); - xTSName.setName("SwXTextSection"); - - log.println(" adding TextTable"); - the_table = SOfficeFactory.createTextTable(xTextDoc, 6, 4); - - XNamed the_name = UnoRuntime.queryInterface(XNamed.class, - the_table); - the_name.setName("SwXTextDocument"); - SOfficeFactory.insertTextContent(xTextDoc, - the_table); - - log.println(" adding ReferenceMark"); - - XInterface aMark = (XInterface) oDocMSF.createInstance( - "com.sun.star.text.ReferenceMark"); - the_name = UnoRuntime.queryInterface(XNamed.class, aMark); - the_name.setName("SwXTextDocument"); - - XTextContent oTC = UnoRuntime.queryInterface( - XTextContent.class, aMark); - SOfficeFactory.insertTextContent(xTextDoc, oTC); - - log.println(" adding TextGraphic"); - WriterTools.insertTextGraphic(xTextDoc, oDocMSF, 5200, 4200, 4400, - 4000, "space-metal.jpg", - "SwXTextDocument"); - - log.println(" adding EndNote"); - - XInterface aEndNote = (XInterface) oDocMSF.createInstance( - "com.sun.star.text.Endnote"); - oTC = UnoRuntime.queryInterface(XTextContent.class, - aEndNote); - SOfficeFactory.insertTextContent(xTextDoc, oTC); - - log.println(" adding Bookmark"); - SOfficeFactory.insertTextContent(xTextDoc, - SOfficeFactory.createBookmark( - xTextDoc)); - - log.println(" adding DocumentIndex"); - oTC = SOfficeFactory.createIndex(xTextDoc, - "com.sun.star.text.DocumentIndex"); - SOfficeFactory.insertTextContent(xTextDoc, oTC); - - log.println(" adding TextFrame"); - - XTextFrame frame = SOfficeFactory.createTextFrame(xTextDoc, 500, - 500); - oTC = UnoRuntime.queryInterface(XTextContent.class, - frame); - SOfficeFactory.insertTextContent(xTextDoc, oTC); - - log.println("creating a second textdocument"); - xSecondTextDoc = WriterTools.createTextDoc( - Param.getMSF()); - } catch (com.sun.star.uno.Exception e) { - // Some exception occurs.FAILED - e.printStackTrace(log); - throw new StatusException("Couldn't create document", e); } + // insert two sections parent and child + XMultiServiceFactory oDocMSF = UnoRuntime.queryInterface( + XMultiServiceFactory.class, xTextDoc); + + XInterface oTS; + XTextSection xTS; + + XTextSectionsSupplier oTSSupp = UnoRuntime.queryInterface( + XTextSectionsSupplier.class, xTextDoc); + XNameAccess oTSSuppName = oTSSupp.getTextSections(); + + oTS = (XInterface) oDocMSF + .createInstance("com.sun.star.text.TextSection"); + + XTextContent oTSC = UnoRuntime.queryInterface(XTextContent.class, oTS); + oText.insertTextContent(oCursor, oTSC, false); + + XWordCursor oWordC = UnoRuntime.queryInterface(XWordCursor.class, + oCursor); + oCursor.setString("End of TextSection"); + oCursor.gotoStart(false); + oCursor.setString("Start of TextSection "); + oWordC.gotoEndOfWord(false); + + XInterface oTS2 = (XInterface) oDocMSF + .createInstance("com.sun.star.text.TextSection"); + oTSC = UnoRuntime.queryInterface(XTextContent.class, oTS2); + oText.insertTextContent(oCursor, oTSC, false); + + XIndexAccess oTSSuppIndex = UnoRuntime.queryInterface( + XIndexAccess.class, oTSSuppName); + log.println("getting a TextSection with the XTextSectionSupplier()"); + xTS = UnoRuntime.queryInterface(XTextSection.class, + oTSSuppIndex.getByIndex(0)); + + XNamed xTSName = UnoRuntime.queryInterface(XNamed.class, xTS); + xTSName.setName("SwXTextSection"); + + log.println(" adding TextTable"); + the_table = SOfficeFactory.createTextTable(xTextDoc, 6, 4); + + XNamed the_name = UnoRuntime.queryInterface(XNamed.class, the_table); + the_name.setName("SwXTextDocument"); + SOfficeFactory.insertTextContent(xTextDoc, the_table); + + log.println(" adding ReferenceMark"); + + XInterface aMark = (XInterface) oDocMSF + .createInstance("com.sun.star.text.ReferenceMark"); + the_name = UnoRuntime.queryInterface(XNamed.class, aMark); + the_name.setName("SwXTextDocument"); + + XTextContent oTC = UnoRuntime.queryInterface(XTextContent.class, aMark); + SOfficeFactory.insertTextContent(xTextDoc, oTC); + + log.println(" adding TextGraphic"); + WriterTools.insertTextGraphic(xTextDoc, oDocMSF, 5200, 4200, 4400, + 4000, "space-metal.jpg", "SwXTextDocument"); + + log.println(" adding EndNote"); + + XInterface aEndNote = (XInterface) oDocMSF + .createInstance("com.sun.star.text.Endnote"); + oTC = UnoRuntime.queryInterface(XTextContent.class, aEndNote); + SOfficeFactory.insertTextContent(xTextDoc, oTC); + + log.println(" adding Bookmark"); + SOfficeFactory.insertTextContent(xTextDoc, + SOfficeFactory.createBookmark(xTextDoc)); + + log.println(" adding DocumentIndex"); + oTC = SOfficeFactory.createIndex(xTextDoc, + "com.sun.star.text.DocumentIndex"); + SOfficeFactory.insertTextContent(xTextDoc, oTC); + + log.println(" adding TextFrame"); + + XTextFrame frame = SOfficeFactory.createTextFrame(xTextDoc, 500, 500); + oTC = UnoRuntime.queryInterface(XTextContent.class, frame); + SOfficeFactory.insertTextContent(xTextDoc, oTC); + + log.println("creating a second textdocument"); + xSecondTextDoc = WriterTools.createTextDoc(Param.getMSF()); + if (xTextDoc != null) { log.println("Creating instance..."); - XText oText = xTextDoc.getText(); - XTextCursor oTextCursor = oText.createTextCursor(); + XText oText2 = xTextDoc.getText(); + XTextCursor oTextCursor = oText2.createTextCursor(); for (int i = 0; i < 11; i++) { - oText.insertString(oTextCursor, "xTextDoc ", false); + oText2.insertString(oTextCursor, "xTextDoc ", false); } tEnv = new TestEnvironment(xTextDoc); @@ -235,10 +202,8 @@ public class SwXTextDocument extends TestCase { return tEnv; } - XModel model1 = UnoRuntime.queryInterface(XModel.class, - xTextDoc); - XModel model2 = UnoRuntime.queryInterface(XModel.class, - xSecondTextDoc); + XModel model1 = UnoRuntime.queryInterface(XModel.class, xTextDoc); + XModel model2 = UnoRuntime.queryInterface(XModel.class, xSecondTextDoc); XController cont1 = model1.getCurrentController(); XController cont2 = model2.getCurrentController(); @@ -247,7 +212,7 @@ public class SwXTextDocument extends TestCase { cont2.getFrame().setName("cont2"); XSelectionSupplier sel = UnoRuntime.queryInterface( - XSelectionSupplier.class, cont1); + XSelectionSupplier.class, cont1); log.println("Adding SelectionSupplier and Shape to select for XModel"); tEnv.addObjRelation("SELSUPP", sel); diff --git a/qadevOOo/tests/java/mod/_sw/SwXTextEmbeddedObject.java b/qadevOOo/tests/java/mod/_sw/SwXTextEmbeddedObject.java index 1012112dc3a4..59019e91de5d 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXTextEmbeddedObject.java +++ b/qadevOOo/tests/java/mod/_sw/SwXTextEmbeddedObject.java @@ -18,9 +18,9 @@ package mod._sw; import com.sun.star.beans.XPropertySet; + import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -94,17 +94,12 @@ public class SwXTextEmbeddedObject extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters tParam, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; // create testobject here SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); - try { - xTextDoc = SOF.createTextDoc(null); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't open document", e); - } + xTextDoc = SOF.createTextDoc(null); XTextCursor xCursor = xTextDoc.getText().createTextCursor(); try { @@ -129,13 +124,8 @@ public class SwXTextEmbeddedObject extends TestCase { XIndexAccess oEmIn = UnoRuntime.queryInterface( XIndexAccess.class, oEmObj); - try { - oObj = (XInterface) AnyConverter.toObject( - new Type(XInterface.class), oEmIn.getByIndex(0)); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't get Object", e); - } + oObj = (XInterface) AnyConverter.toObject( + new Type(XInterface.class), oEmIn.getByIndex(0)); TestEnvironment tEnv = new TestEnvironment(oObj); diff --git a/qadevOOo/tests/java/mod/_sw/SwXTextFrame.java b/qadevOOo/tests/java/mod/_sw/SwXTextFrame.java index 287ba551dc24..e5e04d161b66 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXTextFrame.java +++ b/qadevOOo/tests/java/mod/_sw/SwXTextFrame.java @@ -70,7 +70,7 @@ public class SwXTextFrame extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; XTextFrame oFrame1 = null; XTextFrame oFrame2 = null; @@ -93,42 +93,36 @@ public class SwXTextFrame extends TestCase { Object instance = null; - try { - oFrame1 = SOfficeFactory.createTextFrame(xTextDoc, 500, 500); - oFrame2 = SOfficeFactory.createTextFrame(xTextDoc, 1500, 1500); - oPropSet = UnoRuntime.queryInterface( - XPropertySet.class, oFrame1); - - - // AnchorTypes: 0 = paragraph, 1 = as char, 2 = page, - // 3 = frame/paragraph 4= at char - oPropSet.setPropertyValue("AnchorType", - TextContentAnchorType.AS_CHARACTER); - oText = xTextDoc.getText(); - oCursor = oText.createTextCursor(); - - log.println("inserting Frame1"); - - XTextContent the_content = UnoRuntime.queryInterface( - XTextContent.class, oFrame1); - oText.insertTextContent(oCursor, the_content, true); - - log.println("inserting Frame2"); - the_content = UnoRuntime.queryInterface( - XTextContent.class, oFrame2); - oText.insertTextContent(oCursor, the_content, true); - - XText oFrameText = oFrame1.getText(); - oFrameText.insertString(oFrameText.getStart(), "The FrameText", - true); - - instance = SOF.createInstance(xTextDoc, - "com.sun.star.text.TextFrame"); - } catch (Exception Ex) { - Ex.printStackTrace(log); - throw new StatusException("Couldn't insert TextFrame ", Ex); - } + oFrame1 = SOfficeFactory.createTextFrame(xTextDoc, 500, 500); + oFrame2 = SOfficeFactory.createTextFrame(xTextDoc, 1500, 1500); + oPropSet = UnoRuntime.queryInterface( + XPropertySet.class, oFrame1); + + + // AnchorTypes: 0 = paragraph, 1 = as char, 2 = page, + // 3 = frame/paragraph 4= at char + oPropSet.setPropertyValue("AnchorType", + TextContentAnchorType.AS_CHARACTER); + oText = xTextDoc.getText(); + oCursor = oText.createTextCursor(); + + log.println("inserting Frame1"); + + XTextContent the_content = UnoRuntime.queryInterface( + XTextContent.class, oFrame1); + oText.insertTextContent(oCursor, the_content, true); + + log.println("inserting Frame2"); + the_content = UnoRuntime.queryInterface( + XTextContent.class, oFrame2); + oText.insertTextContent(oCursor, the_content, true); + + XText oFrameText = oFrame1.getText(); + oFrameText.insertString(oFrameText.getStart(), "The FrameText", + true); + instance = SOF.createInstance(xTextDoc, + "com.sun.star.text.TextFrame"); oObj = oFrame1; log.println("creating a new environment for TextFrame object"); diff --git a/qadevOOo/tests/java/mod/_sw/SwXTextFrameText.java b/qadevOOo/tests/java/mod/_sw/SwXTextFrameText.java index 137aa62157db..87a5e64c4866 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXTextFrameText.java +++ b/qadevOOo/tests/java/mod/_sw/SwXTextFrameText.java @@ -40,6 +40,7 @@ import com.sun.star.uno.XInterface; /** * * initial description + * * @see com.sun.star.container.XElementAccess * @see com.sun.star.container.XEnumerationAccess * @see com.sun.star.text.XSimpleText @@ -52,39 +53,41 @@ public class SwXTextFrameText extends TestCase { XTextDocument xTextDoc; @Override - protected void initialize( TestParameters tParam, PrintWriter log ) { - SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF() ); + protected void initialize(TestParameters tParam, PrintWriter log) { + SOfficeFactory SOF = SOfficeFactory.getFactory(tParam.getMSF()); try { - log.println( "creating a textdocument" ); - xTextDoc = SOF.createTextDoc( null ); - } catch ( com.sun.star.uno.Exception e ) { + log.println("creating a textdocument"); + xTextDoc = SOF.createTextDoc(null); + } catch (com.sun.star.uno.Exception e) { // Some exception occurs.FAILED - e.printStackTrace( log ); - throw new StatusException( "Couldn't create document", e ); + e.printStackTrace(log); + throw new StatusException("Couldn't create document", e); } } @Override - protected void cleanup( TestParameters tParam, PrintWriter log ) { - log.println( " disposing xTextDoc " ); + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xTextDoc "); util.DesktopTools.closeDoc(xTextDoc); } /** - * creating a TestEnvironment for the interfaces to be tested + * creating a TestEnvironment for the interfaces to be tested * - * @param tParam class which contains additional test parameters - * @param log class to log the test state and result + * @param tParam + * class which contains additional test parameters + * @param log + * class to log the test state and result * - * @return Status class + * @return Status class * - * @see TestParameters - * @see PrintWriter + * @see TestParameters + * @see PrintWriter */ @Override - public synchronized TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log ) { + public synchronized TestEnvironment createTestEnvironment( + TestParameters tParam, PrintWriter log) throws Exception { XInterface oObj = null; XTextFrame oFrame1 = null; @@ -94,31 +97,23 @@ public class SwXTextFrameText extends TestCase { // creation of testobject here // first we write what we are intend to do to log file - log.println( "creating a test environment" ); + log.println("creating a test environment"); // get a soffice factory object - SOfficeFactory.getFactory( tParam.getMSF() ); + SOfficeFactory.getFactory(tParam.getMSF()); // create testobject here + oFrame1 = SOfficeFactory.createTextFrame(xTextDoc, 500, 500); + oPropSet = UnoRuntime.queryInterface(XPropertySet.class, oFrame1); + // AnchorTypes: 0 = paragraph, 1 = as char, 2 = page, + // 3 = frame/paragraph 4= at char + oPropSet.setPropertyValue("AnchorType", Integer.valueOf(2)); + oText = xTextDoc.getText(); + oCursor = oText.createTextCursor(); - try { - oFrame1 = SOfficeFactory.createTextFrame(xTextDoc, 500, 500); - oPropSet = UnoRuntime.queryInterface - (XPropertySet.class, oFrame1 ); - //AnchorTypes: 0 = paragraph, 1 = as char, 2 = page, - // 3 = frame/paragraph 4= at char - oPropSet.setPropertyValue("AnchorType", Integer.valueOf(2)); - oText = xTextDoc.getText(); - oCursor = oText.createTextCursor(); - - log.println( "inserting Frame1" ); - oText.insertTextContent(oCursor,oFrame1, false); - - } catch (Exception Ex ) { - Ex.printStackTrace(log); - throw new StatusException("Couldn't insert TextFrame ", Ex); - } + log.println("inserting Frame1"); + oText.insertTextContent(oCursor, oFrame1, false); XText oFText = UnoRuntime.queryInterface(XText.class, oFrame1); XTextCursor oFCursor = oFText.createTextCursor(); @@ -126,24 +121,24 @@ public class SwXTextFrameText extends TestCase { oObj = oFText.getText(); - log.println( "creating a new environment for TextFrameText object" ); - TestEnvironment tEnv = new TestEnvironment( oObj ); + log.println("creating a new environment for TextFrameText object"); + TestEnvironment tEnv = new TestEnvironment(oObj); - log.println( "adding TextDocument as mod relation to environment" ); + log.println("adding TextDocument as mod relation to environment"); tEnv.addObjRelation("TEXT", oObj); - log.println( "adding InstDescriptor object" ); - TableDsc tDsc = new TableDsc( 6, 4 ); + log.println("adding InstDescriptor object"); + TableDsc tDsc = new TableDsc(6, 4); - log.println( "adding InstCreator object" ); - tEnv.addObjRelation( "XTEXTINFO", new InstCreator( xTextDoc, tDsc ) ); + log.println("adding InstCreator object"); + tEnv.addObjRelation("XTEXTINFO", new InstCreator(xTextDoc, tDsc)); - log.println( " adding Paragraph" ); + log.println(" adding Paragraph"); ParagraphDsc pDsc = new ParagraphDsc(); - tEnv.addObjRelation( "PARA", new InstCreator( xTextDoc, pDsc ) ); + tEnv.addObjRelation("PARA", new InstCreator(xTextDoc, pDsc)); return tEnv; } // finish method getTestEnvironment -} // finish class SwXTextFrameText +} // finish class SwXTextFrameText diff --git a/qadevOOo/tests/java/mod/_sw/SwXTextGraphicObject.java b/qadevOOo/tests/java/mod/_sw/SwXTextGraphicObject.java index 3cf357bb9c5e..c3e6abb95235 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXTextGraphicObject.java +++ b/qadevOOo/tests/java/mod/_sw/SwXTextGraphicObject.java @@ -43,155 +43,135 @@ public class SwXTextGraphicObject extends TestCase { /** * in general this method creates a testdocument * - * @param tParam class which contains additional test parameters - * @param log class to log the test state and result + * @param tParam + * class which contains additional test parameters + * @param log + * class to log the test state and result * * - * @see TestParameters - * @see PrintWriter + * @see TestParameters + * @see PrintWriter * */ @Override - protected void initialize( TestParameters tParam, PrintWriter log ) { - SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF() ); + protected void initialize(TestParameters tParam, PrintWriter log) { + SOfficeFactory SOF = SOfficeFactory.getFactory(tParam.getMSF()); try { - log.println( "creating a textdoc" ); - xTextDoc = SOF.createTextDoc( null ); - } catch ( Exception e ) { + log.println("creating a textdoc"); + xTextDoc = SOF.createTextDoc(null); + } catch (Exception e) { // Some exception occurs.FAILED - e.printStackTrace( log ); - throw new StatusException( "Couldn't create document", e ); + e.printStackTrace(log); + throw new StatusException("Couldn't create document", e); } } /** * in general this method disposes the testenvironment and document * - * @param tParam class which contains additional test parameters - * @param log class to log the test state and result + * @param tParam + * class which contains additional test parameters + * @param log + * class to log the test state and result * * - * @see TestParameters - * @see PrintWriter + * @see TestParameters + * @see PrintWriter * */ @Override - protected void cleanup( TestParameters tParam, PrintWriter log ) { - log.println( " disposing xDrawDoc " ); + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xDrawDoc "); util.DesktopTools.closeDoc(xTextDoc); } - /** - * creating a TestEnvironment for the interfaces to be tested + * Creating a TestEnvironment for the interfaces to be tested * - * @param tParam class which contains additional test parameters - * @param log class to log the test state and result + * @param tParam + * class which contains additional test parameters + * @param log + * class to log the test state and result * - * @return Status class + * @return Status class * - * @see TestParameters - * @see PrintWriter + * @see TestParameters + * @see PrintWriter */ @Override - protected TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log) { - - XInterface oObj = null; - Object oGObject = null; - Object xTextFrame = null; - SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF() ); - - Object instance = null; - - try { - oGObject = SOF.createInstance - (xTextDoc,"com.sun.star.text.GraphicObject"); - instance = SOF.createInstance - (xTextDoc,"com.sun.star.text.GraphicObject"); - xTextFrame = SOfficeFactory.createTextFrame(xTextDoc, 500, 500); - } - catch (Exception ex) { - log.println("Couldn't create instance"); - ex.printStackTrace(log); - throw new StatusException("Couldn't create instance", ex ); - } - - oObj = (XInterface) oGObject; - - XText the_text = xTextDoc.getText(); - XTextCursor the_cursor = the_text.createTextCursor(); - XTextContent the_content = UnoRuntime.queryInterface(XTextContent.class,oObj); - - log.println("inserting Frame"); - try{ - XTextContent Framecontent = UnoRuntime.queryInterface( - XTextContent.class, xTextFrame); - the_text.insertTextContent(the_cursor, Framecontent, true); - } catch (Exception e) { - System.out.println("Couldn't insert text frame"); - e.printStackTrace(); - throw new StatusException("Couldn't insert text frame", e ); - } - - - log.println( "inserting graphic" ); - try { - the_text.insertTextContent(the_cursor,the_content,true); - } catch (Exception e) { - System.out.println("Couldn't insert Content"); - e.printStackTrace(); - throw new StatusException("Couldn't insert Content", e ); - } - - log.println( "adding graphic" ); - XPropertySet oProps = UnoRuntime.queryInterface(XPropertySet.class,oObj); - try { - String wat = util.utils.getFullTestURL("space-metal.jpg"); - oProps.setPropertyValue("AnchorType", - TextContentAnchorType.AT_PARAGRAPH); - oProps.setPropertyValue("GraphicURL",wat); - oProps.setPropertyValue("HoriOrientPosition",Integer.valueOf(5500)); - oProps.setPropertyValue("VertOrientPosition",Integer.valueOf(4200)); - oProps.setPropertyValue("Width",Integer.valueOf(4400)); - oProps.setPropertyValue("Height",Integer.valueOf(4000)); - } catch (Exception e) { - System.out.println("Couldn't set property 'GraphicURL'"); - e.printStackTrace(); - throw new StatusException - ("Couldn't set property 'GraphicURL'", e ); - } - - TestEnvironment tEnv = new TestEnvironment( oObj ); - - log.println( "adding ObjRelation for XShape " - +"(get/setPosition won't work there)" ); - tEnv.addObjRelation("NoPos", "SwXTextGraphicObject"); - tEnv.addObjRelation("NoSetSize","SwXTextGraphicObject"); - Object ImgMap = null; - //creating ObjectRelation for the property - // 'ImageMap' of 'TextGraphicObject' - try { - XMultiServiceFactory xDocMSF = UnoRuntime.queryInterface - (XMultiServiceFactory.class,xTextDoc); - ImgMap = xDocMSF.createInstance - ("com.sun.star.image.ImageMapRectangleObject"); - } - catch (Exception ex) { - ex.printStackTrace(); - } - - tEnv.addObjRelation("IMGMAP",ImgMap); - - tEnv.addObjRelation("CONTENT", UnoRuntime.queryInterface(XTextContent.class,instance)); - tEnv.addObjRelation("RANGE", xTextDoc.getText().createTextCursor()); - - //object relation for text.BaseFrameProperties - tEnv.addObjRelation("TextFrame", xTextFrame); - - return tEnv; + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) throws Exception { + + XInterface oObj = null; + Object oGObject = null; + Object xTextFrame = null; + SOfficeFactory SOF = SOfficeFactory.getFactory(tParam.getMSF()); + + Object instance = null; + + oGObject = SOF.createInstance(xTextDoc, + "com.sun.star.text.GraphicObject"); + instance = SOF.createInstance(xTextDoc, + "com.sun.star.text.GraphicObject"); + xTextFrame = SOfficeFactory.createTextFrame(xTextDoc, 500, 500); + + oObj = (XInterface) oGObject; + + XText the_text = xTextDoc.getText(); + XTextCursor the_cursor = the_text.createTextCursor(); + XTextContent the_content = UnoRuntime.queryInterface( + XTextContent.class, oObj); + + log.println("inserting Frame"); + XTextContent Framecontent = UnoRuntime.queryInterface( + XTextContent.class, xTextFrame); + the_text.insertTextContent(the_cursor, Framecontent, true); + + log.println("inserting graphic"); + the_text.insertTextContent(the_cursor, the_content, true); + + log.println("adding graphic"); + XPropertySet oProps = UnoRuntime.queryInterface(XPropertySet.class, + oObj); + String wat = util.utils.getFullTestURL("space-metal.jpg"); + oProps.setPropertyValue("AnchorType", + TextContentAnchorType.AT_PARAGRAPH); + oProps.setPropertyValue("GraphicURL", wat); + oProps.setPropertyValue("HoriOrientPosition", Integer.valueOf(5500)); + oProps.setPropertyValue("VertOrientPosition", Integer.valueOf(4200)); + oProps.setPropertyValue("Width", Integer.valueOf(4400)); + oProps.setPropertyValue("Height", Integer.valueOf(4000)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + log.println("adding ObjRelation for XShape " + + "(get/setPosition won't work there)"); + tEnv.addObjRelation("NoPos", "SwXTextGraphicObject"); + tEnv.addObjRelation("NoSetSize", "SwXTextGraphicObject"); + Object ImgMap = null; + // creating ObjectRelation for the property + // 'ImageMap' of 'TextGraphicObject' + try { + XMultiServiceFactory xDocMSF = UnoRuntime.queryInterface( + XMultiServiceFactory.class, xTextDoc); + ImgMap = xDocMSF + .createInstance("com.sun.star.image.ImageMapRectangleObject"); + } catch (Exception ex) { + ex.printStackTrace(); + } + + tEnv.addObjRelation("IMGMAP", ImgMap); + + tEnv.addObjRelation("CONTENT", + UnoRuntime.queryInterface(XTextContent.class, instance)); + tEnv.addObjRelation("RANGE", xTextDoc.getText().createTextCursor()); + + // object relation for text.BaseFrameProperties + tEnv.addObjRelation("TextFrame", xTextFrame); + + return tEnv; } // finish method getTestEnvironment -} // finish class SwXTextGraphicObject +} // finish class SwXTextGraphicObject diff --git a/qadevOOo/tests/java/mod/_sw/SwXTextGraphicObjects.java b/qadevOOo/tests/java/mod/_sw/SwXTextGraphicObjects.java index 8852ffbe7e72..bbe03ca0ff4c 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXTextGraphicObjects.java +++ b/qadevOOo/tests/java/mod/_sw/SwXTextGraphicObjects.java @@ -42,114 +42,101 @@ public class SwXTextGraphicObjects extends TestCase { /** * in general this method creates a testdocument * - * @param tParam class which contains additional test parameters - * @param log class to log the test state and result + * @param tParam + * class which contains additional test parameters + * @param log + * class to log the test state and result * * - * @see TestParameters - * @see PrintWriter + * @see TestParameters + * @see PrintWriter * */ @Override - protected void initialize( TestParameters tParam, PrintWriter log ) { - SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF() ); + protected void initialize(TestParameters tParam, PrintWriter log) { + SOfficeFactory SOF = SOfficeFactory.getFactory(tParam.getMSF()); try { - log.println( "creating a textdoc" ); - xTextDoc = SOF.createTextDoc( null ); - } catch ( Exception e ) { + log.println("creating a textdoc"); + xTextDoc = SOF.createTextDoc(null); + } catch (Exception e) { // Some exception occurs.FAILED - e.printStackTrace( log ); - throw new StatusException( "Couldn't create document", e ); + e.printStackTrace(log); + throw new StatusException("Couldn't create document", e); } } /** * in general this method disposes the testenvironment and document * - * @param tParam class which contains additional test parameters - * @param log class to log the test state and result + * @param tParam + * class which contains additional test parameters + * @param log + * class to log the test state and result * * - * @see TestParameters - * @see PrintWriter + * @see TestParameters + * @see PrintWriter * */ @Override - protected void cleanup( TestParameters tParam, PrintWriter log ) { - log.println( " disposing xTextDoc " ); + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xTextDoc "); util.DesktopTools.closeDoc(xTextDoc); } - /** - * creating a TestEnvironment for the interfaces to be tested + * creating a TestEnvironment for the interfaces to be tested * - * @param tParam class which contains additional test parameters - * @param log class to log the test state and result + * @param tParam + * class which contains additional test parameters + * @param log + * class to log the test state and result * - * @return Status class + * @return Status class * - * @see TestParameters - * @see PrintWriter + * @see TestParameters + * @see PrintWriter */ @Override - public TestEnvironment createTestEnvironment( TestParameters tParam, - PrintWriter log ) - throws StatusException { + public TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) throws Exception { XInterface oObj = null; Object oGObject = null; - SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF() ); + SOfficeFactory SOF = SOfficeFactory.getFactory(tParam.getMSF()); - try { - oGObject = SOF.createInstance - (xTextDoc,"com.sun.star.text.GraphicObject"); - } - catch (Exception ex) { - log.println("Couldn't create instance"); - ex.printStackTrace(log); - throw new StatusException("Couldn't create instance", ex ); - } + oGObject = SOF.createInstance(xTextDoc, + "com.sun.star.text.GraphicObject"); oObj = (XInterface) oGObject; XText the_text = xTextDoc.getText(); XTextCursor the_cursor = the_text.createTextCursor(); - XTextContent the_content = UnoRuntime.queryInterface(XTextContent.class,oObj); - - log.println( "inserting graphic" ); - try { - the_text.insertTextContent(the_cursor,the_content,true); - } catch (Exception e) { - System.out.println("Couldn't insert Content"); - e.printStackTrace(); - throw new StatusException("Couldn't insert Content", e ); - } - - log.println( "adding graphic" ); - XPropertySet oProps = UnoRuntime.queryInterface(XPropertySet.class,oObj); - try { - String wat = util.utils.getFullTestURL("space-metal.jpg"); - oProps.setPropertyValue("GraphicURL",wat); - oProps.setPropertyValue("HoriOrientPosition",Integer.valueOf(5500)); - oProps.setPropertyValue("VertOrientPosition",Integer.valueOf(4200)); - oProps.setPropertyValue("Width",Integer.valueOf(4400)); - oProps.setPropertyValue("Height",Integer.valueOf(4000)); - } catch (Exception e) { - System.out.println("Couldn't set property 'GraphicURL'"); - e.printStackTrace(); - throw new StatusException("Couldn't set property 'GraphicURL'", e ); - } - - XTextGraphicObjectsSupplier xTGS = UnoRuntime.queryInterface(XTextGraphicObjectsSupplier.class, - xTextDoc); + XTextContent the_content = UnoRuntime.queryInterface( + XTextContent.class, oObj); + + log.println("inserting graphic"); + the_text.insertTextContent(the_cursor, the_content, true); + + log.println("adding graphic"); + XPropertySet oProps = UnoRuntime.queryInterface(XPropertySet.class, + oObj); + String wat = util.utils.getFullTestURL("space-metal.jpg"); + oProps.setPropertyValue("GraphicURL", wat); + oProps.setPropertyValue("HoriOrientPosition", Integer.valueOf(5500)); + oProps.setPropertyValue("VertOrientPosition", Integer.valueOf(4200)); + oProps.setPropertyValue("Width", Integer.valueOf(4400)); + oProps.setPropertyValue("Height", Integer.valueOf(4000)); + + XTextGraphicObjectsSupplier xTGS = UnoRuntime.queryInterface( + XTextGraphicObjectsSupplier.class, xTextDoc); oObj = xTGS.getGraphicObjects(); - TestEnvironment tEnv = new TestEnvironment( oObj ); + TestEnvironment tEnv = new TestEnvironment(oObj); return tEnv; } // finish method getTestEnvironment -} // finish class SwXTextGraphicObjects +} // finish class SwXTextGraphicObjects diff --git a/qadevOOo/tests/java/mod/_sw/SwXTextPortion.java b/qadevOOo/tests/java/mod/_sw/SwXTextPortion.java index bffc67d6f19e..96431391763f 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXTextPortion.java +++ b/qadevOOo/tests/java/mod/_sw/SwXTextPortion.java @@ -41,6 +41,7 @@ import com.sun.star.uno.XInterface; /** * * initial description + * * @see com.sun.star.text.TextPortion * */ @@ -48,39 +49,40 @@ public class SwXTextPortion extends TestCase { XTextDocument xTextDoc; @Override - protected void initialize( TestParameters tParam, PrintWriter log ) { - SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF() ); + protected void initialize(TestParameters tParam, PrintWriter log) { + SOfficeFactory SOF = SOfficeFactory.getFactory(tParam.getMSF()); try { - log.println( "creating a textdocument" ); - xTextDoc = SOF.createTextDoc( null ); - } catch ( com.sun.star.uno.Exception e ) { + log.println("creating a textdocument"); + xTextDoc = SOF.createTextDoc(null); + } catch (com.sun.star.uno.Exception e) { // Some exception occurs.FAILED - e.printStackTrace( log ); - throw new StatusException( "Couldn't create document", e ); + e.printStackTrace(log); + throw new StatusException("Couldn't create document", e); } } @Override - protected void cleanup( TestParameters tParam, PrintWriter log ) { - log.println( " disposing xTextDoc " ); + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xTextDoc "); util.DesktopTools.closeDoc(xTextDoc); } /** - * * creating a TestEnvironment for the interfaces to be tested + * creating a TestEnvironment for the interfaces to be tested * - * @param tParam class which contains additional test parameters - * @param log class to log the test state and result + * @param tParam + * class which contains additional test parameters + * @param log + * class to log the test state and result * - * @return Status class + * @return Status class * - * @see TestParameters - * * @see PrintWriter + * @see TestParameters * @see PrintWriter */ @Override - protected synchronized TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment( + TestParameters tParam, PrintWriter log) throws Exception { XInterface oObj = null; XInterface param = null; @@ -89,73 +91,58 @@ public class SwXTextPortion extends TestCase { // creation of testobject here // first we write what we are intend to do to log file - log.println( "creating a test environment" ); + log.println("creating a test environment"); // create testobject here XText oText = xTextDoc.getText(); XTextCursor oCursor = oText.createTextCursor(); - log.println( "inserting Strings" ); - log.println( "inserting ControlCharacter" ); + log.println("inserting Strings"); + log.println("inserting ControlCharacter"); - try{ - for (int i =0; i < 5; i++){ - oText.insertString( oCursor,"Paragraph Number: " + i, false); - oText.insertControlCharacter( - oCursor, ControlCharacter.LINE_BREAK, false ); - oText.insertString( oCursor, + for (int i = 0; i < 5; i++) { + oText.insertString(oCursor, "Paragraph Number: " + i, false); + oText.insertControlCharacter(oCursor, ControlCharacter.LINE_BREAK, + false); + oText.insertString( + oCursor, "The quick brown fox jumps over the lazy Dog: SwXParagraph\n", false); - oText.insertControlCharacter( - oCursor, ControlCharacter.LINE_BREAK, false ); - oText.insertString( oCursor, + oText.insertControlCharacter(oCursor, ControlCharacter.LINE_BREAK, + false); + oText.insertString( + oCursor, "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG: SwXParagraph", false); - oText.insertControlCharacter( - oCursor, ControlCharacter.PARAGRAPH_BREAK, false ); - } - }catch(Exception e){ - log.println("Couldn't insert Text"); - e.printStackTrace(log); - throw new StatusException( "Couldn't insert Text", e ); + oText.insertControlCharacter(oCursor, + ControlCharacter.PARAGRAPH_BREAK, false); } // Enumeration - XEnumerationAccess oEnumA = UnoRuntime.queryInterface( XEnumerationAccess.class, oText ); + XEnumerationAccess oEnumA = UnoRuntime.queryInterface( + XEnumerationAccess.class, oText); XEnumeration oEnum = oEnumA.createEnumeration(); int n = 0; - while ( (oEnum.hasMoreElements()) ) { - try { - param = (XInterface) AnyConverter.toObject( - new Type(XInterface.class),oEnum.nextElement()); - log.println("Element Nr.: " + n ); - } catch ( Exception e) { - log.println("Couldn't get Paragraph"); - e.printStackTrace(log); - throw new StatusException( "Couldn't get Paragraph", e ); - } + while ((oEnum.hasMoreElements())) { + param = (XInterface) AnyConverter.toObject(new Type( + XInterface.class), oEnum.nextElement()); + log.println("Element Nr.: " + n); n++; } - XEnumerationAccess oEnumP = UnoRuntime.queryInterface( XEnumerationAccess.class, param ); + XEnumerationAccess oEnumP = UnoRuntime.queryInterface( + XEnumerationAccess.class, param); XEnumeration oEnum2 = oEnumP.createEnumeration(); - try { - oObj = (XInterface)AnyConverter.toObject( - new Type(XInterface.class),oEnum2.nextElement()); - } catch ( Exception e) { - log.println("Couldn't get TextPortion"); - e.printStackTrace(log); - throw new StatusException( "Couldn't get TextPortion", e ); - } + oObj = (XInterface) AnyConverter.toObject(new Type(XInterface.class), + oEnum2.nextElement()); portP = UnoRuntime.queryInterface(XPropertySet.class, oObj); paraP = UnoRuntime.queryInterface(XPropertySet.class, param); - - log.println( "creating a new environment for Paragraph object" ); - TestEnvironment tEnv = new TestEnvironment( oObj ); + log.println("creating a new environment for Paragraph object"); + TestEnvironment tEnv = new TestEnvironment(oObj); log.println("adding ObjRelation TRO for TextContent"); tEnv.addObjRelation("TRO", Boolean.TRUE); @@ -171,6 +158,5 @@ public class SwXTextPortion extends TestCase { return tEnv; } // finish method getTestEnvironment - -} // finish class SwXTextPortion +} // finish class SwXTextPortion diff --git a/qadevOOo/tests/java/mod/_sw/SwXTextPortionEnumeration.java b/qadevOOo/tests/java/mod/_sw/SwXTextPortionEnumeration.java index 630e12cea3e7..c3f2782ccda6 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXTextPortionEnumeration.java +++ b/qadevOOo/tests/java/mod/_sw/SwXTextPortionEnumeration.java @@ -40,6 +40,7 @@ import com.sun.star.uno.XInterface; /** * * initial description + * * @see com.sun.star.text.TextPortion * */ @@ -48,96 +49,90 @@ public class SwXTextPortionEnumeration extends TestCase { XTextDocument xTextDoc; @Override - protected void initialize( TestParameters tParam, PrintWriter log ) { - SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF() ); + protected void initialize(TestParameters tParam, PrintWriter log) { + SOfficeFactory SOF = SOfficeFactory.getFactory(tParam.getMSF()); try { - log.println( "creating a textdocument" ); - xTextDoc = SOF.createTextDoc( null ); - } catch ( com.sun.star.uno.Exception e ) { - // Some exception occurs.FAILED - e.printStackTrace( log ); - throw new StatusException( "Couldn't create document", e ); + log.println("creating a textdocument"); + xTextDoc = SOF.createTextDoc(null); + } catch (com.sun.star.uno.Exception e) { + // Some exception occurs.FAILED + e.printStackTrace(log); + throw new StatusException("Couldn't create document", e); } } @Override - protected void cleanup( TestParameters tParam, PrintWriter log ) { - log.println( " disposing xTextDoc " ); + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xTextDoc "); util.DesktopTools.closeDoc(xTextDoc); } /** - * creating a TestEnvironment for the interfaces to be tested + * creating a TestEnvironment for the interfaces to be tested * - * @param tParam class which contains additional test parameters - * @param log class to log the test state and result + * @param tParam + * class which contains additional test parameters + * @param log + * class to log the test state and result * - * @return Status class + * @return Status class * - * @see TestParameters - * @see PrintWriter + * @see TestParameters + * @see PrintWriter */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment( + TestParameters tParam, PrintWriter log) throws Exception { XInterface param = null; // creation of testobject here // first we write what we are intend to do to log file - log.println( "creating a test environment" ); + log.println("creating a test environment"); // create testobject here XText oText = xTextDoc.getText(); XTextCursor oCursor = oText.createTextCursor(); - log.println( "inserting Strings" ); - log.println( "inserting ControlCharacter" ); - + log.println("inserting Strings"); + log.println("inserting ControlCharacter"); - try{ - for (int i =0; i < 5; i++){ - oText.insertString( oCursor,"Paragraph Number: " + i, false); - oText.insertControlCharacter( - oCursor, ControlCharacter.LINE_BREAK, false ); - oText.insertString( oCursor, + for (int i = 0; i < 5; i++) { + oText.insertString(oCursor, "Paragraph Number: " + i, false); + oText.insertControlCharacter(oCursor, ControlCharacter.LINE_BREAK, + false); + oText.insertString( + oCursor, "The quick brown fox jumps over the lazy Dog: SwXParagraph\n", false); - oText.insertControlCharacter( - oCursor, ControlCharacter.LINE_BREAK, false ); - oText.insertString( oCursor, + oText.insertControlCharacter(oCursor, ControlCharacter.LINE_BREAK, + false); + oText.insertString( + oCursor, "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG: SwXParagraph", false); - oText.insertControlCharacter( - oCursor, ControlCharacter.PARAGRAPH_BREAK, false ); - } - }catch(Exception e){ - log.println("Couldn't insert Text"); - e.printStackTrace(); - throw new StatusException( "Couldn't insert Text", e ); + oText.insertControlCharacter(oCursor, + ControlCharacter.PARAGRAPH_BREAK, false); } // Enumeration - XEnumerationAccess oEnumA = UnoRuntime.queryInterface( XEnumerationAccess.class, oText ); + XEnumerationAccess oEnumA = UnoRuntime.queryInterface( + XEnumerationAccess.class, oText); XEnumeration oEnum = oEnumA.createEnumeration(); - while ( (oEnum.hasMoreElements()) ) { - try { - param = (XInterface) AnyConverter.toObject( - new Type(XInterface.class),oEnum.nextElement()); - } catch ( Exception e) { - log.println("Couldn't get Paragraph"); - e.printStackTrace(); - throw new StatusException( "Couldn't get Paragraph", e ); - } + while ((oEnum.hasMoreElements())) { + param = (XInterface) AnyConverter.toObject(new Type( + XInterface.class), oEnum.nextElement()); } - XEnumerationAccess oEnumP = UnoRuntime.queryInterface( XEnumerationAccess.class, param ); + XEnumerationAccess oEnumP = UnoRuntime.queryInterface( + XEnumerationAccess.class, param); XEnumeration oEnum2 = oEnumP.createEnumeration(); - log.println( "creating a new environment for TextPortionEnumeration object" ); - TestEnvironment tEnv = new TestEnvironment( oEnum2 ); + log.println("creating a new environment for TextPortionEnumeration object"); + TestEnvironment tEnv = new TestEnvironment(oEnum2); log.println("adding ObjRelation ENUM for XEnumeration"); tEnv.addObjRelation("ENUM", oEnumP); @@ -145,6 +140,5 @@ public class SwXTextPortionEnumeration extends TestCase { return tEnv; } // finish method getTestEnvironment - -} // finish class SwXTextPortionEnumeration +} // finish class SwXTextPortionEnumeration diff --git a/qadevOOo/tests/java/mod/_sw/SwXTextSection.java b/qadevOOo/tests/java/mod/_sw/SwXTextSection.java index 18cbd6375a4a..2d84ffcf32f4 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXTextSection.java +++ b/qadevOOo/tests/java/mod/_sw/SwXTextSection.java @@ -80,7 +80,7 @@ public class SwXTextSection extends TestCase { * creating a TestEnvironment for the interfaces to be tested */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; XInterface oTS = null; @@ -152,14 +152,8 @@ public class SwXTextSection extends TestCase { tEnv.addObjRelation("TRO",Boolean.TRUE); - try { - TC = UnoRuntime.queryInterface(XTextColumns.class, - oDocMSF.createInstance("com.sun.star.text.TextColumns")); - } catch ( com.sun.star.uno.Exception e ) { - e.printStackTrace(log); - throw new StatusException - ("Couldn't create instance of service TextColumns", e ); - } + TC = UnoRuntime.queryInterface(XTextColumns.class, + oDocMSF.createInstance("com.sun.star.text.TextColumns")); tEnv.addObjRelation("TC",TC); tEnv.addObjRelation("CONTENT", UnoRuntime.queryInterface(XTextContent.class,instance)); diff --git a/qadevOOo/tests/java/mod/_sw/SwXTextSections.java b/qadevOOo/tests/java/mod/_sw/SwXTextSections.java index a5c47c00e91b..f55b5b686066 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXTextSections.java +++ b/qadevOOo/tests/java/mod/_sw/SwXTextSections.java @@ -70,7 +70,7 @@ public class SwXTextSections extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment - (TestParameters Param, PrintWriter log ) throws StatusException { + (TestParameters Param, PrintWriter log ) throws Exception { XInterface oObj = null; XInterface oTS = null; @@ -92,28 +92,16 @@ public class SwXTextSections extends TestCase { XMultiServiceFactory oDocMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDoc); // First TextSection - try { - oTS = (XInterface) oDocMSF.createInstance - ("com.sun.star.text.TextSection"); - XTextContent oTSC = UnoRuntime.queryInterface(XTextContent.class, oTS); - oText.insertTextContent(oCursor, oTSC, false); - } - catch(Exception e){ - e.printStackTrace( log ); - throw new StatusException( "Couldn't create document", e ); - } + oTS = (XInterface) oDocMSF.createInstance + ("com.sun.star.text.TextSection"); + XTextContent oTSC = UnoRuntime.queryInterface(XTextContent.class, oTS); + oText.insertTextContent(oCursor, oTSC, false); // Second TextSection - try { - oTS = (XInterface) oDocMSF.createInstance - ("com.sun.star.text.TextSection"); - XTextContent oTSC = UnoRuntime.queryInterface(XTextContent.class, oTS); - oText.insertTextContent(oCursor, oTSC, false); - } - catch(Exception e){ - e.printStackTrace( log ); - throw new StatusException( "Couldn't create document", e ); - } + oTS = (XInterface) oDocMSF.createInstance + ("com.sun.star.text.TextSection"); + XTextContent oTSC2 = UnoRuntime.queryInterface(XTextContent.class, oTS); + oText.insertTextContent(oCursor, oTSC2, false); log.println( "try to get a TextSection with the XTextSectionSupplier()" ); diff --git a/qadevOOo/tests/java/mod/_sw/SwXTextTable.java b/qadevOOo/tests/java/mod/_sw/SwXTextTable.java index 2828479090f6..ca29bed3aa92 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXTextTable.java +++ b/qadevOOo/tests/java/mod/_sw/SwXTextTable.java @@ -98,13 +98,7 @@ public class SwXTextTable extends TestCase { tEnv = new TestEnvironment(oObj); if (SOfficeFactory.getTableCollection(xTextDoc).getCount() == 0) { - try { - SOfficeFactory.insertTextContent(xTextDoc, oObj); - } catch (com.sun.star.lang.IllegalArgumentException uE) { - uE.printStackTrace(log); - throw new StatusException("Couldn't create TextTable : " + - uE.getMessage(), uE); - } + SOfficeFactory.insertTextContent(xTextDoc, oObj); } XPropertySet props = UnoRuntime.queryInterface( diff --git a/qadevOOo/tests/java/mod/_sw/SwXTextTables.java b/qadevOOo/tests/java/mod/_sw/SwXTextTables.java index b7f82f11253a..504693d9000b 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXTextTables.java +++ b/qadevOOo/tests/java/mod/_sw/SwXTextTables.java @@ -95,27 +95,13 @@ public class SwXTextTables extends TestCase { // create testobject here TestEnvironment tEnv = null; XTextTable oTable = null; - try { - oTable = SOfficeFactory.createTextTable( xTextDoc ); - SOfficeFactory.insertTextContent(xTextDoc, oTable ); - } - catch( Exception uE ) { - uE.printStackTrace( log ); - throw new StatusException("Couldn't create TextTable : " - + uE.getMessage(), uE); - } + oTable = SOfficeFactory.createTextTable( xTextDoc ); + SOfficeFactory.insertTextContent(xTextDoc, oTable ); // Number two XTextTable oTable2 = null; - try { - oTable2 = SOfficeFactory.createTextTable( xTextDoc ); - SOfficeFactory.insertTextContent(xTextDoc, oTable2 ); - } - catch( Exception uE ) { - uE.printStackTrace( log ); - throw new StatusException("Couldn't create TextTable two: " - + uE.getMessage(), uE); - } + oTable2 = SOfficeFactory.createTextTable( xTextDoc ); + SOfficeFactory.insertTextContent(xTextDoc, oTable2 ); XMultiServiceFactory msf = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDoc); XTextTablesSupplier oTTSupp = UnoRuntime.queryInterface(XTextTablesSupplier.class, msf); @@ -130,14 +116,7 @@ public class SwXTextTables extends TestCase { tEnv.addObjRelation( "TEXTDOC", xTextDoc ); tEnv.addObjRelation( "ROW", Integer.valueOf( nRow ) ); tEnv.addObjRelation( "COL", Integer.valueOf( nCol ) ); - try { - tEnv.addObjRelation( "INST", SOfficeFactory.createTextTable( xTextDoc )); - } - catch( Exception uE ) { - uE.printStackTrace( log ); - throw new StatusException("Couldn't create TextTable : " - + uE.getMessage(), uE); - } + tEnv.addObjRelation( "INST", SOfficeFactory.createTextTable( xTextDoc )); return tEnv; } // finish method getTestEnvironment diff --git a/qadevOOo/tests/java/mod/_sw/SwXTextView.java b/qadevOOo/tests/java/mod/_sw/SwXTextView.java index 67b7b1a55f20..ef07976ba612 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXTextView.java +++ b/qadevOOo/tests/java/mod/_sw/SwXTextView.java @@ -141,30 +141,25 @@ public class SwXTextView extends TestCase { Object oFrame1 = null; Object oFrame2 = null; - try { - XText oText = xTextDoc.getText(); - XTextCursor oCursor = oText.createTextCursor(); - oFrame1 = SOF.createInstance - (xTextDoc, "com.sun.star.text.TextFrame" ); - first = UnoRuntime.queryInterface - ( XTextFrame.class, oFrame1); - oText.insertTextContent(oCursor,first, false); - first.getText().setString("Frame 1"); - oFrame2 = SOF.createInstance(xTextDoc, "com.sun.star.text.TextFrame" ); - second = UnoRuntime.queryInterface - ( XTextFrame.class, oFrame2); - oText.insertTextContent(oCursor,second, false); - second.getText().setString("Frame 2"); - oText.insertString( oCursor, - "SwXTextRanges...SwXTextRanges...SwXTextRanges", false); - oText.insertControlCharacter( oCursor, - ControlCharacter.PARAGRAPH_BREAK, false); - oText.insertString( oCursor, - "bla...bla...", false); - } catch (Exception Ex ) { - Ex.printStackTrace(log); - throw new StatusException("Couldn't insert text table ", Ex); - } + XText oText = xTextDoc.getText(); + XTextCursor oCursor = oText.createTextCursor(); + oFrame1 = SOF.createInstance + (xTextDoc, "com.sun.star.text.TextFrame" ); + first = UnoRuntime.queryInterface + ( XTextFrame.class, oFrame1); + oText.insertTextContent(oCursor,first, false); + first.getText().setString("Frame 1"); + oFrame2 = SOF.createInstance(xTextDoc, "com.sun.star.text.TextFrame" ); + second = UnoRuntime.queryInterface + ( XTextFrame.class, oFrame2); + oText.insertTextContent(oCursor,second, false); + second.getText().setString("Frame 2"); + oText.insertString( oCursor, + "SwXTextRanges...SwXTextRanges...SwXTextRanges", false); + oText.insertControlCharacter( oCursor, + ControlCharacter.PARAGRAPH_BREAK, false); + oText.insertString( oCursor, + "bla...bla...", false); XSearchable oSearch = UnoRuntime.queryInterface (XSearchable.class, xTextDoc); @@ -209,28 +204,16 @@ public class SwXTextView extends TestCase { }); XSelectionSupplier xsel = UnoRuntime.queryInterface(XSelectionSupplier.class,xContr); - try { - xsel.select(second); - } catch (Exception e) { - log.println("Couldn't select"); - throw new StatusException( "Couldn't select", e ); - } + xsel.select(second); tEnv.addObjRelation("DOCUMENT",xTextDoc); XForm myForm = null; String kindOfControl="CommandButton"; XShape aShape = null; - try{ - log.println("adding contol shape '" + kindOfControl + "'"); - aShape = FormTools.createControlShape(xTextDoc, 3000, - 4500, 15000, 10000, - kindOfControl); - } catch (Exception e){ - e.printStackTrace(log); - throw new StatusException("Couldn't create following control shape : '" + - kindOfControl + "': ", e); - - } + log.println("adding contol shape '" + kindOfControl + "'"); + aShape = FormTools.createControlShape(xTextDoc, 3000, + 4500, 15000, 10000, + kindOfControl); log.println("adding relation for com.sun.star.view.XFormLayerAccess: XForm"); diff --git a/qadevOOo/tests/java/mod/_sw/XMLContentExporter.java b/qadevOOo/tests/java/mod/_sw/XMLContentExporter.java index 4e17682238f1..1cc91d1f3100 100644 --- a/qadevOOo/tests/java/mod/_sw/XMLContentExporter.java +++ b/qadevOOo/tests/java/mod/_sw/XMLContentExporter.java @@ -113,7 +113,7 @@ public class XMLContentExporter extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment - ( TestParameters tParam, PrintWriter log ) throws StatusException { + ( TestParameters tParam, PrintWriter log ) throws Exception { final String CONTENT = "XMLContentExporter"; XMultiServiceFactory xMSF = tParam.getMSF() ; @@ -122,22 +122,17 @@ public class XMLContentExporter extends TestCase { Filter = new ContentFilterChecker(log); Any arg = new Any(new Type(XDocumentHandler.class), Filter); - try { - oObj = (XInterface) xMSF.createInstanceWithArguments( - "com.sun.star.comp.Writer.XMLContentExporter", - new Object[] {arg}); - XExporter xEx = UnoRuntime.queryInterface - (XExporter.class,oObj); - xEx.setSourceDocument(xTextDoc); - - // text added to the document - XSimpleText aText = xTextDoc.getText(); - XTextCursor curs = aText.createTextCursor(); - aText.insertString(curs, CONTENT, false); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oObj = (XInterface) xMSF.createInstanceWithArguments( + "com.sun.star.comp.Writer.XMLContentExporter", + new Object[] {arg}); + XExporter xEx = UnoRuntime.queryInterface + (XExporter.class,oObj); + xEx.setSourceDocument(xTextDoc); + + // text added to the document + XSimpleText aText = xTextDoc.getText(); + XTextCursor curs = aText.createTextCursor(); + aText.insertString(curs, CONTENT, false); // adding tags which must be contained in XML output Filter.addTag("office:document-content") ; diff --git a/qadevOOo/tests/java/mod/_sw/XMLContentImporter.java b/qadevOOo/tests/java/mod/_sw/XMLContentImporter.java index e28378cd3d87..47c825b34bb0 100644 --- a/qadevOOo/tests/java/mod/_sw/XMLContentImporter.java +++ b/qadevOOo/tests/java/mod/_sw/XMLContentImporter.java @@ -107,7 +107,7 @@ public class XMLContentImporter extends TestCase { @Override public synchronized TestEnvironment createTestEnvironment( TestParameters tParam, PrintWriter log ) - throws StatusException { + throws Exception { XInterface oObj = null; Object oInt = null ; @@ -119,13 +119,8 @@ public class XMLContentImporter extends TestCase { XMultiServiceFactory xMSF = tParam.getMSF() ; - try { - oInt = xMSF.createInstance - ("com.sun.star.comp.Writer.XMLContentImporter") ; - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oInt = xMSF.createInstance + ("com.sun.star.comp.Writer.XMLContentImporter") ; oObj = (XInterface) oInt ; diff --git a/qadevOOo/tests/java/mod/_sw/XMLExporter.java b/qadevOOo/tests/java/mod/_sw/XMLExporter.java index 53e37a735849..34eee2b5751d 100644 --- a/qadevOOo/tests/java/mod/_sw/XMLExporter.java +++ b/qadevOOo/tests/java/mod/_sw/XMLExporter.java @@ -113,7 +113,7 @@ public class XMLExporter extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log) { + (TestParameters tParam, PrintWriter log) throws Exception { final String TEST_STR = "XMLExporter"; @@ -123,20 +123,15 @@ public class XMLExporter extends TestCase { Filter = new FilterChecker(log); Any arg = new Any(new Type(XDocumentHandler.class),Filter); - try { - oObj = (XInterface) xMSF.createInstanceWithArguments( - "com.sun.star.comp.Writer.XMLExporter", new Object[] {arg}); - XExporter xEx = UnoRuntime.queryInterface - (XExporter.class,oObj); - xEx.setSourceDocument(xTextDoc); - - XSimpleText aText = xTextDoc.getText(); - XTextCursor curs = aText.createTextCursor(); - aText.insertString(curs, TEST_STR, false); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oObj = (XInterface) xMSF.createInstanceWithArguments( + "com.sun.star.comp.Writer.XMLExporter", new Object[] {arg}); + XExporter xEx = UnoRuntime.queryInterface + (XExporter.class,oObj); + xEx.setSourceDocument(xTextDoc); + + XSimpleText aText = xTextDoc.getText(); + XTextCursor curs = aText.createTextCursor(); + aText.insertString(curs, TEST_STR, false); // adding tags which must be contained in XML output Filter.addTag("office:document") ; diff --git a/qadevOOo/tests/java/mod/_sw/XMLImporter.java b/qadevOOo/tests/java/mod/_sw/XMLImporter.java index 6d74d8fce656..491eef35fd13 100644 --- a/qadevOOo/tests/java/mod/_sw/XMLImporter.java +++ b/qadevOOo/tests/java/mod/_sw/XMLImporter.java @@ -107,21 +107,16 @@ public class XMLImporter extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment - ( TestParameters tParam, PrintWriter log) { + ( TestParameters tParam, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF() ; XInterface oObj = null; - try { - oObj = (XInterface) xMSF.createInstance - ("com.sun.star.comp.Writer.XMLImporter"); - XImporter xIm = UnoRuntime.queryInterface - (XImporter.class,oObj); - xIm.setTargetDocument(xTextDoc); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oObj = (XInterface) xMSF.createInstance + ("com.sun.star.comp.Writer.XMLImporter"); + XImporter xIm = UnoRuntime.queryInterface + (XImporter.class,oObj); + xIm.setTargetDocument(xTextDoc); // create testobject here log.println( "creating a new environment" ); diff --git a/qadevOOo/tests/java/mod/_sw/XMLMetaExporter.java b/qadevOOo/tests/java/mod/_sw/XMLMetaExporter.java index 6eca393fbe22..388157974cb3 100644 --- a/qadevOOo/tests/java/mod/_sw/XMLMetaExporter.java +++ b/qadevOOo/tests/java/mod/_sw/XMLMetaExporter.java @@ -114,7 +114,7 @@ public class XMLMetaExporter extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment - ( TestParameters tParam, PrintWriter log ) throws StatusException { + ( TestParameters tParam, PrintWriter log ) throws Exception { final String TITLE = "Title for testing of XMLMetaExporter"; XMultiServiceFactory xMSF = tParam.getMSF() ; @@ -123,23 +123,18 @@ public class XMLMetaExporter extends TestCase { Filter = new MetaFilterChecker(log); Any arg = new Any(new Type(XDocumentHandler.class), Filter); - try { - oObj = (XInterface) xMSF.createInstanceWithArguments( - "com.sun.star.comp.Writer.XMLMetaExporter", - new Object[] {arg}); - XExporter xEx = UnoRuntime.queryInterface - (XExporter.class,oObj); - xEx.setSourceDocument(xTextDoc); - - //set some meta data - XDocumentPropertiesSupplier xPropSup = UnoRuntime.queryInterface - (XDocumentPropertiesSupplier.class, xTextDoc); - final XDocumentProperties xDocProps = xPropSup.getDocumentProperties(); - xDocProps.setTitle(TITLE); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oObj = (XInterface) xMSF.createInstanceWithArguments( + "com.sun.star.comp.Writer.XMLMetaExporter", + new Object[] {arg}); + XExporter xEx = UnoRuntime.queryInterface + (XExporter.class,oObj); + xEx.setSourceDocument(xTextDoc); + + //set some meta data + XDocumentPropertiesSupplier xPropSup = UnoRuntime.queryInterface + (XDocumentPropertiesSupplier.class, xTextDoc); + final XDocumentProperties xDocProps = xPropSup.getDocumentProperties(); + xDocProps.setTitle(TITLE); // adding tags which must be contained in XML output Filter.addTag("office:document-meta"); diff --git a/qadevOOo/tests/java/mod/_sw/XMLMetaImporter.java b/qadevOOo/tests/java/mod/_sw/XMLMetaImporter.java index 6e6a6baea9ff..b048e7d0f857 100644 --- a/qadevOOo/tests/java/mod/_sw/XMLMetaImporter.java +++ b/qadevOOo/tests/java/mod/_sw/XMLMetaImporter.java @@ -110,7 +110,7 @@ public class XMLMetaImporter extends TestCase { @Override public synchronized TestEnvironment createTestEnvironment( TestParameters tParam, PrintWriter log ) - throws StatusException { + throws Exception { XInterface oObj = null; Object oInt = null ; @@ -122,13 +122,8 @@ public class XMLMetaImporter extends TestCase { XMultiServiceFactory xMSF = tParam.getMSF() ; - try { - oInt = xMSF.createInstance - ("com.sun.star.comp.Writer.XMLMetaImporter") ; - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oInt = xMSF.createInstance + ("com.sun.star.comp.Writer.XMLMetaImporter") ; oObj = (XInterface) oInt ; diff --git a/qadevOOo/tests/java/mod/_sw/XMLSettingsExporter.java b/qadevOOo/tests/java/mod/_sw/XMLSettingsExporter.java index 2e6cf3b7af57..d9268267f2cf 100644 --- a/qadevOOo/tests/java/mod/_sw/XMLSettingsExporter.java +++ b/qadevOOo/tests/java/mod/_sw/XMLSettingsExporter.java @@ -117,7 +117,7 @@ public class XMLSettingsExporter extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log) { + (TestParameters tParam, PrintWriter log) throws Exception { final short ZOOM = 50; @@ -126,25 +126,19 @@ public class XMLSettingsExporter extends TestCase { Filter = new SettingsFilterChecker(log); Any arg = new Any(new Type(XDocumentHandler.class), Filter); - try { - oObj = (XInterface) xMSF.createInstanceWithArguments( - "com.sun.star.comp.Writer.XMLSettingsExporter", - new Object[] {arg}); - XExporter xEx = UnoRuntime.queryInterface - (XExporter.class,oObj); - xEx.setSourceDocument(xTextDoc); - - //set some settings - XController xController = xTextDoc.getCurrentController(); - XViewSettingsSupplier xViewSetSup = UnoRuntime.queryInterface(XViewSettingsSupplier.class, - xController); - XPropertySet xPropSet = xViewSetSup.getViewSettings(); - xPropSet.setPropertyValue("ZoomValue", Short.valueOf(ZOOM)); - - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oObj = (XInterface) xMSF.createInstanceWithArguments( + "com.sun.star.comp.Writer.XMLSettingsExporter", + new Object[] {arg}); + XExporter xEx = UnoRuntime.queryInterface + (XExporter.class,oObj); + xEx.setSourceDocument(xTextDoc); + + //set some settings + XController xController = xTextDoc.getCurrentController(); + XViewSettingsSupplier xViewSetSup = UnoRuntime.queryInterface(XViewSettingsSupplier.class, + xController); + XPropertySet xPropSet = xViewSetSup.getViewSettings(); + xPropSet.setPropertyValue("ZoomValue", Short.valueOf(ZOOM)); // adding tags which must be contained in XML output Filter.addTag( new XMLTools.Tag("office:document-settings") ); diff --git a/qadevOOo/tests/java/mod/_sw/XMLSettingsImporter.java b/qadevOOo/tests/java/mod/_sw/XMLSettingsImporter.java index 573d81e49f39..e6f834e38015 100644 --- a/qadevOOo/tests/java/mod/_sw/XMLSettingsImporter.java +++ b/qadevOOo/tests/java/mod/_sw/XMLSettingsImporter.java @@ -110,7 +110,7 @@ public class XMLSettingsImporter extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log ) throws StatusException { + (TestParameters tParam, PrintWriter log ) throws Exception { XInterface oObj = null; Object oInt = null ; @@ -122,15 +122,8 @@ public class XMLSettingsImporter extends TestCase { XMultiServiceFactory xMSF = tParam.getMSF() ; - try { - oInt = xMSF.createInstance - ("com.sun.star.comp.Writer.XMLSettingsImporter") ; - - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } - + oInt = xMSF.createInstance + ("com.sun.star.comp.Writer.XMLSettingsImporter") ; oObj = (XInterface) oInt ; diff --git a/qadevOOo/tests/java/mod/_sw/XMLStylesExporter.java b/qadevOOo/tests/java/mod/_sw/XMLStylesExporter.java index a82d6e544e7e..6aeddbcca835 100644 --- a/qadevOOo/tests/java/mod/_sw/XMLStylesExporter.java +++ b/qadevOOo/tests/java/mod/_sw/XMLStylesExporter.java @@ -113,24 +113,19 @@ public class XMLStylesExporter extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment - ( TestParameters tParam, PrintWriter log ) { + ( TestParameters tParam, PrintWriter log ) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF() ; XInterface oObj = null; FilterChecker filter = new FilterChecker(log) ; Any arg = new Any(new Type(XDocumentHandler.class),filter); - try { - oObj = (XInterface) xMSF.createInstanceWithArguments( - "com.sun.star.comp.Writer.XMLStylesExporter", - new Object[] {arg}); - XExporter xEx = UnoRuntime.queryInterface - (XExporter.class,oObj); - xEx.setSourceDocument(xTextDoc); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oObj = (XInterface) xMSF.createInstanceWithArguments( + "com.sun.star.comp.Writer.XMLStylesExporter", + new Object[] {arg}); + XExporter xEx = UnoRuntime.queryInterface + (XExporter.class,oObj); + xEx.setSourceDocument(xTextDoc); // Cheching Head Tag existence and that property has changed filter.addTag(new XMLTools.Tag ("office:document-styles")); @@ -147,12 +142,7 @@ public class XMLStylesExporter extends TestCase { XPropertySet set = supp.getFootnoteSettings(); // Change property "Prefix" - try { - set.setPropertyValue("Prefix","New Property"); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace( log ); - throw new StatusException( "Couldn't change property value", e ); - } + set.setPropertyValue("Prefix","New Property"); tEnv.addObjRelation("MediaDescriptor", XMLTools.createMediaDescriptor( new String[] {"FilterName"}, diff --git a/qadevOOo/tests/java/mod/_sw/XMLStylesImporter.java b/qadevOOo/tests/java/mod/_sw/XMLStylesImporter.java index ac25648db583..e673db24430f 100644 --- a/qadevOOo/tests/java/mod/_sw/XMLStylesImporter.java +++ b/qadevOOo/tests/java/mod/_sw/XMLStylesImporter.java @@ -110,7 +110,7 @@ public class XMLStylesImporter extends TestCase { @Override public synchronized TestEnvironment createTestEnvironment( TestParameters tParam, PrintWriter log ) - throws StatusException { + throws Exception { XInterface oObj = null; Object oInt = null ; @@ -122,14 +122,8 @@ public class XMLStylesImporter extends TestCase { XMultiServiceFactory xMSF = tParam.getMSF() ; - try { - oInt = xMSF.createInstance - ("com.sun.star.comp.Writer.XMLStylesImporter") ; - - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oInt = xMSF.createInstance + ("com.sun.star.comp.Writer.XMLStylesImporter") ; oObj = (XInterface) oInt ; diff --git a/qadevOOo/tests/java/mod/_sysdtrans/SystemClipboard.java b/qadevOOo/tests/java/mod/_sysdtrans/SystemClipboard.java index f964d1ed8e8a..f70dcd961c9e 100644 --- a/qadevOOo/tests/java/mod/_sysdtrans/SystemClipboard.java +++ b/qadevOOo/tests/java/mod/_sysdtrans/SystemClipboard.java @@ -20,33 +20,25 @@ package mod._sysdtrans; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.uno.Exception; import com.sun.star.uno.XInterface; public class SystemClipboard extends TestCase { @Override protected TestEnvironment createTestEnvironment(TestParameters tParam, - PrintWriter log) { + PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF(); - try { - XInterface xInt = (XInterface)xMSF.createInstance( - "com.sun.star.datatransfer.clipboard.SystemClipboard"); + XInterface xInt = (XInterface)xMSF.createInstance( + "com.sun.star.datatransfer.clipboard.SystemClipboard"); - TestEnvironment tEnv = new TestEnvironment(xInt); + TestEnvironment tEnv = new TestEnvironment(xInt); - return tEnv; - } catch (Exception e) { - log.println("Unexpected exception : " + e.getMessage()); - e.printStackTrace(log); - throw new StatusException("Unexpected exception", e); - } + return tEnv; } } diff --git a/qadevOOo/tests/java/mod/_syssh/SystemShellExecute.java b/qadevOOo/tests/java/mod/_syssh/SystemShellExecute.java index 0b18c007c8ee..08b0af7dd608 100644 --- a/qadevOOo/tests/java/mod/_syssh/SystemShellExecute.java +++ b/qadevOOo/tests/java/mod/_syssh/SystemShellExecute.java @@ -20,33 +20,25 @@ package mod._syssh; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.uno.Exception; import com.sun.star.uno.XInterface; public class SystemShellExecute extends TestCase { @Override protected TestEnvironment createTestEnvironment(TestParameters tParam, - PrintWriter log) { + PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF(); - try { - XInterface xInt = (XInterface)xMSF.createInstance( - "com.sun.star.system.SystemShellExecute"); + XInterface xInt = (XInterface)xMSF.createInstance( + "com.sun.star.system.SystemShellExecute"); - TestEnvironment tEnv = new TestEnvironment(xInt); + TestEnvironment tEnv = new TestEnvironment(xInt); - return tEnv; - } catch (Exception e) { - log.println("Unexpected exception : " + e.getMessage()); - e.printStackTrace(log); - throw new StatusException("Unexpected exception", e); - } + return tEnv; } } diff --git a/qadevOOo/tests/java/mod/_text/DefaultNumberingProvider.java b/qadevOOo/tests/java/mod/_text/DefaultNumberingProvider.java index df59588707a3..a673cba8df78 100644 --- a/qadevOOo/tests/java/mod/_text/DefaultNumberingProvider.java +++ b/qadevOOo/tests/java/mod/_text/DefaultNumberingProvider.java @@ -20,7 +20,6 @@ package mod._text; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -50,19 +49,13 @@ public class DefaultNumberingProvider extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { + throws Exception { XInterface oObj = null; Object oInterface = null; - try { - XMultiServiceFactory xMSF = Param.getMSF(); - oInterface = xMSF.createInstance - ("com.sun.star.text.DefaultNumberingProvider" ); - } - catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } + XMultiServiceFactory xMSF = Param.getMSF(); + oInterface = xMSF.createInstance + ("com.sun.star.text.DefaultNumberingProvider" ); oObj = (XInterface) oInterface; diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleButton.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleButton.java index 1b8f2461eb23..924595a2ad2b 100644 --- a/qadevOOo/tests/java/mod/_toolkit/AccessibleButton.java +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleButton.java @@ -40,7 +40,6 @@ import java.io.PrintWriter; import lib.StatusException; import lib.TestEnvironment; import lib.TestParameters; - import util.AccessibilityTools; import util.SOfficeFactory; import util.utils; @@ -85,17 +84,11 @@ public class AccessibleButton extends lib.TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; XMultiServiceFactory msf = Param.getMSF(); - try { - oObj = (XInterface) msf.createInstance("com.sun.star.awt.Toolkit"); - } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't get toolkit"); - e.printStackTrace(log); - throw new StatusException("Couldn't get toolkit", e); - } + oObj = (XInterface) msf.createInstance("com.sun.star.awt.Toolkit"); XExtendedToolkit tk = UnoRuntime.queryInterface( XExtendedToolkit.class, oObj); diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleCheckBox.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleCheckBox.java index 6def9bb8fe93..b955e3db0303 100644 --- a/qadevOOo/tests/java/mod/_toolkit/AccessibleCheckBox.java +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleCheckBox.java @@ -37,11 +37,9 @@ import com.sun.star.util.XURLTransformer; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.AccessibilityTools; import util.SOfficeFactory; import util.utils; @@ -90,17 +88,13 @@ public class AccessibleCheckBox extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XMultiServiceFactory msf = Param.getMSF(); log.println("Creating text document"); if (xTextDoc == null) { - try { - SOfficeFactory SOF = SOfficeFactory.getFactory(msf); - xTextDoc = SOF.createTextDoc(null); - } catch (com.sun.star.uno.Exception e) { - throw new StatusException("Can't create document", e); - } + SOfficeFactory SOF = SOfficeFactory.getFactory(msf); + xTextDoc = SOF.createTextDoc(null); } util.utils.pause(Param.getInt("ShortWait")); @@ -109,13 +103,7 @@ public class AccessibleCheckBox extends TestCase { log.println("getting toolkit"); - try { - oObj = (XInterface) msf.createInstance("com.sun.star.awt.Toolkit"); - } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't get toolkit"); - e.printStackTrace(log); - throw new StatusException("Couldn't get toolkit", e); - } + oObj = (XInterface) msf.createInstance("com.sun.star.awt.Toolkit"); XExtendedToolkit tk = UnoRuntime.queryInterface( XExtendedToolkit.class, oObj); diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleComboBox.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleComboBox.java index d48bd0b4763c..855fff011783 100644 --- a/qadevOOo/tests/java/mod/_toolkit/AccessibleComboBox.java +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleComboBox.java @@ -41,7 +41,6 @@ import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.AccessibilityTools; import util.SOfficeFactory; import util.utils; @@ -79,17 +78,11 @@ public class AccessibleComboBox extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; - try { - oObj = (XInterface) Param.getMSF().createInstance( - "com.sun.star.awt.Toolkit"); - } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't get toolkit"); - e.printStackTrace(log); - throw new StatusException("Couldn't get toolkit", e); - } + oObj = (XInterface) Param.getMSF().createInstance( + "com.sun.star.awt.Toolkit"); XExtendedToolkit tk = UnoRuntime.queryInterface( XExtendedToolkit.class, oObj); diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleEdit.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleEdit.java index 270a5ff512d1..1372f1dc6e25 100644 --- a/qadevOOo/tests/java/mod/_toolkit/AccessibleEdit.java +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleEdit.java @@ -41,7 +41,6 @@ import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.AccessibilityTools; import util.SOfficeFactory; import util.utils; @@ -87,17 +86,11 @@ public class AccessibleEdit extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; - try { - oObj = (XInterface) Param.getMSF().createInstance( - "com.sun.star.awt.Toolkit"); - } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't get toolkit"); - e.printStackTrace(log); - throw new StatusException("Couldn't get toolkit", e); - } + oObj = (XInterface) Param.getMSF().createInstance( + "com.sun.star.awt.Toolkit"); XExtendedToolkit tk = UnoRuntime.queryInterface( XExtendedToolkit.class, oObj); @@ -113,15 +106,10 @@ public class AccessibleEdit extends TestCase { XURLTransformer urlTransf = null; - try { - XInterface transf = (XInterface) Param.getMSF().createInstance( - "com.sun.star.util.URLTransformer"); - urlTransf = UnoRuntime.queryInterface( - XURLTransformer.class, transf); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create URLTransformer", e); - } + XInterface transf = (XInterface) Param.getMSF().createInstance( + "com.sun.star.util.URLTransformer"); + urlTransf = UnoRuntime.queryInterface( + XURLTransformer.class, transf); XDispatch getting = null; log.println("opening HyperlinkDialog"); diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleFixedText.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleFixedText.java index 873d643a96c2..5ca277cf63aa 100644 --- a/qadevOOo/tests/java/mod/_toolkit/AccessibleFixedText.java +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleFixedText.java @@ -32,11 +32,9 @@ import com.sun.star.uno.XInterface; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.AccessibilityTools; import util.utils; @@ -75,7 +73,7 @@ public class AccessibleFixedText extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; XMultiServiceFactory xMSF = Param.getMSF(); XControlModel dlgModel = null; @@ -128,14 +126,8 @@ public class AccessibleFixedText extends TestCase { e.printStackTrace(log); } - try { - oObj = (XInterface) Param.getMSF().createInstance( - "com.sun.star.awt.Toolkit"); - } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't get toolkit"); - e.printStackTrace(log); - throw new StatusException("Couldn't get toolkit", e); - } + oObj = (XInterface) Param.getMSF().createInstance( + "com.sun.star.awt.Toolkit"); util.utils.pause(500); diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleList.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleList.java index 12992f9209a8..c390dd00255d 100644 --- a/qadevOOo/tests/java/mod/_toolkit/AccessibleList.java +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleList.java @@ -43,7 +43,6 @@ import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.AccessibilityTools; import util.SOfficeFactory; import util.utils; @@ -64,16 +63,8 @@ public class AccessibleList extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { - XInterface oObj = null; - - try { - oObj = (XInterface) msf.createInstance("com.sun.star.awt.Toolkit"); - } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't get toolkit"); - e.printStackTrace(log); - throw new StatusException("Couldn't get toolkit", e); - } + PrintWriter log) throws Exception { + XInterface oObj = (XInterface) msf.createInstance("com.sun.star.awt.Toolkit"); XExtendedToolkit tk = UnoRuntime.queryInterface( XExtendedToolkit.class, oObj); @@ -91,15 +82,10 @@ public class AccessibleList extends TestCase { XURLTransformer urlTransf = null; - try { - XInterface transf = (XInterface) msf.createInstance( - "com.sun.star.util.URLTransformer"); - urlTransf = UnoRuntime.queryInterface( - XURLTransformer.class, transf); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create URLTransformer", e); - } + XInterface transf = (XInterface) msf.createInstance( + "com.sun.star.util.URLTransformer"); + urlTransf = UnoRuntime.queryInterface( + XURLTransformer.class, transf); XDispatch getting = null; log.println("opening HyperlinkDialog"); @@ -129,17 +115,13 @@ public class AccessibleList extends TestCase { XAccessibleAction.class, oObj); // Selecting 'New Document' tab - try { - oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.TREE); + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.TREE); - XAccessibleSelection xAccSel = UnoRuntime.queryInterface( - XAccessibleSelection.class, - oObj); - xAccSel.selectAccessibleChild(3); - util.utils.pause(1000); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - throw new StatusException("Can't switch to required tab", e); - } + XAccessibleSelection xAccSel = UnoRuntime.queryInterface( + XAccessibleSelection.class, + oObj); + xAccSel.selectAccessibleChild(3); + util.utils.pause(1000); log.println("# Getting the ListBox"); diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleListBox.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleListBox.java index 7eaf80d757e8..3316a7968275 100644 --- a/qadevOOo/tests/java/mod/_toolkit/AccessibleListBox.java +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleListBox.java @@ -41,7 +41,6 @@ import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.AccessibilityTools; import util.SOfficeFactory; import util.utils; @@ -86,17 +85,9 @@ public class AccessibleListBox extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { - XInterface oObj = null; - - try { - oObj = (XInterface) Param.getMSF().createInstance( - "com.sun.star.awt.Toolkit"); - } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't get toolkit"); - e.printStackTrace(log); - throw new StatusException("Couldn't get toolkit", e); - } + PrintWriter log) throws Exception { + XInterface oObj = (XInterface) Param.getMSF().createInstance( + "com.sun.star.awt.Toolkit"); XExtendedToolkit tk = UnoRuntime.queryInterface( XExtendedToolkit.class, oObj); @@ -114,15 +105,10 @@ public class AccessibleListBox extends TestCase { XURLTransformer urlTransf = null; - try { - XInterface transf = (XInterface) Param.getMSF().createInstance( - "com.sun.star.util.URLTransformer"); - urlTransf = UnoRuntime.queryInterface( - XURLTransformer.class, transf); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create URLTransformer", e); - } + XInterface transf = (XInterface) Param.getMSF().createInstance( + "com.sun.star.util.URLTransformer"); + urlTransf = UnoRuntime.queryInterface( + XURLTransformer.class, transf); XDispatch getting = null; log.println("opening HyperlinkDialog"); @@ -153,17 +139,13 @@ public class AccessibleListBox extends TestCase { XAccessibleAction.class, oObj); // Selecting 'New Document' tab - try { - oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.TREE); - - XAccessibleSelection xAccSel = UnoRuntime.queryInterface( - XAccessibleSelection.class, - oObj); - xAccSel.selectAccessibleChild(3); - util.utils.pause(1000); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - throw new StatusException("Can't switch to required tab", e); - } + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.TREE); + + XAccessibleSelection xAccSel = UnoRuntime.queryInterface( + XAccessibleSelection.class, + oObj); + xAccSel.selectAccessibleChild(3); + util.utils.pause(1000); oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.PANEL, "", "com.sun.star.comp.toolkit.AccessibleListBox"); diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleListItem.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleListItem.java index 1443a4a68aed..63e1cab1e66b 100644 --- a/qadevOOo/tests/java/mod/_toolkit/AccessibleListItem.java +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleListItem.java @@ -42,7 +42,6 @@ import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.AccessibilityTools; import util.SOfficeFactory; import util.utils; @@ -84,17 +83,9 @@ public class AccessibleListItem extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { - XInterface oObj = null; + PrintWriter log) throws Exception { XMultiServiceFactory msf = Param.getMSF(); - - try { - oObj = (XInterface) msf.createInstance("com.sun.star.awt.Toolkit"); - } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't get toolkit"); - e.printStackTrace(log); - throw new StatusException("Couldn't get toolkit", e); - } + XInterface oObj = (XInterface) msf.createInstance("com.sun.star.awt.Toolkit"); XExtendedToolkit tk = UnoRuntime.queryInterface( XExtendedToolkit.class, oObj); @@ -112,15 +103,10 @@ public class AccessibleListItem extends TestCase { XURLTransformer urlTransf = null; - try { - XInterface transf = (XInterface) msf.createInstance( - "com.sun.star.util.URLTransformer"); - urlTransf = UnoRuntime.queryInterface( - XURLTransformer.class, transf); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create URLTransformer", e); - } + XInterface transf = (XInterface) msf.createInstance( + "com.sun.star.util.URLTransformer"); + urlTransf = UnoRuntime.queryInterface( + XURLTransformer.class, transf); XDispatch getting = null; log.println("opening HyperlinkDialog"); @@ -150,17 +136,13 @@ public class AccessibleListItem extends TestCase { XAccessibleAction.class, oObj); // Selecting 'New Document' tab - try { - oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.TREE); + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.TREE); - XAccessibleSelection xAccSel = UnoRuntime.queryInterface( - XAccessibleSelection.class, - oObj); - xAccSel.selectAccessibleChild(3); - util.utils.pause(1000); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - throw new StatusException("Can't switch to required tab", e); - } + XAccessibleSelection xAccSel = UnoRuntime.queryInterface( + XAccessibleSelection.class, + oObj); + xAccSel.selectAccessibleChild(3); + util.utils.pause(1000); oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.LIST_ITEM,"Spr"); diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleMenu.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleMenu.java index 5c83d76d4f0b..e5ff3fb8e69b 100644 --- a/qadevOOo/tests/java/mod/_toolkit/AccessibleMenu.java +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleMenu.java @@ -31,11 +31,9 @@ import com.sun.star.uno.XInterface; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.AccessibilityTools; import util.SOfficeFactory; import util.utils; @@ -82,15 +80,11 @@ public class AccessibleMenu extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XMultiServiceFactory msf = Param.getMSF(); - try { - SOfficeFactory SOF = SOfficeFactory.getFactory(msf); - xTextDoc = SOF.createTextDoc(null); - } catch (com.sun.star.uno.Exception e) { - throw new StatusException("Can't create document", e); - } + SOfficeFactory SOF = SOfficeFactory.getFactory(msf); + xTextDoc = SOF.createTextDoc(null); util.utils.pause(500); diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleMenuItem.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleMenuItem.java index 6b1da6f840cf..ef64304715d6 100644 --- a/qadevOOo/tests/java/mod/_toolkit/AccessibleMenuItem.java +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleMenuItem.java @@ -35,7 +35,6 @@ import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.AccessibilityTools; import util.SOfficeFactory; import util.utils; @@ -81,16 +80,8 @@ public class AccessibleMenuItem extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { - XInterface oObj = null; - - try { - oObj = (XInterface) msf.createInstance("com.sun.star.awt.Toolkit"); - } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't get toolkit"); - e.printStackTrace(log); - throw new StatusException("Couldn't get toolkit", e); - } + PrintWriter log) throws Exception { + XInterface oObj = (XInterface) msf.createInstance("com.sun.star.awt.Toolkit"); XExtendedToolkit tk = UnoRuntime.queryInterface( XExtendedToolkit.class, oObj); diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessiblePopupMenu.java b/qadevOOo/tests/java/mod/_toolkit/AccessiblePopupMenu.java index 81da3dd50253..b6a7f71d98c7 100644 --- a/qadevOOo/tests/java/mod/_toolkit/AccessiblePopupMenu.java +++ b/qadevOOo/tests/java/mod/_toolkit/AccessiblePopupMenu.java @@ -33,19 +33,15 @@ import com.sun.star.uno.XInterface; import java.awt.Robot; import java.awt.event.InputEvent; - import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.AccessibilityTools; import util.DesktopTools; import util.SOfficeFactory; - public class AccessiblePopupMenu extends TestCase { private static XTextDocument xTextDoc; private static Point point; @@ -56,8 +52,7 @@ public class AccessiblePopupMenu extends TestCase { @Override protected void initialize(TestParameters Param, PrintWriter log) { UnoRuntime.queryInterface(XDesktop.class, - DesktopTools.createDesktop( - Param.getMSF())); + DesktopTools.createDesktop(Param.getMSF())); } /** @@ -87,20 +82,20 @@ public class AccessiblePopupMenu extends TestCase { } /** - * Creates a text document. - * Then obtains an accessible object with - * the role <code>AccessibleRole.PUSHBUTTON</code> and with the name - * <code>"Bold"</code>. - * Object relations created : + * Creates a text document. Then obtains an accessible object with the role + * <code>AccessibleRole.PUSHBUTTON</code> and with the name + * <code>"Bold"</code>. Object relations created : * <ul> - * <li> <code>'EventProducer'</code> for - * {@link ifc.accessibility._XAccessibleEventBroadcaster}</li> - * <li> <code>'XAccessibleText.Text'</code> for - * {@link ifc.accessibility._XAccessibleText}: the name of button</li> + * <li> <code>'EventProducer'</code> for + * {@link ifc.accessibility._XAccessibleEventBroadcaster}</li> + * <li> <code>'XAccessibleText.Text'</code> for + * {@link ifc.accessibility._XAccessibleText}: the name of button</li> * </ul> * - * @param tParam test parameters - * @param log writer to log information while testing + * @param tParam + * test parameters + * @param log + * writer to log information while testing * * @see com.sun.star.awt.Toolkit * @see com.sun.star.accessibility.AccessibleRole @@ -111,7 +106,7 @@ public class AccessiblePopupMenu extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters tParam, - PrintWriter log) { + PrintWriter log) throws Exception{ log.println("creating a test environment"); if (xTextDoc != null) { @@ -119,38 +114,30 @@ public class AccessiblePopupMenu extends TestCase { } // get a soffice factory object - SOfficeFactory SOF = SOfficeFactory.getFactory( - tParam.getMSF()); + SOfficeFactory SOF = SOfficeFactory.getFactory(tParam.getMSF()); XInterface toolkit = null; - try { - log.println("creating a text document"); - xTextDoc = SOF.createTextDoc(null); - toolkit = (XInterface) tParam.getMSF().createInstance( - "com.sun.star.awt.Toolkit"); - } catch (com.sun.star.uno.Exception e) { - // Some exception occurs.FAILED - e.printStackTrace(log); - throw new StatusException("Couldn't create document", e); - } + log.println("creating a text document"); + xTextDoc = SOF.createTextDoc(null); + toolkit = (XInterface) tParam.getMSF().createInstance( + "com.sun.star.awt.Toolkit"); util.utils.shortWait(); - XModel aModel = UnoRuntime.queryInterface(XModel.class, - xTextDoc); + XModel aModel = UnoRuntime.queryInterface(XModel.class, xTextDoc); XInterface oObj = null; - XWindow xWindow = AccessibilityTools.getCurrentWindow( - aModel); + XWindow xWindow = AccessibilityTools.getCurrentWindow(aModel); XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); - oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.PANEL); + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, + AccessibleRole.PANEL); XAccessibleComponent window = UnoRuntime.queryInterface( - XAccessibleComponent.class, oObj); + XAccessibleComponent.class, oObj); point = window.getLocationOnScreen(); Rectangle rect = window.getBounds(); @@ -168,43 +155,45 @@ public class AccessiblePopupMenu extends TestCase { util.utils.shortWait(); - XExtendedToolkit tk = UnoRuntime.queryInterface( - XExtendedToolkit.class, toolkit); + XExtendedToolkit tk = UnoRuntime.queryInterface(XExtendedToolkit.class, + toolkit); try { xWindow = UnoRuntime.queryInterface(XWindow.class, - tk.getTopWindow(0)); + tk.getTopWindow(0)); xRoot = AccessibilityTools.getAccessibleObject(xWindow); - AccessibilityTools.printAccessibleTree(log, xRoot, tParam.getBool(util.PropertyName.DEBUG_IS_ACTIVE)); + AccessibilityTools.printAccessibleTree(log, xRoot, + tParam.getBool(util.PropertyName.DEBUG_IS_ACTIVE)); } catch (com.sun.star.lang.IndexOutOfBoundsException e) { log.println("Couldn't get Window"); } - oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.POPUP_MENU); + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, + AccessibleRole.POPUP_MENU); log.println("ImplementationName: " + util.utils.getImplName(oObj)); TestEnvironment tEnv = new TestEnvironment(oObj); tEnv.addObjRelation("XAccessibleSelection.multiSelection", - Boolean.FALSE); + Boolean.FALSE); final XAccessibleSelection sel = UnoRuntime.queryInterface( - XAccessibleSelection.class, - oObj); - - tEnv.addObjRelation("EventProducer", - new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { - public void fireEvent() { - try { - sel.selectAccessibleChild(2); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - System.out.println("Couldn't fire event"); - } - } - }); + XAccessibleSelection.class, oObj); + + tEnv.addObjRelation( + "EventProducer", + new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { + public void fireEvent() { + try { + sel.selectAccessibleChild(2); + } catch (com.sun.star.lang.IndexOutOfBoundsException e) { + System.out.println("Couldn't fire event"); + } + } + }); return tEnv; } diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleRadioButton.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleRadioButton.java index c00e6d340610..f74d3eb1c3e1 100644 --- a/qadevOOo/tests/java/mod/_toolkit/AccessibleRadioButton.java +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleRadioButton.java @@ -40,11 +40,9 @@ import com.sun.star.util.XURLTransformer; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.AccessibilityTools; import util.DesktopTools; import util.SOfficeFactory; @@ -152,21 +150,15 @@ public class AccessibleRadioButton extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters tParam, - PrintWriter log) { + PrintWriter log) throws Exception { log.println("creating a test environment"); // get a soffice factory object SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); - try { - log.println("creating a text document"); - xTextDoc = SOF.createTextDoc(null); - } catch (com.sun.star.uno.Exception e) { - // Some exception occurs.FAILED - e.printStackTrace(log); - throw new StatusException("Couldn't create document", e); - } + log.println("creating a text document"); + xTextDoc = SOF.createTextDoc(null); util.utils.pause(2000); @@ -181,15 +173,10 @@ public class AccessibleRadioButton extends TestCase { XURLTransformer urlTransf = null; - try { - XInterface transf = (XInterface) tParam.getMSF().createInstance( - "com.sun.star.util.URLTransformer"); - urlTransf = UnoRuntime.queryInterface( - XURLTransformer.class, transf); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create URLTransformer", e); - } + XInterface transf = (XInterface) tParam.getMSF().createInstance( + "com.sun.star.util.URLTransformer"); + urlTransf = UnoRuntime.queryInterface( + XURLTransformer.class, transf); XDispatch getting = null; log.println("opening HyperlinkDialog"); @@ -205,16 +192,8 @@ public class AccessibleRadioButton extends TestCase { util.utils.pause(2000); - XInterface oObj = null; - - try { - oObj = (XInterface) tParam.getMSF().createInstance( - "com.sun.star.awt.Toolkit"); - } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't get toolkit"); - e.printStackTrace(log); - throw new StatusException("Couldn't get toolkit", e); - } + XInterface oObj = (XInterface) tParam.getMSF().createInstance( + "com.sun.star.awt.Toolkit"); XExtendedToolkit tk = UnoRuntime.queryInterface( XExtendedToolkit.class, oObj); diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleScrollBar.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleScrollBar.java index 8e1f168044ab..e1ec484ab068 100644 --- a/qadevOOo/tests/java/mod/_toolkit/AccessibleScrollBar.java +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleScrollBar.java @@ -29,11 +29,9 @@ import com.sun.star.uno.XInterface; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.AccessibilityTools; import util.DesktopTools; import util.SOfficeFactory; @@ -118,7 +116,7 @@ public class AccessibleScrollBar extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters tParam, - PrintWriter log) { + PrintWriter log) throws Exception { log.println("creating a test environment"); if (xDoc != null) { @@ -129,14 +127,8 @@ public class AccessibleScrollBar extends TestCase { SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); - try { - log.println("creating a text document"); - xDoc = SOF.createDrawDoc(null); - } catch (com.sun.star.uno.Exception e) { - // Some exception occurs.FAILED - e.printStackTrace(log); - throw new StatusException("Couldn't create document", e); - } + log.println("creating a text document"); + xDoc = SOF.createDrawDoc(null); XModel aModel = UnoRuntime.queryInterface(XModel.class, xDoc); diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleStatusBar.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleStatusBar.java index 085254e72885..db248108dca0 100644 --- a/qadevOOo/tests/java/mod/_toolkit/AccessibleStatusBar.java +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleStatusBar.java @@ -30,11 +30,9 @@ import com.sun.star.uno.XInterface; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.AccessibilityTools; import util.SOfficeFactory; @@ -108,7 +106,7 @@ public class AccessibleStatusBar extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters tParam, - PrintWriter log) { + PrintWriter log) throws Exception { log.println("creating a test environment"); if (xTextDoc != null) { @@ -121,16 +119,10 @@ public class AccessibleStatusBar extends TestCase { XInterface toolkit = null; - try { - log.println("creating a text document"); - xTextDoc = SOF.createTextDoc(null); - toolkit = (XInterface) tParam.getMSF().createInstance( - "com.sun.star.awt.Toolkit"); - } catch (com.sun.star.uno.Exception e) { - // Some exception occurs.FAILED - e.printStackTrace(log); - throw new StatusException("Couldn't create document", e); - } + log.println("creating a text document"); + xTextDoc = SOF.createTextDoc(null); + toolkit = (XInterface) tParam.getMSF().createInstance( + "com.sun.star.awt.Toolkit"); XInterface oObj = null; diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleStatusBarItem.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleStatusBarItem.java index a6f29e18e0d7..09265fa7c9e2 100644 --- a/qadevOOo/tests/java/mod/_toolkit/AccessibleStatusBarItem.java +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleStatusBarItem.java @@ -29,11 +29,9 @@ import com.sun.star.uno.XInterface; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.AccessibilityTools; import util.DesktopTools; import util.SOfficeFactory; @@ -118,7 +116,7 @@ public class AccessibleStatusBarItem extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters tParam, - PrintWriter log) { + PrintWriter log) throws Exception { log.println("creating a test environment"); if (xTextDoc != null) { @@ -129,14 +127,8 @@ public class AccessibleStatusBarItem extends TestCase { SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); - try { - log.println("creating a text document"); - xTextDoc = SOF.createTextDoc(null); - } catch (com.sun.star.uno.Exception e) { - // Some exception occurs.FAILED - e.printStackTrace(log); - throw new StatusException("Couldn't create document", e); - } + log.println("creating a text document"); + xTextDoc = SOF.createTextDoc(null); XModel aModel = UnoRuntime.queryInterface(XModel.class, xTextDoc); diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleTabControl.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleTabControl.java index 053bbebeb3fc..ca68609f2561 100644 --- a/qadevOOo/tests/java/mod/_toolkit/AccessibleTabControl.java +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleTabControl.java @@ -38,11 +38,9 @@ import com.sun.star.util.XURLTransformer; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.AccessibilityTools; import util.DesktopTools; import util.SOfficeFactory; @@ -140,7 +138,7 @@ public class AccessibleTabControl extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters tParam, - PrintWriter log) { + PrintWriter log) throws Exception { log.println("creating a test environment"); if (xTextDoc != null) { @@ -151,14 +149,8 @@ public class AccessibleTabControl extends TestCase { SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); - try { - log.println("creating a text document"); - xTextDoc = SOF.createTextDoc(null); - } catch (com.sun.star.uno.Exception e) { - // Some exception occurs.FAILED - e.printStackTrace(log); - throw new StatusException("Couldn't create document", e); - } + log.println("creating a text document"); + xTextDoc = SOF.createTextDoc(null); util.utils.pause(500); @@ -173,15 +165,10 @@ public class AccessibleTabControl extends TestCase { XURLTransformer urlTransf = null; - try { - XInterface transf = (XInterface) tParam.getMSF().createInstance( - "com.sun.star.util.URLTransformer"); - urlTransf = UnoRuntime.queryInterface( - XURLTransformer.class, transf); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create URLTransformer", e); - } + XInterface transf = (XInterface) tParam.getMSF().createInstance( + "com.sun.star.util.URLTransformer"); + urlTransf = UnoRuntime.queryInterface( + XURLTransformer.class, transf); XDispatch getting = null; log.println("opening InsertField dialog"); @@ -197,16 +184,8 @@ public class AccessibleTabControl extends TestCase { util.utils.pause(500); - XInterface oObj = null; - - try { - oObj = (XInterface) tParam.getMSF().createInstance( - "com.sun.star.awt.Toolkit"); - } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't get toolkit"); - e.printStackTrace(log); - throw new StatusException("Couldn't get toolkit", e); - } + XInterface oObj = (XInterface) tParam.getMSF().createInstance( + "com.sun.star.awt.Toolkit"); XExtendedToolkit tk = UnoRuntime.queryInterface( XExtendedToolkit.class, oObj); diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleTabPage.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleTabPage.java index abdc09b9dd2a..c7ebc5e0ffb5 100644 --- a/qadevOOo/tests/java/mod/_toolkit/AccessibleTabPage.java +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleTabPage.java @@ -36,14 +36,11 @@ import com.sun.star.uno.XInterface; import com.sun.star.util.URL; import com.sun.star.util.XURLTransformer; - import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.AccessibilityTools; import util.DesktopTools; import util.SOfficeFactory; @@ -133,7 +130,7 @@ public class AccessibleTabPage extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters tParam, - PrintWriter log) { + PrintWriter log) throws Exception { log.println("creating a test environment"); try { @@ -158,14 +155,8 @@ public class AccessibleTabPage extends TestCase { SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); - try { - log.println("creating a text document"); - xTextDoc = SOF.createTextDoc(null); - } catch (com.sun.star.uno.Exception e) { - // Some exception occurs.FAILED - e.printStackTrace(log); - throw new StatusException("Couldn't create document", e); - } + log.println("creating a text document"); + xTextDoc = SOF.createTextDoc(null); util.utils.pause(1000); @@ -180,15 +171,10 @@ public class AccessibleTabPage extends TestCase { XURLTransformer urlTransf = null; - try { - XInterface transf = (XInterface) tParam.getMSF().createInstance( - "com.sun.star.util.URLTransformer"); - urlTransf = UnoRuntime.queryInterface( - XURLTransformer.class, transf); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create URLTransformer", e); - } + XInterface transf = (XInterface) tParam.getMSF().createInstance( + "com.sun.star.util.URLTransformer"); + urlTransf = UnoRuntime.queryInterface( + XURLTransformer.class, transf); XDispatch getting = null; log.println("opening InsertField dialog"); @@ -206,14 +192,8 @@ public class AccessibleTabPage extends TestCase { XInterface oObj = null; - try { - oObj = (XInterface) tParam.getMSF().createInstance( - "com.sun.star.awt.Toolkit"); - } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't get toolkit"); - e.printStackTrace(log); - throw new StatusException("Couldn't get toolkit", e); - } + oObj = (XInterface) tParam.getMSF().createInstance( + "com.sun.star.awt.Toolkit"); XExtendedToolkit tk = UnoRuntime.queryInterface( XExtendedToolkit.class, oObj); diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleToolBoxItem.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleToolBoxItem.java index cc24b53efd15..c0c35d3ae8e0 100644 --- a/qadevOOo/tests/java/mod/_toolkit/AccessibleToolBoxItem.java +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleToolBoxItem.java @@ -29,11 +29,9 @@ import com.sun.star.uno.XInterface; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.AccessibilityTools; import util.DesktopTools; import util.SOfficeFactory; @@ -126,7 +124,7 @@ public class AccessibleToolBoxItem extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters tParam, - PrintWriter log) { + PrintWriter log) throws Exception { log.println("creating a test environment"); if (xTextDoc != null) { @@ -137,14 +135,8 @@ public class AccessibleToolBoxItem extends TestCase { SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); - try { - log.println("creating a text document"); - xTextDoc = SOF.createTextDoc(null); - } catch (com.sun.star.uno.Exception e) { - // Some exception occurs.FAILED - e.printStackTrace(log); - throw new StatusException("Couldn't create document", e); - } + log.println("creating a text document"); + xTextDoc = SOF.createTextDoc(null); XModel aModel = UnoRuntime.queryInterface(XModel.class, xTextDoc); diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleWindow.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleWindow.java index ab863a7327fa..fd59b064bd43 100644 --- a/qadevOOo/tests/java/mod/_toolkit/AccessibleWindow.java +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleWindow.java @@ -31,11 +31,9 @@ import com.sun.star.uno.XInterface; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.AccessibilityTools; import util.DesktopTools; import util.SOfficeFactory; @@ -128,7 +126,7 @@ public class AccessibleWindow extends TestCase { */ @Override protected TestEnvironment createTestEnvironment(TestParameters tParam, - PrintWriter log) { + PrintWriter log) throws Exception { log.println("creating a test environment"); if (xTextDoc != null) { @@ -141,16 +139,10 @@ public class AccessibleWindow extends TestCase { XInterface toolkit = null; - try { - log.println("creating a text document"); - xTextDoc = SOF.createTextDoc(null); - toolkit = (XInterface) tParam.getMSF().createInstance( - "com.sun.star.awt.Toolkit"); - } catch (com.sun.star.uno.Exception e) { - // Some exception occurs.FAILED - e.printStackTrace(log); - throw new StatusException("Couldn't create document", e); - } + log.println("creating a text document"); + xTextDoc = SOF.createTextDoc(null); + toolkit = (XInterface) tParam.getMSF().createInstance( + "com.sun.star.awt.Toolkit"); XModel aModel = UnoRuntime.queryInterface(XModel.class, xTextDoc); diff --git a/qadevOOo/tests/java/mod/_toolkit/MutableTreeNode.java b/qadevOOo/tests/java/mod/_toolkit/MutableTreeNode.java index 7b469901f8f7..f7cfe4dd94c5 100644 --- a/qadevOOo/tests/java/mod/_toolkit/MutableTreeNode.java +++ b/qadevOOo/tests/java/mod/_toolkit/MutableTreeNode.java @@ -25,11 +25,10 @@ import com.sun.star.ucb.CommandAbortedException; import com.sun.star.ucb.XSimpleFileAccess; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XInterface; + import ifc.awt.tree._XMutableTreeNode.XMutableTreeNodeCreator; import java.io.PrintWriter; -import lib.Status; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; @@ -63,16 +62,11 @@ public class MutableTreeNode extends TestCase { @Override protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XMutableTreeNode xNode; - try { - mXTreeDataModel = UnoRuntime.queryInterface(XMutableTreeDataModel.class, - mxMSF.createInstance("com.sun.star.awt.tree.MutableTreeDataModel")); - } catch (com.sun.star.uno.Exception ex) { - throw new StatusException(ex, Status.failed("ERROR: could not create instance of" + - " 'com.sun.star.awt.tree.MutableTreeDataModel'")); - } + mXTreeDataModel = UnoRuntime.queryInterface(XMutableTreeDataModel.class, + mxMSF.createInstance("com.sun.star.awt.tree.MutableTreeDataModel")); xNode = mXTreeDataModel.createNode("UnoTreeControl", false); diff --git a/qadevOOo/tests/java/mod/_toolkit/TabControllerModel.java b/qadevOOo/tests/java/mod/_toolkit/TabControllerModel.java index b7e9e1d56d67..5f6554eb90e7 100644 --- a/qadevOOo/tests/java/mod/_toolkit/TabControllerModel.java +++ b/qadevOOo/tests/java/mod/_toolkit/TabControllerModel.java @@ -27,7 +27,6 @@ import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.FormTools; import util.WriterTools; import util.utils; @@ -56,7 +55,7 @@ public class TabControllerModel extends TestCase { @Override public TestEnvironment createTestEnvironment(TestParameters param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; log.println("inserting some ControlShapes"); @@ -68,14 +67,8 @@ public class TabControllerModel extends TestCase { 3500, 7500, 5000, "TextField"); - try { - oObj = (XInterface) param.getMSF().createInstance( - "com.sun.star.awt.TabControllerModel"); - } catch (Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create " + - "TabControllerModel", e); - } + oObj = (XInterface) param.getMSF().createInstance( + "com.sun.star.awt.TabControllerModel"); log.println("creating a new environment for TabControllerModel"); diff --git a/qadevOOo/tests/java/mod/_toolkit/Toolkit.java b/qadevOOo/tests/java/mod/_toolkit/Toolkit.java index 7687d0a53898..3d2ca327fa1a 100644 --- a/qadevOOo/tests/java/mod/_toolkit/Toolkit.java +++ b/qadevOOo/tests/java/mod/_toolkit/Toolkit.java @@ -75,7 +75,7 @@ public class Toolkit extends TestCase { @Override public TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) - throws StatusException { + throws Exception { XInterface oObj = null; XWindowPeer the_win = null; XWindow win = null; @@ -98,17 +98,11 @@ public class Toolkit extends TestCase { xTextDoc.getCurrentController()); //now get the toolkit - try { - win = cntrlr.getFrame().getContainerWindow(); + win = cntrlr.getFrame().getContainerWindow(); - the_win = the_access.getControl(the_Model).getPeer(); - oObj = (XInterface) Param.getMSF().createInstance( - "com.sun.star.awt.Toolkit"); - } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't get toolkit"); - e.printStackTrace(log); - throw new StatusException("Couldn't get toolkit", e); - } + the_win = the_access.getControl(the_Model).getPeer(); + oObj = (XInterface) Param.getMSF().createInstance( + "com.sun.star.awt.Toolkit"); XModel xModel = UnoRuntime.queryInterface(XModel.class, xTextDoc); diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlButton.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlButton.java index 4f65ea9f11e8..f5aebd1b62fa 100644 --- a/qadevOOo/tests/java/mod/_toolkit/UnoControlButton.java +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlButton.java @@ -37,7 +37,6 @@ import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.FormTools; import util.SOfficeFactory; import util.WriterTools; @@ -75,7 +74,7 @@ public class UnoControlButton extends TestCase { @Override public TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; XWindowPeer the_win = null; XToolkit the_kit = null; @@ -100,17 +99,11 @@ public class UnoControlButton extends TestCase { xTextDoc.getCurrentController()); //get the ButtonControl for the needed Object relations - try { - oObj = the_access.getControl(the_Model); - the_win = the_access.getControl(the_Model).getPeer(); - the_kit = the_win.getToolkit(); - aDevice = the_kit.createScreenCompatibleDevice(200, 200); - aGraphic = aDevice.createGraphics(); - } catch (Exception e) { - log.println("Couldn't get ButtonControl"); - e.printStackTrace(log); - throw new StatusException("Couldn't get ButtonControl", e); - } + oObj = the_access.getControl(the_Model); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); log.println("creating a new environment for UnoControlButton object"); @@ -129,14 +122,9 @@ public class UnoControlButton extends TestCase { System.out.println("ImplementationName: " + utils.getImplName(oObj)); - try { - XController aController = xTD2.getCurrentController(); - XFrame aFrame = aController.getFrame(); - anotherWindow = aFrame.getComponentWindow(); - } catch (Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create XWindow", e); - } + XController aController = xTD2.getCurrentController(); + XFrame aFrame = aController.getFrame(); + anotherWindow = aFrame.getComponentWindow(); // Object Relation for XWindow diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlButtonModel.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlButtonModel.java index 8ada3adf21ad..03ad504862ac 100644 --- a/qadevOOo/tests/java/mod/_toolkit/UnoControlButtonModel.java +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlButtonModel.java @@ -22,11 +22,9 @@ import com.sun.star.uno.XInterface; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.WriterTools; import util.utils; @@ -56,16 +54,9 @@ public class UnoControlButtonModel extends TestCase { @Override protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { - XInterface oObj = null; - - try { - oObj = (XInterface) Param.getMSF().createInstance( - "com.sun.star.awt.UnoControlButtonModel"); - } catch (Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create object", e); - } + PrintWriter log) throws Exception { + XInterface oObj = (XInterface) Param.getMSF().createInstance( + "com.sun.star.awt.UnoControlButtonModel"); log.println( "creating a new environment for UnoControlButtonModel object"); diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlCheckBox.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlCheckBox.java index 324c8d808a6b..082686089a10 100644 --- a/qadevOOo/tests/java/mod/_toolkit/UnoControlCheckBox.java +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlCheckBox.java @@ -38,7 +38,6 @@ import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.FormTools; import util.SOfficeFactory; import util.WriterTools; @@ -76,7 +75,7 @@ public class UnoControlCheckBox extends TestCase { @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; XWindowPeer the_win = null; XToolkit the_kit = null; @@ -101,17 +100,11 @@ public class UnoControlCheckBox extends TestCase { xTextDoc.getCurrentController()); //get the CheckBoxControl for the needed Object relations - try { - oObj = the_access.getControl(the_Model); - the_win = the_access.getControl(the_Model).getPeer(); - the_kit = the_win.getToolkit(); - aDevice = the_kit.createScreenCompatibleDevice(200, 200); - aGraphic = aDevice.createGraphics(); - } catch (Exception e) { - log.println("Couldn't get CheckBoxControl"); - e.printStackTrace(log); - throw new StatusException("Couldn't get CheckBoxControl", e); - } + oObj = the_access.getControl(the_Model); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); log.println("creating a new environment for UnoControlCheckBox object"); @@ -138,14 +131,9 @@ public class UnoControlCheckBox extends TestCase { System.out.println("ImplementationName: " + utils.getImplName(oObj)); - try { - XController aController = xTD2.getCurrentController(); - XFrame aFrame = aController.getFrame(); - anotherWindow = aFrame.getComponentWindow(); - } catch (Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create XWindow", e); - } + XController aController = xTD2.getCurrentController(); + XFrame aFrame = aController.getFrame(); + anotherWindow = aFrame.getComponentWindow(); // Object Relation for XWindow diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlCheckBoxModel.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlCheckBoxModel.java index 192d1470fdd5..9d3989a257e6 100644 --- a/qadevOOo/tests/java/mod/_toolkit/UnoControlCheckBoxModel.java +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlCheckBoxModel.java @@ -22,11 +22,9 @@ import com.sun.star.uno.XInterface; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.WriterTools; import util.utils; @@ -56,16 +54,9 @@ public class UnoControlCheckBoxModel extends TestCase { @Override protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { - XInterface oObj = null; - - try { - oObj = (XInterface) Param.getMSF().createInstance( - "com.sun.star.awt.UnoControlCheckBoxModel"); - } catch (Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create object", e); - } + PrintWriter log) throws Exception { + XInterface oObj = (XInterface) Param.getMSF().createInstance( + "com.sun.star.awt.UnoControlCheckBoxModel"); log.println( "creating a new environment for UnoControlCheckBoxModel object"); diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlComboBox.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlComboBox.java index 34ad3f819784..cdf41c1a650c 100644 --- a/qadevOOo/tests/java/mod/_toolkit/UnoControlComboBox.java +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlComboBox.java @@ -69,7 +69,7 @@ util.DesktopTools.closeDoc(xTextDoc); @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; XWindowPeer the_win = null; XToolkit the_kit = null; @@ -102,18 +102,12 @@ util.DesktopTools.closeDoc(xTextDoc); xTextDoc.getCurrentController()); //get the ComboBoxControl for the needed Object relations - try { - oObj = the_access.getControl(the_Model); - aControl = the_access.getControl(the_Model2); - the_win = the_access.getControl(the_Model).getPeer(); - the_kit = the_win.getToolkit(); - aDevice = the_kit.createScreenCompatibleDevice(200, 200); - aGraphic = aDevice.createGraphics(); - } catch (Exception e) { - log.println("Couldn't get ComboBoxControl"); - e.printStackTrace(log); - throw new StatusException("Couldn't get ComboBoxControl", e); - } + oObj = the_access.getControl(the_Model); + aControl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); log.println("creating a new environment for UnoControlComboBox object"); diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlContainer.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlContainer.java index 8701e6a80110..128d9998ee73 100644 --- a/qadevOOo/tests/java/mod/_toolkit/UnoControlContainer.java +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlContainer.java @@ -41,7 +41,6 @@ import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.FormTools; import util.WriterTools; import util.utils; @@ -79,7 +78,7 @@ public class UnoControlContainer extends TestCase { @Override public TestEnvironment createTestEnvironment(TestParameters param, - PrintWriter log) { + PrintWriter log) throws Exception { // create Object Relations ------------------------------------------- XInterface oObj = null; XControlShape shape = null; @@ -105,12 +104,7 @@ public class UnoControlContainer extends TestCase { access = UnoRuntime.queryInterface( XControlAccess.class, xTextDoc.getCurrentController()); - try { - xCtrl = access.getControl(model); - } catch (Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create XControl", e); - } + xCtrl = access.getControl(model); // create second XControl @@ -121,12 +115,7 @@ public class UnoControlContainer extends TestCase { access = UnoRuntime.queryInterface( XControlAccess.class, xTextDoc.getCurrentController()); - try { - xCtrl1 = access.getControl(model); - } catch (Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create XControl", e); - } + xCtrl1 = access.getControl(model); // create third XControl @@ -137,12 +126,7 @@ public class UnoControlContainer extends TestCase { access = UnoRuntime.queryInterface( XControlAccess.class, xTextDoc.getCurrentController()); - try { - xCtrl2 = access.getControl(model); - } catch (Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create XControl", e); - } + xCtrl2 = access.getControl(model); // create XToolkit, XWindowPeer, XDevice //Insert a ControlShape and get the ControlModel @@ -162,44 +146,28 @@ public class UnoControlContainer extends TestCase { xTD2.getCurrentController()); //get the ButtonControl for the needed Object relations - try { - the_win = the_access.getControl(the_Model).getPeer(); - the_kit = the_win.getToolkit(); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); - XDevice aDevice = the_kit.createScreenCompatibleDevice(200, 200); - aGraphic = aDevice.createGraphics(); - } catch (Exception e) { - log.println("Couldn't get ButtonControl"); - e.printStackTrace(log); - throw new StatusException("Couldn't get ButtonControl", e); - } + XDevice aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); - try { - XController aController = xTD2.getCurrentController(); - XFrame aFrame = aController.getFrame(); - anotherWindow = aFrame.getComponentWindow(); - } catch (Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create XWindow", e); - } + XController aController = xTD2.getCurrentController(); + XFrame aFrame = aController.getFrame(); + anotherWindow = aFrame.getComponentWindow(); // finished create Object Relations ----------------------------------- // create the UnoControlContainer - try { - oObj = (XInterface) param.getMSF().createInstance( - "com.sun.star.awt.UnoControlContainer"); + oObj = (XInterface) param.getMSF().createInstance( + "com.sun.star.awt.UnoControlContainer"); - XControl xCtrl = UnoRuntime.queryInterface( - XControl.class, oObj); - xCtrl.setModel(the_Model); + XControl xCtrl = UnoRuntime.queryInterface( + XControl.class, oObj); + xCtrl.setModel(the_Model); - ctrlCont = UnoRuntime.queryInterface( - XControlContainer.class, oObj); - ctrlCont.addControl("jupp", access.getControl(aShape.getControl())); - } catch (Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create UnoControlContainer", e); - } + ctrlCont = UnoRuntime.queryInterface( + XControlContainer.class, oObj); + ctrlCont.addControl("jupp", access.getControl(aShape.getControl())); log.println( "creating a new environment for UnoControlContainer object"); diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlContainerModel.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlContainerModel.java index ddd15e450731..cd384556001d 100644 --- a/qadevOOo/tests/java/mod/_toolkit/UnoControlContainerModel.java +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlContainerModel.java @@ -21,28 +21,18 @@ import com.sun.star.uno.XInterface; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.utils; public class UnoControlContainerModel extends TestCase { @Override public TestEnvironment createTestEnvironment(TestParameters param, - PrintWriter log) { - XInterface oObj = null; - - try { - oObj = (XInterface) param.getMSF().createInstance( - "com.sun.star.awt.UnoControlContainerModel"); - } catch (Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create " + - "UnoControlContainerModel", e); - } + PrintWriter log) throws Exception { + XInterface oObj = (XInterface) param.getMSF().createInstance( + "com.sun.star.awt.UnoControlContainerModel"); log.println( "creating a new environment for UnoControlContainer object"); diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlCurrencyField.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlCurrencyField.java index 7c511d75019e..715d357b8260 100644 --- a/qadevOOo/tests/java/mod/_toolkit/UnoControlCurrencyField.java +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlCurrencyField.java @@ -37,7 +37,6 @@ import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.FormTools; import util.SOfficeFactory; import util.WriterTools; @@ -71,7 +70,7 @@ public class UnoControlCurrencyField extends TestCase { @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; XWindowPeer the_win = null; XToolkit the_kit = null; @@ -104,18 +103,12 @@ public class UnoControlCurrencyField extends TestCase { xTextDoc.getCurrentController()); //get the CurrencyFieldControl for the needed Object relations - try { - oObj = the_access.getControl(the_Model); - aControl = the_access.getControl(the_Model2); - the_win = the_access.getControl(the_Model).getPeer(); - the_kit = the_win.getToolkit(); - aDevice = the_kit.createScreenCompatibleDevice(200, 200); - aGraphic = aDevice.createGraphics(); - } catch (Exception e) { - log.println("Couldn't get CurrencyFieldControl"); - e.printStackTrace(log); - throw new StatusException("Couldn't get CurrencyFieldControl", e); - } + oObj = the_access.getControl(the_Model); + aControl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); log.println( "creating a new environment for UnoControlCurrencyField object"); diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlDateField.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlDateField.java index 3e6fb99b21a4..cadd6e81d4e2 100644 --- a/qadevOOo/tests/java/mod/_toolkit/UnoControlDateField.java +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlDateField.java @@ -38,7 +38,6 @@ import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.FormTools; import util.SOfficeFactory; import util.WriterTools; @@ -76,7 +75,7 @@ public class UnoControlDateField extends TestCase { @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; XWindowPeer the_win = null; XToolkit the_kit = null; @@ -101,17 +100,11 @@ public class UnoControlDateField extends TestCase { xTextDoc.getCurrentController()); //get the DateFieldControl for the needed Object relations - try { - oObj = the_access.getControl(the_Model); - the_win = the_access.getControl(the_Model).getPeer(); - the_kit = the_win.getToolkit(); - aDevice = the_kit.createScreenCompatibleDevice(200, 200); - aGraphic = aDevice.createGraphics(); - } catch (Exception e) { - log.println("Couldn't get DateFieldControl"); - e.printStackTrace(log); - throw new StatusException("Couldn't get DateFieldControl", e); - } + oObj = the_access.getControl(the_Model); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); log.println( "creating a new environment for UnoControlDateField object"); @@ -131,14 +124,9 @@ public class UnoControlDateField extends TestCase { System.out.println("ImplementationName: " + utils.getImplName(oObj)); - try { - XController aController = xTD2.getCurrentController(); - XFrame aFrame = aController.getFrame(); - anotherWindow = aFrame.getComponentWindow(); - } catch (Exception e) { - e.printStackTrace(log); - throw new StatusException("Couldn't create XWindow", e); - } + XController aController = xTD2.getCurrentController(); + XFrame aFrame = aController.getFrame(); + anotherWindow = aFrame.getComponentWindow(); // Object Relation for XWindow diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlDialogModel.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlDialogModel.java index 267e8a69f617..8c59f92b7628 100644 --- a/qadevOOo/tests/java/mod/_toolkit/UnoControlDialogModel.java +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlDialogModel.java @@ -27,11 +27,9 @@ import com.sun.star.uno.XInterface; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.utils; @@ -72,7 +70,7 @@ public class UnoControlDialogModel extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; XInterface dialogModel = null; String _buttonName = "MyButton"; @@ -80,71 +78,67 @@ public class UnoControlDialogModel extends TestCase { String _labelPrefix = "MyLabelPrefix"; XMultiServiceFactory xMultiServiceFactory = null; - try { - dialogModel = (XInterface) Param.getMSF().createInstance( - "com.sun.star.awt.UnoControlDialogModel"); - - // create the dialog model and set the properties - XPropertySet xPSetDialog = UnoRuntime.queryInterface( - XPropertySet.class, dialogModel); - xPSetDialog.setPropertyValue("PositionX", Integer.valueOf(100)); - xPSetDialog.setPropertyValue("PositionY", Integer.valueOf(100)); - xPSetDialog.setPropertyValue("Width", Integer.valueOf(150)); - xPSetDialog.setPropertyValue("Height", Integer.valueOf(100)); - xPSetDialog.setPropertyValue("Title", "Runtime Dialog Demo"); - - // get the service manager from the dialog model - xMultiServiceFactory = UnoRuntime.queryInterface( - XMultiServiceFactory.class, + dialogModel = (XInterface) Param.getMSF().createInstance( + "com.sun.star.awt.UnoControlDialogModel"); + + // create the dialog model and set the properties + XPropertySet xPSetDialog = UnoRuntime.queryInterface( + XPropertySet.class, dialogModel); + xPSetDialog.setPropertyValue("PositionX", Integer.valueOf(100)); + xPSetDialog.setPropertyValue("PositionY", Integer.valueOf(100)); + xPSetDialog.setPropertyValue("Width", Integer.valueOf(150)); + xPSetDialog.setPropertyValue("Height", Integer.valueOf(100)); + xPSetDialog.setPropertyValue("Title", "Runtime Dialog Demo"); + + // get the service manager from the dialog model + xMultiServiceFactory = UnoRuntime.queryInterface( + XMultiServiceFactory.class, + dialogModel); + + // create the button model and set the properties + Object buttonModel = xMultiServiceFactory.createInstance( + "com.sun.star.awt.UnoControlButtonModel"); + XPropertySet xPSetButton = UnoRuntime.queryInterface( + XPropertySet.class, buttonModel); + xPSetButton.setPropertyValue("PositionX", Integer.valueOf(50)); + xPSetButton.setPropertyValue("PositionY", Integer.valueOf(30)); + xPSetButton.setPropertyValue("Width", Integer.valueOf(50)); + xPSetButton.setPropertyValue("Height", Integer.valueOf(14)); + xPSetButton.setPropertyValue("Name", _buttonName); + xPSetButton.setPropertyValue("TabIndex", Short.valueOf((short) 0)); + xPSetButton.setPropertyValue("Label", "Click Me"); + + // create the label model and set the properties + Object labelModel = xMultiServiceFactory.createInstance( + "com.sun.star.awt.UnoControlFixedTextModel"); + XPropertySet xPSetLabel = UnoRuntime.queryInterface( + XPropertySet.class, labelModel); + xPSetLabel.setPropertyValue("PositionX", Integer.valueOf(40)); + xPSetLabel.setPropertyValue("PositionY", Integer.valueOf(60)); + xPSetLabel.setPropertyValue("Width", Integer.valueOf(100)); + xPSetLabel.setPropertyValue("Height", Integer.valueOf(14)); + xPSetLabel.setPropertyValue("Name", _labelName); + xPSetLabel.setPropertyValue("TabIndex", Short.valueOf((short) 1)); + xPSetLabel.setPropertyValue("Label", _labelPrefix); + + // insert the control models into the dialog model + XNameContainer xNameCont = UnoRuntime.queryInterface( + XNameContainer.class, dialogModel); - - // create the button model and set the properties - Object buttonModel = xMultiServiceFactory.createInstance( - "com.sun.star.awt.UnoControlButtonModel"); - XPropertySet xPSetButton = UnoRuntime.queryInterface( - XPropertySet.class, buttonModel); - xPSetButton.setPropertyValue("PositionX", Integer.valueOf(50)); - xPSetButton.setPropertyValue("PositionY", Integer.valueOf(30)); - xPSetButton.setPropertyValue("Width", Integer.valueOf(50)); - xPSetButton.setPropertyValue("Height", Integer.valueOf(14)); - xPSetButton.setPropertyValue("Name", _buttonName); - xPSetButton.setPropertyValue("TabIndex", Short.valueOf((short) 0)); - xPSetButton.setPropertyValue("Label", "Click Me"); - - // create the label model and set the properties - Object labelModel = xMultiServiceFactory.createInstance( - "com.sun.star.awt.UnoControlFixedTextModel"); - XPropertySet xPSetLabel = UnoRuntime.queryInterface( - XPropertySet.class, labelModel); - xPSetLabel.setPropertyValue("PositionX", Integer.valueOf(40)); - xPSetLabel.setPropertyValue("PositionY", Integer.valueOf(60)); - xPSetLabel.setPropertyValue("Width", Integer.valueOf(100)); - xPSetLabel.setPropertyValue("Height", Integer.valueOf(14)); - xPSetLabel.setPropertyValue("Name", _labelName); - xPSetLabel.setPropertyValue("TabIndex", Short.valueOf((short) 1)); - xPSetLabel.setPropertyValue("Label", _labelPrefix); - - // insert the control models into the dialog model - XNameContainer xNameCont = UnoRuntime.queryInterface( - XNameContainer.class, - dialogModel); - xNameCont.insertByName(_buttonName, buttonModel); - xNameCont.insertByName(_labelName, labelModel); - - // create the dialog control and set the model - XControl dialog = UnoRuntime.queryInterface( - XControl.class, - Param.getMSF().createInstance( - "com.sun.star.awt.UnoControlDialog")); - XControl xControl = UnoRuntime.queryInterface( - XControl.class, dialog); - XControlModel xControlModel = UnoRuntime.queryInterface( - XControlModel.class, - dialogModel); - xControl.setModel(xControlModel); - } catch (Exception e) { - throw new StatusException("Could no create test object", e); - } + xNameCont.insertByName(_buttonName, buttonModel); + xNameCont.insertByName(_labelName, labelModel); + + // create the dialog control and set the model + XControl dialog = UnoRuntime.queryInterface( + XControl.class, + Param.getMSF().createInstance( + "com.sun.star.awt.UnoControlDialog")); + XControl xControl = UnoRuntime.queryInterface( + XControl.class, dialog); + XControlModel xControlModel = UnoRuntime.queryInterface( + XControlModel.class, + dialogModel); + xControl.setModel(xControlModel); oObj = dialogModel; diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlEdit.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlEdit.java index 07eb8fe7bedd..dda2dc7d93c6 100644 --- a/qadevOOo/tests/java/mod/_toolkit/UnoControlEdit.java +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlEdit.java @@ -37,7 +37,6 @@ import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.FormTools; import util.SOfficeFactory; import util.WriterTools; @@ -71,7 +70,7 @@ public class UnoControlEdit extends TestCase { @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; XWindowPeer the_win = null; XToolkit the_kit = null; @@ -104,18 +103,12 @@ public class UnoControlEdit extends TestCase { xTextDoc.getCurrentController()); //get the EditControl for the needed Object relations - try { - oObj = the_access.getControl(the_Model); - aControl = the_access.getControl(the_Model2); - the_win = the_access.getControl(the_Model).getPeer(); - the_kit = the_win.getToolkit(); - aDevice = the_kit.createScreenCompatibleDevice(200, 200); - aGraphic = aDevice.createGraphics(); - } catch (Exception e) { - log.println("Couldn't get EditControl"); - e.printStackTrace(log); - throw new StatusException("Couldn't get EditControl", e); - } + oObj = the_access.getControl(the_Model); + aControl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); log.println("creating a new environment for UnoControlEdit object"); diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlFileControl.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlFileControl.java index 5b3cb2ef005b..78d68ebf4683 100644 --- a/qadevOOo/tests/java/mod/_toolkit/UnoControlFileControl.java +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlFileControl.java @@ -37,7 +37,6 @@ import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.FormTools; import util.SOfficeFactory; import util.WriterTools; @@ -71,7 +70,7 @@ public class UnoControlFileControl extends TestCase { @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; XWindowPeer the_win = null; XToolkit the_kit = null; @@ -104,18 +103,12 @@ public class UnoControlFileControl extends TestCase { xTextDoc.getCurrentController()); //get the FileControlControl for the needed Object relations - try { - oObj = the_access.getControl(the_Model); - aControl = the_access.getControl(the_Model2); - the_win = the_access.getControl(the_Model).getPeer(); - the_kit = the_win.getToolkit(); - aDevice = the_kit.createScreenCompatibleDevice(200, 200); - aGraphic = aDevice.createGraphics(); - } catch (Exception e) { - log.println("Couldn't get FileControlControl"); - e.printStackTrace(log); - throw new StatusException("Couldn't get FileControlControl", e); - } + oObj = the_access.getControl(the_Model); + aControl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); log.println( "creating a new environment for UnoControlFileControl object"); diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlFixedText.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlFixedText.java index 0649bcb20a46..513cefcdaedf 100644 --- a/qadevOOo/tests/java/mod/_toolkit/UnoControlFixedText.java +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlFixedText.java @@ -36,7 +36,6 @@ import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.FormTools; import util.SOfficeFactory; import util.WriterTools; @@ -70,7 +69,7 @@ public class UnoControlFixedText extends TestCase { @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; XWindowPeer the_win = null; XToolkit the_kit = null; @@ -103,18 +102,12 @@ public class UnoControlFixedText extends TestCase { xTextDoc.getCurrentController()); //get the FixedTextControl for the needed Object relations - try { - oObj = the_access.getControl(the_Model); - aControl = the_access.getControl(the_Model2); - the_win = the_access.getControl(the_Model).getPeer(); - the_kit = the_win.getToolkit(); - aDevice = the_kit.createScreenCompatibleDevice(200, 200); - aGraphic = aDevice.createGraphics(); - } catch (Exception e) { - log.println("Couldn't get FixedTextControl"); - e.printStackTrace(log); - throw new StatusException("Couldn't get FixedTextControl", e); - } + oObj = the_access.getControl(the_Model); + aControl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); log.println( "creating a new environment for UnoControlFixedText object"); diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlFormattedField.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlFormattedField.java index 94c5cfb1c6ed..56e618c85a04 100644 --- a/qadevOOo/tests/java/mod/_toolkit/UnoControlFormattedField.java +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlFormattedField.java @@ -38,7 +38,6 @@ import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.FormTools; import util.SOfficeFactory; import util.WriterTools; @@ -72,7 +71,7 @@ public class UnoControlFormattedField extends TestCase { @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; XWindowPeer the_win = null; XToolkit the_kit = null; @@ -108,20 +107,14 @@ public class UnoControlFormattedField extends TestCase { xTextDoc.getCurrentController()); //get the EditControl for the needed Object relations - try { - oObj = the_access.getControl(the_Model); - aControl = the_access.getControl(the_Model2); - the_win = the_access.getControl(the_Model).getPeer(); - the_kit = the_win.getToolkit(); - aDevice = the_kit.createScreenCompatibleDevice(200, 200); - aGraphic = aDevice.createGraphics(); - - xPS.setPropertyValue("Spin", Boolean.TRUE); - } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't get EditControl"); - e.printStackTrace(log); - throw new StatusException("Couldn't get EditControl", e); - } + oObj = the_access.getControl(the_Model); + aControl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); + + xPS.setPropertyValue("Spin", Boolean.TRUE); log.println("creating a new environment for UnoControlEdit object"); diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlGroupBox.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlGroupBox.java index d26b0a62a377..d7f42e67506f 100644 --- a/qadevOOo/tests/java/mod/_toolkit/UnoControlGroupBox.java +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlGroupBox.java @@ -36,7 +36,6 @@ import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.FormTools; import util.SOfficeFactory; import util.WriterTools; @@ -70,7 +69,7 @@ public class UnoControlGroupBox extends TestCase { @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; XWindowPeer the_win = null; XToolkit the_kit = null; @@ -103,18 +102,12 @@ public class UnoControlGroupBox extends TestCase { xTextDoc.getCurrentController()); //get the GroupBoxControl for the needed Object relations - try { - oObj = the_access.getControl(the_Model); - aControl = the_access.getControl(the_Model2); - the_win = the_access.getControl(the_Model).getPeer(); - the_kit = the_win.getToolkit(); - aDevice = the_kit.createScreenCompatibleDevice(200, 200); - aGraphic = aDevice.createGraphics(); - } catch (Exception e) { - log.println("Couldn't get GroupBoxControl"); - e.printStackTrace(log); - throw new StatusException("Couldn't get GroupBoxControl", e); - } + oObj = the_access.getControl(the_Model); + aControl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); log.println("creating a new environment for UnoControlGroupBox object"); diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlImageControl.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlImageControl.java index 1bf267dec6d5..fb0310834cec 100644 --- a/qadevOOo/tests/java/mod/_toolkit/UnoControlImageControl.java +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlImageControl.java @@ -37,7 +37,6 @@ import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.FormTools; import util.SOfficeFactory; import util.WriterTools; @@ -71,7 +70,7 @@ public class UnoControlImageControl extends TestCase { @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; XWindowPeer the_win = null; XToolkit the_kit = null; @@ -107,22 +106,16 @@ public class UnoControlImageControl extends TestCase { xTextDoc.getCurrentController()); //get the ImageControlControl for the needed Object relations - try { - oObj = the_access.getControl(the_Model); - aControl = the_access.getControl(the_Model2); - the_win = the_access.getControl(the_Model).getPeer(); - the_kit = the_win.getToolkit(); - aDevice = the_kit.createScreenCompatibleDevice(200, 200); - aGraphic = aDevice.createGraphics(); + oObj = the_access.getControl(the_Model); + aControl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); - String imgUrl = util.utils.getFullTestURL("poliball.gif"); + String imgUrl = util.utils.getFullTestURL("poliball.gif"); - xPS.setPropertyValue("ImageURL", imgUrl); - } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't get ImageControlControl"); - e.printStackTrace(log); - throw new StatusException("Couldn't get ImageControlControl", e); - } + xPS.setPropertyValue("ImageURL", imgUrl); log.println( "creating a new environment for UnoControlImageControl object"); diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlListBox.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlListBox.java index 089b5ab2e170..5c55eeb47836 100644 --- a/qadevOOo/tests/java/mod/_toolkit/UnoControlListBox.java +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlListBox.java @@ -37,7 +37,6 @@ import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.FormTools; import util.SOfficeFactory; import util.WriterTools; @@ -71,7 +70,7 @@ public class UnoControlListBox extends TestCase { @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; XWindowPeer the_win = null; XToolkit the_kit = null; @@ -104,18 +103,12 @@ public class UnoControlListBox extends TestCase { xTextDoc.getCurrentController()); //get the ListBoxControl for the needed Object relations - try { - oObj = the_access.getControl(the_Model); - aControl = the_access.getControl(the_Model2); - the_win = the_access.getControl(the_Model).getPeer(); - the_kit = the_win.getToolkit(); - aDevice = the_kit.createScreenCompatibleDevice(200, 200); - aGraphic = aDevice.createGraphics(); - } catch (Exception e) { - log.println("Couldn't get ListBoxControl"); - e.printStackTrace(log); - throw new StatusException("Couldn't get ListBoxControl", e); - } + oObj = the_access.getControl(the_Model); + aControl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); log.println("creating a new environment for UnoControlListBox object"); diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlNumericField.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlNumericField.java index 0fea72e8d8aa..a380485c162b 100644 --- a/qadevOOo/tests/java/mod/_toolkit/UnoControlNumericField.java +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlNumericField.java @@ -78,7 +78,7 @@ public class UnoControlNumericField extends TestCase { @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; XWindowPeer the_win = null; XToolkit the_kit = null; @@ -111,18 +111,12 @@ public class UnoControlNumericField extends TestCase { xTextDoc.getCurrentController()); //get the NumericFieldControl for the needed Object relations - try { - oObj = the_access.getControl(the_Model); - aControl = the_access.getControl(the_Model2); - the_win = the_access.getControl(the_Model).getPeer(); - the_kit = the_win.getToolkit(); - aDevice = the_kit.createScreenCompatibleDevice(200, 200); - aGraphic = aDevice.createGraphics(); - } catch (Exception e) { - log.println("Couldn't get NumericFieldControl"); - e.printStackTrace(log); - throw new StatusException("Couldn't get NumericFieldControl", e); - } + oObj = the_access.getControl(the_Model); + aControl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); log.println( "creating a new environment for UnoControlNumericField object"); diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlPatternField.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlPatternField.java index a9c2283944ed..0d69ca52afc4 100644 --- a/qadevOOo/tests/java/mod/_toolkit/UnoControlPatternField.java +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlPatternField.java @@ -37,7 +37,6 @@ import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.FormTools; import util.SOfficeFactory; import util.WriterTools; @@ -71,7 +70,7 @@ public class UnoControlPatternField extends TestCase { @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; XWindowPeer the_win = null; XToolkit the_kit = null; @@ -104,18 +103,12 @@ public class UnoControlPatternField extends TestCase { xTextDoc.getCurrentController()); //get the PatternFieldControl for the needed Object relations - try { - oObj = the_access.getControl(the_Model); - aControl = the_access.getControl(the_Model2); - the_win = the_access.getControl(the_Model).getPeer(); - the_kit = the_win.getToolkit(); - aDevice = the_kit.createScreenCompatibleDevice(200, 200); - aGraphic = aDevice.createGraphics(); - } catch (Exception e) { - log.println("Couldn't get PatternFieldControl"); - e.printStackTrace(log); - throw new StatusException("Couldn't get PatternFieldControl", e); - } + oObj = the_access.getControl(the_Model); + aControl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); log.println( "creating a new environment for UnoControlPatternField object"); diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlRadioButton.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlRadioButton.java index 0d232ab48fbf..32ab02c96df0 100644 --- a/qadevOOo/tests/java/mod/_toolkit/UnoControlRadioButton.java +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlRadioButton.java @@ -36,7 +36,6 @@ import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.FormTools; import util.SOfficeFactory; import util.WriterTools; @@ -70,7 +69,7 @@ public class UnoControlRadioButton extends TestCase { @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; XWindowPeer the_win = null; XToolkit the_kit = null; @@ -103,18 +102,12 @@ public class UnoControlRadioButton extends TestCase { xTextDoc.getCurrentController()); //get the RadioButtonControl for the needed Object relations - try { - oObj = the_access.getControl(the_Model); - aControl = the_access.getControl(the_Model2); - the_win = the_access.getControl(the_Model).getPeer(); - the_kit = the_win.getToolkit(); - aDevice = the_kit.createScreenCompatibleDevice(200, 200); - aGraphic = aDevice.createGraphics(); - } catch (Exception e) { - log.println("Couldn't get RadioButtonControl"); - e.printStackTrace(log); - throw new StatusException("Couldn't get RadioButtonControl", e); - } + oObj = the_access.getControl(the_Model); + aControl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); log.println( "creating a new environment for UnoControlRadioButton object"); diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlTimeField.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlTimeField.java index d7ebd7b7c2b0..bbeefb3a2a5a 100644 --- a/qadevOOo/tests/java/mod/_toolkit/UnoControlTimeField.java +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlTimeField.java @@ -37,7 +37,6 @@ import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.FormTools; import util.SOfficeFactory; import util.WriterTools; @@ -71,7 +70,7 @@ public class UnoControlTimeField extends TestCase { @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; XWindowPeer the_win = null; XToolkit the_kit = null; @@ -104,18 +103,12 @@ public class UnoControlTimeField extends TestCase { xTextDoc.getCurrentController()); //get the TimeFieldControl for the needed Object relations - try { - oObj = the_access.getControl(the_Model); - aControl = the_access.getControl(the_Model2); - the_win = the_access.getControl(the_Model).getPeer(); - the_kit = the_win.getToolkit(); - aDevice = the_kit.createScreenCompatibleDevice(200, 200); - aGraphic = aDevice.createGraphics(); - } catch (Exception e) { - log.println("Couldn't get TimeFieldControl"); - e.printStackTrace(log); - throw new StatusException("Couldn't get TimeFieldControl", e); - } + oObj = the_access.getControl(the_Model); + aControl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); log.println( "creating a new environment for UnoControlTimeField object"); diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoScrollBarControl.java b/qadevOOo/tests/java/mod/_toolkit/UnoScrollBarControl.java index 8f722cb243e9..f5f4def73b22 100644 --- a/qadevOOo/tests/java/mod/_toolkit/UnoScrollBarControl.java +++ b/qadevOOo/tests/java/mod/_toolkit/UnoScrollBarControl.java @@ -32,16 +32,15 @@ import com.sun.star.text.XTextDocument; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XInterface; import com.sun.star.view.XControlAccess; + import java.awt.Dimension; import java.awt.Toolkit; - import java.io.PrintWriter; import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.FormTools; import util.SOfficeFactory; import util.WriterTools; @@ -93,7 +92,7 @@ public class UnoScrollBarControl extends TestCase { @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; XWindowPeer the_win = null; XToolkit the_kit = null; @@ -126,18 +125,12 @@ public class UnoScrollBarControl extends TestCase { xTextDoc.getCurrentController()); //get the ScrollBarControl for the needed Object relations - try { - oObj = the_access.getControl(the_Model); - aControl = the_access.getControl(the_Model2); - the_win = the_access.getControl(the_Model).getPeer(); - the_kit = the_win.getToolkit(); - aDevice = the_kit.createScreenCompatibleDevice(200, 200); - aGraphic = aDevice.createGraphics(); - } catch (Exception e) { - log.println("Couldn't get ScrollBarControl"); - e.printStackTrace(log); - throw new StatusException("Couldn't get ScrollBarControl", e); - } + oObj = the_access.getControl(the_Model); + aControl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); log.println( "creating a new environment for UnoControlScrollBar object"); diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoSpinButtonControl.java b/qadevOOo/tests/java/mod/_toolkit/UnoSpinButtonControl.java index 843e05c9abca..4f04480c38e0 100644 --- a/qadevOOo/tests/java/mod/_toolkit/UnoSpinButtonControl.java +++ b/qadevOOo/tests/java/mod/_toolkit/UnoSpinButtonControl.java @@ -32,11 +32,9 @@ import com.sun.star.view.XControlAccess; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; - import util.FormTools; import util.WriterTools; import util.utils; @@ -61,7 +59,7 @@ public class UnoSpinButtonControl extends TestCase { @Override protected TestEnvironment createTestEnvironment(TestParameters Param, - PrintWriter log) { + PrintWriter log) throws Exception { XInterface oObj = null; XWindowPeer the_win = null; XToolkit the_kit = null; @@ -94,18 +92,12 @@ public class UnoSpinButtonControl extends TestCase { xTextDoc.getCurrentController()); //get the SpinButtonControl for the needed Object relations - try { - oObj = the_access.getControl(the_Model); - aControl = the_access.getControl(the_Model2); - the_win = the_access.getControl(the_Model).getPeer(); - the_kit = the_win.getToolkit(); - aDevice = the_kit.createScreenCompatibleDevice(200, 200); - aGraphic = aDevice.createGraphics(); - } catch (Exception e) { - log.println("Couldn't get SpinButtonControl"); - e.printStackTrace(log); - throw new StatusException("Couldn't get SpinButtonControl", e); - } + oObj = the_access.getControl(the_Model); + aControl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); log.println( "creating a new environment for UnoControlSpinButton object"); diff --git a/qadevOOo/tests/java/mod/_ucb/UcbContentProviderProxyFactory.java b/qadevOOo/tests/java/mod/_ucb/UcbContentProviderProxyFactory.java index 465199414397..b24ca70e77d1 100644 --- a/qadevOOo/tests/java/mod/_ucb/UcbContentProviderProxyFactory.java +++ b/qadevOOo/tests/java/mod/_ucb/UcbContentProviderProxyFactory.java @@ -20,7 +20,6 @@ package mod._ucb; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -41,19 +40,14 @@ public class UcbContentProviderProxyFactory extends TestCase { */ @Override public TestEnvironment createTestEnvironment - (TestParameters Param,PrintWriter log ) { + (TestParameters Param,PrintWriter log ) throws Exception { XInterface oObj = null; Object oInterface = null; - try { - XMultiServiceFactory xMSF = Param.getMSF(); - oInterface = xMSF.createInstance - ( "com.sun.star.comp.ucb.UcbContentProviderProxyFactory" ); - } catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } + XMultiServiceFactory xMSF = Param.getMSF(); + oInterface = xMSF.createInstance + ( "com.sun.star.comp.ucb.UcbContentProviderProxyFactory" ); oObj = (XInterface) oInterface; diff --git a/qadevOOo/tests/java/mod/_ucb/UcbPropertiesManager.java b/qadevOOo/tests/java/mod/_ucb/UcbPropertiesManager.java index 4f518b1c3cca..5f04e3864728 100644 --- a/qadevOOo/tests/java/mod/_ucb/UcbPropertiesManager.java +++ b/qadevOOo/tests/java/mod/_ucb/UcbPropertiesManager.java @@ -20,7 +20,6 @@ package mod._ucb; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -32,19 +31,14 @@ public class UcbPropertiesManager extends TestCase { @Override public TestEnvironment createTestEnvironment - ( TestParameters Param, PrintWriter log ) { + ( TestParameters Param, PrintWriter log ) throws Exception { XInterface oObj = null; Object oInterface = null; - try { - XMultiServiceFactory xMSF = Param.getMSF(); - oInterface = xMSF.createInstance - ( "com.sun.star.comp.ucb.UcbPropertiesManager" ); - } catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } + XMultiServiceFactory xMSF = Param.getMSF(); + oInterface = xMSF.createInstance + ( "com.sun.star.comp.ucb.UcbPropertiesManager" ); oObj = (XInterface) oInterface; diff --git a/qadevOOo/tests/java/mod/_ucb/UcbStore.java b/qadevOOo/tests/java/mod/_ucb/UcbStore.java index 35a8ac9e5643..784210db5c3a 100644 --- a/qadevOOo/tests/java/mod/_ucb/UcbStore.java +++ b/qadevOOo/tests/java/mod/_ucb/UcbStore.java @@ -20,7 +20,6 @@ package mod._ucb; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -42,18 +41,12 @@ public class UcbStore extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { + throws Exception { XInterface oObj = null; Object oInterface = null; - try { - XMultiServiceFactory xMSF = Param.getMSF(); - oInterface = xMSF.createInstance( "com.sun.star.comp.ucb.UcbStore" ); - } - catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } + XMultiServiceFactory xMSF = Param.getMSF(); + oInterface = xMSF.createInstance( "com.sun.star.comp.ucb.UcbStore" ); oObj = (XInterface) oInterface; diff --git a/qadevOOo/tests/java/mod/_ucb/UniversalContentBroker.java b/qadevOOo/tests/java/mod/_ucb/UniversalContentBroker.java index 5272ec325754..17f4155691ad 100644 --- a/qadevOOo/tests/java/mod/_ucb/UniversalContentBroker.java +++ b/qadevOOo/tests/java/mod/_ucb/UniversalContentBroker.java @@ -20,7 +20,6 @@ package mod._ucb; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -43,19 +42,14 @@ public class UniversalContentBroker extends TestCase { */ @Override public TestEnvironment createTestEnvironment - ( TestParameters Param, PrintWriter log ) { + ( TestParameters Param, PrintWriter log ) throws Exception { XInterface oObj = null; Object oInterface = null; - try { - XMultiServiceFactory xMSF = Param.getMSF(); - oInterface = xMSF.createInstance - ( "com.sun.star.comp.ucb.UniversalContentBroker" ); - } catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } + XMultiServiceFactory xMSF = Param.getMSF(); + oInterface = xMSF.createInstance + ( "com.sun.star.comp.ucb.UniversalContentBroker" ); oObj = (XInterface) oInterface; diff --git a/qadevOOo/tests/java/mod/_ucpchelp/CHelpContentProvider.java b/qadevOOo/tests/java/mod/_ucpchelp/CHelpContentProvider.java index 522cbca1c23e..0cc406fd2ac6 100644 --- a/qadevOOo/tests/java/mod/_ucpchelp/CHelpContentProvider.java +++ b/qadevOOo/tests/java/mod/_ucpchelp/CHelpContentProvider.java @@ -20,7 +20,6 @@ package mod._ucpchelp; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -34,22 +33,17 @@ public class CHelpContentProvider extends TestCase { @Override public TestEnvironment createTestEnvironment - ( TestParameters Param,PrintWriter log ) { + ( TestParameters Param,PrintWriter log ) throws Exception { XInterface oObj = null; Object oInterface = null; Object aUCB = null; - try { - XMultiServiceFactory xMSF = Param.getMSF(); - oInterface = xMSF.createInstance - ( "com.sun.star.ucb.HelpContentProvider" ); - aUCB = xMSF.createInstance - ( "com.sun.star.comp.ucb.UniversalContentBroker" ); - } catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } + XMultiServiceFactory xMSF = Param.getMSF(); + oInterface = xMSF.createInstance + ( "com.sun.star.ucb.HelpContentProvider" ); + aUCB = xMSF.createInstance + ( "com.sun.star.comp.ucb.UniversalContentBroker" ); oObj = (XInterface) oInterface; diff --git a/qadevOOo/tests/java/mod/_ucpdav/WebDAVContentProvider.java b/qadevOOo/tests/java/mod/_ucpdav/WebDAVContentProvider.java index 0cdba640549f..cc0736f322b1 100644 --- a/qadevOOo/tests/java/mod/_ucpdav/WebDAVContentProvider.java +++ b/qadevOOo/tests/java/mod/_ucpdav/WebDAVContentProvider.java @@ -20,14 +20,12 @@ package mod._ucpdav; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.ucb.XContentIdentifierFactory; -import com.sun.star.uno.Exception; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XInterface; @@ -42,35 +40,23 @@ public class WebDAVContentProvider extends TestCase { */ @Override public TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log) { + (TestParameters tParam, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF(); XInterface xInt; log.println("creating WebDAVContentProvider instance"); - try { - xInt = (XInterface)xMSF.createInstance( - "com.sun.star.ucb.WebDAVContentProvider"); - } catch (Exception e) { - log.println("Unexpected exception " + e.getMessage()); - e.printStackTrace(log); - throw new StatusException("Unexpected exception", e); - } + xInt = (XInterface)xMSF.createInstance( + "com.sun.star.ucb.WebDAVContentProvider"); TestEnvironment tEnv = new TestEnvironment(xInt); log.println("creating XContentIdentifierFactory"); XContentIdentifierFactory xCIF; - try { - xCIF = UnoRuntime.queryInterface( - XContentIdentifierFactory.class, - xMSF.createInstance( - "com.sun.star.comp.ucb.UniversalContentBroker")); - } catch (Exception e) { - log.println("Unexpected exception " + e.getMessage()); - e.printStackTrace(log); - throw new StatusException("Unexpected exception", e); - } + xCIF = UnoRuntime.queryInterface( + XContentIdentifierFactory.class, + xMSF.createInstance( + "com.sun.star.comp.ucb.UniversalContentBroker")); tEnv.addObjRelation("FACTORY", xCIF); diff --git a/qadevOOo/tests/java/mod/_ucpfile/FileProvider.java b/qadevOOo/tests/java/mod/_ucpfile/FileProvider.java index 0b1d7d192b66..f4fab5e9b06b 100644 --- a/qadevOOo/tests/java/mod/_ucpfile/FileProvider.java +++ b/qadevOOo/tests/java/mod/_ucpfile/FileProvider.java @@ -20,7 +20,6 @@ package mod._ucpfile; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -34,19 +33,14 @@ public class FileProvider extends TestCase { @Override public TestEnvironment createTestEnvironment - ( TestParameters Param,PrintWriter log ) { + ( TestParameters Param,PrintWriter log ) throws Exception { XInterface oObj = null; Object oInterface = null; - try { - XMultiServiceFactory xMSF = Param.getMSF(); - oInterface = xMSF.createInstance - ( "com.sun.star.comp.ucb.FileProvider" ); - } catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } + XMultiServiceFactory xMSF = Param.getMSF(); + oInterface = xMSF.createInstance + ( "com.sun.star.comp.ucb.FileProvider" ); oObj = (XInterface) oInterface; diff --git a/qadevOOo/tests/java/mod/_ucpftp/FTPContentProvider.java b/qadevOOo/tests/java/mod/_ucpftp/FTPContentProvider.java index d967505d2cbc..7bb047214d37 100644 --- a/qadevOOo/tests/java/mod/_ucpftp/FTPContentProvider.java +++ b/qadevOOo/tests/java/mod/_ucpftp/FTPContentProvider.java @@ -20,7 +20,6 @@ package mod._ucpftp; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -34,22 +33,17 @@ public class FTPContentProvider extends TestCase { @Override public TestEnvironment createTestEnvironment - ( TestParameters Param,PrintWriter log ) { + ( TestParameters Param,PrintWriter log ) throws Exception { XInterface oObj = null; Object oInterface = null; Object aUCB = null; - try { - XMultiServiceFactory xMSF = Param.getMSF(); - oInterface = xMSF.createInstance - ( "com.sun.star.ucb.FTPContentProvider" ); - aUCB = xMSF.createInstance - ( "com.sun.star.comp.ucb.UniversalContentBroker" ); - } catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } + XMultiServiceFactory xMSF = Param.getMSF(); + oInterface = xMSF.createInstance + ( "com.sun.star.ucb.FTPContentProvider" ); + aUCB = xMSF.createInstance + ( "com.sun.star.comp.ucb.UniversalContentBroker" ); oObj = (XInterface) oInterface; diff --git a/qadevOOo/tests/java/mod/_ucphier/HierarchyContentProvider.java b/qadevOOo/tests/java/mod/_ucphier/HierarchyContentProvider.java index dc2f70455b23..1d0cf0e8198f 100644 --- a/qadevOOo/tests/java/mod/_ucphier/HierarchyContentProvider.java +++ b/qadevOOo/tests/java/mod/_ucphier/HierarchyContentProvider.java @@ -20,7 +20,6 @@ package mod._ucphier; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -34,22 +33,17 @@ public class HierarchyContentProvider extends TestCase { @Override public TestEnvironment createTestEnvironment - (TestParameters Param, PrintWriter log ) { + (TestParameters Param, PrintWriter log ) throws Exception { XInterface oObj = null; Object oInterface = null; Object ucb = null; - try { - XMultiServiceFactory xMSF = Param.getMSF(); - oInterface = xMSF.createInstance - ( "com.sun.star.comp.ucb.HierarchyContentProvider" ); - ucb = xMSF.createInstance - ( "com.sun.star.comp.ucb.UniversalContentBroker" ); - } catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } + XMultiServiceFactory xMSF = Param.getMSF(); + oInterface = xMSF.createInstance + ( "com.sun.star.comp.ucb.HierarchyContentProvider" ); + ucb = xMSF.createInstance + ( "com.sun.star.comp.ucb.UniversalContentBroker" ); oObj = (XInterface) oInterface; diff --git a/qadevOOo/tests/java/mod/_ucppkg/PackageContentProvider.java b/qadevOOo/tests/java/mod/_ucppkg/PackageContentProvider.java index 0b4760155a50..72b7f3577dd1 100644 --- a/qadevOOo/tests/java/mod/_ucppkg/PackageContentProvider.java +++ b/qadevOOo/tests/java/mod/_ucppkg/PackageContentProvider.java @@ -20,7 +20,6 @@ package mod._ucppkg; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -34,22 +33,17 @@ public class PackageContentProvider extends TestCase { @Override public TestEnvironment createTestEnvironment - ( TestParameters Param,PrintWriter log ) { + ( TestParameters Param,PrintWriter log ) throws Exception { XInterface oObj = null; Object oInterface = null; Object ucb = null; - try { - XMultiServiceFactory xMSF = Param.getMSF(); - oInterface = xMSF.createInstance - ( "com.sun.star.comp.ucb.PackageContentProvider" ); - ucb = xMSF.createInstance - ( "com.sun.star.comp.ucb.UniversalContentBroker" ); - } catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } + XMultiServiceFactory xMSF = Param.getMSF(); + oInterface = xMSF.createInstance + ( "com.sun.star.comp.ucb.PackageContentProvider" ); + ucb = xMSF.createInstance + ( "com.sun.star.comp.ucb.UniversalContentBroker" ); oObj = (XInterface) oInterface; diff --git a/qadevOOo/tests/java/mod/_ucprmt/ContentProvider.java b/qadevOOo/tests/java/mod/_ucprmt/ContentProvider.java index bedf2d8a9329..22c7885227e8 100644 --- a/qadevOOo/tests/java/mod/_ucprmt/ContentProvider.java +++ b/qadevOOo/tests/java/mod/_ucprmt/ContentProvider.java @@ -20,8 +20,6 @@ package mod._ucprmt; import java.io.PrintWriter; -import lib.Status; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -74,27 +72,15 @@ public class ContentProvider extends TestCase { */ @Override public TestEnvironment createTestEnvironment - (TestParameters Param, PrintWriter log ) { + (TestParameters Param, PrintWriter log ) throws Exception { XInterface oObj = null; XMultiServiceFactory xMSF = Param.getMSF(); XContentIdentifierFactory cntIDFac = null ; - try { - oObj = (XInterface) xMSF.createInstance - ("com.sun.star.ucb.RemoteAccessContentProvider"); - cntIDFac = UnoRuntime.queryInterface - (XContentIdentifierFactory.class, oObj) ; - } - catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } - - if (oObj == null) { - log.println("!!! Object wasn't created !!!") ; - throw new StatusException(Status.failed - ("!!! Object wasn't created !!!")) ; - } + oObj = (XInterface) xMSF.createInstance + ("com.sun.star.ucb.RemoteAccessContentProvider"); + cntIDFac = UnoRuntime.queryInterface + (XContentIdentifierFactory.class, oObj) ; TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_ucprmt/ProviderAcceptor.java b/qadevOOo/tests/java/mod/_ucprmt/ProviderAcceptor.java index ac8116e82f85..733b8d1be52c 100644 --- a/qadevOOo/tests/java/mod/_ucprmt/ProviderAcceptor.java +++ b/qadevOOo/tests/java/mod/_ucprmt/ProviderAcceptor.java @@ -20,7 +20,6 @@ package mod._ucprmt; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -33,20 +32,11 @@ public class ProviderAcceptor extends TestCase { @Override public TestEnvironment createTestEnvironment - (TestParameters Param, PrintWriter log) { + (TestParameters Param, PrintWriter log) throws Exception { - XInterface oObj = null; - Object oInterface = null; - - try { - oInterface = Param.getMSF().createInstance - ("com.sun.star.ucb.RemoteContentProviderAcceptor"); - } catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } - - oObj = (XInterface) oInterface; + Object oInterface = Param.getMSF().createInstance + ("com.sun.star.ucb.RemoteContentProviderAcceptor"); + XInterface oObj = (XInterface) oInterface; TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_ucprmt/ProxyProvider.java b/qadevOOo/tests/java/mod/_ucprmt/ProxyProvider.java index f5ab9345aa95..2c075ca0dcbe 100644 --- a/qadevOOo/tests/java/mod/_ucprmt/ProxyProvider.java +++ b/qadevOOo/tests/java/mod/_ucprmt/ProxyProvider.java @@ -20,8 +20,6 @@ package mod._ucprmt; import java.io.PrintWriter; -import lib.Status; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -35,27 +33,13 @@ public class ProxyProvider extends TestCase { @Override public TestEnvironment createTestEnvironment - ( TestParameters Param, PrintWriter log ) { + ( TestParameters Param, PrintWriter log ) throws Exception { - XInterface oObj = null; XMultiServiceFactory xMSF = Param.getMSF(); - XContentIdentifierFactory cntIDFac = null ; - - try { - oObj = (XInterface) xMSF.createInstance - ("com.sun.star.ucb.RemoteProxyContentProvider"); - cntIDFac = UnoRuntime.queryInterface - (XContentIdentifierFactory.class, oObj) ; - } catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } - - if (oObj == null) { - log.println("!!! Object wasn't created !!!") ; - throw new StatusException(Status.failed - ("!!! Object wasn't created !!!")) ; - } + XInterface oObj = (XInterface) xMSF.createInstance + ("com.sun.star.ucb.RemoteProxyContentProvider"); + XContentIdentifierFactory cntIDFac = UnoRuntime.queryInterface + (XContentIdentifierFactory.class, oObj) ; TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_uui/UUIInteractionHandler.java b/qadevOOo/tests/java/mod/_uui/UUIInteractionHandler.java index 817074c86276..bcabde63d5b6 100644 --- a/qadevOOo/tests/java/mod/_uui/UUIInteractionHandler.java +++ b/qadevOOo/tests/java/mod/_uui/UUIInteractionHandler.java @@ -20,7 +20,6 @@ package mod._uui; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -49,21 +48,11 @@ public class UUIInteractionHandler extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { - XInterface oObj = null; - Object oInterface = null; - - try { - XMultiServiceFactory xMSF = Param.getMSF(); - oInterface = xMSF.createInstance - ( "com.sun.star.uui.InteractionHandler" ); - } - catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } - - oObj = (XInterface) oInterface; + throws Exception { + XMultiServiceFactory xMSF = Param.getMSF(); + Object oInterface = xMSF.createInstance + ( "com.sun.star.uui.InteractionHandler" ); + XInterface oObj = (XInterface) oInterface; TestEnvironment tEnv = new TestEnvironment( oObj ); diff --git a/qadevOOo/tests/java/mod/_uuresolver/UnoUrlResolver.java b/qadevOOo/tests/java/mod/_uuresolver/UnoUrlResolver.java index e95aa0cd69ad..594c6717897b 100644 --- a/qadevOOo/tests/java/mod/_uuresolver/UnoUrlResolver.java +++ b/qadevOOo/tests/java/mod/_uuresolver/UnoUrlResolver.java @@ -20,13 +20,11 @@ package mod._uuresolver; import java.io.PrintWriter; -import lib.StatusException; import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.uno.Exception; import com.sun.star.uno.XInterface; public class UnoUrlResolver extends TestCase { @@ -34,40 +32,34 @@ public class UnoUrlResolver extends TestCase { @Override protected TestEnvironment createTestEnvironment(TestParameters tParam, - PrintWriter log) { + PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF(); - try { - XInterface xInt = (XInterface)xMSF.createInstance( - "com.sun.star.bridge.UnoUrlResolver"); - TestEnvironment tEnv = new TestEnvironment(xInt); - Object oBFctr = xMSF.createInstance( - "com.sun.star.bridge.BridgeFactory"); - tEnv.addObjRelation("BRIDGEFACTORY", oBFctr); + XInterface xInt = (XInterface)xMSF.createInstance( + "com.sun.star.bridge.UnoUrlResolver"); + TestEnvironment tEnv = new TestEnvironment(xInt); + Object oBFctr = xMSF.createInstance( + "com.sun.star.bridge.BridgeFactory"); + tEnv.addObjRelation("BRIDGEFACTORY", oBFctr); - Object oAcctr = xMSF.createInstance( - "com.sun.star.connection.Acceptor") ; - tEnv.addObjRelation("ACCEPTOR", oAcctr); + Object oAcctr = xMSF.createInstance( + "com.sun.star.connection.Acceptor") ; + tEnv.addObjRelation("ACCEPTOR", oAcctr); - String os = System.getProperty("OS"); - System.out.println("OS: " + os); - int port = 20004; - if (os.equalsIgnoreCase("wntmsci")) - port = 20004; - if (os.equalsIgnoreCase("unxsols")) - port = 20004; - if (os.equalsIgnoreCase("unxsoli")) - port = 30004; - if (os.equalsIgnoreCase("unxlngi")) - port = 20006; + String os = System.getProperty("OS"); + System.out.println("OS: " + os); + int port = 20004; + if (os.equalsIgnoreCase("wntmsci")) + port = 20004; + if (os.equalsIgnoreCase("unxsols")) + port = 20004; + if (os.equalsIgnoreCase("unxsoli")) + port = 30004; + if (os.equalsIgnoreCase("unxlngi")) + port = 20006; - tEnv.addObjRelation("PORT", Integer.valueOf(port)); - - return tEnv; - } catch (Exception e) { - e.printStackTrace(log); - throw new StatusException("Unexpected exception", e); - } + tEnv.addObjRelation("PORT", Integer.valueOf(port)); + return tEnv; } } diff --git a/qadevOOo/tests/java/mod/_uuresolver/uno/UnoUrlResolver.java b/qadevOOo/tests/java/mod/_uuresolver/uno/UnoUrlResolver.java index 96cccdb7700d..ffb7c582043f 100644 --- a/qadevOOo/tests/java/mod/_uuresolver/uno/UnoUrlResolver.java +++ b/qadevOOo/tests/java/mod/_uuresolver/uno/UnoUrlResolver.java @@ -19,10 +19,10 @@ package mod._uuresolver.uno; import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.uno.Exception; import com.sun.star.uno.XInterface; + import java.io.PrintWriter; -import lib.StatusException; + import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; @@ -32,29 +32,23 @@ public class UnoUrlResolver extends TestCase { @Override protected TestEnvironment createTestEnvironment(TestParameters tParam, - PrintWriter log) { + PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF(); - try { - XInterface xInt = (XInterface)xMSF.createInstance( - "com.sun.star.bridge.UnoUrlResolver"); - TestEnvironment tEnv = new TestEnvironment(xInt); - Object oBFctr = xMSF.createInstance( - "com.sun.star.bridge.BridgeFactory"); - tEnv.addObjRelation("BRIDGEFACTORY", oBFctr); - - Object oAcctr = xMSF.createInstance( - "com.sun.star.connection.Acceptor") ; - tEnv.addObjRelation("ACCEPTOR", oAcctr); + XInterface xInt = (XInterface)xMSF.createInstance( + "com.sun.star.bridge.UnoUrlResolver"); + TestEnvironment tEnv = new TestEnvironment(xInt); + Object oBFctr = xMSF.createInstance( + "com.sun.star.bridge.BridgeFactory"); + tEnv.addObjRelation("BRIDGEFACTORY", oBFctr); - int port = util.utils.getNextFreePort(20004); - tEnv.addObjRelation("PORT", Integer.valueOf(port)); + Object oAcctr = xMSF.createInstance( + "com.sun.star.connection.Acceptor") ; + tEnv.addObjRelation("ACCEPTOR", oAcctr); - return tEnv; - } catch (Exception e) { - e.printStackTrace(log); - throw new StatusException("Unexpected exception", e); - } + int port = util.utils.getNextFreePort(20004); + tEnv.addObjRelation("PORT", Integer.valueOf(port)); + return tEnv; } } diff --git a/qadevOOo/tests/java/mod/_xmloff/Chart/XMLContentExporter.java b/qadevOOo/tests/java/mod/_xmloff/Chart/XMLContentExporter.java index 09b06c08395a..7913a2b1e8e7 100644 --- a/qadevOOo/tests/java/mod/_xmloff/Chart/XMLContentExporter.java +++ b/qadevOOo/tests/java/mod/_xmloff/Chart/XMLContentExporter.java @@ -116,7 +116,7 @@ public class XMLContentExporter extends TestCase { * </ul> */ @Override - protected synchronized TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + protected synchronized TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF() ; XInterface oObj = null; @@ -125,21 +125,16 @@ public class XMLContentExporter extends TestCase { FilterChecker filter = new FilterChecker(log); Any arg = new Any(new Type(XDocumentHandler.class),filter); - try { - oObj = (XInterface) xMSF.createInstanceWithArguments( - "com.sun.star.comp.Chart.XMLContentExporter", - new Object[] {arg}); - XExporter xEx = UnoRuntime.queryInterface(XExporter.class,oObj); - xEx.setSourceDocument(xChartDoc); - - Object oTitle = xChartDoc.getTitle() ; - XPropertySet xTitleProp = UnoRuntime.queryInterface - (XPropertySet.class, oTitle) ; - xTitleProp.setPropertyValue("String", exportStr) ; - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oObj = (XInterface) xMSF.createInstanceWithArguments( + "com.sun.star.comp.Chart.XMLContentExporter", + new Object[] {arg}); + XExporter xEx = UnoRuntime.queryInterface(XExporter.class,oObj); + xEx.setSourceDocument(xChartDoc); + + Object oTitle = xChartDoc.getTitle() ; + XPropertySet xTitleProp = UnoRuntime.queryInterface + (XPropertySet.class, oTitle) ; + xTitleProp.setPropertyValue("String", exportStr) ; filter.addTag(new XMLTools.Tag("office:document-content")) ; filter.addTagEnclosed(new XMLTools.Tag("office:body"), diff --git a/qadevOOo/tests/java/mod/_xmloff/Chart/XMLContentImporter.java b/qadevOOo/tests/java/mod/_xmloff/Chart/XMLContentImporter.java index 0a622cb85bf5..7df36555a65f 100644 --- a/qadevOOo/tests/java/mod/_xmloff/Chart/XMLContentImporter.java +++ b/qadevOOo/tests/java/mod/_xmloff/Chart/XMLContentImporter.java @@ -116,7 +116,7 @@ public class XMLContentImporter extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log ) { + (TestParameters tParam, PrintWriter log ) throws Exception { XInterface oObj = null; Object oInt = null ; @@ -129,18 +129,13 @@ public class XMLContentImporter extends TestCase { XMultiServiceFactory xMSF = tParam.getMSF() ; final XPropertySet xTitleProp ; - try { - oInt = xMSF.createInstance - ("com.sun.star.comp.Chart.XMLContentImporter") ; + oInt = xMSF.createInstance + ("com.sun.star.comp.Chart.XMLContentImporter") ; - Object oTitle = xChartDoc.getTitle() ; - xTitleProp = UnoRuntime.queryInterface - (XPropertySet.class, oTitle) ; - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + Object oTitle = xChartDoc.getTitle() ; + xTitleProp = UnoRuntime.queryInterface + (XPropertySet.class, oTitle) ; oObj = (XInterface) oInt ; diff --git a/qadevOOo/tests/java/mod/_xmloff/Chart/XMLExporter.java b/qadevOOo/tests/java/mod/_xmloff/Chart/XMLExporter.java index 3e80faee3b22..c0f6576d3624 100644 --- a/qadevOOo/tests/java/mod/_xmloff/Chart/XMLExporter.java +++ b/qadevOOo/tests/java/mod/_xmloff/Chart/XMLExporter.java @@ -117,7 +117,7 @@ public class XMLExporter extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log ) { + (TestParameters tParam, PrintWriter log ) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF() ; XInterface oObj = null; @@ -126,20 +126,15 @@ public class XMLExporter extends TestCase { FilterChecker filter = new FilterChecker(log); Any arg = new Any(new Type(XDocumentHandler.class),filter); - try { - oObj = (XInterface) xMSF.createInstanceWithArguments( - "com.sun.star.comp.Chart.XMLExporter", new Object[] {arg}); - XExporter xEx = UnoRuntime.queryInterface(XExporter.class,oObj); - xEx.setSourceDocument(xChartDoc); - - Object oTitle = xChartDoc.getTitle() ; - XPropertySet xTitleProp = UnoRuntime.queryInterface - (XPropertySet.class, oTitle) ; - xTitleProp.setPropertyValue("String", exportStr) ; - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oObj = (XInterface) xMSF.createInstanceWithArguments( + "com.sun.star.comp.Chart.XMLExporter", new Object[] {arg}); + XExporter xEx = UnoRuntime.queryInterface(XExporter.class,oObj); + xEx.setSourceDocument(xChartDoc); + + Object oTitle = xChartDoc.getTitle() ; + XPropertySet xTitleProp = UnoRuntime.queryInterface + (XPropertySet.class, oTitle) ; + xTitleProp.setPropertyValue("String", exportStr) ; filter.addTag(new XMLTools.Tag("office:document")) ; filter.addTagEnclosed(new XMLTools.Tag("office:meta"), diff --git a/qadevOOo/tests/java/mod/_xmloff/Chart/XMLImporter.java b/qadevOOo/tests/java/mod/_xmloff/Chart/XMLImporter.java index 4415780939ee..817f00b267bf 100644 --- a/qadevOOo/tests/java/mod/_xmloff/Chart/XMLImporter.java +++ b/qadevOOo/tests/java/mod/_xmloff/Chart/XMLImporter.java @@ -116,7 +116,7 @@ public class XMLImporter extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log) { + (TestParameters tParam, PrintWriter log) throws Exception { XInterface oObj = null; Object oInt = null ; @@ -129,16 +129,11 @@ public class XMLImporter extends TestCase { XMultiServiceFactory xMSF = tParam.getMSF() ; final XPropertySet xTitleProp ; - try { - oInt = xMSF.createInstance("com.sun.star.comp.Chart.XMLImporter") ; - - Object oTitle = xChartDoc.getTitle() ; - xTitleProp = UnoRuntime.queryInterface - (XPropertySet.class, oTitle) ; - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oInt = xMSF.createInstance("com.sun.star.comp.Chart.XMLImporter") ; + + Object oTitle = xChartDoc.getTitle() ; + xTitleProp = UnoRuntime.queryInterface + (XPropertySet.class, oTitle) ; oObj = (XInterface) oInt ; diff --git a/qadevOOo/tests/java/mod/_xmloff/Chart/XMLStylesExporter.java b/qadevOOo/tests/java/mod/_xmloff/Chart/XMLStylesExporter.java index 639d34760324..c3ed6bc18460 100644 --- a/qadevOOo/tests/java/mod/_xmloff/Chart/XMLStylesExporter.java +++ b/qadevOOo/tests/java/mod/_xmloff/Chart/XMLStylesExporter.java @@ -113,7 +113,7 @@ public class XMLStylesExporter extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log) { + (TestParameters tParam, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF() ; XInterface oObj = null; @@ -121,17 +121,11 @@ public class XMLStylesExporter extends TestCase { FilterChecker filter = new FilterChecker(log); Any arg = new Any(new Type(XDocumentHandler.class),filter); - try { - oObj = (XInterface) xMSF.createInstanceWithArguments( - "com.sun.star.comp.Chart.XMLStylesExporter", - new Object[] {arg}); - XExporter xEx = UnoRuntime.queryInterface(XExporter.class,oObj); - xEx.setSourceDocument(xChartDoc); - - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oObj = (XInterface) xMSF.createInstanceWithArguments( + "com.sun.star.comp.Chart.XMLStylesExporter", + new Object[] {arg}); + XExporter xEx = UnoRuntime.queryInterface(XExporter.class,oObj); + xEx.setSourceDocument(xChartDoc); filter.addTag(new XMLTools.Tag("office:document-styles")) ; diff --git a/qadevOOo/tests/java/mod/_xmloff/Chart/XMLStylesImporter.java b/qadevOOo/tests/java/mod/_xmloff/Chart/XMLStylesImporter.java index b480537c45be..e34c52ce9896 100644 --- a/qadevOOo/tests/java/mod/_xmloff/Chart/XMLStylesImporter.java +++ b/qadevOOo/tests/java/mod/_xmloff/Chart/XMLStylesImporter.java @@ -111,7 +111,7 @@ public class XMLStylesImporter extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log) { + (TestParameters tParam, PrintWriter log) throws Exception { XInterface oObj = null; Object oInt = null ; @@ -122,14 +122,8 @@ public class XMLStylesImporter extends TestCase { XMultiServiceFactory xMSF = tParam.getMSF() ; - try { - oInt = xMSF.createInstance - ("com.sun.star.comp.Chart.XMLStylesImporter") ; - - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oInt = xMSF.createInstance + ("com.sun.star.comp.Chart.XMLStylesImporter") ; oObj = (XInterface) oInt ; diff --git a/qadevOOo/tests/java/mod/_xmloff/Draw/XMLContentExporter.java b/qadevOOo/tests/java/mod/_xmloff/Draw/XMLContentExporter.java index 54bcb39475e5..418927aff1db 100644 --- a/qadevOOo/tests/java/mod/_xmloff/Draw/XMLContentExporter.java +++ b/qadevOOo/tests/java/mod/_xmloff/Draw/XMLContentExporter.java @@ -115,7 +115,7 @@ public class XMLContentExporter extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log) { + (TestParameters tParam, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF() ; XInterface oObj = null; @@ -131,30 +131,25 @@ public class XMLContentExporter extends TestCase { filter.addTag(new XMLTools.Tag("draw:page","draw:name","NewSlide1")); filter.addTag(new XMLTools.Tag("draw:page","draw:name","NewSlide2")); - try { - oObj = (XInterface) xMSF.createInstanceWithArguments( - "com.sun.star.comp.Draw.XMLContentExporter", - new Object[] {arg}); - XExporter xEx = UnoRuntime.queryInterface(XExporter.class,oObj); - - XDrawPagesSupplier supp = UnoRuntime.queryInterface(XDrawPagesSupplier.class, xDrawDoc); - XDrawPages set = supp.getDrawPages(); - - // This is an XML-export BUG (new slide named "NewSlide2" - // can not be exported to XML) - set.insertNewByIndex(1); - - XDrawPage page1 = UnoRuntime.queryInterface(XDrawPage.class, set.getByIndex(0)); - XNamed NPage1 = UnoRuntime.queryInterface(XNamed.class,page1); - NPage1.setName("NewSlide1"); - XDrawPage page2 = UnoRuntime.queryInterface(XDrawPage.class, set.getByIndex(1)); - XNamed NPage2 = UnoRuntime.queryInterface(XNamed.class,page2); - NPage2.setName("NewSlide2"); - xEx.setSourceDocument(xDrawDoc); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oObj = (XInterface) xMSF.createInstanceWithArguments( + "com.sun.star.comp.Draw.XMLContentExporter", + new Object[] {arg}); + XExporter xEx = UnoRuntime.queryInterface(XExporter.class,oObj); + + XDrawPagesSupplier supp = UnoRuntime.queryInterface(XDrawPagesSupplier.class, xDrawDoc); + XDrawPages set = supp.getDrawPages(); + + // This is an XML-export BUG (new slide named "NewSlide2" + // can not be exported to XML) + set.insertNewByIndex(1); + + XDrawPage page1 = UnoRuntime.queryInterface(XDrawPage.class, set.getByIndex(0)); + XNamed NPage1 = UnoRuntime.queryInterface(XNamed.class,page1); + NPage1.setName("NewSlide1"); + XDrawPage page2 = UnoRuntime.queryInterface(XDrawPage.class, set.getByIndex(1)); + XNamed NPage2 = UnoRuntime.queryInterface(XNamed.class,page2); + NPage2.setName("NewSlide2"); + xEx.setSourceDocument(xDrawDoc); // create testobject here log.println( "creating a new environment" ); diff --git a/qadevOOo/tests/java/mod/_xmloff/Draw/XMLContentImporter.java b/qadevOOo/tests/java/mod/_xmloff/Draw/XMLContentImporter.java index 8ce74d0d81f4..87713b4dee5f 100644 --- a/qadevOOo/tests/java/mod/_xmloff/Draw/XMLContentImporter.java +++ b/qadevOOo/tests/java/mod/_xmloff/Draw/XMLContentImporter.java @@ -111,7 +111,7 @@ public class XMLContentImporter extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log ) throws StatusException { + (TestParameters tParam, PrintWriter log ) throws Exception { XInterface oObj = null; Object oInt = null ; @@ -122,14 +122,8 @@ public class XMLContentImporter extends TestCase { XMultiServiceFactory xMSF = tParam.getMSF() ; - try { - oInt = xMSF.createInstance - ("com.sun.star.comp.Draw.XMLContentImporter") ; - - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oInt = xMSF.createInstance + ("com.sun.star.comp.Draw.XMLContentImporter") ; oObj = (XInterface) oInt ; diff --git a/qadevOOo/tests/java/mod/_xmloff/Draw/XMLExporter.java b/qadevOOo/tests/java/mod/_xmloff/Draw/XMLExporter.java index 51a15c9a9bd9..8a2a36fcd150 100644 --- a/qadevOOo/tests/java/mod/_xmloff/Draw/XMLExporter.java +++ b/qadevOOo/tests/java/mod/_xmloff/Draw/XMLExporter.java @@ -117,7 +117,7 @@ public class XMLExporter extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log) { + (TestParameters tParam, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF() ; XInterface oObj = null; @@ -133,31 +133,25 @@ public class XMLExporter extends TestCase { filter.addTag(new XMLTools.Tag("draw:page","draw:name","NewSlide1")); filter.addTag(new XMLTools.Tag("draw:page","draw:name","NewSlide2")); - try { - oObj = (XInterface) xMSF.createInstanceWithArguments( - "com.sun.star.comp.Draw.XMLExporter", new Object[] {arg}); - + oObj = (XInterface) xMSF.createInstanceWithArguments( + "com.sun.star.comp.Draw.XMLExporter", new Object[] {arg}); - XDrawPagesSupplier supp = UnoRuntime.queryInterface(XDrawPagesSupplier.class, xDrawDoc); - XDrawPages set = supp.getDrawPages(); - // This is an XML-export BUG (new slide named "NewSlide2" can not be exported to XML) - set.insertNewByIndex(1); + XDrawPagesSupplier supp = UnoRuntime.queryInterface(XDrawPagesSupplier.class, xDrawDoc); + XDrawPages set = supp.getDrawPages(); - XDrawPage page1 = UnoRuntime.queryInterface(XDrawPage.class, set.getByIndex(0)); - XNamed NPage1 = UnoRuntime.queryInterface(XNamed.class,page1); - NPage1.setName("NewSlide1"); - XDrawPage page2 = UnoRuntime.queryInterface(XDrawPage.class, set.getByIndex(1)); - XNamed NPage2 = UnoRuntime.queryInterface(XNamed.class,page2); - NPage2.setName("NewSlide2"); + // This is an XML-export BUG (new slide named "NewSlide2" can not be exported to XML) + set.insertNewByIndex(1); - XExporter xEx = UnoRuntime.queryInterface(XExporter.class,oObj); - xEx.setSourceDocument(xDrawDoc); + XDrawPage page1 = UnoRuntime.queryInterface(XDrawPage.class, set.getByIndex(0)); + XNamed NPage1 = UnoRuntime.queryInterface(XNamed.class,page1); + NPage1.setName("NewSlide1"); + XDrawPage page2 = UnoRuntime.queryInterface(XDrawPage.class, set.getByIndex(1)); + XNamed NPage2 = UnoRuntime.queryInterface(XNamed.class,page2); + NPage2.setName("NewSlide2"); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + XExporter xEx = UnoRuntime.queryInterface(XExporter.class,oObj); + xEx.setSourceDocument(xDrawDoc); // create testobject here log.println( "creating a new environment" ); diff --git a/qadevOOo/tests/java/mod/_xmloff/Draw/XMLImporter.java b/qadevOOo/tests/java/mod/_xmloff/Draw/XMLImporter.java index 0bb5da21e3ef..426218f0d6bf 100644 --- a/qadevOOo/tests/java/mod/_xmloff/Draw/XMLImporter.java +++ b/qadevOOo/tests/java/mod/_xmloff/Draw/XMLImporter.java @@ -111,7 +111,7 @@ public class XMLImporter extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log ) throws StatusException { + (TestParameters tParam, PrintWriter log ) throws Exception { XInterface oObj = null; Object oInt = null ; @@ -122,13 +122,7 @@ public class XMLImporter extends TestCase { XMultiServiceFactory xMSF = tParam.getMSF() ; - try { - oInt = xMSF.createInstance("com.sun.star.comp.Draw.XMLImporter") ; - - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oInt = xMSF.createInstance("com.sun.star.comp.Draw.XMLImporter") ; oObj = (XInterface) oInt ; diff --git a/qadevOOo/tests/java/mod/_xmloff/Draw/XMLMetaExporter.java b/qadevOOo/tests/java/mod/_xmloff/Draw/XMLMetaExporter.java index 24c15d55a6c3..aebc74eb30f5 100644 --- a/qadevOOo/tests/java/mod/_xmloff/Draw/XMLMetaExporter.java +++ b/qadevOOo/tests/java/mod/_xmloff/Draw/XMLMetaExporter.java @@ -115,7 +115,7 @@ public class XMLMetaExporter extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log ) throws StatusException { + (TestParameters tParam, PrintWriter log ) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF() ; XInterface oObj = null; @@ -124,22 +124,16 @@ public class XMLMetaExporter extends TestCase { FilterChecker filter = new FilterChecker(log) ; Any arg = new Any(new Type(XDocumentHandler.class),filter); - try { - oObj = (XInterface) xMSF.createInstanceWithArguments( - "com.sun.star.comp.Draw.XMLMetaExporter", new Object[] {arg}); - XExporter xEx = UnoRuntime.queryInterface(XExporter.class, oObj); - xEx.setSourceDocument(xDrawDoc); - - //set some meta data - XDocumentPropertiesSupplier xPropSup = UnoRuntime.queryInterface - (XDocumentPropertiesSupplier.class, xDrawDoc); - final XDocumentProperties xDocProps = xPropSup.getDocumentProperties(); - xDocProps.setTitle(TITLE); - - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oObj = (XInterface) xMSF.createInstanceWithArguments( + "com.sun.star.comp.Draw.XMLMetaExporter", new Object[] {arg}); + XExporter xEx = UnoRuntime.queryInterface(XExporter.class, oObj); + xEx.setSourceDocument(xDrawDoc); + + //set some meta data + XDocumentPropertiesSupplier xPropSup = UnoRuntime.queryInterface + (XDocumentPropertiesSupplier.class, xDrawDoc); + final XDocumentProperties xDocProps = xPropSup.getDocumentProperties(); + xDocProps.setTitle(TITLE); // Checking Head Tag existence and that property has changed filter.addTag(new XMLTools.Tag ("office:document-meta")); diff --git a/qadevOOo/tests/java/mod/_xmloff/Draw/XMLMetaImporter.java b/qadevOOo/tests/java/mod/_xmloff/Draw/XMLMetaImporter.java index e80f80f8e026..d16e8af201d9 100644 --- a/qadevOOo/tests/java/mod/_xmloff/Draw/XMLMetaImporter.java +++ b/qadevOOo/tests/java/mod/_xmloff/Draw/XMLMetaImporter.java @@ -110,7 +110,7 @@ public class XMLMetaImporter extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment - (TestParameters tParam,PrintWriter log ) { + (TestParameters tParam,PrintWriter log ) throws Exception { XInterface oObj = null; Object oInt = null ; @@ -121,12 +121,7 @@ public class XMLMetaImporter extends TestCase { XMultiServiceFactory xMSF = tParam.getMSF() ; - try { - oInt = xMSF.createInstance("com.sun.star.comp.Draw.XMLMetaImporter") ; - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oInt = xMSF.createInstance("com.sun.star.comp.Draw.XMLMetaImporter") ; oObj = (XInterface) oInt ; diff --git a/qadevOOo/tests/java/mod/_xmloff/Draw/XMLSettingsExporter.java b/qadevOOo/tests/java/mod/_xmloff/Draw/XMLSettingsExporter.java index f4bd08a90beb..a908f1f3c004 100644 --- a/qadevOOo/tests/java/mod/_xmloff/Draw/XMLSettingsExporter.java +++ b/qadevOOo/tests/java/mod/_xmloff/Draw/XMLSettingsExporter.java @@ -116,7 +116,7 @@ public class XMLSettingsExporter extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log) { + (TestParameters tParam, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF() ; XInterface oObj = null; @@ -124,23 +124,17 @@ public class XMLSettingsExporter extends TestCase { FilterChecker filter = new FilterChecker(log) ; Any arg = new Any(new Type(XDocumentHandler.class),filter); - try { - oObj = (XInterface) xMSF.createInstanceWithArguments( - "com.sun.star.comp.Draw.XMLSettingsExporter", - new Object[] {arg}); - XExporter xEx = UnoRuntime.queryInterface(XExporter.class, oObj); - xEx.setSourceDocument(xDrawDoc); - - //set some settings - XModel xDrawModel = UnoRuntime.queryInterface(XModel.class, xDrawDoc); - XController xController = xDrawModel.getCurrentController(); - XPropertySet xPropSet = UnoRuntime.queryInterface(XPropertySet.class, xController); - xPropSet.setPropertyValue("IsLayerMode", Boolean.TRUE); - - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oObj = (XInterface) xMSF.createInstanceWithArguments( + "com.sun.star.comp.Draw.XMLSettingsExporter", + new Object[] {arg}); + XExporter xEx = UnoRuntime.queryInterface(XExporter.class, oObj); + xEx.setSourceDocument(xDrawDoc); + + //set some settings + XModel xDrawModel = UnoRuntime.queryInterface(XModel.class, xDrawDoc); + XController xController = xDrawModel.getCurrentController(); + XPropertySet xPropSet = UnoRuntime.queryInterface(XPropertySet.class, xController); + xPropSet.setPropertyValue("IsLayerMode", Boolean.TRUE); // Checking Head Tag existence and that property has changed filter.addTag(new XMLTools.Tag ("office:document-settings")); diff --git a/qadevOOo/tests/java/mod/_xmloff/Draw/XMLSettingsImporter.java b/qadevOOo/tests/java/mod/_xmloff/Draw/XMLSettingsImporter.java index 3850046792b4..9ee908c6aebf 100644 --- a/qadevOOo/tests/java/mod/_xmloff/Draw/XMLSettingsImporter.java +++ b/qadevOOo/tests/java/mod/_xmloff/Draw/XMLSettingsImporter.java @@ -112,7 +112,7 @@ public class XMLSettingsImporter extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log) throws StatusException { + (TestParameters tParam, PrintWriter log) throws Exception { XInterface oObj = null; Object oInt = null ; @@ -123,14 +123,8 @@ public class XMLSettingsImporter extends TestCase { XMultiServiceFactory xMSF = tParam.getMSF() ; - try { - oInt = xMSF.createInstance - ("com.sun.star.comp.Draw.XMLSettingsImporter") ; - - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oInt = xMSF.createInstance + ("com.sun.star.comp.Draw.XMLSettingsImporter") ; oObj = (XInterface) oInt ; diff --git a/qadevOOo/tests/java/mod/_xmloff/Draw/XMLStylesExporter.java b/qadevOOo/tests/java/mod/_xmloff/Draw/XMLStylesExporter.java index a4b5eff331b8..753c5b9de26c 100644 --- a/qadevOOo/tests/java/mod/_xmloff/Draw/XMLStylesExporter.java +++ b/qadevOOo/tests/java/mod/_xmloff/Draw/XMLStylesExporter.java @@ -118,7 +118,7 @@ public class XMLStylesExporter extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment( - TestParameters tParam, PrintWriter log) throws StatusException { + TestParameters tParam, PrintWriter log) throws Exception { SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF() ); XMultiServiceFactory xMSF = tParam.getMSF() ; @@ -127,30 +127,25 @@ public class XMLStylesExporter extends TestCase { Any arg = new Any(new Type(XDocumentHandler.class),filter); final String STYLE_NAME = "New style" + counter++ ; - try { - oObj = (XInterface) xMSF.createInstanceWithArguments( - "com.sun.star.comp.Draw.XMLStylesExporter", new Object[] {arg}); - XExporter xEx = UnoRuntime.queryInterface(XExporter.class,oObj); - xEx.setSourceDocument(xDrawDoc); - - //obtain style families - XStyleFamiliesSupplier styleSup = UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, xDrawDoc); - XNameAccess StyleFamilies = styleSup.getStyleFamilies(); - //obtain all style family names - String[] styleFamiliesNames = StyleFamilies.getElementNames(); - String styleFamilyName = styleFamiliesNames[0]; - //obtain style family with name[0] - Object objectStyle = StyleFamilies.getByName(styleFamilyName); - XNameContainer xStyleFamilyName = UnoRuntime.queryInterface(XNameContainer.class, objectStyle); - //create new style - Object SC = SOF.createInstance(xDrawDoc, "com.sun.star.style.Style"); - XStyle Style = UnoRuntime.queryInterface(XStyle.class,SC); - //add new style to style familiy with name[0] - xStyleFamilyName.insertByName(STYLE_NAME,Style); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oObj = (XInterface) xMSF.createInstanceWithArguments( + "com.sun.star.comp.Draw.XMLStylesExporter", new Object[] {arg}); + XExporter xEx = UnoRuntime.queryInterface(XExporter.class,oObj); + xEx.setSourceDocument(xDrawDoc); + + //obtain style families + XStyleFamiliesSupplier styleSup = UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, xDrawDoc); + XNameAccess StyleFamilies = styleSup.getStyleFamilies(); + //obtain all style family names + String[] styleFamiliesNames = StyleFamilies.getElementNames(); + String styleFamilyName = styleFamiliesNames[0]; + //obtain style family with name[0] + Object objectStyle = StyleFamilies.getByName(styleFamilyName); + XNameContainer xStyleFamilyName = UnoRuntime.queryInterface(XNameContainer.class, objectStyle); + //create new style + Object SC = SOF.createInstance(xDrawDoc, "com.sun.star.style.Style"); + XStyle Style = UnoRuntime.queryInterface(XStyle.class,SC); + //add new style to style familiy with name[0] + xStyleFamilyName.insertByName(STYLE_NAME,Style); // Checking Head Tag existence and that property has changed filter.addTag(new XMLTools.Tag ("office:document-styles")); diff --git a/qadevOOo/tests/java/mod/_xmloff/Draw/XMLStylesImporter.java b/qadevOOo/tests/java/mod/_xmloff/Draw/XMLStylesImporter.java index c02c61ff7941..c178a8606b13 100644 --- a/qadevOOo/tests/java/mod/_xmloff/Draw/XMLStylesImporter.java +++ b/qadevOOo/tests/java/mod/_xmloff/Draw/XMLStylesImporter.java @@ -112,7 +112,7 @@ public class XMLStylesImporter extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log ) throws StatusException { + (TestParameters tParam, PrintWriter log ) throws Exception { XInterface oObj = null; Object oInt = null ; @@ -123,14 +123,8 @@ public class XMLStylesImporter extends TestCase { XMultiServiceFactory xMSF = tParam.getMSF() ; - try { - oInt = xMSF.createInstance - ("com.sun.star.comp.Draw.XMLStylesImporter") ; - - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oInt = xMSF.createInstance + ("com.sun.star.comp.Draw.XMLStylesImporter") ; oObj = (XInterface) oInt ; diff --git a/qadevOOo/tests/java/mod/_xmloff/Impress/XMLContentExporter.java b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLContentExporter.java index c5997f057d84..5738566cb496 100644 --- a/qadevOOo/tests/java/mod/_xmloff/Impress/XMLContentExporter.java +++ b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLContentExporter.java @@ -116,7 +116,7 @@ public class XMLContentExporter extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log ) throws StatusException { + (TestParameters tParam, PrintWriter log ) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF() ; XInterface oObj = null; @@ -125,24 +125,19 @@ public class XMLContentExporter extends TestCase { FilterChecker filter = new FilterChecker(log); Any arg = new Any(new Type(XDocumentHandler.class),filter); - try { - oObj = (XInterface) xMSF.createInstanceWithArguments( - "com.sun.star.comp.Impress.XMLContentExporter", - new Object[] {arg}); - XExporter xEx = UnoRuntime.queryInterface(XExporter.class,oObj); - xEx.setSourceDocument(xImpressDoc); - - // assigning a draw page a new name - XDrawPagesSupplier xPagesSup = UnoRuntime.queryInterface - (XDrawPagesSupplier.class, xImpressDoc) ; - XDrawPages xPages = xPagesSup.getDrawPages() ; - XNamed xPageName = UnoRuntime.queryInterface - (XNamed.class, xPages.getByIndex(0)) ; - xPageName.setName(expPageName) ; - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oObj = (XInterface) xMSF.createInstanceWithArguments( + "com.sun.star.comp.Impress.XMLContentExporter", + new Object[] {arg}); + XExporter xEx = UnoRuntime.queryInterface(XExporter.class,oObj); + xEx.setSourceDocument(xImpressDoc); + + // assigning a draw page a new name + XDrawPagesSupplier xPagesSup = UnoRuntime.queryInterface + (XDrawPagesSupplier.class, xImpressDoc) ; + XDrawPages xPages = xPagesSup.getDrawPages() ; + XNamed xPageName = UnoRuntime.queryInterface + (XNamed.class, xPages.getByIndex(0)) ; + xPageName.setName(expPageName) ; // adding tags required to be in XML data exported. filter.addTag(new XMLTools.Tag("office:document-content")) ; diff --git a/qadevOOo/tests/java/mod/_xmloff/Impress/XMLContentImporter.java b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLContentImporter.java index 01cd9372e387..7b816c529a32 100644 --- a/qadevOOo/tests/java/mod/_xmloff/Impress/XMLContentImporter.java +++ b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLContentImporter.java @@ -111,7 +111,7 @@ public class XMLContentImporter extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment - (TestParameters tParam,PrintWriter log) throws StatusException { + (TestParameters tParam,PrintWriter log) throws Exception { XInterface oObj = null; Object oInt = null ; @@ -123,14 +123,8 @@ public class XMLContentImporter extends TestCase { XMultiServiceFactory xMSF = tParam.getMSF() ; - try { - oInt = xMSF.createInstance - ("com.sun.star.comp.Impress.XMLContentImporter") ; - - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oInt = xMSF.createInstance + ("com.sun.star.comp.Impress.XMLContentImporter") ; oObj = (XInterface) oInt ; diff --git a/qadevOOo/tests/java/mod/_xmloff/Impress/XMLExporter.java b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLExporter.java index ed9968f50012..87a4f891e4aa 100644 --- a/qadevOOo/tests/java/mod/_xmloff/Impress/XMLExporter.java +++ b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLExporter.java @@ -117,7 +117,7 @@ public class XMLExporter extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log) { + (TestParameters tParam, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF() ; XInterface oObj = null; @@ -127,25 +127,19 @@ public class XMLExporter extends TestCase { final String NAME = "XMLExporter"; - try { - oObj = (XInterface) xMSF.createInstanceWithArguments( - "com.sun.star.comp.Impress.XMLExporter", new Object[] {arg}); - - //get draw pages - XDrawPagesSupplier drawPagesSupplier = UnoRuntime.queryInterface(XDrawPagesSupplier.class, xImpressDoc); - XDrawPages drawPages = drawPagesSupplier.getDrawPages(); - //insert new draw page - XDrawPage newDrawPage = drawPages.insertNewByIndex(0); - //set specific test name - XNamed newPageNamed = UnoRuntime.queryInterface(XNamed.class, newDrawPage); - newPageNamed.setName(NAME); - XExporter xEx = UnoRuntime.queryInterface(XExporter.class,oObj); - xEx.setSourceDocument(xImpressDoc); - - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oObj = (XInterface) xMSF.createInstanceWithArguments( + "com.sun.star.comp.Impress.XMLExporter", new Object[] {arg}); + + //get draw pages + XDrawPagesSupplier drawPagesSupplier = UnoRuntime.queryInterface(XDrawPagesSupplier.class, xImpressDoc); + XDrawPages drawPages = drawPagesSupplier.getDrawPages(); + //insert new draw page + XDrawPage newDrawPage = drawPages.insertNewByIndex(0); + //set specific test name + XNamed newPageNamed = UnoRuntime.queryInterface(XNamed.class, newDrawPage); + newPageNamed.setName(NAME); + XExporter xEx = UnoRuntime.queryInterface(XExporter.class,oObj); + xEx.setSourceDocument(xImpressDoc); // adding tags which must be contained in XML output Filter.addTag( new XMLTools.Tag("office:document") ); diff --git a/qadevOOo/tests/java/mod/_xmloff/Impress/XMLImporter.java b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLImporter.java index 06f104445cb1..5b76b9622cef 100644 --- a/qadevOOo/tests/java/mod/_xmloff/Impress/XMLImporter.java +++ b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLImporter.java @@ -111,7 +111,7 @@ public class XMLImporter extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log) throws StatusException { + (TestParameters tParam, PrintWriter log) throws Exception { XInterface oObj = null; Object oInt = null ; @@ -122,13 +122,8 @@ public class XMLImporter extends TestCase { XMultiServiceFactory xMSF = tParam.getMSF() ; - try { - oInt = xMSF.createInstance - ("com.sun.star.comp.Impress.XMLImporter") ; - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oInt = xMSF.createInstance + ("com.sun.star.comp.Impress.XMLImporter") ; oObj = (XInterface) oInt ; diff --git a/qadevOOo/tests/java/mod/_xmloff/Impress/XMLMetaExporter.java b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLMetaExporter.java index faa13c1a45ab..9b010e69b3bd 100644 --- a/qadevOOo/tests/java/mod/_xmloff/Impress/XMLMetaExporter.java +++ b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLMetaExporter.java @@ -115,7 +115,7 @@ public class XMLMetaExporter extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log) throws StatusException { + (TestParameters tParam, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF() ; XInterface oObj = null; @@ -124,23 +124,17 @@ public class XMLMetaExporter extends TestCase { Any arg = new Any(new Type(XDocumentHandler.class), filter); final String NAME = "XMLMetaExporter"; - try { - oObj = (XInterface) xMSF.createInstanceWithArguments( - "com.sun.star.comp.Impress.XMLMetaExporter", - new Object[]{arg}); - XExporter xEx = UnoRuntime.queryInterface(XExporter.class,oObj); - xEx.setSourceDocument(xImpressDoc); - - // change title name - XDocumentPropertiesSupplier xPropSup = UnoRuntime.queryInterface - (XDocumentPropertiesSupplier.class, xImpressDoc); - final XDocumentProperties xDocProps = xPropSup.getDocumentProperties(); - xDocProps.setTitle(NAME); - - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oObj = (XInterface) xMSF.createInstanceWithArguments( + "com.sun.star.comp.Impress.XMLMetaExporter", + new Object[]{arg}); + XExporter xEx = UnoRuntime.queryInterface(XExporter.class,oObj); + xEx.setSourceDocument(xImpressDoc); + + // change title name + XDocumentPropertiesSupplier xPropSup = UnoRuntime.queryInterface + (XDocumentPropertiesSupplier.class, xImpressDoc); + final XDocumentProperties xDocProps = xPropSup.getDocumentProperties(); + xDocProps.setTitle(NAME); // Checking tags existence and changed property value filter.addTag(new XMLTools.Tag ("office:document-meta")); diff --git a/qadevOOo/tests/java/mod/_xmloff/Impress/XMLMetaImporter.java b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLMetaImporter.java index caaa7090339b..a9d840f3efd0 100644 --- a/qadevOOo/tests/java/mod/_xmloff/Impress/XMLMetaImporter.java +++ b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLMetaImporter.java @@ -110,7 +110,7 @@ public class XMLMetaImporter extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment - (TestParameters tParam,PrintWriter log ) throws StatusException { + (TestParameters tParam,PrintWriter log ) throws Exception { XInterface oObj = null; Object oInt = null ; @@ -122,14 +122,8 @@ public class XMLMetaImporter extends TestCase { XMultiServiceFactory xMSF = tParam.getMSF() ; - try { - oInt = xMSF.createInstance - ("com.sun.star.comp.Impress.XMLMetaImporter") ; - - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oInt = xMSF.createInstance + ("com.sun.star.comp.Impress.XMLMetaImporter") ; oObj = (XInterface) oInt ; diff --git a/qadevOOo/tests/java/mod/_xmloff/Impress/XMLSettingsExporter.java b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLSettingsExporter.java index a317be770c9d..bab90b342d6c 100644 --- a/qadevOOo/tests/java/mod/_xmloff/Impress/XMLSettingsExporter.java +++ b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLSettingsExporter.java @@ -113,7 +113,7 @@ public class XMLSettingsExporter extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log ) throws StatusException { + (TestParameters tParam, PrintWriter log ) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF(); XInterface oObj = null; @@ -121,27 +121,21 @@ public class XMLSettingsExporter extends TestCase { Any arg = new Any(new Type(XDocumentHandler.class),filter); final boolean NewDataValue; - try { - oObj = (XInterface) xMSF.createInstanceWithArguments( - "com.sun.star.comp.Impress.XMLSettingsExporter", - new Object[] {arg}); - XExporter xEx = UnoRuntime.queryInterface(XExporter.class,oObj); - xEx.setSourceDocument(xImpressDoc); - - //set some settings - XModel xImpressModel = UnoRuntime.queryInterface(XModel.class, xImpressDoc); - XController xController = xImpressModel.getCurrentController(); - XPropertySet xPropSet = UnoRuntime.queryInterface(XPropertySet.class, xController); - NewDataValue = ! ((Boolean) xPropSet.getPropertyValue - ("IsLayerMode")).booleanValue(); - xPropSet.setPropertyValue("IsLayerMode", - Boolean.valueOf(NewDataValue)); - - - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oObj = (XInterface) xMSF.createInstanceWithArguments( + "com.sun.star.comp.Impress.XMLSettingsExporter", + new Object[] {arg}); + XExporter xEx = UnoRuntime.queryInterface(XExporter.class,oObj); + xEx.setSourceDocument(xImpressDoc); + + //set some settings + XModel xImpressModel = UnoRuntime.queryInterface(XModel.class, xImpressDoc); + XController xController = xImpressModel.getCurrentController(); + XPropertySet xPropSet = UnoRuntime.queryInterface(XPropertySet.class, xController); + NewDataValue = ! ((Boolean) xPropSet.getPropertyValue + ("IsLayerMode")).booleanValue(); + xPropSet.setPropertyValue("IsLayerMode", + Boolean.valueOf(NewDataValue)); + // Adding tags for checking existence of head tag and other tags filter.addTagEnclosed(new XMLTools.Tag("office:settings"), diff --git a/qadevOOo/tests/java/mod/_xmloff/Impress/XMLSettingsImporter.java b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLSettingsImporter.java index a048a1a6bcfd..e370eb1a23a3 100644 --- a/qadevOOo/tests/java/mod/_xmloff/Impress/XMLSettingsImporter.java +++ b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLSettingsImporter.java @@ -112,7 +112,7 @@ public class XMLSettingsImporter extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log ) throws StatusException { + (TestParameters tParam, PrintWriter log ) throws Exception { XInterface oObj = null; Object oInt = null ; @@ -123,14 +123,8 @@ public class XMLSettingsImporter extends TestCase { XMultiServiceFactory xMSF = tParam.getMSF() ; - try { - oInt = xMSF.createInstance - ("com.sun.star.comp.Impress.XMLSettingsImporter") ; - - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oInt = xMSF.createInstance + ("com.sun.star.comp.Impress.XMLSettingsImporter") ; oObj = (XInterface) oInt ; @@ -169,13 +163,8 @@ public class XMLSettingsImporter extends TestCase { XModel xImpressModel = UnoRuntime.queryInterface(XModel.class, xImpressDoc); XController xController = xImpressModel.getCurrentController(); final XPropertySet xPropSet = UnoRuntime.queryInterface(XPropertySet.class, xController); - try { - log.println("Property \"IsLayerMode\" before import is " + - xPropSet.getPropertyValue("IsLayerMode")); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Can't create component.", e); - } + log.println("Property \"IsLayerMode\" before import is " + + xPropSet.getPropertyValue("IsLayerMode")); final PrintWriter logF = log; tEnv.addObjRelation("XDocumentHandler.ImportChecker", new ifc.xml.sax._XDocumentHandler.ImportChecker() { diff --git a/qadevOOo/tests/java/mod/_xmloff/Impress/XMLStylesExporter.java b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLStylesExporter.java index 5360e5dfc50e..803c7f431ae7 100644 --- a/qadevOOo/tests/java/mod/_xmloff/Impress/XMLStylesExporter.java +++ b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLStylesExporter.java @@ -118,7 +118,7 @@ public class XMLStylesExporter extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log) throws StatusException { + (TestParameters tParam, PrintWriter log) throws Exception { SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF() ); XMultiServiceFactory xMSF = tParam.getMSF() ; @@ -132,29 +132,23 @@ public class XMLStylesExporter extends TestCase { filter.addTag(new XMLTools.Tag("office:styles")); filter.addTag(new XMLTools.Tag("style:style","style:name", newName)); - try { - oObj = (XInterface) xMSF.createInstanceWithArguments( - "com.sun.star.comp.Impress.XMLStylesExporter", - new Object[] {arg}); - XExporter xEx = UnoRuntime.queryInterface(XExporter.class,oObj); - xEx.setSourceDocument(xImpressDoc); - - // Obtaining and changing property values - XStyleFamiliesSupplier styleSup = UnoRuntime.queryInterface - (XStyleFamiliesSupplier.class, xImpressDoc) ; - XNameAccess styleFamilies = styleSup.getStyleFamilies(); - String[] styleFamiliesNames = styleFamilies.getElementNames(); - XNameContainer StyleFamilyName = UnoRuntime.queryInterface(XNameContainer.class, - styleFamilies.getByName(styleFamiliesNames[0])); - Object SC = SOF.createInstance - (xImpressDoc, "com.sun.star.style.Style"); - XStyle StylePage = UnoRuntime.queryInterface(XStyle.class,SC); - StyleFamilyName.insertByName(newName, StylePage); - - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oObj = (XInterface) xMSF.createInstanceWithArguments( + "com.sun.star.comp.Impress.XMLStylesExporter", + new Object[] {arg}); + XExporter xEx = UnoRuntime.queryInterface(XExporter.class,oObj); + xEx.setSourceDocument(xImpressDoc); + + // Obtaining and changing property values + XStyleFamiliesSupplier styleSup = UnoRuntime.queryInterface + (XStyleFamiliesSupplier.class, xImpressDoc) ; + XNameAccess styleFamilies = styleSup.getStyleFamilies(); + String[] styleFamiliesNames = styleFamilies.getElementNames(); + XNameContainer StyleFamilyName = UnoRuntime.queryInterface(XNameContainer.class, + styleFamilies.getByName(styleFamiliesNames[0])); + Object SC = SOF.createInstance + (xImpressDoc, "com.sun.star.style.Style"); + XStyle StylePage = UnoRuntime.queryInterface(XStyle.class,SC); + StyleFamilyName.insertByName(newName, StylePage); // create testobject here log.println( "creating a new environment" ); diff --git a/qadevOOo/tests/java/mod/_xmloff/Impress/XMLStylesImporter.java b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLStylesImporter.java index 8cd1ff917fb1..d4f48b276a84 100644 --- a/qadevOOo/tests/java/mod/_xmloff/Impress/XMLStylesImporter.java +++ b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLStylesImporter.java @@ -111,7 +111,7 @@ public class XMLStylesImporter extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log ) throws StatusException { + (TestParameters tParam, PrintWriter log ) throws Exception { XInterface oObj = null; Object oInt = null ; @@ -123,14 +123,8 @@ public class XMLStylesImporter extends TestCase { XMultiServiceFactory xMSF = tParam.getMSF() ; - try { - oInt = xMSF.createInstance - ("com.sun.star.comp.Impress.XMLStylesImporter") ; - - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oInt = xMSF.createInstance + ("com.sun.star.comp.Impress.XMLStylesImporter") ; oObj = (XInterface) oInt ; |