Search in sources :

Example 6 with Option

use of com.microsoft.graph.options.Option in project msgraph-sdk-java by microsoftgraph.

the class SharePointTests method setUp.

@Before
public void setUp() {
    testBase = new TestBase();
    List<Option> requestOptions = new LinkedList<Option>();
    requestOptions.add(new QueryOption("search", "Contoso"));
    ISiteCollectionPage sites = testBase.graphClient.sites().buildRequest(requestOptions).get();
    testSite = sites.getCurrentPage().get(0);
}
Also used : ISiteCollectionPage(com.microsoft.graph.requests.extensions.ISiteCollectionPage) QueryOption(com.microsoft.graph.options.QueryOption) Option(com.microsoft.graph.options.Option) QueryOption(com.microsoft.graph.options.QueryOption) LinkedList(java.util.LinkedList)

Example 7 with Option

use of com.microsoft.graph.options.Option in project msgraph-sdk-java by microsoftgraph.

the class BaseCollectionRequestTests method testQueryParameters.

@Test
public void testQueryParameters() {
    final Option q1 = new QueryOption("q1", "option1 ");
    final Option q2 = new QueryOption("q2", "option2");
    final BaseCollectionRequest<String, String> request = new BaseCollectionRequest<String, String>("https://a.b.c", null, Arrays.asList(q1, q2), null, null) {
    };
    assertEquals("https://a.b.c?q1=option1+&q2=option2", request.getRequestUrl().toString());
    request.addQueryOption(new QueryOption("q3", "option3"));
    assertEquals("https://a.b.c?q1=option1+&q2=option2&q3=option3", request.getRequestUrl().toString());
    assertEquals(4, request.getOptions().size());
}
Also used : QueryOption(com.microsoft.graph.options.QueryOption) QueryOption(com.microsoft.graph.options.QueryOption) Option(com.microsoft.graph.options.Option) FunctionOption(com.microsoft.graph.options.FunctionOption) Test(org.junit.Test)

Example 8 with Option

use of com.microsoft.graph.options.Option in project msgraph-sdk-java by microsoftgraph.

the class BaseCollectionRequestTests method testFunctionParameters.

@Test
public void testFunctionParameters() {
    final Option f1 = new FunctionOption("1", "one");
    final Option f2 = new FunctionOption("2", null);
    final BaseCollectionRequest<String, String> request = new BaseCollectionRequest<String, String>("https://a.b.c", null, Arrays.asList(f1, f2), null, null) {
    };
    String urlTest = request.getRequestUrl().toString();
    assertEquals("https://a.b.c(1='one',2=null)", request.getRequestUrl().toString());
    request.addFunctionOption(new FunctionOption("3", "two"));
    ;
    assertEquals("https://a.b.c(1='one',2=null,3='two')", request.getRequestUrl().toString());
    assertEquals(4, request.getOptions().size());
}
Also used : FunctionOption(com.microsoft.graph.options.FunctionOption) QueryOption(com.microsoft.graph.options.QueryOption) Option(com.microsoft.graph.options.Option) FunctionOption(com.microsoft.graph.options.FunctionOption) Test(org.junit.Test)

Example 9 with Option

use of com.microsoft.graph.options.Option in project msgraph-sdk-java by microsoftgraph.

the class BaseRequestTests method testFunctionParameters.

@Test
public void testFunctionParameters() {
    final Option fo1 = new FunctionOption("1", "one");
    final Option fo2 = new FunctionOption("2", null);
    final BaseRequest request = new BaseRequest("https://a.b.c", null, Arrays.asList(fo1, fo2), null) {
    };
    assertEquals("https://a.b.c(1='one',2=null)", request.getRequestUrl().toString());
    request.addFunctionOption(new FunctionOption("3", "two"));
    ;
    assertEquals("https://a.b.c(1='one',2=null,3='two')", request.getRequestUrl().toString());
    assertEquals(4, request.getOptions().size());
}
Also used : FunctionOption(com.microsoft.graph.options.FunctionOption) QueryOption(com.microsoft.graph.options.QueryOption) Option(com.microsoft.graph.options.Option) FunctionOption(com.microsoft.graph.options.FunctionOption) HeaderOption(com.microsoft.graph.options.HeaderOption) Test(org.junit.Test)

Example 10 with Option

use of com.microsoft.graph.options.Option in project msgraph-sdk-java by microsoftgraph.

the class BaseRequestTests method testProtectedProperties.

@Test
public void testProtectedProperties() {
    assertEquals(0, request.functionOptions.size());
    assertEquals(0, request.queryOptions.size());
    final Option q1 = new QueryOption("q1", "option1 ");
    final Option f1 = new FunctionOption("f1", "option2");
    final BaseRequest request = new BaseRequest("https://a.b.c", null, Arrays.asList(q1, f1), null) {
    };
    assertEquals(1, request.functionOptions.size());
    assertEquals(1, request.queryOptions.size());
    assertEquals("q1", request.queryOptions.get(0).getName());
    assertEquals("option1 ", request.queryOptions.get(0).getValue());
    assertEquals("f1", request.functionOptions.get(0).getName());
    assertEquals("option2", request.functionOptions.get(0).getValue());
}
Also used : FunctionOption(com.microsoft.graph.options.FunctionOption) QueryOption(com.microsoft.graph.options.QueryOption) QueryOption(com.microsoft.graph.options.QueryOption) Option(com.microsoft.graph.options.Option) FunctionOption(com.microsoft.graph.options.FunctionOption) HeaderOption(com.microsoft.graph.options.HeaderOption) Test(org.junit.Test)

Aggregations

Option (com.microsoft.graph.options.Option)11 QueryOption (com.microsoft.graph.options.QueryOption)11 FunctionOption (com.microsoft.graph.options.FunctionOption)7 Test (org.junit.Test)7 HeaderOption (com.microsoft.graph.options.HeaderOption)4 LinkedList (java.util.LinkedList)4 ICallback (com.microsoft.graph.concurrency.ICallback)2 ClientException (com.microsoft.graph.core.ClientException)2 User (com.microsoft.graph.extensions.User)2 ISiteCollectionPage (com.microsoft.graph.requests.extensions.ISiteCollectionPage)2 SharedPreferences (android.content.SharedPreferences)1 DirectoryObject (com.microsoft.graph.extensions.DirectoryObject)1 IDirectoryObjectCollectionWithReferencesPage (com.microsoft.graph.extensions.IDirectoryObjectCollectionWithReferencesPage)1 IUserCollectionPage (com.microsoft.graph.extensions.IUserCollectionPage)1 PasswordProfile (com.microsoft.graph.extensions.PasswordProfile)1 ProfilePhoto (com.microsoft.graph.extensions.ProfilePhoto)1