summaryrefslogtreecommitdiff
path: root/javaunohelper/test/com/sun
diff options
context:
space:
mode:
authorRobert Antoni Buj i Gelonch <robert.buj@gmail.com>2014-09-21 13:50:27 +0200
committerChris Sherlock <chris.sherlock79@gmail.com>2014-09-21 12:15:42 +0000
commit6c87571125fbddf4215160f07894b7063f834b34 (patch)
tree46efa995cdd5bb8a79c92cc03e468fb0069aaf8f /javaunohelper/test/com/sun
parent8a5ffa063a7edc78f9c75e9dc3490108732435e5 (diff)
javaunohelper: use java.util.logging in tests
Change-Id: Icdc61dc88a11afae5257bcddda32adb691cb5883 Reviewed-on: https://gerrit.libreoffice.org/11564 Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com> Tested-by: Chris Sherlock <chris.sherlock79@gmail.com>
Diffstat (limited to 'javaunohelper/test/com/sun')
-rw-r--r--javaunohelper/test/com/sun/star/comp/helper/Bootstrap_Test.java21
-rw-r--r--javaunohelper/test/com/sun/star/lib/uno/helper/ComponentBase_Test.java40
-rw-r--r--javaunohelper/test/com/sun/star/lib/uno/helper/InterfaceContainer_Test.java197
-rw-r--r--javaunohelper/test/com/sun/star/lib/uno/helper/MultiTypeInterfaceContainer_Test.java69
-rw-r--r--javaunohelper/test/com/sun/star/lib/uno/helper/PropertySet_Test.java104
-rw-r--r--javaunohelper/test/com/sun/star/lib/uno/helper/WeakBase_Test.java38
6 files changed, 168 insertions, 301 deletions
diff --git a/javaunohelper/test/com/sun/star/comp/helper/Bootstrap_Test.java b/javaunohelper/test/com/sun/star/comp/helper/Bootstrap_Test.java
index 57724be79300..184515d47d8b 100644
--- a/javaunohelper/test/com/sun/star/comp/helper/Bootstrap_Test.java
+++ b/javaunohelper/test/com/sun/star/comp/helper/Bootstrap_Test.java
@@ -25,18 +25,19 @@ import com.sun.star.uno.XComponentContext;
import com.sun.star.lang.XComponent;
import com.sun.star.lang.XMultiServiceFactory;
+import java.util.logging.Logger;
+import java.util.logging.Level;
import java.util.Map;
public class Bootstrap_Test {
+ private static final Logger logger = Logger.getLogger(Bootstrap_Test.class.getName());
+
static public boolean test( String ini_file, Map<String,String> bootstrap_parameters )
throws java.lang.Exception
{
boolean passed = false;
- System.err.println();
- System.out.println("*******************************************************************");
- System.err.println("Bootstrap - doing tests...");
- System.err.println();
+ logger.log(Level.INFO, "Bootstrap - doing tests...");
try {
XComponentContext xContext =
@@ -54,14 +55,13 @@ public class Bootstrap_Test {
XMultiServiceFactory msf = UnoRuntime.queryInterface(
XMultiServiceFactory.class, xContext.getServiceManager() );
String services[] = msf.getAvailableServiceNames();
- System.out.println("Available services are:");
- System.err.println();
+ logger.log(Level.FINE, "Available services are:");
if (services.length == 0)
- System.out.println("No services avialable!");
+ logger.log(Level.FINE, "No services avialable!");
else
for ( int i=0; i<services.length; i++ )
- System.out.println(services[i]);
+ logger.log(Level.FINE, services[i]);
XComponent xComp = UnoRuntime.queryInterface(
XComponent.class, xContext );
@@ -72,10 +72,7 @@ public class Bootstrap_Test {
catch (Exception e) {
e.printStackTrace();
}
- System.err.println();
- System.err.println("Bootstrap test passed? " + passed);
- System.out.println("*******************************************************************");
- System.err.println();
+ logger.log(Level.INFO, "Bootstrap test passed? " + passed);
return passed;
}
diff --git a/javaunohelper/test/com/sun/star/lib/uno/helper/ComponentBase_Test.java b/javaunohelper/test/com/sun/star/lib/uno/helper/ComponentBase_Test.java
index 5afc6385ea5d..7bf048415933 100644
--- a/javaunohelper/test/com/sun/star/lib/uno/helper/ComponentBase_Test.java
+++ b/javaunohelper/test/com/sun/star/lib/uno/helper/ComponentBase_Test.java
@@ -17,13 +17,18 @@
*/
package com.sun.star.lib.uno.helper;
+
import com.sun.star.uno.XWeak;
import com.sun.star.lang.XTypeProvider;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.lang.XEventListener;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
public class ComponentBase_Test
{
+ private static final Logger logger = Logger.getLogger(ComponentBase_Test.class.getName());
AWeakBase obj1, obj2, obj3;
Object proxyObj1Weak1;
Object proxyObj3Weak1;
@@ -46,12 +51,12 @@ public class ComponentBase_Test
public boolean dispose()
{
- System.out.println("Testing ComponentBase");
+ logger.log(Level.INFO, "Testing ComponentBase");
ComponentBase comp= new ComponentBase();
boolean r[]= new boolean[50];
int i= 0;
- // addEventListener
+ logger.log(Level.FINE, "addEventListener");
comp.addEventListener(obj1);
comp.addEventListener(obj2);
comp.addEventListener(obj3);
@@ -66,11 +71,13 @@ public class ComponentBase_Test
r[i++]= obj1.nDisposingCalled == 1;
r[i++]= obj2.nDisposingCalled == 1;
r[i++]= obj3.nDisposingCalled == 1;
- // adding a listener after dispose, causes a immediate call to the listerner
+
+ logger.log(Level.FINE, "Adding a listener after dispose, causes a immediate call to the listerner.");
obj1.nDisposingCalled= 0;
comp.addEventListener(obj1);
r[i++]= obj1.nDisposingCalled == 1;
- //calling dispose again must not notify the listeners again
+
+ logger.log(Level.FINE, "Calling dispose again must not notify the listeners again.");
obj1.nDisposingCalled= 0;
obj2.nDisposingCalled= 0;
obj3.nDisposingCalled= 0;
@@ -80,16 +87,13 @@ public class ComponentBase_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if (!bOk)
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
public boolean test_finalize()
{
- System.out.println("Testing ComponentBase");
+ logger.log(Level.INFO, "Testing ComponentBase");
ComponentBase comp= new ComponentBase();
boolean r[]= new boolean[50];
int i= 0;
@@ -97,7 +101,7 @@ public class ComponentBase_Test
comp.addEventListener(obj1);
comp= null;
- System.out.println("Waiting 10s");
+ logger.log(Level.FINE, "Waiting 10s");
for(int c= 0; c < 100; c++)
{
try
@@ -114,10 +118,7 @@ public class ComponentBase_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if (!bOk)
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
@@ -133,12 +134,7 @@ public class ComponentBase_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if (!bOk)
- System.out.println("Errors occurred!");
- else
- System.out.println("No errors.");
-
+ logger.log(Level.INFO, bOk ? "No errors." : "Errors occurred!");
+ System.exit( bOk ? 0: -1 );
}
-
-}
-
+} \ No newline at end of file
diff --git a/javaunohelper/test/com/sun/star/lib/uno/helper/InterfaceContainer_Test.java b/javaunohelper/test/com/sun/star/lib/uno/helper/InterfaceContainer_Test.java
index e76825e245d8..e3523145ef5d 100644
--- a/javaunohelper/test/com/sun/star/lib/uno/helper/InterfaceContainer_Test.java
+++ b/javaunohelper/test/com/sun/star/lib/uno/helper/InterfaceContainer_Test.java
@@ -18,16 +18,20 @@
package com.sun.star.lib.uno.helper;
-import java.util.Iterator;
-import java.util.ListIterator;
import com.sun.star.uno.XWeak;
import com.sun.star.lang.XTypeProvider;
-import java.util.ArrayList;
import com.sun.star.lib.uno.environments.java.java_environment;
+
+import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
+import java.util.ListIterator;
+import java.util.logging.Level;
+import java.util.logging.Logger;
public class InterfaceContainer_Test
{
+ private static final Logger logger = Logger.getLogger(InterfaceContainer_Test.class.getName());
java_environment env= new java_environment(null);
/** Creates a new instance of InterfaceContainerTest */
AWeakBase obj1,obj2,obj3,obj4;
@@ -74,7 +78,7 @@ public class InterfaceContainer_Test
*/
public boolean add()
{
- System.out.println("Testing List.add(Object), List.size(), List.clear(), List.isEmpty()");
+ logger.log(Level.INFO, "Testing List.add(Object), List.size(), List.clear(), List.isEmpty()");
InterfaceContainer cont= new InterfaceContainer();
boolean r[]= new boolean[50];
int i= 0;
@@ -94,10 +98,7 @@ public class InterfaceContainer_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if (!bOk)
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
@@ -105,7 +106,7 @@ public class InterfaceContainer_Test
*/
public boolean listConstructors()
{
- System.out.println("Testing Constructors of InterfaceContainer");
+ logger.log(Level.INFO, "Testing Constructors of InterfaceContainer");
boolean r[]= new boolean[50];
int i= 0;
InterfaceContainer cont= new InterfaceContainer(100);
@@ -114,15 +115,12 @@ public class InterfaceContainer_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if (!bOk)
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
public boolean trimToSize()
{
- System.out.println("Testing InterfaceContainer.trimToSize");
+ logger.log(Level.INFO, "Testing InterfaceContainer.trimToSize");
InterfaceContainer cont= new InterfaceContainer(100);
boolean r[]= new boolean[50];
int i= 0;
@@ -135,15 +133,12 @@ public class InterfaceContainer_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if (!bOk)
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
public boolean ensureCapacity()
{
- System.out.println("Testing InterfaceContainer.ensureCapacity");
+ logger.log(Level.INFO, "Testing InterfaceContainer.ensureCapacity");
InterfaceContainer cont= new InterfaceContainer(10);
boolean r[]= new boolean[50];
int i= 0;
@@ -155,16 +150,13 @@ public class InterfaceContainer_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if (!bOk)
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
public boolean addAll()
{
- System.out.println("Testing List.addAll(Collection c), List.addAll(int index, Collection c)");
+ logger.log(Level.INFO, "Testing List.addAll(Collection c), List.addAll(int index, Collection c)");
InterfaceContainer cont= new InterfaceContainer();
boolean r[]= new boolean[50];
int i= 0;
@@ -194,10 +186,7 @@ public class InterfaceContainer_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if (!bOk)
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
@@ -205,7 +194,7 @@ public class InterfaceContainer_Test
*/
public boolean get()
{
- System.out.println("Testing List.add(int index, Object element), List.get(int index)");
+ logger.log(Level.INFO, "Testing List.add(int index, Object element), List.get(int index)");
InterfaceContainer cont= new InterfaceContainer();
boolean r[]= new boolean[50];
int i= 0;
@@ -229,17 +218,14 @@ public class InterfaceContainer_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if (!bOk)
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
/** Tests List.contains
*/
public boolean contains()
{
- System.out.println("Testing List.contains()");
+ logger.log(Level.INFO, "Testing List.contains()");
InterfaceContainer cont= new InterfaceContainer();
boolean r[]= new boolean[50];
int i= 0;
@@ -259,17 +245,14 @@ public class InterfaceContainer_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if ( ! bOk )
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
/** Tests List.containsAll
*/
public boolean containsAll()
{
- System.out.println("Testing List.containsAll");
+ logger.log(Level.INFO, "Testing List.containsAll");
InterfaceContainer cont= new InterfaceContainer();
boolean r[]= new boolean[50];
int i= 0;
@@ -293,17 +276,14 @@ public class InterfaceContainer_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if ( ! bOk )
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
/** Tests List.indexOf, List.lastIndexOf
*/
public boolean indexOf()
{
- System.out.println("Testing List.indexOf(Object element), List.lastIndexOf(Object element)");
+ logger.log(Level.INFO, "Testing List.indexOf(Object element), List.lastIndexOf(Object element)");
InterfaceContainer cont= new InterfaceContainer();
boolean r[]= new boolean[50];
int i= 0;
@@ -320,10 +300,7 @@ public class InterfaceContainer_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if ( ! bOk )
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
@@ -331,7 +308,7 @@ public class InterfaceContainer_Test
*/
public boolean remove()
{
- System.out.println("Testing List.remove(int index), List.remove(Object element), List.removeAll(Collection c)");
+ logger.log(Level.INFO, "Testing List.remove(int index), List.remove(Object element), List.removeAll(Collection c)");
InterfaceContainer cont= new InterfaceContainer();
boolean r[]= new boolean[50];
int i= 0;
@@ -361,10 +338,7 @@ public class InterfaceContainer_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if ( ! bOk )
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
@@ -372,7 +346,7 @@ public class InterfaceContainer_Test
*/
public boolean retainAll()
{
- System.out.println("Testing List.retainAll(Collection c)");
+ logger.log(Level.INFO, "Testing List.retainAll(Collection c)");
InterfaceContainer cont= new InterfaceContainer();
boolean r[]= new boolean[50];
int i= 0;
@@ -393,10 +367,7 @@ public class InterfaceContainer_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if ( ! bOk )
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
@@ -404,7 +375,7 @@ public class InterfaceContainer_Test
**/
public boolean set()
{
- System.out.println("Testing List.set(int index, Object element)");
+ logger.log(Level.INFO, "Testing List.set(int index, Object element)");
boolean r[]= new boolean[50];
int i= 0;
InterfaceContainer cont= new InterfaceContainer();
@@ -419,10 +390,7 @@ public class InterfaceContainer_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if ( ! bOk )
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
@@ -430,7 +398,7 @@ public class InterfaceContainer_Test
*/
public boolean toArray()
{
- System.out.println("Testing List.toArray(), List.toArray(Object[] a)");
+ logger.log(Level.INFO, "Testing List.toArray(), List.toArray(Object[] a)");
InterfaceContainer cont= new InterfaceContainer();
boolean r[]= new boolean[50];
int i= 0;
@@ -457,16 +425,13 @@ public class InterfaceContainer_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if ( ! bOk )
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
public boolean Iterator_next()
{
- System.out.println("Testing InterfaceContainer.iterator, Iterator.next()");
+ logger.log(Level.INFO, "Testing InterfaceContainer.iterator, Iterator.next()");
InterfaceContainer cont= new InterfaceContainer();
boolean r[]= new boolean[50];
int i= 0;
@@ -490,16 +455,13 @@ public class InterfaceContainer_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if ( ! bOk )
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
public boolean Iterator_hasNext()
{
- System.out.println("Testing, Iterator.next()");
+ logger.log(Level.INFO, "Testing, Iterator.next()");
InterfaceContainer cont= new InterfaceContainer();
boolean r[]= new boolean[50];
int i= 0;
@@ -519,16 +481,13 @@ public class InterfaceContainer_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if ( ! bOk )
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
public boolean Iterator_remove()
{
- System.out.println("Testing, Iterator.remove()");
+ logger.log(Level.INFO, "Testing, Iterator.remove()");
InterfaceContainer cont= new InterfaceContainer();
boolean r[]= new boolean[50];
int i= 0;
@@ -599,15 +558,13 @@ public class InterfaceContainer_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if ( ! bOk )
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
+
public boolean ListIterator_next()
{
- System.out.println("Testing InterfaceContainer.listIerator, ListIterator.next()");
+ logger.log(Level.INFO, "Testing InterfaceContainer.listIerator, ListIterator.next()");
InterfaceContainer cont= new InterfaceContainer();
boolean r[]= new boolean[50];
int i= 0;
@@ -631,16 +588,13 @@ public class InterfaceContainer_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if ( ! bOk )
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
public boolean ListIterator_hasNext()
{
- System.out.println("Testing ListIterator.hasNext()");
+ logger.log(Level.INFO, "Testing ListIterator.hasNext()");
InterfaceContainer cont= new InterfaceContainer();
boolean r[]= new boolean[50];
int i= 0;
@@ -660,16 +614,13 @@ public class InterfaceContainer_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if ( ! bOk )
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
public boolean ListIterator_remove()
{
- System.out.println("Testing ListIterator.remove()");
+ logger.log(Level.INFO, "Testing ListIterator.remove()");
InterfaceContainer cont= new InterfaceContainer();
boolean r[]= new boolean[50];
int i= 0;
@@ -740,16 +691,13 @@ public class InterfaceContainer_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if ( ! bOk )
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
public boolean ListIterator_hasPrevious()
{
- System.out.println("Testing ListIterator.hasPrevious()");
+ logger.log(Level.INFO, "Testing ListIterator.hasPrevious()");
InterfaceContainer cont= new InterfaceContainer();
boolean r[]= new boolean[50];
int i= 0;
@@ -767,16 +715,13 @@ public class InterfaceContainer_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if ( ! bOk )
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
public boolean ListIterator_previous()
{
- System.out.println("Testing ListIterator.previous()");
+ logger.log(Level.INFO, "Testing ListIterator.previous()");
InterfaceContainer cont= new InterfaceContainer();
boolean r[]= new boolean[50];
int i= 0;
@@ -807,16 +752,13 @@ public class InterfaceContainer_Test
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if ( ! bOk )
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
public boolean ListIterator_nextIndex()
{
- System.out.println("Testing ListIterator.nextIndex()");
+ logger.log(Level.INFO, "Testing ListIterator.nextIndex()");
InterfaceContainer cont= new InterfaceContainer();
boolean r[]= new boolean[50];
int i= 0;
@@ -833,15 +775,12 @@ public class InterfaceContainer_Test
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if ( ! bOk )
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
public boolean ListIterator_previousIndex()
{
- System.out.println("Testing ListIterator.previousIndex()");
+ logger.log(Level.INFO, "Testing ListIterator.previousIndex()");
InterfaceContainer cont= new InterfaceContainer();
boolean r[]= new boolean[50];
int i= 0;
@@ -862,15 +801,12 @@ public class InterfaceContainer_Test
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if ( ! bOk )
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
public boolean ListIterator_add()
{
- System.out.println("Testing ListIterator.add()");
+ logger.log(Level.INFO, "Testing ListIterator.add()");
InterfaceContainer cont= new InterfaceContainer();
boolean r[]= new boolean[50];
int i= 0;
@@ -888,16 +824,13 @@ public class InterfaceContainer_Test
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if ( ! bOk )
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
public boolean disposeAndClear()
{
- System.out.println("Testing InterfaceContainer.disposeAndClear");
+ logger.log(Level.INFO, "Testing InterfaceContainer.disposeAndClear");
InterfaceContainer cont= new InterfaceContainer(10);
boolean r[]= new boolean[50];
int i= 0;
@@ -907,7 +840,7 @@ public class InterfaceContainer_Test
cont.add(obj3);
cont.add(proxyObj1Weak1);
cont.add(proxyObj3TypeProv);
- System.out.println("Two proxies are called. Check the output:");
+ logger.log(Level.FINE, "Two proxies are called. Check the output:");
cont.disposeAndClear(new com.sun.star.lang.EventObject());
r[i++]= obj1.nDisposingCalled == 1;
r[i++]= obj2.nDisposingCalled == 1;
@@ -915,10 +848,7 @@ public class InterfaceContainer_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if (!bOk)
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
@@ -956,11 +886,8 @@ public class InterfaceContainer_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if ( ! bOk )
- System.out.println("Test finished.\nErrors occurred!!!");
- else
- System.out.println("Test finished. \nNo errors.");
-
+ logger.log(Level.INFO, "Test finished.");
+ logger.log(Level.INFO, bOk ? "No errors." : "Errors occurred!!!");
+ System.exit( bOk ? 0: -1 );
}
-
}
diff --git a/javaunohelper/test/com/sun/star/lib/uno/helper/MultiTypeInterfaceContainer_Test.java b/javaunohelper/test/com/sun/star/lib/uno/helper/MultiTypeInterfaceContainer_Test.java
index 22e664170486..6f805d574b43 100644
--- a/javaunohelper/test/com/sun/star/lib/uno/helper/MultiTypeInterfaceContainer_Test.java
+++ b/javaunohelper/test/com/sun/star/lib/uno/helper/MultiTypeInterfaceContainer_Test.java
@@ -17,16 +17,22 @@
*/
package com.sun.star.lib.uno.helper;
-import java.util.List;
-import com.sun.star.uno.XWeak;
+
+import com.sun.star.lang.XSingleComponentFactory;
import com.sun.star.lang.XTypeProvider;
-import java.util.ArrayList;
+
+import com.sun.star.uno.XWeak;
import com.sun.star.uno.Type;
import com.sun.star.uno.XInterface;
-import com.sun.star.lang.XSingleComponentFactory;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
public class MultiTypeInterfaceContainer_Test
{
+ private static final Logger logger = Logger.getLogger(MultiTypeInterfaceContainer_Test.class.getName());
/** Creates a new instance of InterfaceContainerTest */
AWeakBase obj1,obj2,obj3,obj4;
Object proxyObj1Weak1;
@@ -72,7 +78,7 @@ public class MultiTypeInterfaceContainer_Test
public boolean addInterface()
{
- System.out.println("Testing MultiTypeInterfaceContainer.addInterface");
+ logger.log(Level.INFO, "Testing MultiTypeInterfaceContainer.addInterface");
MultiTypeInterfaceContainer cont= new MultiTypeInterfaceContainer();
boolean r[]= new boolean[200];
int i= 0;
@@ -107,16 +113,13 @@ public class MultiTypeInterfaceContainer_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if (!bOk)
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
public boolean getContainedTypes()
{
- System.out.println("Testing MultiTypeInterfaceContainer.getContainedTypes");
+ logger.log(Level.INFO, "Testing MultiTypeInterfaceContainer.getContainedTypes");
MultiTypeInterfaceContainer cont= new MultiTypeInterfaceContainer();
boolean r[]= new boolean[50];
int i= 0;
@@ -153,16 +156,13 @@ public class MultiTypeInterfaceContainer_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if (!bOk)
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
public boolean getContainer()
{
- System.out.println("Testing MultiTypeInterfaceContainer.getContainedTypes");
+ logger.log(Level.INFO, "Testing MultiTypeInterfaceContainer.getContainedTypes");
MultiTypeInterfaceContainer cont= new MultiTypeInterfaceContainer();
boolean r[]= new boolean[50];
int i= 0;
@@ -186,16 +186,13 @@ public class MultiTypeInterfaceContainer_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if (!bOk)
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
public boolean removeInterface()
{
- System.out.println("Testing MultiTypeInterfaceContainer.removeInterface");
+ logger.log(Level.INFO, "Testing MultiTypeInterfaceContainer.removeInterface");
MultiTypeInterfaceContainer cont= new MultiTypeInterfaceContainer();
boolean r[]= new boolean[50];
int i= 0;
@@ -221,16 +218,13 @@ public class MultiTypeInterfaceContainer_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if (!bOk)
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
public boolean clear()
{
- System.out.println("Testing MultiTypeInterfaceContainer.clear");
+ logger.log(Level.INFO, "Testing MultiTypeInterfaceContainer.clear");
MultiTypeInterfaceContainer cont= new MultiTypeInterfaceContainer();
boolean r[]= new boolean[50];
int i= 0;
@@ -254,16 +248,13 @@ public class MultiTypeInterfaceContainer_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if (!bOk)
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
public boolean disposeAndClear()
{
- System.out.println("Testing MultiTypeInterfaceContainer.disposeAndClear");
+ logger.log(Level.INFO, "Testing MultiTypeInterfaceContainer.disposeAndClear");
MultiTypeInterfaceContainer cont= new MultiTypeInterfaceContainer();
boolean r[]= new boolean[50];
int i= 0;
@@ -288,10 +279,7 @@ public class MultiTypeInterfaceContainer_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if (!bOk)
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
@@ -310,13 +298,8 @@ public class MultiTypeInterfaceContainer_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if ( ! bOk )
- System.out.println("Test finished.\nErrors occurred!!!");
- else
- System.out.println("Test finished. \nNo errors.");
-
+ logger.log(Level.INFO, "Test finished.");
+ logger.log(Level.INFO, bOk ? "No errors." : "Errors occurred!!!");
+ System.exit( bOk ? 0: -1 );
}
-}
-
-
-
+} \ No newline at end of file
diff --git a/javaunohelper/test/com/sun/star/lib/uno/helper/PropertySet_Test.java b/javaunohelper/test/com/sun/star/lib/uno/helper/PropertySet_Test.java
index 6893bd19e57f..88956b7f88b3 100644
--- a/javaunohelper/test/com/sun/star/lib/uno/helper/PropertySet_Test.java
+++ b/javaunohelper/test/com/sun/star/lib/uno/helper/PropertySet_Test.java
@@ -17,6 +17,7 @@
*/
package com.sun.star.lib.uno.helper;
+
import com.sun.star.lang.EventObject;
import com.sun.star.lang.DisposedException;
import com.sun.star.uno.Type;
@@ -34,12 +35,17 @@ import com.sun.star.beans.XVetoableChangeListener;
import com.sun.star.beans.XPropertySetInfo;
import com.sun.star.beans.XPropertiesChangeListener;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
public class PropertySet_Test
{
+ private static final Logger logger = Logger.getLogger(PropertySet_Test.class.getName());
+
public boolean convertPropertyValue()
{
- System.out.println("PropertySet.convertPropertyValue");
+ logger.log(Level.INFO, "PropertySet.convertPropertyValue");
boolean[] r= new boolean[50];
int i= 0;
@@ -52,16 +58,13 @@ public class PropertySet_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if (!bOk)
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
public boolean setPropertyValueNoBroadcast()
{
- System.out.println("PropertySet.setValueNoBroadcast");
+ logger.log(Level.INFO, "PropertySet.setValueNoBroadcast");
boolean[] r= new boolean[50];
int i= 0;
@@ -74,16 +77,13 @@ public class PropertySet_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if (!bOk)
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
public boolean setPropertyValue()
{
- System.out.println("PropertySet.setPropertyValue");
+ logger.log(Level.INFO, "PropertySet.setPropertyValue");
boolean[] r= new boolean[150];
int i= 0;
@@ -576,20 +576,17 @@ public class PropertySet_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if (!bOk)
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
public boolean addPropertyChangeListener()
{
- System.out.println("PropertySet.addPropertyChangeListener,\n" +
- "PropertySet.removePropertChangeListener," +
- "PropertySet.addVetoableChangeListener, \n" +
- "PropertySet.removeVetoableChangeListener" +
- "Notification of listeners");
+ logger.log(Level.INFO, "PropertySet.addPropertyChangeListener,\n" +
+ "PropertySet.removePropertChangeListener," +
+ "PropertySet.addVetoableChangeListener, \n" +
+ "PropertySet.removeVetoableChangeListener" +
+ "Notification of listeners");
boolean[] r= new boolean[50];
int i= 0;
try {
@@ -771,16 +768,13 @@ public class PropertySet_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if (!bOk)
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
public boolean getPropertySetInfo()
{
- System.out.println("PropertySet.getPropertySetInfo");
+ logger.log(Level.INFO, "PropertySet.getPropertySetInfo");
boolean[] r= new boolean[50];
int i= 0;
@@ -823,16 +817,13 @@ public class PropertySet_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if (!bOk)
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
public boolean setFastPropertyValue()
{
- System.out.println("PropertySet.setFastPropertyValue");
+ logger.log(Level.INFO, "PropertySet.setFastPropertyValue");
boolean[] r= new boolean[50];
int i= 0;
@@ -854,16 +845,13 @@ public class PropertySet_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if (!bOk)
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
public boolean getFastPropertyValue()
{
- System.out.println("PropertySet.setFastPropertyValue");
+ logger.log(Level.INFO, "PropertySet.setFastPropertyValue");
boolean[] r= new boolean[50];
int i= 0;
@@ -880,16 +868,13 @@ public class PropertySet_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if (!bOk)
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
public boolean setPropertyValues()
{
- System.out.println("PropertySet.setPropertyValues");
+ logger.log(Level.INFO, "PropertySet.setPropertyValues");
boolean[] r= new boolean[50];
int i= 0;
@@ -915,16 +900,13 @@ public class PropertySet_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if (!bOk)
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
public boolean getPropertyValues()
{
- System.out.println("PropertySet.getPropertyValues");
+ logger.log(Level.INFO, "PropertySet.getPropertyValues");
boolean[] r= new boolean[50];
int i= 0;
@@ -944,10 +926,7 @@ public class PropertySet_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if (!bOk)
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
@@ -955,9 +934,9 @@ public class PropertySet_Test
// The property names in the first argument are ignored.
public boolean addPropertiesChangeListener()
{
- System.out.println("PropertySet.addPropertiesChangeListener\n" +
- "PropertySet.removePropertiesChangeListener\n" +
- "notification of such listeners");
+ logger.log(Level.INFO, "PropertySet.addPropertiesChangeListener\n" +
+ "PropertySet.removePropertiesChangeListener\n" +
+ "notification of such listeners");
boolean[] r= new boolean[50];
int i= 0;
@@ -986,16 +965,13 @@ public class PropertySet_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if (!bOk)
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
public boolean firePropertiesChangeEvent()
{
- System.out.println("PropertySet.firePropertiesChangeEvent");
+ logger.log(Level.INFO, "PropertySet.firePropertiesChangeEvent");
boolean[] r= new boolean[50];
int i= 0;
@@ -1020,10 +996,7 @@ public class PropertySet_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if (!bOk)
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
@@ -1060,15 +1033,13 @@ public class PropertySet_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if (!bOk)
- System.out.println("Errors occurred!");
- else
- System.out.println("No errors.");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
+
public static void main(String[] args)
{
- test();
+ System.exit( test() ? 0: -1 );
}
}
@@ -1469,7 +1440,6 @@ class TestClass2 extends PropertySet
boolean test_registerProperty1()
{
- System.out.println("registerProperty Test 1");
boolean r[]= new boolean[50];
int i= 0;
diff --git a/javaunohelper/test/com/sun/star/lib/uno/helper/WeakBase_Test.java b/javaunohelper/test/com/sun/star/lib/uno/helper/WeakBase_Test.java
index 3d36c763b10a..db86e57c4f72 100644
--- a/javaunohelper/test/com/sun/star/lib/uno/helper/WeakBase_Test.java
+++ b/javaunohelper/test/com/sun/star/lib/uno/helper/WeakBase_Test.java
@@ -17,6 +17,7 @@
*/
package com.sun.star.lib.uno.helper;
+
import com.sun.star.uno.Type;
import com.sun.star.bridge.XBridgeSupplier2;
import com.sun.star.uno.XReference;
@@ -24,12 +25,17 @@ import com.sun.star.uno.XWeak;
import com.sun.star.lang.XTypeProvider;
import com.sun.star.uno.XAdapter;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
public class WeakBase_Test
{
+ private static final Logger logger = Logger.getLogger(WeakBase_Test.class.getName());
+
public boolean getTypes()
{
- System.out.println("Testing WeakBase.getTypes");
+ logger.log(Level.INFO, "Testing WeakBase.getTypes");
boolean[] r= new boolean[50];
int i= 0;
@@ -60,16 +66,13 @@ public class WeakBase_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if (!bOk)
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
public boolean getImplementationId()
{
- System.out.println("Testing WeakBase.getImplementationId");
+ logger.log(Level.INFO, "Testing WeakBase.getImplementationId");
boolean[] r= new boolean[50];
int i= 0;
@@ -94,16 +97,13 @@ public class WeakBase_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if (!bOk)
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
public boolean queryAdapter()
{
- System.out.println("Testing WeakBase.queryAdapter, XAdapter tests");
+ logger.log(Level.INFO, "Testing WeakBase.queryAdapter, XAdapter tests");
boolean[] r= new boolean[50];
int i= 0;
@@ -116,7 +116,7 @@ public class WeakBase_Test
r[i++]= adapter.queryAdapted() == comp;
comp= null;
- System.out.println("Wait 5 sec");
+ logger.log(Level.FINE, "Wait 5 sec");
for(int c= 0; c < 50; c++)
{
try
@@ -144,7 +144,7 @@ public class WeakBase_Test
adapter.addReference(aRef2);
adapter.removeReference(aRef1);
- System.out.println("Wait 5 sec");
+ logger.log(Level.FINE, "Wait 5 sec");
comp= null;
for(int c= 0; c < 50; c++)
{
@@ -163,10 +163,7 @@ public class WeakBase_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if (!bOk)
- System.out.println("Failed");
- else
- System.out.println("Ok");
+ logger.log(Level.INFO, bOk ? "Ok" : "Failed");
return bOk;
}
@@ -182,11 +179,8 @@ public class WeakBase_Test
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
- if (!bOk)
- System.out.println("Errors occurred!");
- else
- System.out.println("No errors.");
-
+ logger.log(Level.INFO, bOk ? "No errors." : "Errors occurred!");
+ System.exit( bOk ? 0: -1 );
}
}