diff options
author | Noel Grandin <noel@peralex.com> | 2014-12-09 15:19:05 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2014-12-10 08:06:14 +0000 |
commit | 9711dccd7fae3e3e77dc2d2018bdb8cdbf85309c (patch) | |
tree | 4ad76112f6f9e8fb9f792f36af8963dcf17ce5fb /sfx2 | |
parent | 9adb820158bdbfa0a34d843d4eb4c35963f00ac5 (diff) |
java: merge JUnitBasedTest into DocumentEvents
since it was the only place that used it
Change-Id: If9a71fbb468d02616da5cfacab0332e51a416d13
Reviewed-on: https://gerrit.libreoffice.org/13407
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/JunitTest_sfx2_complex.mk | 1 | ||||
-rw-r--r-- | sfx2/qa/complex/sfx2/DocumentEvents.java | 28 | ||||
-rw-r--r-- | sfx2/qa/complex/sfx2/JUnitBasedTest.java | 46 |
3 files changed, 24 insertions, 51 deletions
diff --git a/sfx2/JunitTest_sfx2_complex.mk b/sfx2/JunitTest_sfx2_complex.mk index cb77929c3632..1f11298dc925 100644 --- a/sfx2/JunitTest_sfx2_complex.mk +++ b/sfx2/JunitTest_sfx2_complex.mk @@ -38,7 +38,6 @@ $(eval $(call gb_JunitTest_add_sourcefiles,sfx2_complex,\ sfx2/qa/complex/sfx2/DocumentProperties \ sfx2/qa/complex/sfx2/GlobalEventBroadcaster \ sfx2/qa/complex/sfx2/UndoManager \ - sfx2/qa/complex/sfx2/JUnitBasedTest \ sfx2/qa/complex/sfx2/DocumentEvents \ sfx2/qa/complex/sfx2/tools/DialogThread \ sfx2/qa/complex/sfx2/tools/TestDocument \ diff --git a/sfx2/qa/complex/sfx2/DocumentEvents.java b/sfx2/qa/complex/sfx2/DocumentEvents.java index ae6b44453bb3..32c7ba5ae1d1 100644 --- a/sfx2/qa/complex/sfx2/DocumentEvents.java +++ b/sfx2/qa/complex/sfx2/DocumentEvents.java @@ -1,15 +1,18 @@ package complex.sfx2; -import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertTrue; import java.util.ArrayList; import java.util.logging.Level; import java.util.logging.Logger; import org.junit.After; +import org.junit.AfterClass; import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; +import org.openoffice.test.OfficeConnection; import org.openoffice.test.tools.OfficeDocument; import com.sun.star.document.DocumentEvent; @@ -17,18 +20,35 @@ import com.sun.star.document.XDocumentEventBroadcaster; import com.sun.star.document.XDocumentEventListener; import com.sun.star.lang.EventObject; import com.sun.star.lang.XEventListener; -import com.sun.star.uno.Exception; +import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.UnoRuntime; import com.sun.star.util.CloseVetoException; import com.sun.star.util.XCloseListener; import com.sun.star.util.XCloseable; -public class DocumentEvents extends JUnitBasedTest +public class DocumentEvents { + private static final OfficeConnection m_connection = new OfficeConnection(); + + @BeforeClass + public static void setUpConnection() throws Exception + { + m_connection.setUp(); + } + + + @AfterClass + public static void tearDownConnection() throws InterruptedException, com.sun.star.uno.Exception + { + m_connection.tearDown(); + } + @Before public void beforeTest() throws Exception { - m_document = OfficeDocument.blankTextDocument( this.getORB() ); + final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface( + XMultiServiceFactory.class, m_connection.getComponentContext().getServiceManager() ); + m_document = OfficeDocument.blankTextDocument( xMSF1 ); } @After diff --git a/sfx2/qa/complex/sfx2/JUnitBasedTest.java b/sfx2/qa/complex/sfx2/JUnitBasedTest.java deleted file mode 100644 index d4c3b1428b2b..000000000000 --- a/sfx2/qa/complex/sfx2/JUnitBasedTest.java +++ /dev/null @@ -1,46 +0,0 @@ -package complex.sfx2; - -import org.openoffice.test.OfficeConnection; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.uno.XComponentContext; -import org.junit.AfterClass; -import org.junit.BeforeClass; - -public class JUnitBasedTest -{ - - protected XComponentContext getContext() - { - return m_connection.getComponentContext(); - } - - - protected XMultiServiceFactory getORB() - { - final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface( - XMultiServiceFactory.class, getContext().getServiceManager() ); - return xMSF1; - } - - - @BeforeClass - public static void setUpConnection() throws Exception - { - System.out.println( "--------------------------------------------------------------------------------" ); - System.out.println( "connecting ..." ); - m_connection.setUp(); - } - - - @AfterClass - public static void tearDownConnection() throws InterruptedException, com.sun.star.uno.Exception - { - System.out.println(); - System.out.println( "tearing down connection" ); - m_connection.tearDown(); - System.out.println( "--------------------------------------------------------------------------------" ); - } - - private static final OfficeConnection m_connection = new OfficeConnection(); -} |