Removed unused tests

This commit is contained in:
Georgy Litvinov 2021-02-24 16:37:54 +01:00
parent b60088711e
commit b6a3aec8d7
5 changed files with 0 additions and 157 deletions

View file

@ -1,13 +0,0 @@
package org.libreoffice.example.comp.tests;
import org.junit.runner.RunWith;
import org.junit.runners.Suite.SuiteClasses;
import org.libreoffice.example.comp.tests.base.UnoSuite;
import org.libreoffice.example.comp.tests.uno.WriterTest;
@RunWith(UnoSuite.class)
@SuiteClasses({WriterTest.class})
public class UnoTests {
}

View file

@ -1,75 +0,0 @@
package org.libreoffice.example.comp.tests.base;
import java.util.List;
import org.junit.runner.Runner;
import org.junit.runner.notification.RunNotifier;
import org.junit.runners.Suite;
import org.junit.runners.model.InitializationError;
import org.junit.runners.model.RunnerBuilder;
import com.sun.star.frame.XDesktop;
import com.sun.star.lang.XMultiComponentFactory;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;
public class UnoSuite extends Suite {
private static XComponentContext componentContext;
public UnoSuite(Class<?> klass, RunnerBuilder builder) throws InitializationError {
super(klass, builder);
}
public UnoSuite(RunnerBuilder builder, Class<?>[] classes) throws InitializationError {
super(builder, classes);
}
public UnoSuite(Class<?> klass, Class<?>[] suiteClasses) throws InitializationError {
super(klass, suiteClasses);
}
public UnoSuite(Class<?> klass, List<Runner> runners) throws InitializationError {
super(klass, runners);
}
public UnoSuite(RunnerBuilder builder, Class<?> klass, Class<?>[] suiteClasses) throws InitializationError {
super(builder, klass, suiteClasses);
}
@Override
public void run(RunNotifier arg0) {
try {
startOffice();
} catch (Exception e) {
e.printStackTrace();
}
super.run(arg0);
stopOffice();
}
private void startOffice() throws Exception {
componentContext = com.sun.star.comp.helper.Bootstrap.bootstrap();
}
private void stopOffice() {
try {
if (componentContext != null) {
// Only the uno test suite which started the office can stop it
XMultiComponentFactory xMngr = componentContext.getServiceManager();
Object oDesktop = xMngr.createInstanceWithContext("com.sun.star.frame.Desktop", componentContext);
XDesktop xDesktop = (XDesktop)UnoRuntime.queryInterface(XDesktop.class, oDesktop);
xDesktop.terminate();
}
} catch (Exception e) {
e.printStackTrace();
}
}
public static XComponentContext getComponentContext() {
return componentContext;
}
}

View file

@ -1,28 +0,0 @@
package org.libreoffice.example.comp.tests.helper;
import com.sun.star.beans.PropertyValue;
import com.sun.star.frame.FrameSearchFlag;
import com.sun.star.frame.XComponentLoader;
import com.sun.star.lang.XComponent;
import com.sun.star.lang.XMultiComponentFactory;
import com.sun.star.text.XTextDocument;
import com.sun.star.uno.Exception;
import com.sun.star.uno.UnoRuntime;
import org.libreoffice.example.comp.tests.base.UnoSuite;
public class UnoHelper {
public static XTextDocument getWriterDocument() throws Exception {
XMultiComponentFactory xMngr = UnoSuite.getComponentContext().getServiceManager();
Object oDesktop = xMngr.createInstanceWithContext("com.sun.star.frame.Desktop", UnoSuite.getComponentContext());
XComponentLoader xLoader = (XComponentLoader)UnoRuntime.queryInterface(
XComponentLoader.class, oDesktop);
XComponent xDoc = xLoader.loadComponentFromURL("private:factory/swriter", "_default",
FrameSearchFlag.ALL, new PropertyValue[0]);
return (XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, xDoc);
}
}

View file

@ -1,26 +0,0 @@
package org.libreoffice.example.comp.tests.uno;
import static org.junit.Assert.assertNotNull;
import org.junit.Before;
import org.junit.Test;
import com.sun.star.text.XTextDocument;
import org.libreoffice.example.comp.tests.helper.UnoHelper;
public class WriterTest {
private XTextDocument xTextDocument;
@Before
public void setUp() throws Exception {
xTextDocument = UnoHelper.getWriterDocument();
}
@Test
public void test() {
assertNotNull(xTextDocument);
}
}

View file

@ -1,15 +0,0 @@
package w2phtml.rdf;
import static org.junit.Assert.*;
import org.junit.Test;
public class MetadataTests {
@Test
public void MetadataExists() {
Metadata tester = new Metadata();
}
}