Author: vrockai
Date: 2009-07-10 11:11:54 -0400 (Fri, 10 Jul 2009)
New Revision: 13539
Added:
branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/src/org/jboss/portal/test/ant/
branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/src/org/jboss/portal/test/ant/FileCreate.java
Removed:
branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/test_files/big_archive.zip
branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/test_files/many_files.zip
Log:
[selenium] - test suite migration 2
Added:
branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/src/org/jboss/portal/test/ant/FileCreate.java
===================================================================
---
branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/src/org/jboss/portal/test/ant/FileCreate.java
(rev 0)
+++
branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/src/org/jboss/portal/test/ant/FileCreate.java 2009-07-10
15:11:54 UTC (rev 13539)
@@ -0,0 +1,94 @@
+package org.jboss.portal.test.ant;
+
+import java.io.FileWriter;
+import java.io.IOException;
+
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+
+/**
+ * @author vrockai
+ * FileCreate task is responsible for creating specified number of files of random
content and of specified name and size.
+ * <h2>Parameters</h2>
+ * <table>
+ * <thead>
+ * <tr>
+ * <th>Attribute</th>
+ * <th>Description</th>
+ * </tr>
+ * </thead>
+ * <tbody>
+ * <tr>
+ * <td>filename</td>
+ * <td>The prefix of name of file(s) to be generated.</td>
+ * </tr>
+ * <tr>
+ * <td>suffix</td>
+ * <td>When more then one file is about to be created (set by the count attribute)
the filename then consist of the string set by the filename attribe + "[i]"
string + the suffix string set by the suffix attribute.</td>
+ * </tr>
+ * <tr>
+ * <td>size</td>
+ * <td>The size of individual file to be generated in bytes. When more files are
generated (set by count attribute), each file has specified size.</td>
+ * </tr>
+ * <tr>
+ * <td>count</td>
+ * <td>The number of files to be generated. The filename then consist of the string
set by the filename attribe + "[i]" string + the suffix string set by the suffix
attribute.</td>
+ * </tr>
+ * </tbody>
+ * </table>
+ *
+ */
+public class FileCreate extends Task {
+
+ String filename;
+ String suffix = "";
+ int size = 0;
+ int count = 1;
+
+ public void setFilename(String filename) {
+ this.filename = filename;
+ }
+
+ public void setSuffix(String suffix) {
+ this.suffix = suffix;
+ }
+
+ public void setSize(int size) {
+ this.size = size;
+ }
+
+ public void setCount(int count) {
+ this.count = count;
+ }
+
+ public void execute() {
+ createFile();
+ }
+
+ public void createFile() {
+
+ FileWriter fstream;
+ try {
+ for (int i = 0; i < count; i++) {
+
+ String fname = count > 1 ? filename + "" + (i+1) + suffix: filename;
+
+ fstream = new FileWriter(fname);
+
+ for (int k = 0; k < size; k++) {
+ fstream.write(Math.random() > 0.5 ? 1 : 0);
+ }
+
+ fstream.close();
+
+ }
+ String mess = "File \"" + filename + "\" of size " +
size + "B was created";
+ if (count > 1)
+ mess = count + " files \"" + filename +
"[i]"+suffix+"\" each of size " + size + "B were
created";
+ log(mess, Project.MSG_INFO);
+ } catch (IOException e) {
+ log("FAIL: " + e.getLocalizedMessage());
+ }
+ }
+
+}
Deleted:
branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/test_files/big_archive.zip
===================================================================
(Binary files differ)
Deleted:
branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/test_files/many_files.zip
===================================================================
(Binary files differ)
Show replies by date