Author: veithen
Date: Sat May  9 21:55:24 2015
New Revision: 1678528

URL: http://svn.apache.org/r1678528
Log:
Refactor the WritableBlob tests to use MatrixTestCase and Google Truth.

Added:
    
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestGetInputStreamNew.java
   (with props)
    
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestGetInputStreamUncommitted.java
   (with props)
    
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestGetOutputStreamCommitted.java
   (with props)
    
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestGetOutputStreamUncommitted.java
   (with props)
    
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestMarkReset.java
   (with props)
    
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestRandomReadWrite.java
   (with props)
    
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestReadFrom.java
   (with props)
    
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/WritableBlobFactory.java
   (with props)
    
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/WritableBlobTestCase.java
   (with props)
    
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/WritableBlobTestSuiteBuilder.java
   (with props)
Removed:
    
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/WritableBlobTestBase.java
Modified:
    
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/MemoryBlobTest.java
    
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/OverflowBlobTest.java

Modified: 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/MemoryBlobTest.java
URL: 
http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/MemoryBlobTest.java?rev=1678528&r1=1678527&r2=1678528&view=diff
==============================================================================
--- 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/MemoryBlobTest.java
 (original)
+++ 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/MemoryBlobTest.java
 Sat May  9 21:55:24 2015
@@ -16,11 +16,17 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.axiom.util.blob;
 
-public class MemoryBlobTest extends WritableBlobTestBase {
-    protected WritableBlob createBlob() {
-        return new MemoryBlob();
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+public class MemoryBlobTest extends TestCase {
+    public static TestSuite suite() {
+        return new WritableBlobTestSuiteBuilder(new WritableBlobFactory() {
+            public WritableBlob createBlob() {
+                return new MemoryBlob();
+            }
+        }).build();
     }
 }

Modified: 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/OverflowBlobTest.java
URL: 
http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/OverflowBlobTest.java?rev=1678528&r1=1678527&r2=1678528&view=diff
==============================================================================
--- 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/OverflowBlobTest.java
 (original)
+++ 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/OverflowBlobTest.java
 Sat May  9 21:55:24 2015
@@ -16,11 +16,17 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.axiom.util.blob;
 
-public class OverflowBlobTest extends WritableBlobTestBase {
-    protected WritableBlob createBlob() {
-        return new OverflowBlob(16, 1024, "test", ".dat");
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+public class OverflowBlobTest extends TestCase {
+    public static TestSuite suite() {
+        return new WritableBlobTestSuiteBuilder(new WritableBlobFactory() {
+            public WritableBlob createBlob() {
+                return new OverflowBlob(16, 1024, "test", ".dat");
+            }
+        }).build();
     }
 }

Added: 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestGetInputStreamNew.java
URL: 
http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestGetInputStreamNew.java?rev=1678528&view=auto
==============================================================================
--- 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestGetInputStreamNew.java
 (added)
+++ 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestGetInputStreamNew.java
 Sat May  9 21:55:24 2015
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.util.blob;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Random;
+
+import org.apache.commons.io.IOUtils;
+
+public class TestGetInputStreamNew extends WritableBlobTestCase {
+    public TestGetInputStreamNew(WritableBlobFactory factory) {
+        super(factory);
+    }
+
+    @Override
+    protected void runTest(WritableBlob blob) throws Throwable {
+        if (blob.isSupportingReadUncommitted()) {
+            Random random = new Random();
+            // The order of instructions is important here: we first get
+            // the input stream (when the blob is still in state NEW) and
+            // only then we request the output stream (which will put the
+            // stream in state UNCOMMITTED).
+            InputStream in = blob.getInputStream();
+            OutputStream out = blob.getOutputStream();
+            assertThat(in.read()).isEqualTo(-1);
+            // Check that any data written to the output stream immediately 
becomes available
+            // on the input stream.
+            byte[] data = new byte[1000];
+            random.nextBytes(data);
+            out.write(data);
+            assertThat(IOUtils.toByteArray(in)).isEqualTo(data);
+            random.nextBytes(data);
+            out.write(data);
+            assertThat(IOUtils.toByteArray(in)).isEqualTo(data);
+        } else {
+            try {
+                blob.getInputStream();
+                fail("Expected IllegalStateException");
+            } catch (IllegalStateException ex) {
+                // Expected
+            }
+        }
+    }
+}

Propchange: 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestGetInputStreamNew.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestGetInputStreamUncommitted.java
URL: 
http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestGetInputStreamUncommitted.java?rev=1678528&view=auto
==============================================================================
--- 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestGetInputStreamUncommitted.java
 (added)
+++ 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestGetInputStreamUncommitted.java
 Sat May  9 21:55:24 2015
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.util.blob;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Random;
+
+import org.apache.commons.io.IOUtils;
+
+public class TestGetInputStreamUncommitted extends WritableBlobTestCase {
+    public TestGetInputStreamUncommitted(WritableBlobFactory factory) {
+        super(factory);
+    }
+
+    @Override
+    protected void runTest(WritableBlob blob) throws Throwable {
+        Random random = new Random();
+        OutputStream out = blob.getOutputStream();
+        try {
+            byte[] data = new byte[1000];
+            random.nextBytes(data);
+            out.write(data);
+            if (blob.isSupportingReadUncommitted()) {
+                InputStream in = blob.getInputStream();
+                try {
+                    assertThat(IOUtils.toByteArray(in)).isEqualTo(data);
+                } finally {
+                    in.close();
+                }
+            } else {
+                try {
+                    blob.getInputStream();
+                    fail("Expected IllegalStateException");
+                } catch (IllegalStateException ex) {
+                    // Expected
+                }
+            }
+        } finally {
+            out.close();
+        }
+    }
+}

Propchange: 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestGetInputStreamUncommitted.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestGetOutputStreamCommitted.java
URL: 
http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestGetOutputStreamCommitted.java?rev=1678528&view=auto
==============================================================================
--- 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestGetOutputStreamCommitted.java
 (added)
+++ 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestGetOutputStreamCommitted.java
 Sat May  9 21:55:24 2015
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.util.blob;
+
+import java.io.OutputStream;
+
+public class TestGetOutputStreamCommitted extends WritableBlobTestCase {
+    public TestGetOutputStreamCommitted(WritableBlobFactory factory) {
+        super(factory);
+    }
+
+    @Override
+    protected void runTest(WritableBlob blob) throws Throwable {
+        OutputStream out = blob.getOutputStream();
+        out.close();
+        try {
+            blob.getOutputStream();
+            fail("Expected IllegalStateException");
+        } catch (IllegalStateException ex) {
+            // Expected
+        }
+    }
+}

Propchange: 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestGetOutputStreamCommitted.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestGetOutputStreamUncommitted.java
URL: 
http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestGetOutputStreamUncommitted.java?rev=1678528&view=auto
==============================================================================
--- 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestGetOutputStreamUncommitted.java
 (added)
+++ 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestGetOutputStreamUncommitted.java
 Sat May  9 21:55:24 2015
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.util.blob;
+
+import java.io.OutputStream;
+
+public class TestGetOutputStreamUncommitted extends WritableBlobTestCase {
+    public TestGetOutputStreamUncommitted(WritableBlobFactory factory) {
+        super(factory);
+    }
+
+    @Override
+    protected void runTest(WritableBlob blob) throws Throwable {
+        OutputStream out = blob.getOutputStream();
+        try {
+            try {
+                blob.getOutputStream();
+                fail("Expected IllegalStateException");
+            } catch (IllegalStateException ex) {
+                // Expected
+            }
+        } finally {
+            out.close();
+        }
+    }
+}

Propchange: 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestGetOutputStreamUncommitted.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestMarkReset.java
URL: 
http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestMarkReset.java?rev=1678528&view=auto
==============================================================================
--- 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestMarkReset.java
 (added)
+++ 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestMarkReset.java
 Sat May  9 21:55:24 2015
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.util.blob;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import java.io.DataInputStream;
+import java.io.OutputStream;
+import java.util.Random;
+
+public class TestMarkReset extends WritableBlobTestCase {
+    public TestMarkReset(WritableBlobFactory factory) {
+        super(factory);
+    }
+
+    @Override
+    protected void runTest(WritableBlob blob) throws Throwable {
+        Random random = new Random();
+        byte[] sourceData1 = new byte[2000];
+        byte[] sourceData2 = new byte[2000];
+        random.nextBytes(sourceData1);
+        random.nextBytes(sourceData2);
+        OutputStream out = blob.getOutputStream();
+        out.write(sourceData1);
+        out.write(sourceData2);
+        out.close();
+        DataInputStream in = new DataInputStream(blob.getInputStream());
+        byte[] data1 = new byte[sourceData1.length];
+        byte[] data2 = new byte[sourceData2.length];
+        in.readFully(data1);
+        in.mark(sourceData2.length);
+        in.readFully(data2);
+        in.reset();
+        in.readFully(data2);
+        assertThat(data1).isEqualTo(sourceData1);
+        assertThat(data2).isEqualTo(sourceData2);
+    }
+}

Propchange: 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestMarkReset.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestRandomReadWrite.java
URL: 
http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestRandomReadWrite.java?rev=1678528&view=auto
==============================================================================
--- 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestRandomReadWrite.java
 (added)
+++ 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestRandomReadWrite.java
 Sat May  9 21:55:24 2015
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.util.blob;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Random;
+
+public class TestRandomReadWrite extends WritableBlobTestCase {
+    private final int size;
+    
+    public TestRandomReadWrite(WritableBlobFactory factory, int size) {
+        super(factory);
+        this.size = size;
+        addTestParameter("size", size);
+    }
+
+    @Override
+    protected void runTest(WritableBlob blob) throws Throwable {
+        Random random = new Random();
+        byte[] data = new byte[size];
+        random.nextBytes(data);
+        OutputStream out = blob.getOutputStream();
+        // Write the test data in chunks with random size
+        int offset = 0;
+        while (offset < data.length) {
+            int c = Math.min(512 + random.nextInt(1024), data.length - offset);
+            out.write(data, offset, c);
+            offset += c;
+        }
+        out.close();
+        assertThat(blob.getLength()).isEqualTo(size);
+        // Reread the test data, again in chunks with random size
+        InputStream in = blob.getInputStream();
+        offset = 0;
+        byte[] data2 = new byte[data.length];
+        byte[] buffer = new byte[2048];
+        while (true) {
+            int bufferOffset = random.nextInt(512);
+            int c = 512 + random.nextInt(1024);
+            int read = in.read(buffer, bufferOffset, c);
+            if (read == -1) {
+                break;
+            }
+            int newOffset = offset + read;
+            assertThat(newOffset).isAtMost(data2.length);
+            System.arraycopy(buffer, bufferOffset, data2, offset, read);
+            offset = newOffset;
+        }
+        assertThat(offset).isEqualTo(data2.length);
+        in.close();
+        assertThat(data2).isEqualTo(data);
+    }
+}

Propchange: 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestRandomReadWrite.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestReadFrom.java
URL: 
http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestReadFrom.java?rev=1678528&view=auto
==============================================================================
--- 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestReadFrom.java
 (added)
+++ 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestReadFrom.java
 Sat May  9 21:55:24 2015
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.util.blob;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.Random;
+
+import org.apache.commons.io.IOUtils;
+
+public class TestReadFrom extends WritableBlobTestCase {
+    private final int size;
+    
+    public TestReadFrom(WritableBlobFactory factory, int size) {
+        super(factory);
+        this.size = size;
+        addTestParameter("size", size);
+    }
+
+    @Override
+    protected void runTest(WritableBlob blob) throws Throwable {
+        Random random = new Random();
+        byte[] data = new byte[size];
+        random.nextBytes(data);
+        blob.readFrom(new ByteArrayInputStream(data), -1);
+        InputStream in = blob.getInputStream();
+        try {
+            assertThat(IOUtils.toByteArray(in)).isEqualTo(data);
+        }
+        finally {
+            in.close();
+        }
+    }
+}

Propchange: 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/TestReadFrom.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/WritableBlobFactory.java
URL: 
http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/WritableBlobFactory.java?rev=1678528&view=auto
==============================================================================
--- 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/WritableBlobFactory.java
 (added)
+++ 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/WritableBlobFactory.java
 Sat May  9 21:55:24 2015
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.util.blob;
+
+public interface WritableBlobFactory {
+    WritableBlob createBlob();
+}

Propchange: 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/WritableBlobFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/WritableBlobTestCase.java
URL: 
http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/WritableBlobTestCase.java?rev=1678528&view=auto
==============================================================================
--- 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/WritableBlobTestCase.java
 (added)
+++ 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/WritableBlobTestCase.java
 Sat May  9 21:55:24 2015
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.util.blob;
+
+import org.apache.axiom.testutils.suite.MatrixTestCase;
+
+public abstract class WritableBlobTestCase extends MatrixTestCase {
+    private final WritableBlobFactory factory;
+
+    public WritableBlobTestCase(WritableBlobFactory factory) {
+        this.factory = factory;
+    }
+
+    @Override
+    protected final void runTest() throws Throwable {
+        WritableBlob blob = factory.createBlob();
+        try {
+            runTest(blob);
+        } finally {
+            blob.release();
+        }
+    }
+    
+    protected abstract void runTest(WritableBlob blob) throws Throwable;
+}

Propchange: 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/WritableBlobTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/WritableBlobTestSuiteBuilder.java
URL: 
http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/WritableBlobTestSuiteBuilder.java?rev=1678528&view=auto
==============================================================================
--- 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/WritableBlobTestSuiteBuilder.java
 (added)
+++ 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/WritableBlobTestSuiteBuilder.java
 Sat May  9 21:55:24 2015
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.util.blob;
+
+import org.apache.axiom.testutils.suite.MatrixTestSuiteBuilder;
+
+public class WritableBlobTestSuiteBuilder extends MatrixTestSuiteBuilder {
+    private final WritableBlobFactory factory;
+
+    public WritableBlobTestSuiteBuilder(WritableBlobFactory factory) {
+        this.factory = factory;
+    }
+
+    @Override
+    protected void addTests() {
+        addTest(new TestGetInputStreamNew(factory));
+        addTest(new TestGetInputStreamUncommitted(factory));
+        addTest(new TestGetOutputStreamCommitted(factory));
+        addTest(new TestGetOutputStreamUncommitted(factory));
+        addTest(new TestMarkReset(factory));
+        addTest(new TestReadFrom(factory, 10000));
+        addTest(new TestReadFrom(factory, 100000));
+        addTest(new TestRandomReadWrite(factory, 10000));
+        addTest(new TestRandomReadWrite(factory, 100000));
+    };
+}

Propchange: 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/WritableBlobTestSuiteBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native


Reply via email to