Skip to content
This repository was archived by the owner on Sep 4, 2020. It is now read-only.

Commit 4898323

Browse files
author
Caitlin Bales (MSFT)
authored
Merge pull request #58 from microsoftgraph/dev
Bugfixes for Build release and fast-follow
2 parents 3d3bb0d + 0446b08 commit 4898323

File tree

420 files changed

+18105
-5709
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

420 files changed

+18105
-5709
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ For a more detailed documentation see:
8787
* [Handling Open Types, PATCH support with `null` values](docs/opentypes.md)
8888
* [Collections](docs/collections.md)
8989
* [Errors](docs/errors.md)
90+
* [Making Custom Requests](docs/custom-queries.md)
91+
* [Known Issues](docs/known-issues.md)
9092
* [Contributions](docs/contributions.md)
9193

9294
## 5. Issues

docs/custom-queries.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Making Custom Calls to Graph
22

3-
The Graph SDK attempts to enable all available scenarios through Microsoft Graph. There are times, however, through errors or custom Graph functionality, that makes calling the desired endpoint is not possible through the provided requests and builders.
3+
The Graph SDK attempts to enable all available scenarios through Microsoft Graph. There are times, however, through errors or custom Graph functionality, that makes calling the desired endpoint not possible through the provided requests and builders.
44

55
## Creating a custom request
66
You can extend BaseRequest to create a custom request:

docs/known-issues.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Known Issues
2-
Because of our close partnership with workload teams who surface API functionality through Graph, it is not always appropriate or feasible to introduce fixes to missing or broken functionality.
2+
The Graph library is a snapshot of the Microsoft Graph and may not be in sync with the current service. Because this library is generated, the generator may fail to address all potential scenarios in the Graph. Furthermore, service behavior changes may not be reflected in the library as the development of the library and the Microsoft Graph are loosely coupled.
33

44
## No Annotation Support
55
[OData](http://docs.oasis-open.org/odata/odata/v4.0/errata03/os/complete/part3-csdl/odata-v4.0-errata03-os-part3-csdl-complete.html#_Toc453752630) allows workloads to specify additional information about their API surface including both functional and non-functional stipulations. We currently do not support these annotations in the [Generator](https://github.com/microsoftgraph/MSGraph-SDK-Code-Generator), due to hierarchical inheritance issues regarding said annotations. Therefore, there may be methods that do not produce valid queries to Graph. Please refer to the [Graph Docs](https://developer.microsoft.com/en-us/graph/docs/concepts/overview) as the source of truth in these discrepancies.

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ mavenGroupId = com.microsoft.graph
2323
mavenArtifactId = msgraph-sdk-android
2424
mavenMajorVersion = 1
2525
mavenMinorVersion = 3
26-
mavenPatchVersion = 0
26+
mavenPatchVersion = 2
2727
nightliesUrl = http://dl.bintray.com/MicrosoftGraph/Maven
2828

2929
#These values are used to run functional tests

graphsdk/src/androidTest/java/com/microsoft/graph/functional/AzureTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public void testGetAdministrativeUnits() {
3333
// assertNotNull(administrativeUnits);
3434
}
3535

36+
@Test
3637
public void testCreateAdministrativeUnit() {
3738
// AdministrativeUnit adminUnit = new AdministrativeUnit();
3839
// adminUnit.displayName = "Test admin unit";

graphsdk/src/androidTest/java/com/microsoft/graph/functional/CollectionPaginationTests.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
package com.microsoft.graph.functional;
22

33
import android.test.AndroidTestCase;
4+
import android.test.suitebuilder.annotation.Suppress;
45

56
import com.microsoft.graph.extensions.IDriveItemCollectionPage;
67
import com.microsoft.graph.extensions.IDriveItemCollectionRequestBuilder;
78
import com.microsoft.graph.extensions.IGraphServiceClient;
89

9-
public class CollectionPaginationTests extends AndroidTestCase {
10+
import org.junit.Test;
1011

12+
@Suppress
13+
public class CollectionPaginationTests extends AndroidTestCase {
1114

15+
@Test
1216
public void testNextPage() {
1317
TestBase testBase = new TestBase();
1418
IGraphServiceClient graphServiceClient = testBase.graphClient;
Lines changed: 28 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,52 @@
11
package com.microsoft.graph.functional;
22

33
import android.test.AndroidTestCase;
4+
import android.test.suitebuilder.annotation.Suppress;
45

5-
//import com.microsoft.graph.extensions.IDirectoryDeletedItemsCollectionPage;
6-
import com.google.gson.JsonArray;
7-
import com.google.gson.JsonElement;
86
import com.google.gson.JsonObject;
9-
import com.microsoft.graph.extensions.DriveItem;
10-
import com.microsoft.graph.extensions.File;
11-
import com.microsoft.graph.extensions.IDirectoryObjectCollectionPage;
12-
import com.microsoft.graph.extensions.IDriveItemCollectionPage;
13-
import com.microsoft.graph.extensions.IDriveItemCollectionRequestBuilder;
14-
import com.microsoft.graph.extensions.IGraphServiceClient;
7+
import com.google.gson.JsonPrimitive;
158
import com.microsoft.graph.extensions.IWorkbookNamedItemCollectionPage;
16-
import com.microsoft.graph.extensions.Workbook;
179
import com.microsoft.graph.extensions.WorkbookNamedItem;
18-
import com.microsoft.graph.extensions.WorkbookNamedItemCollectionPage;
19-
import com.microsoft.graph.extensions.WorkbookRange;
20-
import com.microsoft.graph.http.GraphServiceException;
2110

11+
import org.junit.Before;
12+
import org.junit.Test;
2213

14+
@Suppress
2315
public class ExcelTests extends AndroidTestCase {
2416

2517
private TestBase testBase;
26-
private String fileId;
18+
private String fileId = "015U5LKCVICVSIQ6DKOVELGXD3WAEHMMAI";
2719

20+
@Before
2821
public void setUp()
2922
{
3023
testBase = new TestBase();
31-
fileId = createTestFile("_excelTestResourceAndroid.xlsx");
32-
3324
}
3425

35-
public String createTestFile(String fileName)
36-
{
37-
try {
38-
DriveItem excelWorkbook = new DriveItem();
39-
excelWorkbook.name = fileName;
40-
excelWorkbook.file = new File();
41-
42-
DriveItem driveItem = testBase.graphClient.getMe().getDrive().getRoot().getChildren().buildRequest().post(excelWorkbook);
43-
return driveItem.id;
44-
}
45-
catch (GraphServiceException ex) {
46-
// File could not be created successfully
47-
}
48-
return null;
49-
}
50-
51-
26+
@Test
5227
public void testCreateNamedItem() {
53-
// JsonObject range = new JsonObject();
54-
// range.addProperty("address", "Sheet1!A1");
55-
// WorkbookNamedItem item = testBase.graphClient.getMe().getDrive().getItems("015U5LKCVICVSIQ6DKOVELGXD3WAEHMMAI").getWorkbook().getNames().getAdd("named-range", range, "Comment").buildRequest().post();
56-
// assertNotNull(item);
57-
// assertEquals("named-range", item.name);
28+
JsonObject range = new JsonObject();
29+
range.addProperty("address", "Sheet1!A1");
30+
WorkbookNamedItem item = testBase.graphClient
31+
.getMe()
32+
.getDrive()
33+
.getItems(fileId)
34+
.getWorkbook()
35+
.getNames()
36+
.getAdd("testNamedRange", new JsonPrimitive("Sheet1!A1"), "Comment")
37+
.buildRequest()
38+
.post();
39+
assertNotNull(item);
40+
assertEquals("testNamedRange", item.name);
5841
}
5942

43+
@Test
6044
public void testGetNamedItems() {
61-
// JsonObject range = new JsonObject();
62-
// range.addProperty("range", "A1");
63-
// WorkbookNamedItem item = testBase.graphClient.getMe().getDrive().getItems(fileId).getWorkbook().getNames().getAdd("named-range", range, "Comment").buildRequest().post();
64-
//
65-
// IWorkbookNamedItemCollectionPage namedItems = testBase.graphClient.getMe().getDrive().getItems(fileId).getWorkbook().getNames().buildRequest().get();
66-
// assertNotNull(namedItems);
45+
JsonObject range = new JsonObject();
46+
range.addProperty("range", "A1");
47+
WorkbookNamedItem item = testBase.graphClient.getMe().getDrive().getItems(fileId).getWorkbook().getNames().getAdd("named-range", range, "Comment").buildRequest().post();
48+
49+
IWorkbookNamedItemCollectionPage namedItems = testBase.graphClient.getMe().getDrive().getItems(fileId).getWorkbook().getNames().buildRequest().get();
50+
assertNotNull(namedItems);
6751
}
6852
}

graphsdk/src/androidTest/java/com/microsoft/graph/functional/InsightsTests.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,43 @@
11
package com.microsoft.graph.functional;
22

33
import android.test.AndroidTestCase;
4+
import android.test.suitebuilder.annotation.Suppress;
45

56
import com.microsoft.graph.options.Option;
67
import com.microsoft.graph.options.QueryOption;
78

9+
import org.junit.Before;
10+
import org.junit.Test;
11+
812
import java.util.LinkedList;
913
import java.util.List;
1014

15+
@Suppress
1116
public class InsightsTests extends AndroidTestCase {
1217

18+
private TestBase testBase;
19+
20+
@Before
21+
public void setUp() {
22+
testBase = new TestBase();
23+
}
24+
25+
@Test
1326
public void testTrending() {
14-
TestBase testBase = new TestBase();
1527
//ITrendingCollectionPage trendingCollectionPage = testBase.graphClient.getMe().getInsights().getTrending().buildRequest().get();
1628
//assertNotNull(trendingCollectionPage);
1729
}
1830

31+
@Test
1932
public void testFilterType(){
20-
TestBase testBase = new TestBase();
2133
final List<Option> options = new LinkedList<Option>();
2234
options.add(new QueryOption("filter", "resourceVisualization/type eq 'Word'"));
2335
//ITrendingCollectionPage trendingCollectionPage = testBase.graphClient.getMe().getInsights().getTrending().buildRequest(options).get();
2436
//assertNotNull(trendingCollectionPage);
2537
}
2638

39+
@Test
2740
public void testFilterContentType(){
28-
TestBase testBase = new TestBase();
2941
final List<Option> options = new LinkedList<Option>();
3042
options.add(new QueryOption("filter", "resourceVisualization/contentType eq 'OneDrive'"));
3143
//ITrendingCollectionPage trendingCollectionPage = testBase.graphClient.getMe().getInsights().getTrending().buildRequest(options).get();

graphsdk/src/androidTest/java/com/microsoft/graph/functional/ODataTests.java

Lines changed: 68 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,16 @@
33
import android.test.AndroidTestCase;
44
import android.test.suitebuilder.annotation.Suppress;
55

6-
import com.google.gson.JsonElement;
76
import com.google.gson.JsonPrimitive;
8-
import com.microsoft.graph.extensions.Group;
9-
import com.microsoft.graph.extensions.GroupDeltaCollectionPage;
10-
import com.microsoft.graph.extensions.IGroupDeltaCollectionPage;
11-
import com.microsoft.graph.extensions.IGroupDeltaCollectionRequest;
12-
import com.microsoft.graph.extensions.IGroupDeltaCollectionRequestBuilder;
7+
import com.microsoft.graph.extensions.ExtensionSchemaProperty;
138
import com.microsoft.graph.extensions.Extension;
14-
//import com.microsoft.graph.extensions.IUserGetMailTipsCollectionPage;
15-
//import com.microsoft.graph.extensions.MailTips;
16-
//import com.microsoft.graph.extensions.MailTipsType;
17-
//import com.microsoft.graph.extensions.RecipientScopeType;
9+
import com.microsoft.graph.extensions.SchemaExtension;
1810

11+
import org.junit.Assert;
1912
import org.junit.Before;
2013
import org.junit.Test;
2114

22-
import java.net.URL;
2315
import java.util.ArrayList;
24-
import java.util.EnumSet;
2516
import java.util.List;
2617

2718
@Suppress
@@ -35,10 +26,10 @@ public void setUp() {
3526

3627
// There's a current limitation of two extensions per user. If there's two extensions in the collection,
3728
// delete the latest one
38-
// List<Extension> extensions = testBase.graphClient.getMe().getExtensions().buildRequest().get().getCurrentPage();
39-
// if (extensions.size() >= 2) {
40-
// testBase.graphClient.getMe().getExtensions(extensions.get(1).id).buildRequest().delete();
41-
// }
29+
List<Extension> extensions = testBase.graphClient.getMe().getExtensions().buildRequest().get().getCurrentPage();
30+
if (extensions.size() >= 2) {
31+
testBase.graphClient.getMe().getExtensions(extensions.get(1).id).buildRequest().delete();
32+
}
4233
}
4334

4435
@Test
@@ -47,12 +38,68 @@ public void testOpenExtensions() {
4738

4839
extension.getAdditionalDataManager().put("theme", new JsonPrimitive("dark"));
4940
extension.getAdditionalDataManager().put("extensionName", new JsonPrimitive("Extension 1"));
41+
Extension newExtension = testBase.graphClient.getMe().getExtensions().buildRequest().post(extension);
42+
assertEquals(extension.getAdditionalDataManager().get("theme"), newExtension.getAdditionalDataManager().get("theme"));
5043

51-
// Extension newExtension = testBase.graphClient.getMe().getExtensions().buildRequest().post(extension);
52-
//
53-
// assertEquals(extension.getAdditionalDataManager().get("theme"), newExtension.getAdditionalDataManager().get("theme"));
54-
//
55-
// testBase.graphClient.getMe().getExtensions(newExtension.id).buildRequest().delete();
44+
testBase.graphClient.getMe().getExtensions(newExtension.id).buildRequest().delete();
45+
}
46+
47+
@Test
48+
public void testSchemaExtensions() {
49+
SchemaExtension extension = new SchemaExtension();
50+
extension.id = "schematest";
51+
extension.description = "Android Graph SDK test";
52+
List<String> targets = new ArrayList<>();
53+
targets.add("Group");
54+
extension.targetTypes = targets;
55+
56+
ExtensionSchemaProperty prop = new ExtensionSchemaProperty();
57+
prop.name = "courseId";
58+
prop.type = "Integer";
59+
60+
ExtensionSchemaProperty prop2 = new ExtensionSchemaProperty();
61+
prop2.name = "courseName";
62+
prop2.type = "String";
63+
64+
List<ExtensionSchemaProperty> properties = new ArrayList<>();
65+
properties.add(prop);
66+
properties.add(prop2);
67+
extension.properties = properties;
68+
69+
SchemaExtension newExtension = testBase.graphClient.getSchemaExtensions().buildRequest().post(extension);
70+
assertEquals(extension.description, newExtension.description);
71+
72+
try {
73+
SchemaExtension patchExtension = new SchemaExtension();
74+
List<ExtensionSchemaProperty> patchProperties = new ArrayList<>();
75+
ExtensionSchemaProperty patchProperty = new ExtensionSchemaProperty();
76+
patchProperty.name = "newItem";
77+
patchProperty.type = "String";
78+
patchProperties.add(prop);
79+
patchProperties.add(prop2);
80+
patchProperties.add(patchProperty);
81+
82+
patchExtension.properties = patchProperties;
83+
84+
testBase.graphClient.getSchemaExtensions(newExtension.id).buildRequest().patch(patchExtension);
85+
SchemaExtension updatedExtension = testBase.graphClient.getSchemaExtensions(newExtension.id).buildRequest().get();
86+
87+
boolean foundUpdatedProperty = false;
88+
for (ExtensionSchemaProperty updatedProperty : updatedExtension.properties) {
89+
if (updatedProperty.name.equals(patchProperty.name)) {
90+
assertEquals(patchProperty.type, updatedProperty.type);
91+
foundUpdatedProperty = true;
92+
break;
93+
}
94+
}
95+
if (!foundUpdatedProperty) {
96+
Assert.fail("Patch failed on Schema Extension");
97+
}
98+
} catch (Exception e) {
99+
Assert.fail("Patch failed on Schema Extension");
100+
} finally {
101+
testBase.graphClient.getSchemaExtensions(newExtension.id).buildRequest().delete();
102+
}
56103
}
57104

58105
@Test

0 commit comments

Comments
 (0)