From 8c99725f06e15d14a06427dc8f5d2f2c14259575 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 14 Sep 2010 09:35:03 +0200 Subject: dba34a: properly close the connection, and survive (without error log) if there actually isn't a connection --- .../tests/java/mod/_forms/GenericModelTest.java | 28 ++++++++++++---------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'qadevOOo') diff --git a/qadevOOo/tests/java/mod/_forms/GenericModelTest.java b/qadevOOo/tests/java/mod/_forms/GenericModelTest.java index 8ddbbc293..f3657e6ac 100644 --- a/qadevOOo/tests/java/mod/_forms/GenericModelTest.java +++ b/qadevOOo/tests/java/mod/_forms/GenericModelTest.java @@ -27,6 +27,7 @@ package mod._forms; import com.sun.star.beans.NamedValue; import com.sun.star.beans.PropertyValue; +import com.sun.star.container.XIndexAccess; import java.io.PrintWriter; import lib.StatusException; @@ -251,11 +252,10 @@ public class GenericModelTest extends TestCase { if (m_ConnectionColsed) return; try { + XIndexAccess forms = UnoRuntime.queryInterface( XIndexAccess.class, + FormTools.getForms( WriterTools.getDrawPage( m_xTextDoc ) ) ); XForm myForm = (XForm) AnyConverter.toObject(new Type(XForm.class), - (FormTools.getForms( - WriterTools.getDrawPage( - m_xTextDoc))) - .getByName("Standard")); + forms.getByIndex(0)); if (debug){ if (myForm == null){ @@ -269,18 +269,20 @@ public class GenericModelTest extends TestCase { } - XPropertySet xSetProp = (XPropertySet) UnoRuntime.queryInterface( - XPropertySet.class, myForm); - XConnection connection = (XConnection) AnyConverter.toObject( - new Type(XConnection.class), - xSetProp.getPropertyValue("ActiveConnection")); - if (debug && connection == null){ - log.println("ERROR: could not get property 'ActiveConnection' from the XForm"); + XPropertySet xSetProp = UnoRuntime.queryInterface( XPropertySet.class, myForm ); + XConnection connection = UnoRuntime.queryInterface( XConnection.class, xSetProp.getPropertyValue( "ActiveConnection" ) ); + if ( connection == null ) + { + if ( debug ) + log.println("ERROR: could not get property 'ActiveConnection' from the XForm"); + } + else + { + connection.close(); } - - connection.close(); } catch (Exception e) { log.println("ERROR: Can't close the connection: " + e.toString()); + e.printStackTrace( log ); } log.println("closing data source..."); -- cgit v1.2.3 From a3fa5722d4f78231d50f0d6d7a51a158c0c7eb40 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 14 Sep 2010 10:15:53 +0200 Subject: dba34a: let the state message for incomplete tests end with OK - otherwise, some weird code elsewhere interprets it is failure --- qadevOOo/runner/stats/Summarizer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qadevOOo') diff --git a/qadevOOo/runner/stats/Summarizer.java b/qadevOOo/runner/stats/Summarizer.java index 2d28ea1fe..16fb3d880 100644 --- a/qadevOOo/runner/stats/Summarizer.java +++ b/qadevOOo/runner/stats/Summarizer.java @@ -78,7 +78,7 @@ public class Summarizer { if (states.elementAt(j).equals("not part of the job")) { - state = "Not possible since not all Interfaces/Services have been checked"; + state = "PASSED(some interfaces/services not tested).OK"; } else { -- cgit v1.2.3