Search in sources :

Example 16 with LiveOperation

use of com.microsoft.live.LiveOperation in project LiveSDK-for-Android by liveservices.

the class PutTest method testAsyncResponseBodyInvalid.

@Override
public void testAsyncResponseBodyInvalid() throws Throwable {
    this.loadInvalidResponseBody();
    String requestPath = Paths.INVALID;
    this.runTestOnUiThread(createAsyncRunnable(requestPath, CALENDAR));
    LiveOperation fromMethod = this.responseQueue.take();
    LiveOperation fromCallback = this.pollResponseQueue();
    LiveOperationException exception = this.pollExceptionQueue();
    this.checkReturnedException(fromMethod, fromCallback, exception);
    this.checkOperationMembers(fromMethod, METHOD, requestPath);
    this.checkResponseBodyInvalid(fromMethod);
}
Also used : LiveOperation(com.microsoft.live.LiveOperation) LiveOperationException(com.microsoft.live.LiveOperationException)

Example 17 with LiveOperation

use of com.microsoft.live.LiveOperation in project LiveSDK-for-Android by liveservices.

the class CopyTest method testSyncResponseBodyValid.

@Override
public void testSyncResponseBodyValid() throws Exception {
    this.loadValidResponseBody();
    String requestPath = "folder.181231";
    String destination = "folder.1231";
    LiveOperation operation = this.liveConnectClient.copy(requestPath, destination);
    this.checkOperationMembers(operation, METHOD, requestPath);
    this.checkValidResponseBody(operation);
}
Also used : LiveOperation(com.microsoft.live.LiveOperation)

Example 18 with LiveOperation

use of com.microsoft.live.LiveOperation in project LiveSDK-for-Android by liveservices.

the class ContactsActivity method loadContacts.

private void loadContacts() {
    final ProgressDialog progDialog = ProgressDialog.show(this, "", "Loading. Please wait...", true);
    mClient.getAsync("me/contacts", new LiveOperationListener() {

        @Override
        public void onError(LiveOperationException exception, LiveOperation operation) {
            progDialog.dismiss();
            showToast(exception.getMessage());
        }

        @Override
        public void onComplete(LiveOperation operation) {
            progDialog.dismiss();
            JSONObject result = operation.getResult();
            if (result.has(JsonKeys.ERROR)) {
                JSONObject error = result.optJSONObject(JsonKeys.ERROR);
                String message = error.optString(JsonKeys.MESSAGE);
                String code = error.optString(JsonKeys.CODE);
                showToast(code + ": " + message);
                return;
            }
            ArrayList<Contact> contacts = mAdapter.getContacts();
            contacts.clear();
            JSONArray data = result.optJSONArray(JsonKeys.DATA);
            for (int i = 0; i < data.length(); i++) {
                Contact contact = new Contact(data.optJSONObject(i));
                contacts.add(contact);
            }
            mAdapter.notifyDataSetChanged();
        }
    });
}
Also used : JSONObject(org.json.JSONObject) LiveOperationListener(com.microsoft.live.LiveOperationListener) LiveOperation(com.microsoft.live.LiveOperation) ArrayList(java.util.ArrayList) JSONArray(org.json.JSONArray) ProgressDialog(android.app.ProgressDialog) LiveOperationException(com.microsoft.live.LiveOperationException)

Example 19 with LiveOperation

use of com.microsoft.live.LiveOperation in project LiveSDK-for-Android by liveservices.

the class DeleteTest method testAsyncResponseBodyValid.

@Override
public void testAsyncResponseBodyValid() throws Throwable {
    this.loadValidResponseBody();
    String requestPath = this.calendarId;
    this.runTestOnUiThread(createAsyncRunnable(requestPath));
    LiveOperation fromMethod = this.responseQueue.take();
    LiveOperation fromCallback = this.pollResponseQueue();
    this.checkReturnedOperations(fromMethod, fromCallback);
    this.checkOperationMembers(fromMethod, METHOD, requestPath);
    this.checkValidResponseBody(fromMethod);
}
Also used : LiveOperation(com.microsoft.live.LiveOperation)

Example 20 with LiveOperation

use of com.microsoft.live.LiveOperation in project LiveSDK-for-Android by liveservices.

the class DeleteTest method testSyncResponseBodyValid.

@Override
public void testSyncResponseBodyValid() throws Exception {
    this.loadValidResponseBody();
    String requestPath = this.calendarId;
    LiveOperation operation = this.liveConnectClient.delete(requestPath);
    this.checkOperationMembers(operation, METHOD, requestPath);
    this.checkValidResponseBody(operation);
}
Also used : LiveOperation(com.microsoft.live.LiveOperation)

Aggregations

LiveOperation (com.microsoft.live.LiveOperation)36 LiveOperationException (com.microsoft.live.LiveOperationException)10 JSONObject (org.json.JSONObject)10 OperationQueueingListener (com.microsoft.live.test.util.OperationQueueingListener)4 ProgressDialog (android.app.ProgressDialog)3 LiveOperationListener (com.microsoft.live.LiveOperationListener)3 ArrayList (java.util.ArrayList)2 JSONArray (org.json.JSONArray)2 DialogInterface (android.content.DialogInterface)1 OnCancelListener (android.content.DialogInterface.OnCancelListener)1 View (android.view.View)1 OnClickListener (android.view.View.OnClickListener)1 TextView (android.widget.TextView)1 LiveAuthClient (com.microsoft.live.LiveAuthClient)1 LiveAuthException (com.microsoft.live.LiveAuthException)1 LiveAuthListener (com.microsoft.live.LiveAuthListener)1 LiveConnectClient (com.microsoft.live.LiveConnectClient)1 LiveConnectSession (com.microsoft.live.LiveConnectSession)1 LiveDownloadOperation (com.microsoft.live.LiveDownloadOperation)1 LiveDownloadOperationListener (com.microsoft.live.LiveDownloadOperationListener)1