summaryrefslogtreecommitdiff
path: root/extensions/qa
diff options
context:
space:
mode:
authorLars Langhans <lla@openoffice.org>2010-06-07 13:14:09 +0200
committerLars Langhans <lla@openoffice.org>2010-06-07 13:14:09 +0200
commit6c4b6d9b49a97c8098fc9bdfa6f03c7847c91fb9 (patch)
tree33e4ca859aef78f754db6837434156b69231be7c /extensions/qa
parent2e7323d28b9ca191905558a85187478f3ddfd2fd (diff)
sb123:#i111449# cleanups in extensions qa/complex tests
Diffstat (limited to 'extensions/qa')
-rw-r--r--extensions/qa/complex/extensions/OfficeResourceLoader.java84
-rw-r--r--extensions/qa/complex/extensions/makefile.mk59
2 files changed, 88 insertions, 55 deletions
diff --git a/extensions/qa/complex/extensions/OfficeResourceLoader.java b/extensions/qa/complex/extensions/OfficeResourceLoader.java
index d0b2f1db2db8..f28d04d3d438 100644
--- a/extensions/qa/complex/extensions/OfficeResourceLoader.java
+++ b/extensions/qa/complex/extensions/OfficeResourceLoader.java
@@ -26,6 +26,7 @@
************************************************************************/
package complex.extensions;
+import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.resource.XResourceBundle;
@@ -34,7 +35,15 @@ import com.sun.star.beans.XPropertySet;
import com.sun.star.uno.XComponentContext;
import com.sun.star.lang.Locale;
-public class OfficeResourceLoader extends complexlib.ComplexTestCase
+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 static org.junit.Assert.*;
+
+public class OfficeResourceLoader
{
XResourceBundleLoader m_loader;
XResourceBundle m_bundle;
@@ -45,37 +54,36 @@ public class OfficeResourceLoader extends complexlib.ComplexTestCase
}
/* ------------------------------------------------------------------ */
- public String[] getTestMethodNames()
- {
- return new String[] {
- "checkSimpleStringAccess",
- "checkLocales"
- };
- }
+// public String[] getTestMethodNames()
+// {
+// return new String[] {
+// "checkSimpleStringAccess",
+// "checkLocales"
+// };
+// }
/* ------------------------------------------------------------------ */
- public String getTestObjectName()
- {
- return "Extensions - OfficeResourceLoader";
- }
+// public String getTestObjectName()
+// {
+// return "Extensions - OfficeResourceLoader";
+// }
/* ------------------------------------------------------------------ */
- public void before() throws com.sun.star.uno.Exception, java.lang.Exception
+ @Before public void before() throws com.sun.star.uno.Exception, java.lang.Exception
{
- XPropertySet orb = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, param.getMSF() );
- XComponentContext context = (XComponentContext)UnoRuntime.queryInterface( XComponentContext.class,
- orb.getPropertyValue( "DefaultContext" ) );
+ XPropertySet orb = UnoRuntime.queryInterface(XPropertySet.class, getMSF());
+ XComponentContext context = UnoRuntime.queryInterface(XComponentContext.class, orb.getPropertyValue("DefaultContext"));
m_loader = com.sun.star.resource.OfficeResourceLoader.get( context );
}
/* ------------------------------------------------------------------ */
- public void after() throws com.sun.star.uno.Exception, java.lang.Exception
+ @After public void after() throws com.sun.star.uno.Exception, java.lang.Exception
{
}
/* ------------------------------------------------------------------ */
- public void checkSimpleStringAccess() throws com.sun.star.uno.Exception, java.lang.Exception
+ @Test public void checkSimpleStringAccess() throws com.sun.star.uno.Exception, java.lang.Exception
{
// default bundle (UI locale)
m_bundle = m_loader.loadBundle_Default( "orl" );
@@ -88,34 +96,62 @@ public class OfficeResourceLoader extends complexlib.ComplexTestCase
&& resourceLocale.Country.equals( "US" )
&& resourceLocale.Variant.equals( "" )
)
- assure( "invalid 'en-US' string", testString.equals( "Dummy String" ) );
+ {
+ assertTrue( "invalid 'en-US' string", testString.equals( "Dummy String" ) );
+ }
if ( resourceLocale.Language.equals( "de" )
&& resourceLocale.Country.equals( "" )
&& resourceLocale.Variant.equals( "" )
)
- assure( "invalid 'de' string", testString.equals( "Attrappen-Zeichenkette" ) );
+ {
+ assertTrue( "invalid 'de' string", testString.equals( "Attrappen-Zeichenkette" ) );
+ }
if ( resourceLocale.Language.equals( "" )
&& resourceLocale.Country.equals( "" )
&& resourceLocale.Variant.equals( "" )
)
- assure( "invalid unlocalized string", testString.equals( "unlocalized string" ) );
+ {
+ assertTrue( "invalid unlocalized string", testString.equals( "unlocalized string" ) );
+ }
}
/* ------------------------------------------------------------------ */
- public void checkLocales() throws com.sun.star.uno.Exception, java.lang.Exception
+ @Test public void checkLocales() throws com.sun.star.uno.Exception, java.lang.Exception
{
// en-US bundle (should always be built and thus present and thus found)
m_bundle = m_loader.loadBundle( "orl", new Locale( "en", "US", "" ) );
Locale resourceLocale = m_bundle.getLocale();
- assure( "'en-US' could not be loaded",
+ assertTrue( "'en-US' could not be loaded",
resourceLocale.Language.equals( "en" ) && resourceLocale.Country.equals( "US" ) && resourceLocale.Variant.equals( "" ) );
// some (invalid) locale which is usually no built, and should thus fallback to en-US
m_bundle = m_loader.loadBundle( "orl", new Locale( "inv", "al", "id" ) );
resourceLocale = m_bundle.getLocale();
- assure( "non-existing locale request does not fallback to en-US",
+ assertTrue( "non-existing locale request does not fallback to en-US",
resourceLocale.Language.equals( "en" ) && resourceLocale.Country.equals( "US" ) && resourceLocale.Variant.equals( "" ) );
}
+
+
+ private XMultiServiceFactory getMSF()
+ {
+ final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager());
+ return xMSF1;
+ }
+
+ // setup and close connections
+ @BeforeClass public static void setUpConnection() throws Exception {
+ System.out.println("setUpConnection()");
+ connection.setUp();
+ }
+
+ @AfterClass public static void tearDownConnection()
+ throws InterruptedException, com.sun.star.uno.Exception
+ {
+ System.out.println("tearDownConnection()");
+ connection.tearDown();
+ }
+
+ private static final OfficeConnection connection = new OfficeConnection();
}
diff --git a/extensions/qa/complex/extensions/makefile.mk b/extensions/qa/complex/extensions/makefile.mk
index 96c2afb40bf3..281960b32da9 100644
--- a/extensions/qa/complex/extensions/makefile.mk
+++ b/extensions/qa/complex/extensions/makefile.mk
@@ -25,12 +25,26 @@
#
#*************************************************************************
-PRJ = ..$/..$/..
-TARGET = ExtensionsComplexTests
+.IF "$(OOO_SUBSEQUENT_TESTS)" == ""
+nothing .PHONY:
+.ELSE
+
+PRJ = ../../..
PRJNAME = extensions
-PACKAGE = complex$/$(PRJNAME)
+TARGET = qa_complex_extensions
+
+.IF "$(OOO_JUNIT_JAR)" != ""
+PACKAGE = complex/extensions
+JAVATESTFILES = \
+ OfficeResourceLoader.java
+
+JAVAFILES = $(JAVATESTFILES)
+
+JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar jurt.jar ConnectivityTools.jar
+EXTRAJARFILES = $(OOO_JUNIT_JAR)
+.END
+
-RES_TARGET = orl
.IF "$(GUI)"=="WNT"
command_seperator=&&
@@ -38,11 +52,11 @@ command_seperator=&&
command_seperator=;
.ENDIF
-# --- Settings -----------------------------------------------------
-.INCLUDE : settings.mk
+.INCLUDE: settings.mk
#----- resource files for the OfficeResourceLoader test ------------
+RES_TARGET = orl
SRS1NAME=$(RES_TARGET)_A_
SRC1FILES= \
@@ -66,36 +80,19 @@ RES2FILELIST=\
RESLIB2NAME=$(RES_TARGET)_B_
RESLIB2SRSFILES=$(RES2FILELIST)
+.INCLUDE: target.mk
+.INCLUDE: installationtest.mk
-#----- compile .java files -----------------------------------------
-JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar ConnectivityTools.jar
-JAVAFILES = $(shell @$(FIND) .$/*.java)
-JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
-
-#----- make a jar from compiled files ------------------------------
-
-MAXLINELENGTH = 100000
-
-JARCLASSDIRS = $(PACKAGE)
-JARTARGET = $(TARGET).jar
-JARCOMPRESS = TRUE
-
-# --- Targets ------------------------------------------------------
-
-.INCLUDE : target.mk
+#----- resource files for the OfficeResourceLoader test ------------
-RUNNER_CLASSPATH = -cp $(CLASSPATH)$(PATH_SEPERATOR)$(SOLARBINDIR)$/OOoRunner.jar$(PATH_SEPERATOR)$(CLASSPATH)$(PATH_SEPERATOR)$(SOLARBINDIR)$/ConnectivityTools.jar
-RUNNER_ARGS = org.openoffice.Runner -TestBase java_complex
-run:copy_resources
- +java $(RUNNER_CLASSPATH) $(RUNNER_ARGS) -sce extensions_all.sce
+ALLTAR : copy_resources javatest
-run_%:copy_resources
- +java $(RUNNER_CLASSPATH) $(RUNNER_ARGS) -o complex.$(PRJNAME).$(@:s/run_//)
+copy_resources: $(RESLIB1TARGETN) $(RESLIB2TARGETN)
+ $(foreach,i,$(RESLIB1TARGETN) $(COPY) $i $(i:s/de/invalid/:s/_A_//) $(command_seperator)) echo
+ $(foreach,i,$(RESLIB2TARGETN) $(COPY) $i $(i:s/en-US/invalid/:s/_B_//) $(command_seperator)) echo
-copy_resources: $(RESLIB1TARGETN) $(RESLIB2TARGETN)
- @$(foreach,i,$(RESLIB1TARGETN) $(COPY) $i $(i:s/de/invalid/:s/_A_//) $(command_seperator)) echo.
- @$(foreach,i,$(RESLIB2TARGETN) $(COPY) $i $(i:s/en-US/invalid/:s/_B_//) $(command_seperator)) echo.
+.END