You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2013/03/05 23:27:48 UTC
svn commit: r1453046 - in /subversion/trunk/subversion/bindings/javahl:
native/ src/org/apache/subversion/javahl/
src/org/apache/subversion/javahl/callback/
tests/org/apache/subversion/javahl/
Author: brane
Date: Tue Mar 5 22:27:47 2013
New Revision: 1453046
URL: http://svn.apache.org/r1453046
Log:
Working on isue #4326 (update javahl with new 1.8 APIs).
Implement property-inheritance-aware SVNCLient.properties.
[subversion/bindings/javahl/native]
* CreateJ.h, CreateJ.cpp (CreateJ::InheritedProps): New factory.
* ProplistCallback.cpp, ProplistCallback.h (ProplistCallback):
Make the native wrapper aware of the difference between
the Java classes ProplistCallback and InheritedProplistCallback.
* SVNClient.cpp (SVNClient::properties): Likewise.
* org_apache_subversion_javahl_SVNClient.cpp: Wrap the SVNClient.properties
native implementation with overloaded native methods.
[in subversion/bindings/javahl/src/org/apache/subversion/javahl]
* ISVNClient.java (ISVNClient.properties):
New (overloaded) method that calls an inherited-props-aware callback.
* SVNClient.java (ISVNClient.properties): Declare native overloaded method.
* callback/InheritedProplistCallback.java: New.
* callback/ProplistCallback.java: Fix docstring.
[in subversion/bindings/javahl/tests/org/apache/subversion/javahl]
* BasicTests.java (BasicTests.testInheritedProperties): New test case.
Added:
subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/InheritedProplistCallback.java
Modified:
subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp
subversion/trunk/subversion/bindings/javahl/native/CreateJ.h
subversion/trunk/subversion/bindings/javahl/native/ProplistCallback.cpp
subversion/trunk/subversion/bindings/javahl/native/ProplistCallback.h
subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp
subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java
subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java
subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/ProplistCallback.java
subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
Modified: subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp?rev=1453046&r1=1453045&r2=1453046&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp Tue Mar 5 22:27:47 2013
@@ -35,6 +35,7 @@
#include "../include/org_apache_subversion_javahl_CommitItemStateFlags.h"
#include "svn_path.h"
+#include "svn_props.h"
#include "private/svn_wc_private.h"
jobject
@@ -1049,6 +1050,87 @@ jobject CreateJ::PropertyMap(apr_hash_t
return env->PopLocalFrame(map);
}
+jobject CreateJ::InheritedProps(apr_array_header_t *iprops)
+{
+ JNIEnv *env = JNIUtil::getEnv();
+
+ if (iprops == NULL)
+ return NULL;
+
+ // Create a local frame for our references
+ env->PushLocalFrame(LOCAL_FRAME_SIZE);
+ if (JNIUtil::isJavaExceptionThrown())
+ return NULL;
+
+ jclass list_cls = env->FindClass("java/util/ArrayList");
+ if (JNIUtil::isJavaExceptionThrown())
+ POP_AND_RETURN_NULL;
+
+ static volatile jmethodID init_mid = 0;
+ if (init_mid == 0)
+ {
+ init_mid = env->GetMethodID(list_cls, "<init>", "(I)V");
+ if (JNIUtil::isJavaExceptionThrown())
+ POP_AND_RETURN_NULL;
+ }
+
+ static volatile jmethodID add_mid = 0;
+ if (add_mid == 0)
+ {
+ add_mid = env->GetMethodID(list_cls, "add",
+ "(Ljava/lang/Object;)Z");
+ if (JNIUtil::isJavaExceptionThrown())
+ POP_AND_RETURN_NULL;
+ }
+
+ jclass item_cls = env->FindClass(
+ JAVA_PACKAGE"/callback/InheritedProplistCallback$InheritedItem");
+ if (JNIUtil::isJavaExceptionThrown())
+ POP_AND_RETURN_NULL;
+
+ static volatile jmethodID ctor_mid = 0;
+ if (ctor_mid == 0)
+ {
+ ctor_mid = env->GetMethodID(item_cls, "<init>",
+ "(Ljava/lang/String;Ljava/util/Map;)V");
+ if (JNIUtil::isJavaExceptionThrown())
+ POP_AND_RETURN_NULL;
+ }
+
+ jobject array = env->NewObject(list_cls, init_mid, iprops->nelts);
+ if (JNIUtil::isJavaExceptionThrown())
+ POP_AND_RETURN_NULL;
+
+ for (int i = 0; i < iprops->nelts; ++i)
+ {
+ svn_prop_inherited_item_t *iprop =
+ APR_ARRAY_IDX(iprops, i, svn_prop_inherited_item_t*);
+
+ jstring path_or_url = JNIUtil::makeJString(iprop->path_or_url);
+ if (JNIUtil::isJavaExceptionThrown())
+ POP_AND_RETURN_NULL;
+
+ jobject props = PropertyMap(iprop->prop_hash);
+ if (JNIUtil::isJavaExceptionThrown())
+ POP_AND_RETURN_NULL;
+
+ jobject item = env->NewObject(item_cls, ctor_mid, path_or_url, props);
+ if (JNIUtil::isJavaExceptionThrown())
+ POP_AND_RETURN_NULL;
+
+ env->CallBooleanMethod(array, add_mid, item);
+ if (JNIUtil::isJavaExceptionThrown())
+ POP_AND_RETURN_NULL;
+
+ env->DeleteLocalRef(item);
+ env->DeleteLocalRef(props);
+ env->DeleteLocalRef(path_or_url);
+ }
+
+ return env->PopLocalFrame(array);
+}
+
+
jobject CreateJ::Set(std::vector<jobject> &objects)
{
JNIEnv *env = JNIUtil::getEnv();
Modified: subversion/trunk/subversion/bindings/javahl/native/CreateJ.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/CreateJ.h?rev=1453046&r1=1453045&r2=1453046&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/CreateJ.h (original)
+++ subversion/trunk/subversion/bindings/javahl/native/CreateJ.h Tue Mar 5 22:27:47 2013
@@ -82,6 +82,9 @@ class CreateJ
static jobject
PropertyMap(apr_hash_t *prop_hash);
+ static jobject
+ InheritedProps(apr_array_header_t *inherited_props);
+
/* This creates a set of Objects. It derefs the members of the vector
* after putting them in the set, so they caller doesn't need to. */
static jobject
Modified: subversion/trunk/subversion/bindings/javahl/native/ProplistCallback.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/ProplistCallback.cpp?rev=1453046&r1=1453045&r2=1453046&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/ProplistCallback.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/ProplistCallback.cpp Tue Mar 5 22:27:47 2013
@@ -33,10 +33,10 @@
* Create a ProplistCallback object
* @param jcallback the Java callback object.
*/
-ProplistCallback::ProplistCallback(jobject jcallback)
-{
- m_callback = jcallback;
-}
+ProplistCallback::ProplistCallback(jobject jcallback, bool inherited)
+ : m_callback(jcallback),
+ m_inherited(inherited)
+{}
/**
* Destroy a ProplistCallback object
@@ -51,11 +51,18 @@ svn_error_t *
ProplistCallback::callback(void *baton,
const char *path,
apr_hash_t *prop_hash,
+ apr_array_header_t *inherited_props,
apr_pool_t *pool)
{
if (baton)
- return static_cast<ProplistCallback *>(baton)->singlePath(
- path, prop_hash, pool);
+ {
+ ProplistCallback *cb = static_cast<ProplistCallback *>(baton);
+
+ if (cb->inherited())
+ return cb->singlePath(path, prop_hash, inherited_props, pool);
+ else
+ return cb->singlePath(path, prop_hash, pool);
+ }
return SVN_NO_ERROR;
}
@@ -79,7 +86,7 @@ svn_error_t *ProplistCallback::singlePat
// The method id will not change during the time this library is
// loaded, so it can be cached.
- static jmethodID mid = 0;
+ static volatile jmethodID mid = 0;
if (mid == 0)
{
jclass clazz = env->FindClass(JAVA_PACKAGE"/callback/ProplistCallback");
@@ -109,3 +116,62 @@ svn_error_t *ProplistCallback::singlePat
return SVN_NO_ERROR;
}
+
+
+
+/**
+ * Callback called for a single path
+ * @param path the path name
+ * @param prop_hash the hash of properties on this path
+ * @param inherited_props list of inherited props
+ * @param pool memory pool for the use of this function
+ */
+svn_error_t *ProplistCallback::singlePath(
+ const char *path,
+ apr_hash_t *prop_hash,
+ apr_array_header_t *inherited_props,
+ apr_pool_t *pool)
+{
+ JNIEnv *env = JNIUtil::getEnv();
+
+ // Create a local frame for our references
+ env->PushLocalFrame(LOCAL_FRAME_SIZE);
+ if (JNIUtil::isJavaExceptionThrown())
+ return NULL;
+
+ // The method id will not change during the time this library is
+ // loaded, so it can be cached.
+ static jmethodID mid = 0;
+ if (mid == 0)
+ {
+ jclass clazz = env->FindClass(JAVA_PACKAGE"/callback/InheritedProplistCallback");
+ if (JNIUtil::isJavaExceptionThrown())
+ return SVN_NO_ERROR;
+
+ mid = env->GetMethodID(clazz, "singlePath",
+ "(Ljava/lang/String;Ljava/util/Map;Ljava/util/Collection;)V");
+ if (JNIUtil::isJavaExceptionThrown() || mid == 0)
+ POP_AND_RETURN(SVN_NO_ERROR);
+ }
+
+ // convert the parameters to their Java relatives
+ jstring jpath = JNIUtil::makeJString(path);
+ if (JNIUtil::isJavaExceptionThrown())
+ POP_AND_RETURN(SVN_NO_ERROR);
+
+ jobject jmap = CreateJ::PropertyMap(prop_hash);
+ if (JNIUtil::isJavaExceptionThrown())
+ POP_AND_RETURN(SVN_NO_ERROR);
+
+ jobject jiprops = CreateJ::InheritedProps(inherited_props);
+ if (JNIUtil::isJavaExceptionThrown())
+ POP_AND_RETURN(SVN_NO_ERROR);
+
+ // call the Java method
+ env->CallVoidMethod(m_callback, mid, jpath, jmap, jiprops);
+ // We return whether an exception was thrown or not.
+
+ env->PopLocalFrame(NULL);
+
+ return SVN_NO_ERROR;
+}
Modified: subversion/trunk/subversion/bindings/javahl/native/ProplistCallback.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/ProplistCallback.h?rev=1453046&r1=1453045&r2=1453046&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/ProplistCallback.h (original)
+++ subversion/trunk/subversion/bindings/javahl/native/ProplistCallback.h Tue Mar 5 22:27:47 2013
@@ -37,24 +37,33 @@
class ProplistCallback
{
public:
- ProplistCallback(jobject jcallback);
+ ProplistCallback(jobject jcallback, bool inherited);
~ProplistCallback();
static svn_error_t *callback(void *baton,
const char *path,
apr_hash_t *prop_hash,
+ apr_array_header_t *inherited_props,
apr_pool_t *pool);
+ bool inherited() const { return m_inherited; }
+
protected:
svn_error_t *singlePath(const char *path,
apr_hash_t *prop_hash,
apr_pool_t *pool);
+ svn_error_t *singlePath(const char *path,
+ apr_hash_t *prop_hash,
+ apr_array_header_t *inherited_props,
+ apr_pool_t *pool);
private:
/**
* This a local reference to the Java object.
*/
jobject m_callback;
+ bool m_inherited;
};
+
#endif // PROPLISTCALLBACK_H
Modified: subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp?rev=1453046&r1=1453045&r2=1453046&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp Tue Mar 5 22:27:47 2013
@@ -885,7 +885,8 @@ jbyteArray SVNClient::propertyGet(const
void SVNClient::properties(const char *path, Revision &revision,
Revision &pegRevision, svn_depth_t depth,
- StringArray &changelists, ProplistCallback *callback)
+ StringArray &changelists,
+ ProplistCallback *callback)
{
SVN::Pool subPool(pool);
SVN_JNI_NULL_PTR_EX(path, "path", );
@@ -896,13 +897,12 @@ void SVNClient::properties(const char *p
if (ctx == NULL)
return;
- SVN_JNI_ERR(svn_client_proplist3(intPath.c_str(), pegRevision.revision(),
+ SVN_JNI_ERR(svn_client_proplist4(intPath.c_str(), pegRevision.revision(),
revision.revision(), depth,
changelists.array(subPool),
+ callback->inherited(),
ProplistCallback::callback, callback,
ctx, subPool.getPool()), );
-
- return;
}
void SVNClient::propertySetLocal(Targets &targets, const char *name,
Modified: subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp?rev=1453046&r1=1453045&r2=1453046&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp Tue Mar 5 22:27:47 2013
@@ -906,13 +906,11 @@ Java_org_apache_subversion_javahl_SVNCli
jdryRun ? true:false);
}
-JNIEXPORT void JNICALL
-Java_org_apache_subversion_javahl_SVNClient_properties
+static void SVNClient_properties
(JNIEnv *env, jobject jthis, jstring jpath, jobject jrevision,
jobject jpegRevision, jobject jdepth, jobject jchangelists,
- jobject jproplistCallback)
+ jobject jproplistCallback, bool inherited)
{
- JNIEntry(SVNClient, properties);
SVNClient *cl = SVNClient::getCppObject(jthis);
if (cl == NULL)
{
@@ -935,12 +933,34 @@ Java_org_apache_subversion_javahl_SVNCli
if (JNIUtil::isExceptionThrown())
return;
- ProplistCallback callback(jproplistCallback);
+ ProplistCallback callback(jproplistCallback, inherited);
cl->properties(path, revision, pegRevision, EnumMapper::toDepth(jdepth),
changelists, &callback);
}
JNIEXPORT void JNICALL
+Java_org_apache_subversion_javahl_SVNClient_properties__Ljava_lang_String_2Lorg_apache_subversion_javahl_types_Revision_2Lorg_apache_subversion_javahl_types_Revision_2Lorg_apache_subversion_javahl_types_Depth_2Ljava_util_Collection_2Lorg_apache_subversion_javahl_callback_ProplistCallback_2
+(JNIEnv *env, jobject jthis, jstring jpath, jobject jrevision,
+ jobject jpegRevision, jobject jdepth, jobject jchangelists,
+ jobject jproplistCallback)
+{
+ JNIEntry(SVNClient, properties);
+ SVNClient_properties(env, jthis, jpath, jrevision, jpegRevision, jdepth,
+ jchangelists, jproplistCallback, false);
+}
+
+JNIEXPORT void JNICALL
+Java_org_apache_subversion_javahl_SVNClient_properties__Ljava_lang_String_2Lorg_apache_subversion_javahl_types_Revision_2Lorg_apache_subversion_javahl_types_Revision_2Lorg_apache_subversion_javahl_types_Depth_2Ljava_util_Collection_2Lorg_apache_subversion_javahl_callback_InheritedProplistCallback_2
+(JNIEnv *env, jobject jthis, jstring jpath, jobject jrevision,
+ jobject jpegRevision, jobject jdepth, jobject jchangelists,
+ jobject jproplistCallback)
+{
+ JNIEntry(SVNClient, properties);
+ SVNClient_properties(env, jthis, jpath, jrevision, jpegRevision, jdepth,
+ jchangelists, jproplistCallback, true);
+}
+
+JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_SVNClient_propertySetRemote
(JNIEnv *env, jobject jthis, jstring jpath, jlong jbaseRev, jstring jname,
jbyteArray jval, jobject jmessage, jboolean jforce, jobject jrevpropTable,
Modified: subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java?rev=1453046&r1=1453045&r2=1453046&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java (original)
+++ subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java Tue Mar 5 22:27:47 2013
@@ -662,6 +662,23 @@ public interface ISVNClient
throws ClientException;
/**
+ * Retrieves the properties of an item, including inherited properties.
+ *
+ * @param path the path of the item
+ * @param revision the revision of the item
+ * @param pegRevision the revision to interpret path
+ * @param depth the depth to recurse into subdirectories
+ * @param changelists changelists to filter by
+ * @param callback the callback to use to return the properties
+ * @throws ClientException
+ * @since 1.8
+ */
+ void properties(String path, Revision revision, Revision pegRevision,
+ Depth depth, Collection<String> changelists,
+ InheritedProplistCallback callback)
+ throws ClientException;
+
+ /**
* Sets one property of an item with a String value
*
* @param paths paths of the items
Modified: subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java?rev=1453046&r1=1453045&r2=1453046&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java (original)
+++ subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java Tue Mar 5 22:27:47 2013
@@ -356,6 +356,12 @@ public class SVNClient implements ISVNCl
ProplistCallback callback)
throws ClientException;
+ public native void properties(String path, Revision revision,
+ Revision pegRevision, Depth depth,
+ Collection<String> changelists,
+ InheritedProplistCallback callback)
+ throws ClientException;
+
public native void propertySetLocal(Set<String> paths, String name,
byte[] value, Depth depth,
Collection<String> changelists,
Added: subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/InheritedProplistCallback.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/InheritedProplistCallback.java?rev=1453046&view=auto
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/InheritedProplistCallback.java (added)
+++ subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/InheritedProplistCallback.java Tue Mar 5 22:27:47 2013
@@ -0,0 +1,71 @@
+/**
+ * @copyright
+ * ====================================================================
+ * 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.
+ * ====================================================================
+ * @endcopyright
+ */
+
+package org.apache.subversion.javahl.callback;
+
+import java.util.Collection;
+import java.util.Map;
+import org.apache.subversion.javahl.ISVNClient;
+
+/**
+ * This interface is used to return regular and inherited property
+ * lists for each path in a {@link ISVNClient#properties} call.
+ *
+ * @since 1.8
+ */
+public interface InheritedProplistCallback
+{
+
+ /**
+ * Describes properties inherited from one parent.
+ */
+ public class InheritedItem
+ {
+ /**
+ * The path or URL of the owner of the inherited property.
+ */
+ public final String path_or_url;
+
+ /**
+ * the inherited properties
+ */
+ public final Map<String, byte[]> properties;
+
+ public InheritedItem(String path_or_url, Map<String, byte[]> properties)
+ {
+ this.path_or_url = path_or_url;
+ this.properties = properties;
+ }
+ }
+
+ /**
+ * The method will be called once for every file.
+ * @param path the path.
+ * @param properties the properties on the path.
+ * @param inherited_properties
+ * depth-first ordered array of inherited properties..
+ */
+ public void singlePath(String path,
+ Map<String, byte[]> properties,
+ Collection<InheritedItem> inherited_properties);
+}
Modified: subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/ProplistCallback.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/ProplistCallback.java?rev=1453046&r1=1453045&r2=1453046&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/ProplistCallback.java (original)
+++ subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/ProplistCallback.java Tue Mar 5 22:27:47 2013
@@ -33,7 +33,7 @@ import org.apache.subversion.javahl.ISVN
public interface ProplistCallback
{
/**
- * the method will be called for every line in a file.
+ * the method will be called once for every file.
* @param path the path.
* @param properties the properties on the path.
*/
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=1453046&r1=1453045&r2=1453046&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 Tue Mar 5 22:27:47 2013
@@ -796,6 +796,49 @@ public class BasicTests extends SVNTests
}
/**
+ * Test property inheritance.
+ * @throws Throwable
+ */
+ public void testInheritedProperties() throws Throwable
+ {
+ OneTest thisTest = new OneTest();
+ WC wc = thisTest.getWc();
+
+ String adirPath = fileToSVNPath(new File(thisTest.getWCPath(),
+ "/A"),
+ false);
+ String alphaPath = fileToSVNPath(new File(thisTest.getWCPath(),
+ "/A/B/E/alpha"),
+ false);
+
+ String propval = "ybg";
+ setprop(adirPath, "ahqrtz", propval.getBytes());
+
+ final Map<String, Collection<InheritedProplistCallback.InheritedItem>> ipropMaps =
+ new HashMap<String, Collection<InheritedProplistCallback.InheritedItem>>();
+
+ client.properties(alphaPath, null, null, Depth.empty, null,
+ new InheritedProplistCallback () {
+ public void singlePath(
+ String path, Map<String, byte[]> props,
+ Collection<InheritedProplistCallback.InheritedItem> iprops)
+ { ipropMaps.put(path, iprops); }
+ });
+ Collection<InheritedProplistCallback.InheritedItem> iprops = ipropMaps.get(alphaPath);
+ for (InheritedProplistCallback.InheritedItem item : iprops)
+ {
+ for (String key : item.properties.keySet())
+ {
+ assertEquals("ahqrtz", key);
+ assertEquals(propval, new String(item.properties.get(key)));
+ }
+ }
+
+ wc.setItemPropStatus("A", Status.Kind.modified);
+ thisTest.checkStatus();
+ }
+
+ /**
* Test the basic SVNClient.update functionality.
* @throws Throwable
*/
RE: Review of JavaHL updates (was: svn commit: r1453046 - in /subversion/trunk/subversion/bindings/javahl: native/ src/org/apache/subversion/javahl/ src/org/apache/subversion/javahl/callback/ tests/org/apache/subversion/javahl/)
Posted by Gavin Baumanis <ga...@thespidernet.com>.
<snip>
> You'll notice the implementation uses the copy-paste-modify-by-
> example-and-hope-for-the-best method of software development.
One of my all-time favourite ways to code! :)
Welcome aboard the crazy train... You might just fit right in here!
Next stop - debug central!
Review of JavaHL updates (was: svn commit: r1453046 - in /subversion/trunk/subversion/bindings/javahl:
native/ src/org/apache/subversion/javahl/ src/org/apache/subversion/javahl/callback/
tests/org/apache/subversion/javahl/)
Posted by Branko Čibej <br...@wandisco.com>.
On 05.03.2013 23:27, brane@apache.org wrote:
> Author: brane
> Date: Tue Mar 5 22:27:47 2013
> New Revision: 1453046
>
> URL: http://svn.apache.org/r1453046
> Log:
> Working on isue #4326 (update javahl with new 1.8 APIs).
>
> Implement property-inheritance-aware SVNCLient.properties.
Given that I'm a total n00b as far as JNI and JavaHL are concerned, I
would appreciate a review of these changes by someone more knowledgeable
on the subject. You'll notice the implementation uses the
copy-paste-modify-by-example-and-hope-for-the-best method of software
development.
See also r1451810 and r1451811.
Thanks!
-- Brane
P.S.: I'll be making more changes as I dig through the new APIs in
svn_client.h and other places that may need exposure in JavaHL.
--
Branko Čibej
Director of Subversion | WANdisco | www.wandisco.com