summaryrefslogtreecommitdiff
path: root/filter/qa
diff options
context:
space:
mode:
authorSander Vesik <svesik@openoffice.org>2004-04-21 10:57:10 +0000
committerSander Vesik <svesik@openoffice.org>2004-04-21 10:57:10 +0000
commit186ef43a6562032d4974bb4fafe75d64e4f71828 (patch)
tree05e1ae9d02ccfc0313a13b9a0e5465c04ec57951 /filter/qa
parent4062c06750b675618ca5cec44cf6586688f8f7b9 (diff)
INTEGRATION: CWS loadenv01 (1.2.28); FILE MERGED
2004/04/19 14:13:25 cn 1.2.28.1: #i24378# test checkStreamLoader() added
Diffstat (limited to 'filter/qa')
-rw-r--r--filter/qa/complex/filter/detection/typeDetection/TypeDetection.java74
1 files changed, 69 insertions, 5 deletions
diff --git a/filter/qa/complex/filter/detection/typeDetection/TypeDetection.java b/filter/qa/complex/filter/detection/typeDetection/TypeDetection.java
index c7f7585112bb..f160d26b1581 100644
--- a/filter/qa/complex/filter/detection/typeDetection/TypeDetection.java
+++ b/filter/qa/complex/filter/detection/typeDetection/TypeDetection.java
@@ -2,9 +2,9 @@
*
* $RCSfile: TypeDetection.java,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Date: 2004-01-28 14:59:10 $
+ * last change: $Date: 2004-04-21 11:57:10 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -58,7 +58,6 @@
*
*
************************************************************************/
-
package complex.filter.detection.typeDetection;
import com.sun.star.beans.PropertyValue;
@@ -69,6 +68,7 @@ import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XInterface;
import complexlib.ComplexTestCase;
+import java.io.File;
import java.util.Enumeration;
import java.util.Hashtable;
@@ -234,7 +234,10 @@ public class TypeDetection extends ComplexTestCase {
return new String[]{"checkByURLonly",
"checkPreselectedType",
"checkPreselectedFilter",
- "checkPreselectedDocService"};
+ "checkPreselectedDocService",
+ "checkStreamLoader",
+ "checkStreamLoader"};
+
}
/** Create the environment for following tests.
@@ -260,7 +263,11 @@ public class TypeDetection extends ComplexTestCase {
m_xDetection = (XTypeDetection)
UnoRuntime.queryInterface(XTypeDetection.class, oInterface);
-
+ Enumeration k = param.keys();
+ while (k.hasMoreElements()){
+ String kName = ((String)k.nextElement()).toString();
+ log.println(kName + ":" + param.get(kName).toString());
+ }
// create instrace of helper class
helper = new Helper(param, log);
@@ -525,5 +532,62 @@ public class TypeDetection extends ComplexTestCase {
}
}
+ public void checkStreamLoader(){
+ try{
+
+ /*
+ *als Dateien die typeDetection.props und eine der csv-Dateien
+ *benutzten. diese knnen per dmake einfach auf andere Rechte setzten
+ *
+ */
+ log.println("### checkStreamLoader() ###");
+ String[] urls = new String[2];
+
+ urls[0] = helper.getClassURLString("TypeDetection.props");
+ urls[1] = helper.getClassURLString("files.csv");
+
+ for (int j=0; j<urls.length; j++){
+ String fileURL = urls[j];
+ File file = new File(fileURL);
+ fileURL = utils.getFullURL(fileURL);
+
+ PropertyValue[] MediaDescriptor = helper.createMediaDescriptor(
+ new String[] {"URL"},
+ new Object[] {fileURL});
+
+ if (file.canWrite()) log.println("check writable file...");
+ else log.println("check readonly file...");
+
+ PropertyValue[][] inOut = helper.createInOutPropertyValue(MediaDescriptor);
+ PropertyValue[] in = inOut[0];
+ log.println("in-Parameter:");
+ for (int i=0; i < in.length; i++){
+ log.println("["+i+"] '" + in[i].Name + "':'" + in[i].Value.toString()+"'");
+ }
+
+ String type = m_xDetection.queryTypeByDescriptor(inOut, true);
+
+ PropertyValue[] out = inOut[0];
+
+ boolean bStream = false;
+ log.println("out-Parameter");
+ boolean bReadOnly = false;
+ for (int i=0; i < out.length; i++){
+ if ((out[i].Name.equals("ReadOnly")) && (out[i].Value.toString().equals("true"))) bReadOnly = true;
+ log.println("["+i+"] '" + out[i].Name + "':'" + out[i].Value.toString()+"'");
+ }
+
+ if (file.canWrite() && bReadOnly)
+ assure("\nStreamLoader: file '"+ fileURL +"' is writable but out-Parameter does contain 'ReadOnly' property",false ,true);
+ else if ((!file.canWrite()) && (!bReadOnly))
+ assure("\nStreamLoader: file '"+ fileURL +"'is readonly but out-Parameter does not contain 'ReadOnly' property",false ,true);
+ else assure("all ok",true,true);
+
+ }
+ } catch (ClassCastException e){
+ failed(e.toString(), true);
+ }
+
+ }
} \ No newline at end of file