diff options
Diffstat (limited to 'qadevOOo/tests/java/mod/_dbaccess/ConnectionLineAccessibility.java')
-rw-r--r-- | qadevOOo/tests/java/mod/_dbaccess/ConnectionLineAccessibility.java | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/qadevOOo/tests/java/mod/_dbaccess/ConnectionLineAccessibility.java b/qadevOOo/tests/java/mod/_dbaccess/ConnectionLineAccessibility.java index c515ffaf8c01..c2494f6c0541 100644 --- a/qadevOOo/tests/java/mod/_dbaccess/ConnectionLineAccessibility.java +++ b/qadevOOo/tests/java/mod/_dbaccess/ConnectionLineAccessibility.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -86,7 +86,7 @@ public class ConnectionLineAccessibility extends TestCase XComponent QueryComponent = null; String user = ""; String password=""; - + /** * Creates a new DataSource and stores it. * Creates a connection and using it @@ -105,13 +105,13 @@ public class ConnectionLineAccessibility extends TestCase PrintWriter log) { XInterface oObj = null; - + Object oDBContext = null; Object oDBSource = null; Object newQuery = null; Object toolkit = null; XStorable store = null; - + try { oDBContext = ((XMultiServiceFactory) Param.getMSF()) @@ -128,24 +128,24 @@ public class ConnectionLineAccessibility extends TestCase e.printStackTrace(log); throw new StatusException(Status.failed("Couldn't create instance")); } - + String mysqlURL = (String) Param.get("mysql.url"); - + if (mysqlURL == null) { 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")); } - + PropertyValue[] info = new PropertyValue[2]; info[0] = new PropertyValue(); info[0].Name = "user"; @@ -153,10 +153,10 @@ public class ConnectionLineAccessibility extends TestCase info[1] = new PropertyValue(); info[1].Name = "password"; info[1].Value = password; - + XPropertySet propSetDBSource = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, oDBSource); - + try { propSetDBSource.setPropertyValue("URL", mysqlURL); @@ -186,7 +186,7 @@ public class ConnectionLineAccessibility extends TestCase throw new StatusException(Status.failed( "Couldn't set property value")); } - + try { log.println("writing database file ..."); @@ -194,7 +194,7 @@ public class ConnectionLineAccessibility extends TestCase UnoRuntime.queryInterface(XDocumentDataSource.class, oDBSource); store = (XStorable) UnoRuntime.queryInterface(XStorable.class, xDDS.getDatabaseDocument()); - + aFile = utils.getOfficeTemp((XMultiServiceFactory) Param.getMSF())+"ConnectionLine.odb"; log.println("... filename will be "+aFile); store.storeAsURL(aFile,new PropertyValue[] @@ -206,19 +206,19 @@ public class ConnectionLineAccessibility extends TestCase e.printStackTrace(log); throw new StatusException(Status.failed("Couldn't register object")); } - + isolConnection = (XIsolatedConnection) UnoRuntime.queryInterface( XIsolatedConnection.class, oDBSource); - + XConnection connection = null; XStatement statement = null; - + final String tbl_name1 = "tst_table1"; final String tbl_name2 = "tst_table2"; final String col_name1 = "id1"; final String col_name2 = "id2"; - + try { connection = isolConnection.getIsolatedConnection(user, password); @@ -251,16 +251,16 @@ public class ConnectionLineAccessibility extends TestCase throw new StatusException(Status.failed("SQLException")); } } - + XQueryDefinitionsSupplier querySuppl = (XQueryDefinitionsSupplier) UnoRuntime.queryInterface( XQueryDefinitionsSupplier.class, oDBSource); - + XNameAccess defContainer = querySuppl.getQueryDefinitions(); - + XPropertySet queryProp = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, newQuery); - + try { final String query = "select * from " + tbl_name1 + ", " + @@ -293,11 +293,11 @@ public class ConnectionLineAccessibility extends TestCase throw new StatusException(Status.failed( "Couldn't set property value")); } - + XNameContainer queryContainer = (XNameContainer) UnoRuntime.queryInterface( XNameContainer.class, defContainer); - + try { queryContainer.insertByName("Query1", newQuery); @@ -329,43 +329,43 @@ public class ConnectionLineAccessibility extends TestCase e.printStackTrace(log); throw new StatusException(Status.failed("Couldn't insert query")); } - + PropertyValue[] loadProps = new PropertyValue[3]; loadProps[0] = new PropertyValue(); loadProps[0].Name = "QueryDesignView"; loadProps[0].Value = Boolean.TRUE; - + loadProps[1] = new PropertyValue(); loadProps[1].Name = "CurrentQuery"; loadProps[1].Value = "Query1"; - + loadProps[2] = new PropertyValue(); loadProps[2].Name = "DataSource"; loadProps[2].Value = oDBSource; - + QueryComponent = DesktopTools.loadDoc((XMultiServiceFactory) Param.getMSF(),".component:DB/QueryDesign",loadProps); - + util.utils.shortWait(1000); - + 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)); - + oObj = AccessibilityTools.getAccessibleObjectForRoleIgnoreShowing(xRoot, AccessibleRole.UNKNOWN, "", "ConnectionLine"); - + log.println("ImplementationName " + util.utils.getImplName(oObj)); - + log.println("creating TestEnvironment"); - + TestEnvironment tEnv = new TestEnvironment(oObj); - + shortWait(); - + final XWindow queryWin = xWindow; - + tEnv.addObjRelation("EventProducer", new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { @@ -375,10 +375,10 @@ public class ConnectionLineAccessibility extends TestCase queryWin.setPosSize(rect.X, rect.Y, rect.Height-5, rect.Width-5, PosSize.POSSIZE); } }); - + return tEnv; } // finish method getTestEnvironment - + /** * Closes the DatasourceAdministration dialog and Query Dialog. */ @@ -386,7 +386,7 @@ public class ConnectionLineAccessibility extends TestCase { try { - + log.println("closing QueryComponent ..."); DesktopTools.closeDoc(QueryComponent); log.println("... done"); @@ -402,7 +402,7 @@ public class ConnectionLineAccessibility extends TestCase e.printStackTrace(); } } - + /** * Sleeps for 1.5 sec. to allow StarOffice to react on <code> * reset</code> call. |