You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ma...@apache.org on 2010/12/30 17:33:00 UTC
svn commit: r1053932 -
/subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
Author: markphip
Date: Thu Dec 30 16:32:59 2010
New Revision: 1053932
URL: http://svn.apache.org/viewvc?rev=1053932&view=rev
Log:
JavaHL: Followup to r1053915.
Update the properties test to set and get a property with binary data.
* subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
(testBasicProperties): Set the property value with binary data instead of a String
Also update other caller in same test to use the new Byte[] method with a String
Modified:
subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
Modified: subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java?rev=1053932&r1=1053931&r2=1053932&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java (original)
+++ subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java Thu Dec 30 16:32:59 2010
@@ -691,12 +691,15 @@ public class BasicTests extends SVNTests
"iota"),
false);
- client.propertySet(itemPath, "abc", "def", Depth.empty, null, false,
+ byte[] BINARY_DATA = {-12, -125, -51, 43, 5, 47, 116, -72, -120,
+ 2, -98, -100, -73, 61, 118, 74, 36, 38, 56, 107, 45, 91, 38, 107, -87,
+ 119, -107, -114, -45, -128, -69, 96};
+ client.propertySet(itemPath, "abc", BINARY_DATA, Depth.empty, null, false,
null, null);
Map<String, byte[]> properties = collectProperties(itemPath, null,
null, Depth.empty, null);
- assertEquals("def", new String(properties.get("abc")));
+ assertTrue(Arrays.equals(BINARY_DATA, properties.get("abc")));
wc.setItemPropStatus("iota", Status.Kind.modified);
thisTest.checkStatus();
@@ -705,7 +708,8 @@ public class BasicTests extends SVNTests
itemPath = fileToSVNPath(new File(thisTest.getWCPath(),
"/A/B/E/alpha"),
false);
- client.propertyCreate(itemPath, "cqcq", "qrz", Depth.empty, null,
+ String alphaVal = "qrz";
+ client.propertyCreate(itemPath, "cqcq", alphaVal.getBytes(), Depth.empty, null,
false, null);
final Map<String, Map<String, byte[]>> propMaps =
@@ -719,7 +723,7 @@ public class BasicTests extends SVNTests
for (String key : propMap.keySet())
{
assertEquals("cqcq", key);
- assertEquals("qrz", new String(propMap.get(key)));
+ assertEquals(alphaVal, new String(propMap.get(key)));
}
wc.setItemPropStatus("A/B/E/alpha", Status.Kind.modified);
Re: svn commit: r1053932 - /subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
Posted by Blair Zajac <bl...@orcaware.com>.
On 12/30/10 11:54 AM, Mark Phippard wrote:
> On Thu, Dec 30, 2010 at 2:24 PM, Blair Zajac<bl...@orcaware.com> wrote:
>>> - client.propertyCreate(itemPath, "cqcq", "qrz", Depth.empty, null,
>>> + String alphaVal = "qrz";
>>> + client.propertyCreate(itemPath, "cqcq", alphaVal.getBytes(),
>>> Depth.empty, null,
>>
>> Do you need to pass "UTF-8" to alphaVal.getBytes?
>
> Don't know. Do I? Tests pass.
Looks like all the string conversions were remove, so it's moot.
But typically, one always wants to pass UTF-8 to String's constructor and
getBytes() so you don't have different encodings in different locales.
Blair
Re: svn commit: r1053932 - /subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
Posted by Mark Phippard <ma...@gmail.com>.
On Thu, Dec 30, 2010 at 2:24 PM, Blair Zajac <bl...@orcaware.com> wrote:
>> - client.propertyCreate(itemPath, "cqcq", "qrz", Depth.empty, null,
>> + String alphaVal = "qrz";
>> + client.propertyCreate(itemPath, "cqcq", alphaVal.getBytes(),
>> Depth.empty, null,
>
> Do you need to pass "UTF-8" to alphaVal.getBytes?
Don't know. Do I? Tests pass.
--
Thanks
Mark Phippard
http://markphip.blogspot.com/
Re: svn commit: r1053932 - /subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
Posted by Blair Zajac <bl...@orcaware.com>.
On 12/30/10 8:33 AM, markphip@apache.org wrote:
> Author: markphip
> Date: Thu Dec 30 16:32:59 2010
> New Revision: 1053932
>
> URL: http://svn.apache.org/viewvc?rev=1053932&view=rev
> Log:
> JavaHL: Followup to r1053915.
> Update the properties test to set and get a property with binary data.
>
> * subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
> (testBasicProperties): Set the property value with binary data instead of a String
> Also update other caller in same test to use the new Byte[] method with a String
> wc.setItemPropStatus("iota", Status.Kind.modified);
> thisTest.checkStatus();
> @@ -705,7 +708,8 @@ public class BasicTests extends SVNTests
> itemPath = fileToSVNPath(new File(thisTest.getWCPath(),
> "/A/B/E/alpha"),
> false);
> - client.propertyCreate(itemPath, "cqcq", "qrz", Depth.empty, null,
> + String alphaVal = "qrz";
> + client.propertyCreate(itemPath, "cqcq", alphaVal.getBytes(), Depth.empty, null,
Do you need to pass "UTF-8" to alphaVal.getBytes?
> false, null);
>
> final Map<String, Map<String, byte[]>> propMaps =
> @@ -719,7 +723,7 @@ public class BasicTests extends SVNTests
> for (String key : propMap.keySet())
> {
> assertEquals("cqcq", key);
> - assertEquals("qrz", new String(propMap.get(key)));
> + assertEquals(alphaVal, new String(propMap.get(key)));
And here to the String constructor?
Blair