mirror of
				https://github.com/owncloud/android-library.git
				synced 2025-10-31 02:17:41 +00:00 
			
		
		
		
	Merge pull request #111 from owncloud/federated_sharing
Support for federated sharing
This commit is contained in:
		
						commit
						cf3baa6cd5
					
				| @ -35,6 +35,7 @@ env: | |||||||
|   - secure: gPCBnpGLA2sdSMtfhT+/InThmXNEU8XrrS54uuIP8iXBLvVe0yZrNl76GbMosV0ry3YtDngsmsbHwRjPPb0+3mTTdAqZ60HHzGaNPgEm6b5t0t4bpJ3LW9osLZsuf9jRsI2LD66zxblaMrK2+8hN/dUrj707ijsZHp3SPSQJ6g8= |   - secure: gPCBnpGLA2sdSMtfhT+/InThmXNEU8XrrS54uuIP8iXBLvVe0yZrNl76GbMosV0ry3YtDngsmsbHwRjPPb0+3mTTdAqZ60HHzGaNPgEm6b5t0t4bpJ3LW9osLZsuf9jRsI2LD66zxblaMrK2+8hN/dUrj707ijsZHp3SPSQJ6g8= | ||||||
|   - secure: AnxLVarfwM7IhJ7Sca35USyRlFHFvlcBhWTt2TVDcyQ+ldDyb+U6IWXFK0Yy82QP0ZH/RCLu7FnmHK/rKG0BHNRt1Ymco1VkTQql0MZcHXP+4IKgEvgJyUn1TqYj+hSVmM6lgTA+QUjZYGSfwU8mhUFiU7644ZTdTe6ALdqa+v8= |   - secure: AnxLVarfwM7IhJ7Sca35USyRlFHFvlcBhWTt2TVDcyQ+ldDyb+U6IWXFK0Yy82QP0ZH/RCLu7FnmHK/rKG0BHNRt1Ymco1VkTQql0MZcHXP+4IKgEvgJyUn1TqYj+hSVmM6lgTA+QUjZYGSfwU8mhUFiU7644ZTdTe6ALdqa+v8= | ||||||
|   - secure: ezKyZbb3q1Phcv/vJntuJe0C2req+Hp4/C+tFZIWZ3o8wRO9jVI3bnED9TWQyQOOT0SoRYjJ5zqp0UcEOGCzPeWFO6bA7RWp+zA/R9sziLNcVWMVv3WXnuClQjPBHJeXRnP7YmNjxDmSfV97a14dk5d9LgJZYliTDepH4dLsxro= |   - secure: ezKyZbb3q1Phcv/vJntuJe0C2req+Hp4/C+tFZIWZ3o8wRO9jVI3bnED9TWQyQOOT0SoRYjJ5zqp0UcEOGCzPeWFO6bA7RWp+zA/R9sziLNcVWMVv3WXnuClQjPBHJeXRnP7YmNjxDmSfV97a14dk5d9LgJZYliTDepH4dLsxro= | ||||||
|  |   - secure: HV8REF7bB1i6cBEe4YCZvjgTf6tGiptAPzp9qZXGUH9Lxh6yUjYMXXP8flDaIFcE2JuAakW6P4SPr7/SQ+X4f8/84cNhmU1I+6Y1nG37WvelRHQVslOUDbl1TNUnynYZ+ybkb3BtrQvggCGMdQKvGZXYiggFhN/TWuDo0c7Q2Ro= | ||||||
|   matrix: |   matrix: | ||||||
|   - ANDROID_TARGET=android-23 ANDROID_ABI=armeabi-v7a |   - ANDROID_TARGET=android-23 ANDROID_ABI=armeabi-v7a | ||||||
| addons: | addons: | ||||||
|  | |||||||
| @ -78,7 +78,7 @@ public class GetRemoteShareesOperation extends RemoteOperation{ | |||||||
| 
 | 
 | ||||||
|     // Arguments - constant values |     // Arguments - constant values | ||||||
|     private static final String VALUE_FORMAT = "json"; |     private static final String VALUE_FORMAT = "json"; | ||||||
|     private static final String VALUE_ITEM_TYPE = "search";         //  to get the server search for users / groups |     private static final String VALUE_ITEM_TYPE = "file";         //  to get the server search for users / groups | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     // JSON Node names |     // JSON Node names | ||||||
| @ -87,15 +87,12 @@ public class GetRemoteShareesOperation extends RemoteOperation{ | |||||||
|     private static final String NODE_EXACT = "exact"; |     private static final String NODE_EXACT = "exact"; | ||||||
|     private static final String NODE_USERS = "users"; |     private static final String NODE_USERS = "users"; | ||||||
|     private static final String NODE_GROUPS = "groups"; |     private static final String NODE_GROUPS = "groups"; | ||||||
|  |     private static final String NODE_REMOTES = "remotes"; | ||||||
|     public static final String NODE_VALUE = "value"; |     public static final String NODE_VALUE = "value"; | ||||||
|     public static final String PROPERTY_LABEL = "label"; |     public static final String PROPERTY_LABEL = "label"; | ||||||
|     public static final String PROPERTY_SHARE_TYPE = "shareType"; |     public static final String PROPERTY_SHARE_TYPE = "shareType"; | ||||||
|     public static final String PROPERTY_SHARE_WITH = "shareWith"; |     public static final String PROPERTY_SHARE_WITH = "shareWith"; | ||||||
| 
 | 
 | ||||||
|     // Result types |  | ||||||
|     public static final Byte USER_TYPE = 0; |  | ||||||
|     public static final Byte GROUP_TYPE = 1; |  | ||||||
| 
 |  | ||||||
|     private String mSearchString; |     private String mSearchString; | ||||||
|     private int mPage; |     private int mPage; | ||||||
|     private int mPerPage; |     private int mPerPage; | ||||||
| @ -146,17 +143,21 @@ public class GetRemoteShareesOperation extends RemoteOperation{ | |||||||
|                 JSONObject respExact = respData.getJSONObject(NODE_EXACT); |                 JSONObject respExact = respData.getJSONObject(NODE_EXACT); | ||||||
|                 JSONArray respExactUsers = respExact.getJSONArray(NODE_USERS); |                 JSONArray respExactUsers = respExact.getJSONArray(NODE_USERS); | ||||||
|                 JSONArray respExactGroups = respExact.getJSONArray(NODE_GROUPS); |                 JSONArray respExactGroups = respExact.getJSONArray(NODE_GROUPS); | ||||||
|  |                 JSONArray respExactRemotes = respExact.getJSONArray(NODE_REMOTES); | ||||||
|                 JSONArray respPartialUsers = respData.getJSONArray(NODE_USERS); |                 JSONArray respPartialUsers = respData.getJSONArray(NODE_USERS); | ||||||
|                 JSONArray respPartialGroups = respData.getJSONArray(NODE_GROUPS); |                 JSONArray respPartialGroups = respData.getJSONArray(NODE_GROUPS); | ||||||
|  |                 JSONArray respPartialRemotes = respData.getJSONArray(NODE_REMOTES); | ||||||
|                 JSONArray[] jsonResults = { |                 JSONArray[] jsonResults = { | ||||||
|                         respExactUsers, |                         respExactUsers, | ||||||
|                         respExactGroups, |                         respExactGroups, | ||||||
|  |                         respExactRemotes, | ||||||
|                         respPartialUsers, |                         respPartialUsers, | ||||||
|                         respPartialGroups |                         respPartialGroups, | ||||||
|  |                         respPartialRemotes | ||||||
|                 }; |                 }; | ||||||
| 
 | 
 | ||||||
|                 ArrayList<Object> data = new ArrayList<Object>(); // For result data |                 ArrayList<Object> data = new ArrayList<Object>(); // For result data | ||||||
|                 for (int i=0; i<4; i++) { |                 for (int i=0; i<6; i++) { | ||||||
|                     for(int j=0; j< jsonResults[i].length(); j++){ |                     for(int j=0; j< jsonResults[i].length(); j++){ | ||||||
|                         JSONObject jsonResult = jsonResults[i].getJSONObject(j); |                         JSONObject jsonResult = jsonResults[i].getJSONObject(j); | ||||||
|                         data.add(jsonResult); |                         data.add(jsonResult); | ||||||
|  | |||||||
| @ -62,6 +62,16 @@ public class OCShare implements Parcelable, Serializable { | |||||||
|             CREATE_PERMISSION_FLAG + |             CREATE_PERMISSION_FLAG + | ||||||
|             DELETE_PERMISSION_FLAG |             DELETE_PERMISSION_FLAG | ||||||
|     ; |     ; | ||||||
|  |     public static final int FEDERATED_PERMISSIONS_FOR_FILE = | ||||||
|  |             READ_PERMISSION_FLAG + | ||||||
|  |             UPDATE_PERMISSION_FLAG | ||||||
|  |     ; | ||||||
|  |     public static final int FEDERATED_PERMISSIONS_FOR_FOLDER = | ||||||
|  |             READ_PERMISSION_FLAG + | ||||||
|  |             UPDATE_PERMISSION_FLAG + | ||||||
|  |             CREATE_PERMISSION_FLAG + | ||||||
|  |             DELETE_PERMISSION_FLAG | ||||||
|  |     ; | ||||||
| 
 | 
 | ||||||
|     private long mId; |     private long mId; | ||||||
|     private long mFileSource; |     private long mFileSource; | ||||||
|  | |||||||
| @ -15,6 +15,20 @@ | |||||||
| 			</then> | 			</then> | ||||||
| 		</if> | 		</if> | ||||||
| 		 | 		 | ||||||
|  | 		<!-- Replace OC server URL 2 if set in environment --> | ||||||
|  | 		<if> | ||||||
|  | 			<condition> | ||||||
|  | 				<isset property="env.OCTEST_SERVER_BASE_URL_2" /> | ||||||
|  | 			</condition> | ||||||
|  | 			<then> | ||||||
|  | 				<replaceregexp | ||||||
|  | 					file="res/values/setup.xml" | ||||||
|  | 					match='("server_base_url_2">)\s*(<)' | ||||||
|  | 					replace="\1${env.OCTEST_SERVER_BASE_URL_2}\2" | ||||||
|  | 					byline="true" /> | ||||||
|  | 			</then> | ||||||
|  | 		</if> | ||||||
|  | 		 | ||||||
| 		<!-- Replace test username if set in environment --> | 		<!-- Replace test username if set in environment --> | ||||||
| 		<if> | 		<if> | ||||||
| 			<condition> | 			<condition> | ||||||
|  | |||||||
| @ -26,6 +26,7 @@ | |||||||
| <resources> | <resources> | ||||||
|     <string name="build_number"></string> |     <string name="build_number"></string> | ||||||
|     <string name="server_base_url"></string> |     <string name="server_base_url"></string> | ||||||
|  |     <string name="server_base_url_2"></string> | ||||||
|     <string name="username"></string> |     <string name="username"></string> | ||||||
|     <string name="password"></string> |     <string name="password"></string> | ||||||
|     <string name ="user_agent">Mozilla/5.0 (Android) ownCloud test project</string> |     <string name ="user_agent">Mozilla/5.0 (Android) ownCloud test project</string> | ||||||
|  | |||||||
| @ -29,6 +29,7 @@ import java.io.File; | |||||||
| import com.owncloud.android.lib.common.operations.RemoteOperationResult; | import com.owncloud.android.lib.common.operations.RemoteOperationResult; | ||||||
| import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode; | import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode; | ||||||
| import com.owncloud.android.lib.resources.shares.ShareType; | import com.owncloud.android.lib.resources.shares.ShareType; | ||||||
|  | import com.owncloud.android.lib.test_project.R; | ||||||
| import com.owncloud.android.lib.test_project.TestActivity; | import com.owncloud.android.lib.test_project.TestActivity; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
| @ -47,6 +48,7 @@ public class CreateShareTest extends RemoteTest { | |||||||
| 	private TestActivity mActivity; | 	private TestActivity mActivity; | ||||||
| 	private String mFullPath2FileToShare; | 	private String mFullPath2FileToShare; | ||||||
| 	private String mFullPath2NonExistentFile; | 	private String mFullPath2NonExistentFile; | ||||||
|  | 	private String mRemoteServer; | ||||||
| 	 | 	 | ||||||
| 	@Override | 	@Override | ||||||
| 	protected void setUp() throws Exception { | 	protected void setUp() throws Exception { | ||||||
| @ -55,6 +57,7 @@ public class CreateShareTest extends RemoteTest { | |||||||
| 	    mActivity = getActivity(); | 	    mActivity = getActivity(); | ||||||
| 	    mFullPath2FileToShare = mBaseFolderPath + FILE_TO_SHARE; | 	    mFullPath2FileToShare = mBaseFolderPath + FILE_TO_SHARE; | ||||||
| 	    mFullPath2NonExistentFile = mBaseFolderPath + NON_EXISTENT_FILE; | 	    mFullPath2NonExistentFile = mBaseFolderPath + NON_EXISTENT_FILE; | ||||||
|  | 	    mRemoteServer = getActivity().getString(R.string.server_base_url_2); | ||||||
| 	    		 | 	    		 | ||||||
| 		File textFile = mActivity.extractAsset(TestActivity.ASSETS__TEXT_FILE_NAME); | 		File textFile = mActivity.extractAsset(TestActivity.ASSETS__TEXT_FILE_NAME); | ||||||
| 		RemoteOperationResult result = mActivity.uploadFile( | 		RemoteOperationResult result = mActivity.uploadFile( | ||||||
| @ -217,6 +220,82 @@ public class CreateShareTest extends RemoteTest { | |||||||
| 		 | 		 | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
|  | 	/** | ||||||
|  | 	 * Test creation of federated shares with remote users | ||||||
|  | 	 */ | ||||||
|  | 	public void testCreateFederatedShareWithUser() { | ||||||
|  | 		 | ||||||
|  | 		String remoteDomain = mRemoteServer.split("//")[1]; | ||||||
|  | 		 | ||||||
|  | 		/// Successful cases | ||||||
|  | 		RemoteOperationResult result = mActivity.createShare( | ||||||
|  | 				mFullPath2FileToShare,  | ||||||
|  | 				ShareType.FEDERATED,  | ||||||
|  | 				"admin@" + remoteDomain,  | ||||||
|  | 				false,  | ||||||
|  | 				"",  | ||||||
|  | 				1); | ||||||
|  | 		assertTrue(result.isSuccess()); | ||||||
|  | 		 | ||||||
|  | 		 | ||||||
|  | 		/// Failed cases | ||||||
|  | 		 | ||||||
|  | 		// sharee doesn't exist in an existing remote server | ||||||
|  | 		result = mActivity.createShare( | ||||||
|  | 				mFullPath2FileToShare,  | ||||||
|  | 				ShareType.FEDERATED,  | ||||||
|  | 				"no_exist@" + remoteDomain,  | ||||||
|  | 				false,  | ||||||
|  | 				"",  | ||||||
|  | 				31); | ||||||
|  | 		assertFalse(result.isSuccess()); | ||||||
|  | 		assertEquals( | ||||||
|  | 				RemoteOperationResult.ResultCode.SHARE_FORBIDDEN,  | ||||||
|  | 				result.getCode() | ||||||
|  | 		); | ||||||
|  | 		assertTrue(		// error message from server as part of the result | ||||||
|  | 				result.getData().size() == 1 &&  | ||||||
|  | 				result.getData().get(0) instanceof String | ||||||
|  | 		); | ||||||
|  | 		 | ||||||
|  | 		// remote server doesn't exist | ||||||
|  | 		result = mActivity.createShare( | ||||||
|  | 				mFullPath2FileToShare, | ||||||
|  | 				ShareType.FEDERATED, | ||||||
|  | 				"no_exist", | ||||||
|  | 				false, | ||||||
|  | 				"", | ||||||
|  | 				31); | ||||||
|  | 		assertFalse(result.isSuccess()); | ||||||
|  | 		assertEquals( | ||||||
|  | 				RemoteOperationResult.ResultCode.SHARE_WRONG_PARAMETER, | ||||||
|  | 				result.getCode() | ||||||
|  | 		); | ||||||
|  | 		assertTrue(		// error message from server as part of the result | ||||||
|  | 				result.getData().size() == 1 && | ||||||
|  | 				result.getData().get(0) instanceof String | ||||||
|  | 		); | ||||||
|  | 		 | ||||||
|  | 		// file doesn't exist | ||||||
|  | 		result = mActivity.createShare( | ||||||
|  | 				mFullPath2NonExistentFile,  | ||||||
|  | 				ShareType.FEDERATED,  | ||||||
|  | 				"admin@" + remoteDomain,  | ||||||
|  | 				false,  | ||||||
|  | 				"",  | ||||||
|  | 				31); | ||||||
|  | 		assertFalse(result.isSuccess()); | ||||||
|  | 		assertEquals( | ||||||
|  | 				RemoteOperationResult.ResultCode.SHARE_NOT_FOUND,  | ||||||
|  | 				result.getCode() | ||||||
|  | 		); | ||||||
|  | 		assertTrue(		// error message from server as part of the result | ||||||
|  | 				result.getData().size() == 1 &&  | ||||||
|  | 				result.getData().get(0) instanceof String | ||||||
|  | 		); | ||||||
|  | 		 | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
| 	 | 	 | ||||||
| 	@Override | 	@Override | ||||||
| 	protected void tearDown() throws Exception { | 	protected void tearDown() throws Exception { | ||||||
|  | |||||||
| @ -41,6 +41,7 @@ import com.owncloud.android.lib.common.OwnCloudCredentialsFactory; | |||||||
| import com.owncloud.android.lib.common.network.NetworkUtils; | import com.owncloud.android.lib.common.network.NetworkUtils; | ||||||
| import com.owncloud.android.lib.common.operations.RemoteOperationResult; | import com.owncloud.android.lib.common.operations.RemoteOperationResult; | ||||||
| import com.owncloud.android.lib.resources.shares.GetRemoteShareesOperation; | import com.owncloud.android.lib.resources.shares.GetRemoteShareesOperation; | ||||||
|  | import com.owncloud.android.lib.resources.shares.ShareType; | ||||||
| import com.owncloud.android.lib.test_project.R; | import com.owncloud.android.lib.test_project.R; | ||||||
| import com.owncloud.android.lib.test_project.SelfSignedConfidentSslSocketFactory; | import com.owncloud.android.lib.test_project.SelfSignedConfidentSslSocketFactory; | ||||||
| 
 | 
 | ||||||
| @ -68,7 +69,7 @@ public class GetShareesTest extends RemoteTest { | |||||||
| 
 | 
 | ||||||
| 	private static final String LOG_TAG = GetShareesTest.class.getCanonicalName(); | 	private static final String LOG_TAG = GetShareesTest.class.getCanonicalName(); | ||||||
| 		 | 		 | ||||||
| 	String mServerUri, mUser, mPass; | 	String mServerUri, mUser, mPass, mServerUri2; | ||||||
| 	OwnCloudClient mClient = null; | 	OwnCloudClient mClient = null; | ||||||
| 	 | 	 | ||||||
| 	public GetShareesTest() { | 	public GetShareesTest() { | ||||||
| @ -125,15 +126,15 @@ public class GetShareesTest extends RemoteTest { | |||||||
| 		RemoteOperationResult result = getShareesOperation.execute(mClient); | 		RemoteOperationResult result = getShareesOperation.execute(mClient); | ||||||
| 		JSONObject resultItem; | 		JSONObject resultItem; | ||||||
| 		JSONObject value; | 		JSONObject value; | ||||||
| 		byte type; | 		int type; | ||||||
| 		int userCount = 0, groupCount = 0; | 		int userCount = 0, groupCount = 0; | ||||||
| 		assertTrue(result.isSuccess() && result.getData().size() > 0); | 		assertTrue(result.isSuccess() && result.getData().size() > 0); | ||||||
| 		try { | 		try { | ||||||
| 			for (int i=0; i<result.getData().size(); i++) { | 			for (int i=0; i<result.getData().size(); i++) { | ||||||
| 				resultItem = (JSONObject) result.getData().get(i); | 				resultItem = (JSONObject) result.getData().get(i); | ||||||
| 	            value = resultItem.getJSONObject(GetRemoteShareesOperation.NODE_VALUE); | 	            value = resultItem.getJSONObject(GetRemoteShareesOperation.NODE_VALUE); | ||||||
| 	            type = (byte) value.getInt(GetRemoteShareesOperation.PROPERTY_SHARE_TYPE); | 	            type = value.getInt(GetRemoteShareesOperation.PROPERTY_SHARE_TYPE); | ||||||
| 				if (GetRemoteShareesOperation.GROUP_TYPE.equals(type)) { | 				if (type == ShareType.GROUP.getValue()) { | ||||||
| 					groupCount++; | 					groupCount++; | ||||||
| 				} else { | 				} else { | ||||||
| 					userCount++; | 					userCount++; | ||||||
| @ -156,8 +157,8 @@ public class GetShareesTest extends RemoteTest { | |||||||
| 			for (int i=0; i<2; i++) { | 			for (int i=0; i<2; i++) { | ||||||
| 				resultItem = (JSONObject) result.getData().get(i); | 				resultItem = (JSONObject) result.getData().get(i); | ||||||
| 	            value = resultItem.getJSONObject(GetRemoteShareesOperation.NODE_VALUE); | 	            value = resultItem.getJSONObject(GetRemoteShareesOperation.NODE_VALUE); | ||||||
| 	            type = (byte) value.getInt(GetRemoteShareesOperation.PROPERTY_SHARE_TYPE); | 	            type = value.getInt(GetRemoteShareesOperation.PROPERTY_SHARE_TYPE); | ||||||
| 				if (GetRemoteShareesOperation.GROUP_TYPE.equals(type)) { | 				if (type == ShareType.GROUP.getValue()) { | ||||||
| 					groupCount++; | 					groupCount++; | ||||||
| 				} else { | 				} else { | ||||||
| 					userCount++; | 					userCount++; | ||||||
| @ -190,6 +191,59 @@ public class GetShareesTest extends RemoteTest { | |||||||
| 		assertTrue(!result.isSuccess() && result.getHttpCode() == HttpStatus.SC_BAD_REQUEST); | 		assertTrue(!result.isSuccess() && result.getHttpCode() == HttpStatus.SC_BAD_REQUEST); | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
|  | 	/** | ||||||
|  | 	 *  Test get federated sharees | ||||||
|  | 	 *  | ||||||
|  | 	 *  Requires OC server 8.2 or later | ||||||
|  | 	 */ | ||||||
|  | 	public void testGetFederatedShareesOperation() { | ||||||
|  | 		Log.v(LOG_TAG, "testGetFederatedSharees in"); | ||||||
|  | 
 | ||||||
|  | 		/// successful cases | ||||||
|  | 
 | ||||||
|  | 		// search for sharees including "@" | ||||||
|  | 		GetRemoteShareesOperation getShareesOperation = new GetRemoteShareesOperation("@", 1, 50); | ||||||
|  | 		RemoteOperationResult result = getShareesOperation.execute(mClient); | ||||||
|  | 		JSONObject resultItem; | ||||||
|  | 		JSONObject value; | ||||||
|  | 		int type; | ||||||
|  | 		int fedCount = 0; | ||||||
|  | 		assertTrue(result.isSuccess() && result.getData().size() > 0); | ||||||
|  | 		try { | ||||||
|  | 			for (int i=0; i<result.getData().size(); i++) { | ||||||
|  | 				resultItem = (JSONObject) result.getData().get(i); | ||||||
|  | 				value = resultItem.getJSONObject(GetRemoteShareesOperation.NODE_VALUE); | ||||||
|  | 				type = value.getInt(GetRemoteShareesOperation.PROPERTY_SHARE_TYPE); | ||||||
|  | 				if (type == ShareType.FEDERATED.getValue()) { | ||||||
|  | 					fedCount++; | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 			assertTrue(fedCount > 0); | ||||||
|  | 		} catch (JSONException e) { | ||||||
|  | 			AssertionFailedError afe = new AssertionFailedError(e.getLocalizedMessage()); | ||||||
|  | 			afe.setStackTrace(e.getStackTrace()); | ||||||
|  | 			throw afe; | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
|  | 		// search for 'admin' sharee from external server - expecting at least 1 result | ||||||
|  | 		String remoteSharee = "admin@" + mServerUri2.split("//")[1]; | ||||||
|  | 		getShareesOperation = new GetRemoteShareesOperation(remoteSharee, 1, 50); | ||||||
|  | 		result = getShareesOperation.execute(mClient); | ||||||
|  | 		assertTrue(result.isSuccess() && result.getData().size() > 0); | ||||||
|  | 
 | ||||||
|  | 		 | ||||||
|  | 		/// failed cases | ||||||
|  | 		 | ||||||
|  | 		// search for sharees including wrong page values | ||||||
|  | 		getShareesOperation = new GetRemoteShareesOperation("@", 0, 50); | ||||||
|  | 		result = getShareesOperation.execute(mClient); | ||||||
|  | 		assertTrue(!result.isSuccess() && result.getHttpCode() == HttpStatus.SC_BAD_REQUEST); | ||||||
|  | 		 | ||||||
|  | 		getShareesOperation = new GetRemoteShareesOperation("@", 1, 0); | ||||||
|  | 		result = getShareesOperation.execute(mClient); | ||||||
|  | 		assertTrue(!result.isSuccess() && result.getHttpCode() == HttpStatus.SC_BAD_REQUEST); | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
| 	@Override | 	@Override | ||||||
| 	protected void tearDown() throws Exception { | 	protected void tearDown() throws Exception { | ||||||
| 	    Log.v(LOG_TAG, "Deleting remote fixture..."); | 	    Log.v(LOG_TAG, "Deleting remote fixture..."); | ||||||
| @ -202,6 +256,7 @@ public class GetShareesTest extends RemoteTest { | |||||||
| 	    Log.v(LOG_TAG, "Setting up client instance to access OC server..."); | 	    Log.v(LOG_TAG, "Setting up client instance to access OC server..."); | ||||||
| 		 | 		 | ||||||
| 		mServerUri = context.getString(R.string.server_base_url); | 		mServerUri = context.getString(R.string.server_base_url); | ||||||
|  | 		mServerUri2 = context.getString(R.string.server_base_url_2); | ||||||
| 		mUser = context.getString(R.string.username); | 		mUser = context.getString(R.string.username); | ||||||
| 		mPass = context.getString(R.string.password); | 		mPass = context.getString(R.string.password); | ||||||
| 		 | 		 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user