diff --git a/README.md b/README.md index dc522200..81485b94 100644 --- a/README.md +++ b/README.md @@ -27,17 +27,17 @@ Now we'll create a simple application that retrieves messages using this SDK and ```Groovy dependencies { // base OData stuff: - compile group: 'com.microsoft.services', name: 'odata-engine-interfaces', version: '0.9.0' - compile group: 'com.microsoft.services', name: 'odata-engine-java-impl', version: '0.9.0' - compile group: 'com.microsoft.services', name: 'odata-engine-helpers', version: '0.9.0' - compile group: 'com.microsoft.services', name: 'odata-engine-android-impl', version: '0.9.0' + compile group: 'com.microsoft.services', name: 'odata-engine-interfaces', version: '(,1.0)' + compile group: 'com.microsoft.services', name: 'odata-engine-java-impl', version: '(,1.0)' + compile group: 'com.microsoft.services', name: 'odata-engine-helpers', version: '(,1.0)' + compile group: 'com.microsoft.services', name: 'odata-engine-android-impl', version: '(,1.0)' // choose the services/SDKs you need: - compile group: 'com.microsoft.services', name: 'outlook-services', version: '0.9.0' - compile group: 'com.microsoft.services', name: 'discovery-services', version: '0.9.0' - compile group: 'com.microsoft.services', name: 'directory-services', version: '0.9.0' - compile group: 'com.microsoft.services', name: 'file-services', version: '0.9.0' - compile group: 'com.microsoft.services', name: 'list-services', version: '0.9.0' + compile group: 'com.microsoft.services', name: 'outlook-services', version: '(,1.0)' + compile group: 'com.microsoft.services', name: 'discovery-services', version: '(,1.0)' + compile group: 'com.microsoft.services', name: 'directory-services', version: '(,1.0)' + compile group: 'com.microsoft.services', name: 'file-services', version: '(,1.0)' + compile group: 'com.microsoft.services', name: 'list-services', version: '(,1.0)' // ADAL compile group: 'com.microsoft.aad', name: 'adal', version: '1.0.2' { @@ -48,6 +48,8 @@ dependencies { ``` > NOTE: To avoid an error related to the Android support library, you might need to ensure it isn't being added redundantly by ADAL. That's why we've added the `exclude` call above. + + > NOTE: The version range will include up to but not including v1.0. 2. Follow the instructions on the [README for ADAL](https://github.com/AzureAD/azure-activedirectory-library-for-android) to handle authentication, or use the [Authentication.java](https://github.com/OfficeDev/Office-365-SDK-for-Android/blob/master/samples/simple-exchange-sample/app/src/main/java/com/microsoft/simple_exchange_sample/Authentication.java) implementation in our samples. diff --git a/samples/simple-exchange-sample/app/build.gradle b/samples/simple-exchange-sample/app/build.gradle index 45a3e0bf..2032c483 100755 --- a/samples/simple-exchange-sample/app/build.gradle +++ b/samples/simple-exchange-sample/app/build.gradle @@ -25,16 +25,16 @@ android { dependencies { // Base OData stuff - compile 'com.microsoft.services:odata-engine-interfaces:0.9.0' - compile 'com.microsoft.services:odata-engine-java-impl:0.9.0' - compile 'com.microsoft.services:odata-engine-android-impl:0.9.0@aar' - compile 'com.microsoft.services:odata-engine-helpers:0.9.0' + compile 'com.microsoft.services:odata-engine-interfaces:(,1.0)' + compile 'com.microsoft.services:odata-engine-java-impl:(,1.0)' + compile 'com.microsoft.services:odata-engine-android-impl:(,1.0)@aar' + compile 'com.microsoft.services:odata-engine-helpers:(,1.0)' // Service libraries - compile 'com.microsoft.services:directory-services:0.9.0' - compile 'com.microsoft.services:file-services:0.9.0' - compile 'com.microsoft.services:outlook-services:0.9.0' - compile 'com.microsoft.services:discovery-services:0.9.0' + compile 'com.microsoft.services:directory-services:(,1.0)' + compile 'com.microsoft.services:file-services:(,1.0)' + compile 'com.microsoft.services:outlook-services:(,1.0)' + compile 'com.microsoft.services:discovery-services:(,1.0)' compile 'com.android.support:support-v4:20.0.0' compile 'com.google.code.gson:gson:2.3' diff --git a/sdk/android-libraries.gradle b/sdk/android-libraries.gradle new file mode 100644 index 00000000..d822217f --- /dev/null +++ b/sdk/android-libraries.gradle @@ -0,0 +1,37 @@ +apply plugin: 'maven' + +uploadArchives { + repositories.mavenDeployer { + pom.groupId = PUBLISH_GROUP_ID + pom.artifactId = PUBLISH_ARTIFACT_ID + pom.version = PUBLISH_VERSION + repository ( + url: 'https://api.bintray.com/maven/msopentech/Maven/Office-365-SDK-for-Android' + ) { + authentication( + userName: 'username', + password: 'password' + ) + } + } +} + +task androidJavadocs(type: Javadoc) { + source = android.sourceSets.main.java.srcDirs + classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) +} + +task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) { + classifier = 'javadoc' + from androidJavadocs.destinationDir +} + +task androidSourcesJar(type: Jar) { + classifier = 'sources' + from android.sourceSets.main.java.srcDirs +} + +artifacts { + archives androidSourcesJar + archives androidJavadocsJar +} \ No newline at end of file diff --git a/sdk/build.gradle b/sdk/build.gradle index 88fd66ed..5d02e6af 100644 --- a/sdk/build.gradle +++ b/sdk/build.gradle @@ -4,6 +4,7 @@ buildscript { jcenter() } dependencies { + classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:0.6" classpath 'com.android.tools.build:gradle:0.12.2' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -14,6 +15,7 @@ allprojects { repositories { jcenter() } + apply plugin: 'idea' + group = 'com.microsoft.services' + version = '0.9.1' } - - diff --git a/sdk/directory-services/build.gradle b/sdk/directory-services/build.gradle index 463bfeb4..8f1a7424 100644 --- a/sdk/directory-services/build.gradle +++ b/sdk/directory-services/build.gradle @@ -4,5 +4,6 @@ dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile project(':odata-engine-interfaces') compile project(':odata-engine-helpers') - } + +apply from :'../java-libraries.gradle' diff --git a/sdk/discovery-services/build.gradle b/sdk/discovery-services/build.gradle index 14c600fa..8f1a7424 100644 --- a/sdk/discovery-services/build.gradle +++ b/sdk/discovery-services/build.gradle @@ -5,3 +5,5 @@ dependencies { compile project(':odata-engine-interfaces') compile project(':odata-engine-helpers') } + +apply from :'../java-libraries.gradle' diff --git a/sdk/file-services/build.gradle b/sdk/file-services/build.gradle index 53f34f3c..496e5154 100644 --- a/sdk/file-services/build.gradle +++ b/sdk/file-services/build.gradle @@ -4,4 +4,6 @@ apply plugin: 'eclipse' dependencies { compile project(':odata-engine-interfaces') compile project(':odata-engine-helpers') -} \ No newline at end of file +} + +apply from :'../java-libraries.gradle' diff --git a/sdk/file-services/src/main/java/com/microsoft/fileservices/DriveQuota.java b/sdk/file-services/src/main/java/com/microsoft/fileservices/DriveQuota.java index 9c16a3c3..7f6428a7 100755 --- a/sdk/file-services/src/main/java/com/microsoft/fileservices/DriveQuota.java +++ b/sdk/file-services/src/main/java/com/microsoft/fileservices/DriveQuota.java @@ -15,14 +15,14 @@ public DriveQuota(){ } - private long deleted; + private Long deleted; /** * Gets the deleted. * * @return the long */ - public long getdeleted() { + public Long getdeleted() { return this.deleted; } @@ -31,18 +31,18 @@ public long getdeleted() { * * @param value the long */ - public void setdeleted(long value) { + public void setdeleted(Long value) { this.deleted = value; } - private long remaining; + private Long remaining; /** * Gets the remaining. * * @return the long */ - public long getremaining() { + public Long getremaining() { return this.remaining; } @@ -51,7 +51,7 @@ public long getremaining() { * * @param value the long */ - public void setremaining(long value) { + public void setremaining(Long value) { this.remaining = value; } @@ -75,14 +75,14 @@ public void setstate(String value) { this.state = value; } - private long total; + private Long total; /** * Gets the total. * * @return the long */ - public long gettotal() { + public Long gettotal() { return this.total; } @@ -91,7 +91,7 @@ public long gettotal() { * * @param value the long */ - public void settotal(long value) { + public void settotal(Long value) { this.total = value; } } \ No newline at end of file diff --git a/sdk/file-services/src/main/java/com/microsoft/fileservices/Item.java b/sdk/file-services/src/main/java/com/microsoft/fileservices/Item.java index bda9ab1b..5366e07b 100755 --- a/sdk/file-services/src/main/java/com/microsoft/fileservices/Item.java +++ b/sdk/file-services/src/main/java/com/microsoft/fileservices/Item.java @@ -128,14 +128,14 @@ public ItemReference getparentReference() { public void setparentReference(ItemReference value) { this.parentReference = value; } - private long size; + private Long size; /** * Gets the size. * * @return the long */ - public long getsize() { + public Long getsize() { return this.size; } @@ -144,7 +144,7 @@ public long getsize() { * * @param value the long */ - public void setsize(long value) { + public void setsize(Long value) { this.size = value; } private java.util.Calendar dateTimeCreated; diff --git a/sdk/java-libraries.gradle b/sdk/java-libraries.gradle new file mode 100644 index 00000000..c4e5b656 --- /dev/null +++ b/sdk/java-libraries.gradle @@ -0,0 +1,82 @@ +apply plugin: 'maven' +apply plugin: 'maven-publish' +apply plugin: 'com.jfrog.bintray' + +// custom tasks for creating source/javadoc jars +task sourcesJar(type: Jar) { + classifier = 'sources' + from sourceSets.main.allSource +} + +task javadocJar(type: Jar) { + classifier = 'javadoc' + from javadoc.destinationDir +} + +repositories { + jcenter() +} + +configurations { + published +} + +// add javadoc/source jar tasks as artifacts +artifacts { + archives sourcesJar, javadocJar +} + +publishing { + publications { + mavenJava(MavenPublication) { + from components.java + + artifact sourcesJar { + classifier "sources" + } + + artifact javadocJar { + classifier "javadoc" + } + } + } +} + +ext.publish = false + +bintray { + + configurations = ['published'] //When uploading configuration files + apiUrl = "https://api.bintray.com" + user = 'user' + key = 'key' + dryRun = false + + filesSpec { + from 'files' + into 'standalone_files/level1' + rename '(.+)\\.(.+)', '$1-suffix.$2' + } + publish = project.publish + + pkg { + repo = 'Maven' + userOrg = 'msopentech' + name = 'Office-365-SDK-for-Android' + publications = ['mavenJava'] // see publications closure + desc = 'Office 365 Android SDK for Android' + websiteUrl = 'https://github.com/OfficeDev/Office-365-SDK-for-Android' + issueTrackerUrl = 'https://github.com/OfficeDev/Office-365-SDK-for-Android/issues' + vcsUrl = 'https://github.com/OfficeDev/Office-365-SDK-for-Android.git' + licenses = ['Apache-2.0'] + labels = ['office-365', 'android', 'exchange', 'sharepoint', 'files'] + attributes = ['plat': ['android', 'java']] + publicDownloadNumbers = true + + version { + name = '0.9.1' //Optional logical version name + desc = 'Office 365 Android SDK' + vcsTag = '0.9.1' + } + } +} diff --git a/sdk/list-services/build.gradle b/sdk/list-services/build.gradle index 9ea7a193..a5e796e9 100644 --- a/sdk/list-services/build.gradle +++ b/sdk/list-services/build.gradle @@ -1,5 +1,11 @@ apply plugin: 'com.android.library' +ext { + PUBLISH_GROUP_ID = 'com.microsoft.services' + PUBLISH_ARTIFACT_ID = 'list-services' + PUBLISH_VERSION = '0.9.1' +} + android { compileSdkVersion 20 buildToolsVersion "20.0.0" diff --git a/sdk/odata-engine-android-impl/build.gradle b/sdk/odata-engine-android-impl/build.gradle index 23f729fc..cf0878ac 100644 --- a/sdk/odata-engine-android-impl/build.gradle +++ b/sdk/odata-engine-android-impl/build.gradle @@ -1,12 +1,17 @@ apply plugin: 'com.android.library' -apply plugin: 'eclipse' + +ext { + PUBLISH_GROUP_ID = 'com.microsoft.services' + PUBLISH_ARTIFACT_ID = 'odata-engine-android-impl' + PUBLISH_VERSION = '0.9.1' +} android { compileSdkVersion 20 buildToolsVersion "20.0.0" defaultConfig { - applicationId "com.microsoft.office365.odata.impl" + applicationId "com.microsoft.services.odata.impl" minSdkVersion 15 targetSdkVersion 15 versionCode 1 @@ -26,3 +31,5 @@ dependencies { compile project(':odata-engine-interfaces') compile project(':odata-engine-java-impl') } + +apply from : '../android-libraries.gradle' \ No newline at end of file diff --git a/sdk/odata-engine-helpers/build.gradle b/sdk/odata-engine-helpers/build.gradle index e63e8a5c..f81b5a2b 100644 --- a/sdk/odata-engine-helpers/build.gradle +++ b/sdk/odata-engine-helpers/build.gradle @@ -1,9 +1,10 @@ apply plugin: 'java' -apply plugin: 'eclipse' dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.google.guava:guava:18.0' compile 'com.google.code.gson:gson:2.3' compile project(':odata-engine-interfaces') -} \ No newline at end of file +} + +apply from :'../java-libraries.gradle' \ No newline at end of file diff --git a/sdk/odata-engine-interfaces/build.gradle b/sdk/odata-engine-interfaces/build.gradle index 5e28161f..daf676ea 100644 --- a/sdk/odata-engine-interfaces/build.gradle +++ b/sdk/odata-engine-interfaces/build.gradle @@ -2,4 +2,6 @@ apply plugin: 'java' dependencies { compile group: 'com.google.guava', name: 'guava', version: '18.0' -} \ No newline at end of file +} + +apply from :'../java-libraries.gradle' \ No newline at end of file diff --git a/sdk/odata-engine-java-desktop-impl/build.gradle b/sdk/odata-engine-java-desktop-impl/build.gradle index dd0d313d..d460943c 100644 --- a/sdk/odata-engine-java-desktop-impl/build.gradle +++ b/sdk/odata-engine-java-desktop-impl/build.gradle @@ -4,4 +4,6 @@ dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile project(':odata-engine-java-impl') compile group: 'org.apache.httpcomponents' , name: 'httpclient' , version: '4.3.5' -} \ No newline at end of file +} + +apply from :'../java-libraries.gradle' \ No newline at end of file diff --git a/sdk/odata-engine-java-impl/build.gradle b/sdk/odata-engine-java-impl/build.gradle index bb6fa94a..e4002815 100644 --- a/sdk/odata-engine-java-impl/build.gradle +++ b/sdk/odata-engine-java-impl/build.gradle @@ -5,4 +5,6 @@ dependencies { compile project(':odata-engine-helpers') compile project(':odata-engine-interfaces') compile 'com.google.code.gson:gson:2.3' -} \ No newline at end of file +} + +apply from :'../java-libraries.gradle' \ No newline at end of file diff --git a/sdk/outlook-services/build.gradle b/sdk/outlook-services/build.gradle index eaa22c5c..db1a1a32 100644 --- a/sdk/outlook-services/build.gradle +++ b/sdk/outlook-services/build.gradle @@ -1,8 +1,9 @@ apply plugin: 'java' -apply plugin: 'eclipse' dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile project(':odata-engine-interfaces') compile project(':odata-engine-helpers') -} \ No newline at end of file +} + +apply from :'../java-libraries.gradle' \ No newline at end of file diff --git a/sdk/settings.gradle b/sdk/settings.gradle index 48dbb6c3..78f3b62d 100644 --- a/sdk/settings.gradle +++ b/sdk/settings.gradle @@ -1,10 +1,10 @@ -include ':odata-engine-interfaces', - ':directory-services', - ':discovery-services', - ':list-services', +include ':list-services', ':odata-engine-android-impl', + ':odata-engine-interfaces', ':odata-engine-java-impl', + ':odata-engine-helpers', + ':directory-services', + ':discovery-services', ':odata-engine-java-desktop-impl', ':outlook-services', - ':file-services', - ':odata-engine-helpers' \ No newline at end of file + ':file-services' diff --git a/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/android/Constants.java b/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/android/Constants.java index 73427f4f..bcdfde0e 100644 --- a/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/android/Constants.java +++ b/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/android/Constants.java @@ -29,7 +29,7 @@ public class Constants { public static final String PREFERENCE_LOG_POST_URL = "pref_log_post_url"; public static final String TAG = "Office365-SDK End2EndApp"; public static final String PREFERENCE_AUTHENTICATION_METHOD = "prefAuthenticationMethod"; - public static final String AUTHORITY_URL = "https://login.windows-ppe.net/common"; + public static final String AUTHORITY_URL = "https://login.windows.net/common"; public static final String PREFERENCE_AAD_CLIENT_ID = "prefAADClientId"; public static final String PREFERENCE_AAD_Redirect_URL ="prefAADRedirectUrl"; public static final String PREFERENCE_EXCHANGE_ENDPOINT_URL ="prefExchangeEndpoint"; diff --git a/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/FilesTests.java b/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/FilesTests.java index a94ce569..37fedefd 100644 --- a/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/FilesTests.java +++ b/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/FilesTests.java @@ -1,6 +1,7 @@ package com.microsoft.office365.test.integration.tests; +import com.microsoft.fileservices.Drive; import com.microsoft.fileservices.File; import com.microsoft.fileservices.Item; import com.microsoft.office365.test.integration.ApplicationContext; @@ -25,6 +26,7 @@ public FilesTests() { this.addTest(canCreateFile("Can create file with content", true)); this.addTest(canUpdateFile("Can update file", true)); this.addTest(canUpdateFileContent("Can update file content", true)); + this.addTest(canGetDrive("Can get drive", false)); } private TestCase canGetFiles(String name, boolean enabled) { @@ -224,4 +226,34 @@ public TestResult executeTest() { test.setEnabled(enabled); return test; } + + private TestCase canGetDrive(String name, boolean enabled) { + TestCase test = new TestCase() { + + @Override + public TestResult executeTest() { + try { + TestResult result = new TestResult(); + result.setStatus(TestStatus.Passed); + result.setTestCase(this); + + SharePointClient client = ApplicationContext.getFilesClient(); + + Drive drive = client.getdrive().read().get(); + + //Assert + if(drive == null || drive.getquota() == null || drive.getquota().gettotal() == 0 || drive.getid().equals("")) + result.setStatus(TestStatus.Failed); + + return result; + } catch (Exception e) { + return createResultFromException(e); + } + } + }; + + test.setName(name); + test.setEnabled(enabled); + return test; + } } diff --git a/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/MailTests.java b/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/MailTests.java index 9b3422f8..7f7440cd 100644 --- a/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/MailTests.java +++ b/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/MailTests.java @@ -21,6 +21,7 @@ import java.io.StringWriter; import java.util.ArrayList; import java.util.List; +import java.util.UUID; public class MailTests extends TestGroup { @@ -148,7 +149,7 @@ public TestResult executeTest() { result.setStatus(TestStatus.Passed); result.setTestCase(this); - String newFolderName = "TestFolder"; + String newFolderName = "TestFolder" + UUID.randomUUID(); String parentFolderName = "Inbox"; //Create new folder @@ -209,7 +210,7 @@ public TestResult executeTest() { result.setStatus(TestStatus.Passed); result.setTestCase(this); - String newFolderName = "TestFolder"; + String newFolderName = "TestFolder" + UUID.randomUUID();; String parentFolderName = "Inbox"; //Prepare for test @@ -275,7 +276,7 @@ public TestResult executeTest() { result.setStatus(TestStatus.Failed); result.setTestCase(this); - String newFolderName = "TestFolder"; + String newFolderName = "TestFolder" + UUID.randomUUID();; String parentFolderName = "Inbox"; String destinationFolderName = "Drafts"; @@ -345,7 +346,7 @@ public TestResult executeTest() { result.setStatus(TestStatus.Failed); result.setTestCase(this); - String newFolderName = "TestFolder"; + String newFolderName = "TestFolder" + UUID.randomUUID();; String parentFolderName = "Inbox"; String destinationFolderName = "Drafts"; @@ -421,8 +422,8 @@ public TestResult executeTest() { result.setStatus(TestStatus.Passed); result.setTestCase(this); - String folderName = "TestFolder"; - String updatedFolderName = "UpdatedTestFolder"; + String folderName = "TestFolder" + UUID.randomUUID();; + String updatedFolderName = "UpdatedTestFolder" + UUID.randomUUID();; String parentFolderName = "Inbox"; //Create new folder