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>
This commit is contained in:
parent
9adb820158
commit
9711dccd7f
@ -38,7 +38,6 @@ $(eval $(call gb_JunitTest_add_sourcefiles,sfx2_complex,\
|
|||||||
sfx2/qa/complex/sfx2/DocumentProperties \
|
sfx2/qa/complex/sfx2/DocumentProperties \
|
||||||
sfx2/qa/complex/sfx2/GlobalEventBroadcaster \
|
sfx2/qa/complex/sfx2/GlobalEventBroadcaster \
|
||||||
sfx2/qa/complex/sfx2/UndoManager \
|
sfx2/qa/complex/sfx2/UndoManager \
|
||||||
sfx2/qa/complex/sfx2/JUnitBasedTest \
|
|
||||||
sfx2/qa/complex/sfx2/DocumentEvents \
|
sfx2/qa/complex/sfx2/DocumentEvents \
|
||||||
sfx2/qa/complex/sfx2/tools/DialogThread \
|
sfx2/qa/complex/sfx2/tools/DialogThread \
|
||||||
sfx2/qa/complex/sfx2/tools/TestDocument \
|
sfx2/qa/complex/sfx2/tools/TestDocument \
|
||||||
|
@ -1,15 +1,18 @@
|
|||||||
package complex.sfx2;
|
package complex.sfx2;
|
||||||
|
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
import static org.junit.Assert.assertArrayEquals;
|
import static org.junit.Assert.assertArrayEquals;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
|
import org.junit.AfterClass;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.openoffice.test.OfficeConnection;
|
||||||
import org.openoffice.test.tools.OfficeDocument;
|
import org.openoffice.test.tools.OfficeDocument;
|
||||||
|
|
||||||
import com.sun.star.document.DocumentEvent;
|
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.document.XDocumentEventListener;
|
||||||
import com.sun.star.lang.EventObject;
|
import com.sun.star.lang.EventObject;
|
||||||
import com.sun.star.lang.XEventListener;
|
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.uno.UnoRuntime;
|
||||||
import com.sun.star.util.CloseVetoException;
|
import com.sun.star.util.CloseVetoException;
|
||||||
import com.sun.star.util.XCloseListener;
|
import com.sun.star.util.XCloseListener;
|
||||||
import com.sun.star.util.XCloseable;
|
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
|
@Before
|
||||||
public void beforeTest() throws Exception
|
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
|
@After
|
||||||
|
@ -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();
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user