diff --git a/.gitignore b/.gitignore
index 8eb5ff0b2..e2a23af44 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,6 @@
*.class
-# Package Files #
+# Package Files
*.jar
*.war
*.ear
@@ -11,6 +11,21 @@
.classpath
.project
-# IDEA project files
+# IntelliJ
+# User-specific stuff:
+.idea
+.idea/workspace.xml
+.idea/tasks.xml
+.idea/findbugs-idea.xml
+.idea/codeStyleSettings.xml
+.idea/dictionaries
+.idea/shelf
+*.iws
+*.ipr
*.iml
-.idea
\ No newline at end of file
+# Sensitive or high-churn files:
+.idea/dataSources.ids
+.idea/dataSources.xml
+.idea/sqlDataSources.xml
+.idea/dynamic.xml
+.idea/uiDesigner.xml
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
index dff5f3a5d..063139190 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1 +1,55 @@
+# The MIT License
+# Copyright (c) 2012 Microsoft Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
language: java
+
+jdk:
+ - oraclejdk8
+ - oraclejdk7
+ - openjdk6
+
+# enable container-based infrastructure
+sudo: false
+
+env:
+ global:
+ - secure: "V37/WY3//w4fQUxmtKXw9dsU4iH5Z6HvTpBkZj+5DaX5h2Lj98FzALvkGSt7KvqVKQBbgETjs3HTMQkz6hwbLgX2okLKCQbmhZu3vQLqkWe6KPqnO1NOKSaU4vhCoGpScNWMiVxrzCHLHZf5tQu7d+1WVMk5GNlgGqeKVSnz5LY="
+ - secure: "O9Mjx/mU5MLQsngcVbTf7AVMFo2Bh3ZWXwTyiLVXAfU7/VZX39vx30Mf2laNpewYqbiouix7fOkK76YS8459QRoLVBAQSwzjuGsZAwQvz7b7+r3kCS7rwGm7eCobJDbwItoxAxA00rI3gpyX/BnaX8aFutQw/0ZoPSPOH+LzR+4="
+
+# cache local repository for speed of build
+cache:
+ directories:
+ - $HOME/.m2/repository
+before_cache:
+ - rm -rf $HOME/.m2/repository/com/microsoft/ews-java-api
+
+notifications:
+ webhooks:
+ urls:
+ - https://webhooks.gitter.im/e/04643d955d03eb39e24e
+ on_success: change
+
+before_install:
+ - chmod +x ./deploy_snapshot.sh
+
+after_success:
+ - bash <(curl -s https://codecov.io/bash)
+ - ./deploy_snapshot.sh
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index c3b12aacf..9be0ef785 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,42 +1,4 @@
-## Contributing to Exchange Web Services Java API
+## Contributing.md
-There are several ways to contribute to the project:
-
-* Report bugs and features in the [issue tracker](https://github.com/officedev/ews-java-api/issues).
-* Submit and review pull requests
-* Help with documentation
-* Help with testing
-
-GitHub supports [markdown](http://github.github.com/github-flavored-markdown/), so when filing bugs make sure you check the formatting before clicking submit.
-
-### Contributing code and content
-Before submitting a feature or substantial code contribution please discuss it with the team and ensure it follows the product roadmap. You might also read these two blogs posts on contributing code:
-
-* [Open Source Contribution Etiquette](http://tirania.org/blog/archive/2010/Dec-31.html) by Miguel de Icaza
-* [Don't "Push" Your Pull Requests](http://www.igvita.com/2011/12/19/dont-push-your-pull-requests/) by Ilya Grigorik.
-
-### Pull Requests
-If you don't know what a pull request is read the "[Using pull requests](https://help.github.com/articles/using-pull-requests)" article.
-
-Some guidelines for pull requests:
-
-* Use a descriptive title and description.
-* Include a single logical change.
-* Base on master branch - once accepted, can be ported to stable branches.
-* Should cleanly merge with target branch.
-
-### Commit Messages
-1. Separate subject from body with a blank line
-2. Limit the subject line to 50 characters
-3. Capitalize the subject line
-4. Do not end the subject line with a period
-5. Use the imperative mood in the subject line (e.g. Fix #123: Make pigs fly).
-6. Wrap the body at 72 characters
-7. Use the body to explain what and why. The how should be mostly covered by the diff.
-
-References:
-
-* [How to Write a Git Commit Message](http://chris.beams.io/posts/git-commit/)
-* [A Note About Git Commit Messages](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
-* [Guidelines for Commit Messages](https://wiki.gnome.org/Git/CommitMessages)
-* [On commit messages](http://who-t.blogspot.de/2009/12/on-commit-messages.html)
+### To participate, please visit the project wiki for more information.
+*Guidelines can be found* [**HERE**](https://github.com/OfficeDev/ews-java-api/wiki/Contributing)
\ No newline at end of file
diff --git a/deploy_snapshot.sh b/deploy_snapshot.sh
new file mode 100644
index 000000000..09f13b0c5
--- /dev/null
+++ b/deploy_snapshot.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+# The MIT License
+# Copyright (c) 2012 Microsoft Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+if [ "$TRAVIS_REPO_SLUG" != "OfficeDev/ews-java-api" ]; then
+ echo "[DEPLOY] Skipping snapshot deployment for repo:'$TRAVIS_REPO_SLUG'."
+elif [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
+ echo "[DEPLOY] Skipping snapshot deployment for a pull request."
+elif [ "$TRAVIS_SECURE_ENV_VARS" == "false" ]; then
+ echo "[DEPLOY] Skipping snapshot deployment due to TRAVIS_SECURE_ENV_VARS is set to '$TRAVIS_SECURE_ENV_VARS'."
+elif [ "$TRAVIS_JDK_VERSION" != "oraclejdk7" ]; then
+ echo "[DEPLOY] Skipping snapshot deployment for jdk:'$TRAVIS_JDK_VERSION'."
+else
+ echo "[DEPLOY] Deploying snapshot for commit:'$TRAVIS_COMMIT' @ build-id:'$TRAVIS_BUILD_ID'"
+ # create settings.xml
+ echo "ossrh-snapshot${OSSRHUSER}${OSSRHPASS}" > $HOME/.m2/settings.xml
+ # deploy
+ if [ -z "${GPG_PASSPHRASE+xxx}" ]; then
+ echo "[INFO] Deploying unsigned artifacts"
+ mvn clean deploy --settings="$HOME/.m2/settings.xml" -Dmaven.test.skip=true -Dcheckstyle.skip=true
+ else
+ echo "[INFO] Deploying signed artifacts"
+ mvn clean deploy --settings="$HOME/.m2/settings.xml" -Dmaven.test.skip=true -Dcheckstyle.skip=true -Dgpg.passphrase=$GPG_PASSPHRASE
+ fi
+ # clean up
+ rm -f $HOME/.m2/settings.xml
+fi
diff --git a/license.txt b/license.txt
index d60bc954c..364ee36bf 100644
--- a/license.txt
+++ b/license.txt
@@ -1,22 +1,20 @@
-Exchange Web Services Java API
+The MIT License
+Copyright (c) 2012 Microsoft Corporation
-Copyright (c) Microsoft Corporation
-All rights reserved.
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
-MIT License
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
-Permission is hereby granted, free of charge, to any person obtaining a copy of this
-software and associated documentation files (the ""Software""), to deal in the Software
-without restriction, including without limitation the rights to use, copy, modify, merge,
-publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
-to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or
-substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
-PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
-FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/pom.xml b/pom.xml
index e80523b5c..e303359bc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,13 +1,37 @@
+
4.0.0
- com.microsoft.office
+ com.microsoft.ews-java-apiews-java-api
- 1.3-SNAPSHOT
- bundle
+
+ 2.1-SNAPSHOTExchange Web Services Java APIExchange Web Services (EWS) Java API
@@ -29,61 +53,343 @@
http://www.microsoft.com/
+
+
+ vboctor
+ Victor Boctor
+ vboctor@users.noreply.github.com
+ http://www.github.com/officedev/ews-java-api
+ Microsoft
+ http://www.microsoft.com
+
+ administrator
+ developer
+
+ America/New_York
+
+ http://www.example.com/jdoe/pic
+
+
+
+
UTF-8
- 1.7
+ 1.6
+
+
+
+ 2.16
+ 1.6
+ 2.10.3
+ 3.3
+ 1.6.5
+ 2.4
+ 1.14
+ 1.1
+
+ 3.4
+ 2.8
+ 2.2
+ 2.5
+ 2.18.1
+ 0.7.5.201505241946
+
+ 4.4.1
+ 4.4.1
+ 1.2
+ 2.8
+ 3.4
+ 2.4
+
+ 4.12
+ 1.3
+ 1.10.19
+ 1.7.12
+ 1.1.3
+
+
+
+ default-jdk18-profile
+
+ [1.8,)
+
+
+ -Xdoclint:none
+
+
+
+
+ java-7-or-later-profile
+
+ [1.7,)
+
+
+
+
+ org.apache.maven.plugins
+ maven-checkstyle-plugin
+ ${maven-checkstyle-plugin.version}
+
+ true
+ google_checks.xml
+
+
+
+ verify
+
+ checkstyle
+
+
+
+
+
+
+
+
+ release-sign-artifacts
+
+
+ gpg.passphrase
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-gpg-plugin
+ ${maven-gpg-plugin.version}
+
+
+ sign-artifacts
+ verify
+
+ sign
+
+
+
+
+
+
+
+
+
+
+
+ MIT License
+ http://opensource.org/licenses/MIT
+ repo
+
+
+
+
+ https://github.com/OfficeDev/ews-java-api/issues
+ GitHub Issues
+
+
+
+ travis
+ https://travis-ci.org/OfficeDev/ews-java-api
+
+
+
+ https://github.com/OfficeDev/ews-java-api
+ scm:git:ssh://git@github.com:OfficeDev/ews-java-api.git
+ scm:git:ssh://git@github.com:OfficeDev/ews-java-api.git
+
+
+
+
+ ossrh-snapshot
+ https://oss.sonatype.org/content/repositories/snapshots
+
+
+ ossrh
+ https://oss.sonatype.org/service/local/staging/deploy/maven2
+
+
+
- commons-httpclient
- commons-httpclient
- 3.1
+ org.apache.httpcomponents
+ httpclient
+ ${httpclient.version}
+
+
+
+ org.apache.httpcomponents
+ httpcore
+ ${httpcore.version}
+
+
+
+ commons-io
+ commons-io
+ ${commons-io.version}commons-loggingcommons-logging
- 1.2
+ ${commons-logging.version}
- jcifs
- jcifs
- 1.3.17
-
-
- javax.servlet
- servlet-api
-
-
+ org.apache.commons
+ commons-lang3
+ ${commons-lang3.version}
+
+
+
+ joda-time
+ joda-time
+ ${joda-time.version}junitjunit
- 4.11
+ ${junit.version}testorg.hamcresthamcrest-all
- 1.3
+ ${hamcrest-all.version}
+ test
+
+
+
+ org.mockito
+ mockito-core
+ ${mockito-core.version}
+ test
+
+
+
+ org.slf4j
+ slf4j-api
+ ${slf4j.version}
+ test
+
+
+
+ ch.qos.logback
+ logback-classic
+ ${logback.version}
+ test
+
+
+
+ org.slf4j
+ jcl-over-slf4j
+ ${slf4j.version}test
+
+
- org.apache.felix
- maven-bundle-plugin
- 2.4.0
+ org.sonatype.plugins
+ nexus-staging-maven-plugin
+ ${nexus-staging-maven-plugin.version}true
+
+
+ true
+ ossrh
+ https://oss.sonatype.org/
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ ${maven-compiler-plugin.version}
+
+ ${project.build.sourceEncoding}
+ ${javaLanguage.version}
+ ${javaLanguage.version}
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ ${maven-javadoc-plugin.version}
+
+ true
+ ${javadoc.doclint.param}
+
+
+
+ attach-javadocs
+
+ jar
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ ${maven-source-plugin.version}
+
+
+ attach-sources
+
+ jar-no-fork
+
+
+
+
+
+ org.codehaus.mojo
+ animal-sniffer-maven-plugin
+ ${animal-sniffer-maven-plugin.version}
+
+
+ org.codehaus.mojo.signature
+ java16-sun
+ ${animal-sniffer-maven-plugin.signature.version}
+
+
+
+
+ check-java16-sun
+ test
+
+ check
+
+
+
+
+
+
+ org.jacoco
+ jacoco-maven-plugin
+ ${jacoco-maven-plugin.version}
+
+
+
+ prepare-agent
+
+
+
+ report
+ test
+
+ report
+
+
+
+
+
Maven
@@ -11,10 +35,8 @@
-
-
\ No newline at end of file
+
diff --git a/src/test/java/microsoft/exchange/webservices/base/BaseTest.java b/src/test/java/microsoft/exchange/webservices/base/BaseTest.java
new file mode 100644
index 000000000..46b07d915
--- /dev/null
+++ b/src/test/java/microsoft/exchange/webservices/base/BaseTest.java
@@ -0,0 +1,66 @@
+/*
+ * The MIT License
+ * Copyright (c) 2012 Microsoft Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+package microsoft.exchange.webservices.base;
+
+import microsoft.exchange.webservices.data.core.ExchangeService;
+import microsoft.exchange.webservices.data.core.ExchangeServiceBase;
+import microsoft.exchange.webservices.data.core.request.HttpWebRequest;
+import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+/**
+ * A base class with "Common-Services"
+ */
+@RunWith(JUnit4.class)
+public abstract class BaseTest {
+
+ /**
+ * Mock for the ExchangeServiceBase
+ */
+ protected static ExchangeServiceBase exchangeServiceBaseMock;
+
+ /**
+ * Mock for the ExchangeService
+ */
+ protected static ExchangeService exchangeServiceMock;
+
+ /**
+ * Setup Mocks
+ *
+ * @throws Exception
+ */
+ @BeforeClass
+ public static final void setUpBaseClass() throws Exception {
+ // Mock up ExchangeServiceBase
+ exchangeServiceBaseMock = new ExchangeServiceBase() {
+ @Override
+ protected void processHttpErrorResponse(HttpWebRequest httpWebResponse, Exception webException)
+ throws Exception {
+ throw webException;
+ }
+ };
+ exchangeServiceMock = new ExchangeService();
+ }
+}
diff --git a/src/test/java/microsoft/exchange/webservices/base/util/TestUtils.java b/src/test/java/microsoft/exchange/webservices/base/util/TestUtils.java
new file mode 100644
index 000000000..3358ca533
--- /dev/null
+++ b/src/test/java/microsoft/exchange/webservices/base/util/TestUtils.java
@@ -0,0 +1,69 @@
+/*
+ * The MIT License
+ * Copyright (c) 2012 Microsoft Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+package microsoft.exchange.webservices.base.util;
+
+import org.junit.Assert;
+import org.junit.Ignore;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Modifier;
+
+@Ignore
+public final class TestUtils {
+
+ private TestUtils() {
+ throw new UnsupportedOperationException();
+ }
+
+
+ /**
+ * Check that class has only one private constructor without parameters that throws exception during
+ * instantiation. It's necessary for util-classes.
+ *
+ * @param utilClass util-class
+ * @throws Throwable exception during instantiation
+ */
+ public static void checkUtilClassConstructor(final Class> utilClass) throws Throwable {
+ // Check count of available constructors.
+ final Constructor>[] constructors = utilClass.getDeclaredConstructors();
+ Assert.assertEquals(1, constructors.length);
+
+ // Check accessibility.
+ final Constructor> constructor = constructors[0];
+ Assert.assertTrue(Modifier.isPrivate(constructor.getModifiers()));
+
+ // Try to create instance.
+ constructor.setAccessible(true);
+ try {
+ constructor.newInstance();
+ } catch (final InvocationTargetException ex) {
+ throw ex.getTargetException();
+ }
+
+ // We should never get this situation.
+ Assert.fail();
+ }
+
+}
diff --git a/src/test/java/microsoft/exchange/webservices/data/BaseTest.java b/src/test/java/microsoft/exchange/webservices/data/BaseTest.java
deleted file mode 100644
index c98edef88..000000000
--- a/src/test/java/microsoft/exchange/webservices/data/BaseTest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**************************************************************************
- Exchange Web Services Java API
- Copyright (c) Microsoft Corporation
- All rights reserved.
- MIT License
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- **************************************************************************/
-package microsoft.exchange.webservices.data;
-
-import org.junit.BeforeClass;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-/**
- * A base class with "Common-Services"
- */
-@RunWith(JUnit4.class)
-public abstract class BaseTest {
-
- /**
- * Mock for the ExchangeServiceBase
- */
- protected static ExchangeServiceBase exchangeServiceBaseMock;
-
- /**
- * Mock for the ExchangeService
- */
- protected static ExchangeService exchangeServiceMock;
-
- /**
- * Setup Mocks
- *
- * @throws Exception
- */
- @BeforeClass
- public static final void setUpBaseClass() throws Exception {
- // Mock up ExchangeServiceBase
- exchangeServiceBaseMock = new ExchangeServiceBase() {
- @Override
- protected void processHttpErrorResponse(HttpWebRequest httpWebResponse, Exception webException) throws Exception {
- throw webException;
- }
- };
- exchangeServiceMock = new ExchangeService();
- }
-}
diff --git a/src/test/java/microsoft/exchange/webservices/data/EwsUtilitiesTest.java b/src/test/java/microsoft/exchange/webservices/data/EwsUtilitiesTest.java
deleted file mode 100644
index 74b76729a..000000000
--- a/src/test/java/microsoft/exchange/webservices/data/EwsUtilitiesTest.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/**************************************************************************
- Exchange Web Services Java API
- Copyright (c) Microsoft Corporation
- All rights reserved.
- MIT License
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- **************************************************************************/
-
-package microsoft.exchange.webservices.data;
-
-import org.junit.Assert;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-import org.junit.Test;
-
-@RunWith(JUnit4.class)
-public class EwsUtilitiesTest {
- @Test
- public void testGetBuildVersion() {
- Assert.assertEquals("Build version must be 0s", "0.0.0.0", EwsUtilities.getBuildVersion());
- }
-
- @Test
- public void testStringEquals() {
- Assert.assertTrue(EwsUtilities.stringEquals(null, null));
- Assert.assertTrue(EwsUtilities.stringEquals("x", "x"));
-
- Assert.assertFalse(EwsUtilities.stringEquals(null, "x"));
- Assert.assertFalse(EwsUtilities.stringEquals("x", null));
- Assert.assertFalse(EwsUtilities.stringEquals("x", "X"));
- }
-}
diff --git a/src/test/java/microsoft/exchange/webservices/data/TaskTest.java b/src/test/java/microsoft/exchange/webservices/data/TaskTest.java
deleted file mode 100644
index 628d683d8..000000000
--- a/src/test/java/microsoft/exchange/webservices/data/TaskTest.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/**************************************************************************
- Exchange Web Services Java API
- Copyright (c) Microsoft Corporation
- All rights reserved.
- MIT License
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- **************************************************************************/
-package microsoft.exchange.webservices.data;
-
-import org.hamcrest.core.IsEqual;
-import org.hamcrest.core.IsInstanceOf;
-import org.hamcrest.core.IsNot;
-import org.hamcrest.core.IsNull;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-import static org.junit.Assert.assertThat;
-
-/**
- * Testclass for methods of Task
- */
-@RunWith(JUnit4.class)
-public class TaskTest extends BaseTest {
-
- /**
- * Mock for the Task
- */
- private Task taskMock;
-
- /**
- * Setup Mocks
- *
- * @throws Exception
- */
- @Before
- public void setup() throws Exception {
- this.taskMock = new Task(this.exchangeServiceMock);
- }
-
- /**
- * Test for reading the value before it is assigned
- *
- * @throws Exception
- */
- @Test(expected = ServiceObjectPropertyException.class)
- public void testInitialValuePercent() throws Exception {
- taskMock.getPercentComplete();
- }
-
- /**
- * Test for adding 0.0 as percentCompleted
- *
- * @throws Exception
- */
- @Test
- public void testAddZeroPercent() throws Exception {
- final Double targetValue = 0.0;
- taskMock.setPercentComplete(targetValue);
-
- assertThat(taskMock.getPercentComplete(), IsNot.not(IsNull.nullValue()));
- assertThat(taskMock.getPercentComplete(), IsInstanceOf.instanceOf(Double.class));
- assertThat(taskMock.getPercentComplete(), IsEqual.equalTo(targetValue));
- }
-
- /**
- * Test for adding 100.0 as percentCompleted
- *
- * @throws Exception
- */
- @Test
- public void testAdd100Percent() throws Exception {
- final Double targetValue = 100.0;
- taskMock.setPercentComplete(targetValue);
-
- assertThat(taskMock.getPercentComplete(), IsNot.not(IsNull.nullValue()));
- assertThat(taskMock.getPercentComplete(), IsInstanceOf.instanceOf(Double.class));
- assertThat(taskMock.getPercentComplete(), IsEqual.equalTo(targetValue));
- }
-
- /**
- * Test for adding Double.MAX_VALUE as percentCompleted
- *
- * @throws Exception
- */
- @Test(expected = IllegalArgumentException.class)
- public void testAddMaxDoublePercent() throws Exception {
- final Double targetValue = Double.MAX_VALUE;
- taskMock.setPercentComplete(targetValue);
- }
-
- /**
- * Test for adding -0.1 as percentCompleted
- *
- * @throws Exception
- */
- @Test(expected = IllegalArgumentException.class)
- public void testAddInvalidPercent() throws Exception {
- final Double targetValue = -0.1;
- taskMock.setPercentComplete(targetValue);
- }
-
- /**
- * Test for adding +100.1 as percentCompleted
- *
- * @throws Exception
- */
- @Test(expected = IllegalArgumentException.class)
- public void testAddInvalidPercent2() throws Exception {
- final Double targetValue = +100.1;
- taskMock.setPercentComplete(targetValue);
- }
-
- /**
- * Test for adding Double.NaN as percentCompleted
- *
- * @throws Exception
- */
- @Test(expected = IllegalArgumentException.class)
- public void testAddNanDoublePercent() throws Exception {
- final Double targetValue = Double.NaN; // closest Value to Zero
- taskMock.setPercentComplete(targetValue);
- }
-
- /**
- * Test for checking if the value changes in case of a thrown exception
- *
- * @throws Exception
- */
- @Test
- public void testDontChangeValueOnException() throws Exception {
- // set valid value
- final Double targetValue = 50.5;
- taskMock.setPercentComplete(targetValue);
-
- assertThat(taskMock.getPercentComplete(), IsNot.not(IsNull.nullValue()));
- assertThat(taskMock.getPercentComplete(), IsInstanceOf.instanceOf(Double.class));
- assertThat(taskMock.getPercentComplete(), IsEqual.equalTo(targetValue));
-
- final Double invalidValue = -0.1;
- try {
- taskMock.setPercentComplete(invalidValue);
- } catch (IllegalArgumentException ex) {
- // ignored
- }
-
- assertThat(taskMock.getPercentComplete(), IsNot.not(IsNull.nullValue()));
- assertThat(taskMock.getPercentComplete(), IsInstanceOf.instanceOf(Double.class));
- assertThat(taskMock.getPercentComplete(), IsEqual.equalTo(targetValue));
- }
-}
diff --git a/src/test/java/microsoft/exchange/webservices/data/UserConfigurationDictionaryTest.java b/src/test/java/microsoft/exchange/webservices/data/UserConfigurationDictionaryTest.java
deleted file mode 100644
index 1c736ddb4..000000000
--- a/src/test/java/microsoft/exchange/webservices/data/UserConfigurationDictionaryTest.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/**************************************************************************
- Exchange Web Services Java API
- Copyright (c) Microsoft Corporation
- All rights reserved.
- MIT License
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- **************************************************************************/
-package microsoft.exchange.webservices.data;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-import java.io.ByteArrayOutputStream;
-import java.io.OutputStream;
-import java.util.Date;
-
-/**
- * Testclass for methods of UserConfigurationDictionary
- *
- */
-@RunWith(JUnit4.class)
-public class UserConfigurationDictionaryTest extends BaseTest {
-
- /**
- * Mock for the UserConfigurationDictionary
- */
- protected UserConfigurationDictionary userConfigurationDictionary;
-
- @Before
- public void setup() throws Exception {
- // Initialise a UserConfigurationDictionary Testobject
- this.userConfigurationDictionary = new UserConfigurationDictionary();
- }
-
- /**
- * Adding a Double Value to the Dictionary witch is not allowed
- *
- * @throws Exception
- */
- @Test(expected = ServiceLocalException.class)
- public void testAddUnsupportedElementsToDictionary() throws Exception {
- this.userConfigurationDictionary.addElement("someDouble", (Double) 1.0);
- }
-
- /**
- * testAddSupportedElementsToDictionary
- *
- * @throws Exception
- */
- @Test
- public void testAddSupportedElementsToDictionary() throws Exception {
- fillDictionaryWithValidEntries();
- }
-
- /**
- * Fills the Dictionary with
- *
- * @throws Exception
- */
- private void fillDictionaryWithValidEntries() throws Exception {
- // Adding Test Values to the Object
- final int testInt = 1;
- final long testLong = 1l;
- final String testString = "someVal";
- final String[] testStringArray = new String[]{"test1", "test2", "test3"};
- final Date testDate = new Date();
- final boolean testBoolean = true;
- final byte testByte = Byte.decode("0x10");
- final byte[] testByteArray = testString.getBytes();
- final Byte[] testByteArray2 = new Byte[testByteArray.length];
- for (int currentIndex = 0; currentIndex < testByteArray.length; currentIndex++) {
- testByteArray2[currentIndex] = testByteArray[currentIndex];
- }
-
- Assert.assertNotNull(this.userConfigurationDictionary);
-
- this.userConfigurationDictionary.addElement("someString", testString);
- Assert.assertTrue(this.userConfigurationDictionary.containsKey("someString"));
- Assert.assertEquals(testString, this.userConfigurationDictionary.getElements("someString"));
- Assert.assertTrue(this.userConfigurationDictionary.getElements("someString") instanceof String);
-
- this.userConfigurationDictionary.addElement("someLong", testLong);
- Assert.assertTrue(this.userConfigurationDictionary.containsKey("someLong"));
- Assert.assertEquals(testLong, this.userConfigurationDictionary.getElements("someLong"));
- Assert.assertTrue(this.userConfigurationDictionary.getElements("someLong") instanceof Long);
-
- this.userConfigurationDictionary.addElement("someInteger", testInt);
- Assert.assertTrue(this.userConfigurationDictionary.containsKey("someInteger"));
- Assert.assertEquals(testInt, this.userConfigurationDictionary.getElements("someInteger"));
- Assert.assertTrue(this.userConfigurationDictionary.getElements("someInteger") instanceof Integer);
-
- this.userConfigurationDictionary.addElement("someString[]", testStringArray);
- Assert.assertTrue(this.userConfigurationDictionary.containsKey("someString[]"));
- Assert.assertEquals(testStringArray, this.userConfigurationDictionary.getElements("someString[]"));
- Assert.assertTrue(this.userConfigurationDictionary.getElements("someString[]") instanceof String[]);
-
- this.userConfigurationDictionary.addElement("someDate", testDate);
- Assert.assertTrue(this.userConfigurationDictionary.containsKey("someDate"));
- Assert.assertEquals(testDate, this.userConfigurationDictionary.getElements("someDate"));
- Assert.assertTrue(this.userConfigurationDictionary.getElements("someDate") instanceof Date);
-
- this.userConfigurationDictionary.addElement("someBoolean", testBoolean);
- Assert.assertTrue(this.userConfigurationDictionary.containsKey("someBoolean"));
- Assert.assertEquals(testBoolean, this.userConfigurationDictionary.getElements("someBoolean"));
- Assert.assertTrue(this.userConfigurationDictionary.getElements("someBoolean") instanceof Boolean);
-
- this.userConfigurationDictionary.addElement("someByte", testByte);
- Assert.assertTrue(this.userConfigurationDictionary.containsKey("someByte"));
- Assert.assertEquals(testByte, this.userConfigurationDictionary.getElements("someByte"));
- Assert.assertTrue(this.userConfigurationDictionary.getElements("someByte") instanceof Byte);
-
- this.userConfigurationDictionary.addElement("someByte[]", testByteArray);
- Assert.assertTrue(this.userConfigurationDictionary.containsKey("someByte[]"));
- Assert.assertEquals(testByteArray, this.userConfigurationDictionary.getElements("someByte[]"));
- Assert.assertTrue(this.userConfigurationDictionary.getElements("someByte[]") instanceof byte[]);
-
- this.userConfigurationDictionary.addElement("someByte2[]", testByteArray2);
- Assert.assertTrue(this.userConfigurationDictionary.containsKey("someByte2[]"));
- Assert.assertEquals(testByteArray2, this.userConfigurationDictionary.getElements("someByte2[]"));
- Assert.assertTrue(this.userConfigurationDictionary.getElements("someByte2[]") instanceof Byte[]);
- }
-
- /**
- * Tests the Method writeElementsToXml(...)
- * with all valid Elements
- */
- @Test
- public void testWriteElementsToXml() throws Exception {
- // Mock up needed Classes
- OutputStream output = new ByteArrayOutputStream();
- EwsServiceXmlWriter testWriter = new EwsServiceXmlWriter(exchangeServiceBaseMock, output);
-
- // Adding Test Values to the Object
- fillDictionaryWithValidEntries();
-
- // Write the Elements
- this.userConfigurationDictionary.writeElementsToXml(testWriter);
- }
-}
diff --git a/src/test/java/microsoft/exchange/webservices/data/autodiscover/AlternateMailboxCollectionTest.java b/src/test/java/microsoft/exchange/webservices/data/autodiscover/AlternateMailboxCollectionTest.java
new file mode 100644
index 000000000..084bbfec8
--- /dev/null
+++ b/src/test/java/microsoft/exchange/webservices/data/autodiscover/AlternateMailboxCollectionTest.java
@@ -0,0 +1,87 @@
+/*
+ * The MIT License
+ * Copyright (c) 2012 Microsoft Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+package microsoft.exchange.webservices.data.autodiscover;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import java.io.ByteArrayInputStream;
+
+import org.junit.Test;
+
+import microsoft.exchange.webservices.data.core.EwsXmlReader;
+
+public class AlternateMailboxCollectionTest {
+
+ private static final String PARTIAL_RESULT =
+ ""
+ + "http://schemas.microsoft.com/exchange/2010/Autodiscover/Autodiscover/GetUserSettingsResponse"
+ + ""
+ + "1501076"
+ + "0Exchange2013_SP1"
+ + ""
+ + ""
+ + ""
+ + ""
+ + "AlternateMailboxes"
+ + "Archive"
+ + "Personal Archive - Testaccount008"
+ + "ou=Exchange Administrative Group/cn=Testaccount008 Test"
+ + "cb7c4056-a738-4004-bd0d-65b58d3b7bc1@test.com"
+ + "testaccount008@test.com"
+ + "Delegate"
+ + "Testaccount007 Test"
+ + "testaccount007@test.com"
+ + "testaccount007@test.com"
+ + ""
+ + "";
+
+
+ @Test
+ public void testGetEntries() throws Exception {
+ final AlternateMailboxCollection amc =
+ AlternateMailboxCollection.loadFromXml(new EwsXmlReader(
+ new ByteArrayInputStream(PARTIAL_RESULT.getBytes())));
+
+ assertEquals(2, amc.getEntries().size());
+
+ final AlternateMailbox first = amc.getEntries().get(0);
+ assertEquals("Archive", first.getType());
+ assertEquals("Personal Archive - Testaccount008", first.getDisplayName());
+ assertEquals("ou=Exchange Administrative Group/cn=Testaccount008 Test",
+ first.getLegacyDN());
+ assertEquals("cb7c4056-a738-4004-bd0d-65b58d3b7bc1@test.com",
+ first.getServer());
+ assertNull(first.getSmtpAddress());
+ assertEquals("testaccount008@test.com", first.getOwnerSmtpAddress());
+
+ final AlternateMailbox second = amc.getEntries().get(1);
+ assertEquals("Delegate", second.getType());
+ assertEquals("Testaccount007 Test", second.getDisplayName());
+ assertNull(second.getLegacyDN());
+ assertNull(second.getServer());
+ assertEquals("testaccount007@test.com", second.getSmtpAddress());
+ assertEquals("testaccount007@test.com", second.getOwnerSmtpAddress());
+ }
+}
diff --git a/src/test/java/microsoft/exchange/webservices/data/autodiscover/AutodiscoverDnsClientTest.java b/src/test/java/microsoft/exchange/webservices/data/autodiscover/AutodiscoverDnsClientTest.java
new file mode 100644
index 000000000..0e529b036
--- /dev/null
+++ b/src/test/java/microsoft/exchange/webservices/data/autodiscover/AutodiscoverDnsClientTest.java
@@ -0,0 +1,65 @@
+/*
+ * The MIT License
+ * Copyright (c) 2012 Microsoft Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+package microsoft.exchange.webservices.data.autodiscover;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public class AutodiscoverDnsClientTest {
+
+ final String validResponse = "autodiscover.contoso.com";
+ final String trailingDotResponse = "autodiscover.contoso.com.";
+
+ /**
+ * If DNS gives us a null, we should return a null
+ */
+ @Test public void textExtractNullHostnameFromDnsSrv() {
+ assertEquals(AutodiscoverDnsClient.extractHostnameFromDnsSrv(null), null);
+ }
+
+ /**
+ * If DNS gives us back an empty string, we should return a null
+ */
+ @Test public void textExtractEmptyHostnameFromDnsSrv() {
+ assertEquals(AutodiscoverDnsClient.extractHostnameFromDnsSrv(""), null);
+ }
+
+ /**
+ * If DNS gives us back a plain domain, we should pass it through.
+ */
+ @Test public void textExtractValidHostnameFromDnsSrv() {
+ assertEquals(AutodiscoverDnsClient.extractHostnameFromDnsSrv(validResponse), validResponse);
+ }
+
+ /**
+ * If DNS gives us back a domain with a trailing dot, we should strip it.
+ */
+ @Test public void textExtractTrailingDotHostnameFromDnsSrv() {
+ assertEquals(AutodiscoverDnsClient.extractHostnameFromDnsSrv(trailingDotResponse), validResponse);
+ }
+}
diff --git a/src/test/java/microsoft/exchange/webservices/data/autodiscover/request/GetUserSettingsRequestTest.java b/src/test/java/microsoft/exchange/webservices/data/autodiscover/request/GetUserSettingsRequestTest.java
new file mode 100644
index 000000000..717d88f79
--- /dev/null
+++ b/src/test/java/microsoft/exchange/webservices/data/autodiscover/request/GetUserSettingsRequestTest.java
@@ -0,0 +1,193 @@
+/*
+ * The MIT License
+ * Copyright (c) 2012 Microsoft Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+package microsoft.exchange.webservices.data.autodiscover.request;
+
+
+import microsoft.exchange.webservices.base.BaseTest;
+import microsoft.exchange.webservices.data.autodiscover.AutodiscoverService;
+import microsoft.exchange.webservices.data.core.EwsServiceXmlWriter;
+import microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion;
+import microsoft.exchange.webservices.data.core.exception.misc.ArgumentException;
+import microsoft.exchange.webservices.data.core.exception.service.local.ServiceValidationException;
+import microsoft.exchange.webservices.data.core.exception.service.local.ServiceXmlSerializationException;
+import org.hamcrest.core.IsNot;
+import org.hamcrest.core.IsNull;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import javax.xml.stream.XMLStreamException;
+
+import java.io.ByteArrayOutputStream;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Testclass for methods of GetUserSettingsRequest
+ */
+@RunWith(Parameterized.class)
+public class GetUserSettingsRequestTest extends BaseTest {
+
+ /**
+ * The ExchangeVersion which is under test
+ */
+ private final ExchangeVersion exchangeVersion;
+
+ /**
+ * The AutodiscoverService which is under test
+ */
+ private final AutodiscoverService autodiscoverService;
+
+ /**
+ * A mocked URI via HTTPS
+ */
+ private final URI uriMockHttps = URI.create("https://localhost");
+
+ /**
+ * A mocked URI via HTTP
+ */
+ private final URI uriMockHttp = URI.create("http://localhost");
+
+ /**
+ * Returns the Parameters which where handled to the constructor
+ *
+ * @return the available Services
+ * @throws ArgumentException
+ */
+ @Parameterized.Parameters
+ public static List