You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ad...@apache.org on 2009/11/24 22:24:10 UTC
svn commit: r883882 -
/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java
Author: adrianc
Date: Tue Nov 24 21:24:10 2009
New Revision: 883882
URL: http://svn.apache.org/viewvc?rev=883882&view=rev
Log:
Improved entity engine Blob test.
Modified:
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java?rev=883882&r1=883881&r2=883882&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java Tue Nov 24 21:24:10 2009
@@ -506,19 +506,29 @@
*/
public void testBlobCreate() throws Exception {
try {
- byte[] b = new byte[1];
- b[0] = (byte)0x01;
+ byte[] b = new byte[100000];
+ for (int i = 0; i < b.length; i++) {
+ b[i] = (byte) i;
+ }
GenericValue testingBlob = delegator.makeValue("TestBlob", "testBlobId", "byte-blob");
testingBlob.setBytes("testBlobField", b);
testingBlob.create();
-
- TestCase.assertTrue("Blob with byte value successfully created...", true);
+ TestCase.assertTrue("Blob with byte array created successfully", true);
+ testingBlob = delegator.findOne("TestBlob", UtilMisc.toMap("testBlobId", "byte-blob"), false);
+ byte[] c = testingBlob.getBytes("testBlobField");
+ TestCase.assertTrue("Byte array read from Blob data is the same length", b.length == c.length);
+ for (int i = 0; i < b.length; i++) {
+ if (b[i] != c[i]) {
+ TestCase.fail("Blob data mismatch at " + i);
+ }
+ }
+ TestCase.assertTrue("Blob with byte array read successfully", true);
} catch (Exception ex) {
- TestCase.fail(ex.getMessage());
+ TestCase.fail(ex.getMessage());
} finally {
// Remove all our newly inserted values.
- List<GenericValue> values = delegator.findList("TestBlob", null, null, null, null, false);
- delegator.removeAll(values);
+ List<GenericValue> values = delegator.findList("TestBlob", null, null, null, null, false);
+ delegator.removeAll(values);
}
}
Re: svn commit: r883882 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java
Posted by Adam Heath <do...@brainfood.com>.
Adrian Crum wrote:
> Adam Heath wrote:
>> adrianc@apache.org wrote:
>>> Modified:
>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java
>>>
>>> URL:
>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java?rev=883882&r1=883881&r2=883882&view=diff
>>>
>>> ==============================================================================
>>>
>>> ---
>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java
>>> (original)
>>> +++
>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java
>>> Tue Nov 24 21:24:10 2009
>>> @@ -506,19 +506,29 @@
>>> */
>>> public void testBlobCreate() throws Exception {
>>> try {
>>> - byte[] b = new byte[1];
>>> - b[0] = (byte)0x01;
>>> + byte[] b = new byte[100000];
>>> + for (int i = 0; i < b.length; i++) {
>>> + b[i] = (byte) i;
>>> + }
>>
>> java.util.Arrays.fill(b, (byte)0x01);
>
> I'm trying to create a pattern that I can test against.
Oh, now I see that you set each element to the index. My bad.
Re: svn commit: r883882 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java
Posted by Adrian Crum <ad...@hlmksw.com>.
Adam Heath wrote:
> adrianc@apache.org wrote:
>> Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java?rev=883882&r1=883881&r2=883882&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java (original)
>> +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java Tue Nov 24 21:24:10 2009
>> @@ -506,19 +506,29 @@
>> */
>> public void testBlobCreate() throws Exception {
>> try {
>> - byte[] b = new byte[1];
>> - b[0] = (byte)0x01;
>> + byte[] b = new byte[100000];
>> + for (int i = 0; i < b.length; i++) {
>> + b[i] = (byte) i;
>> + }
>
> java.util.Arrays.fill(b, (byte)0x01);
I'm trying to create a pattern that I can test against.
Re: svn commit: r883882 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java
Posted by Adam Heath <do...@brainfood.com>.
adrianc@apache.org wrote:
> Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java?rev=883882&r1=883881&r2=883882&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java (original)
> +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java Tue Nov 24 21:24:10 2009
> @@ -506,19 +506,29 @@
> */
> public void testBlobCreate() throws Exception {
> try {
> - byte[] b = new byte[1];
> - b[0] = (byte)0x01;
> + byte[] b = new byte[100000];
> + for (int i = 0; i < b.length; i++) {
> + b[i] = (byte) i;
> + }
java.util.Arrays.fill(b, (byte)0x01);