Commit 703b71d3ec7fe37c65cb55c6100b29724ce41540

Authored by Meenal Bhave
1 parent b9ee8ff8fb
Exists in master

Created alfresco-api-test-utils on gitlab (moved from my dev branch to GitLab)

Showing 41 changed files with 5219 additions and 1 deletions   Show diff stats
... ... @@ -0,0 +1,202 @@
  1 +Apache License
  2 + Version 2.0, January 2004
  3 + http://www.apache.org/licenses/
  4 +
  5 + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
  6 +
  7 + 1. Definitions.
  8 +
  9 + "License" shall mean the terms and conditions for use, reproduction,
  10 + and distribution as defined by Sections 1 through 9 of this document.
  11 +
  12 + "Licensor" shall mean the copyright owner or entity authorized by
  13 + the copyright owner that is granting the License.
  14 +
  15 + "Legal Entity" shall mean the union of the acting entity and all
  16 + other entities that control, are controlled by, or are under common
  17 + control with that entity. For the purposes of this definition,
  18 + "control" means (i) the power, direct or indirect, to cause the
  19 + direction or management of such entity, whether by contract or
  20 + otherwise, or (ii) ownership of fifty percent (50%) or more of the
  21 + outstanding shares, or (iii) beneficial ownership of such entity.
  22 +
  23 + "You" (or "Your") shall mean an individual or Legal Entity
  24 + exercising permissions granted by this License.
  25 +
  26 + "Source" form shall mean the preferred form for making modifications,
  27 + including but not limited to software source code, documentation
  28 + source, and configuration files.
  29 +
  30 + "Object" form shall mean any form resulting from mechanical
  31 + transformation or translation of a Source form, including but
  32 + not limited to compiled object code, generated documentation,
  33 + and conversions to other media types.
  34 +
  35 + "Work" shall mean the work of authorship, whether in Source or
  36 + Object form, made available under the License, as indicated by a
  37 + copyright notice that is included in or attached to the work
  38 + (an example is provided in the Appendix below).
  39 +
  40 + "Derivative Works" shall mean any work, whether in Source or Object
  41 + form, that is based on (or derived from) the Work and for which the
  42 + editorial revisions, annotations, elaborations, or other modifications
  43 + represent, as a whole, an original work of authorship. For the purposes
  44 + of this License, Derivative Works shall not include works that remain
  45 + separable from, or merely link (or bind by name) to the interfaces of,
  46 + the Work and Derivative Works thereof.
  47 +
  48 + "Contribution" shall mean any work of authorship, including
  49 + the original version of the Work and any modifications or additions
  50 + to that Work or Derivative Works thereof, that is intentionally
  51 + submitted to Licensor for inclusion in the Work by the copyright owner
  52 + or by an individual or Legal Entity authorized to submit on behalf of
  53 + the copyright owner. For the purposes of this definition, "submitted"
  54 + means any form of electronic, verbal, or written communication sent
  55 + to the Licensor or its representatives, including but not limited to
  56 + communication on electronic mailing lists, source code control systems,
  57 + and issue tracking systems that are managed by, or on behalf of, the
  58 + Licensor for the purpose of discussing and improving the Work, but
  59 + excluding communication that is conspicuously marked or otherwise
  60 + designated in writing by the copyright owner as "Not a Contribution."
  61 +
  62 + "Contributor" shall mean Licensor and any individual or Legal Entity
  63 + on behalf of whom a Contribution has been received by Licensor and
  64 + subsequently incorporated within the Work.
  65 +
  66 + 2. Grant of Copyright License. Subject to the terms and conditions of
  67 + this License, each Contributor hereby grants to You a perpetual,
  68 + worldwide, non-exclusive, no-charge, royalty-free, irrevocable
  69 + copyright license to reproduce, prepare Derivative Works of,
  70 + publicly display, publicly perform, sublicense, and distribute the
  71 + Work and such Derivative Works in Source or Object form.
  72 +
  73 + 3. Grant of Patent License. Subject to the terms and conditions of
  74 + this License, each Contributor hereby grants to You a perpetual,
  75 + worldwide, non-exclusive, no-charge, royalty-free, irrevocable
  76 + (except as stated in this section) patent license to make, have made,
  77 + use, offer to sell, sell, import, and otherwise transfer the Work,
  78 + where such license applies only to those patent claims licensable
  79 + by such Contributor that are necessarily infringed by their
  80 + Contribution(s) alone or by combination of their Contribution(s)
  81 + with the Work to which such Contribution(s) was submitted. If You
  82 + institute patent litigation against any entity (including a
  83 + cross-claim or counterclaim in a lawsuit) alleging that the Work
  84 + or a Contribution incorporated within the Work constitutes direct
  85 + or contributory patent infringement, then any patent licenses
  86 + granted to You under this License for that Work shall terminate
  87 + as of the date such litigation is filed.
  88 +
  89 + 4. Redistribution. You may reproduce and distribute copies of the
  90 + Work or Derivative Works thereof in any medium, with or without
  91 + modifications, and in Source or Object form, provided that You
  92 + meet the following conditions:
  93 +
  94 + (a) You must give any other recipients of the Work or
  95 + Derivative Works a copy of this License; and
  96 +
  97 + (b) You must cause any modified files to carry prominent notices
  98 + stating that You changed the files; and
  99 +
  100 + (c) You must retain, in the Source form of any Derivative Works
  101 + that You distribute, all copyright, patent, trademark, and
  102 + attribution notices from the Source form of the Work,
  103 + excluding those notices that do not pertain to any part of
  104 + the Derivative Works; and
  105 +
  106 + (d) If the Work includes a "NOTICE" text file as part of its
  107 + distribution, then any Derivative Works that You distribute must
  108 + include a readable copy of the attribution notices contained
  109 + within such NOTICE file, excluding those notices that do not
  110 + pertain to any part of the Derivative Works, in at least one
  111 + of the following places: within a NOTICE text file distributed
  112 + as part of the Derivative Works; within the Source form or
  113 + documentation, if provided along with the Derivative Works; or,
  114 + within a display generated by the Derivative Works, if and
  115 + wherever such third-party notices normally appear. The contents
  116 + of the NOTICE file are for informational purposes only and
  117 + do not modify the License. You may add Your own attribution
  118 + notices within Derivative Works that You distribute, alongside
  119 + or as an addendum to the NOTICE text from the Work, provided
  120 + that such additional attribution notices cannot be construed
  121 + as modifying the License.
  122 +
  123 + You may add Your own copyright statement to Your modifications and
  124 + may provide additional or different license terms and conditions
  125 + for use, reproduction, or distribution of Your modifications, or
  126 + for any such Derivative Works as a whole, provided Your use,
  127 + reproduction, and distribution of the Work otherwise complies with
  128 + the conditions stated in this License.
  129 +
  130 + 5. Submission of Contributions. Unless You explicitly state otherwise,
  131 + any Contribution intentionally submitted for inclusion in the Work
  132 + by You to the Licensor shall be under the terms and conditions of
  133 + this License, without any additional terms or conditions.
  134 + Notwithstanding the above, nothing herein shall supersede or modify
  135 + the terms of any separate license agreement you may have executed
  136 + with Licensor regarding such Contributions.
  137 +
  138 + 6. Trademarks. This License does not grant permission to use the trade
  139 + names, trademarks, service marks, or product names of the Licensor,
  140 + except as required for reasonable and customary use in describing the
  141 + origin of the Work and reproducing the content of the NOTICE file.
  142 +
  143 + 7. Disclaimer of Warranty. Unless required by applicable law or
  144 + agreed to in writing, Licensor provides the Work (and each
  145 + Contributor provides its Contributions) on an "AS IS" BASIS,
  146 + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
  147 + implied, including, without limitation, any warranties or conditions
  148 + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
  149 + PARTICULAR PURPOSE. You are solely responsible for determining the
  150 + appropriateness of using or redistributing the Work and assume any
  151 + risks associated with Your exercise of permissions under this License.
  152 +
  153 + 8. Limitation of Liability. In no event and under no legal theory,
  154 + whether in tort (including negligence), contract, or otherwise,
  155 + unless required by applicable law (such as deliberate and grossly
  156 + negligent acts) or agreed to in writing, shall any Contributor be
  157 + liable to You for damages, including any direct, indirect, special,
  158 + incidental, or consequential damages of any character arising as a
  159 + result of this License or out of the use or inability to use the
  160 + Work (including but not limited to damages for loss of goodwill,
  161 + work stoppage, computer failure or malfunction, or any and all
  162 + other commercial damages or losses), even if such Contributor
  163 + has been advised of the possibility of such damages.
  164 +
  165 + 9. Accepting Warranty or Additional Liability. While redistributing
  166 + the Work or Derivative Works thereof, You may choose to offer,
  167 + and charge a fee for, acceptance of support, warranty, indemnity,
  168 + or other liability obligations and/or rights consistent with this
  169 + License. However, in accepting such obligations, You may act only
  170 + on Your own behalf and on Your sole responsibility, not on behalf
  171 + of any other Contributor, and only if You agree to indemnify,
  172 + defend, and hold each Contributor harmless for any liability
  173 + incurred by, or claims asserted against, such Contributor by reason
  174 + of your accepting any such warranty or additional liability.
  175 +
  176 + END OF TERMS AND CONDITIONS
  177 +
  178 + APPENDIX: How to apply the Apache License to your work.
  179 +
  180 + To apply the Apache License to your work, attach the following
  181 + boilerplate notice, with the fields enclosed by brackets "{}"
  182 + replaced with your own identifying information. (Don't include
  183 + the brackets!) The text should be enclosed in the appropriate
  184 + comment syntax for the file format. We also recommend that a
  185 + file or class name and description of purpose be included on the
  186 + same "printed page" as the copyright notice for easier
  187 + identification within third-party archives.
  188 +
  189 + Copyright {yyyy} {name of copyright owner}
  190 +
  191 + Licensed under the Apache License, Version 2.0 (the "License");
  192 + you may not use this file except in compliance with the License.
  193 + You may obtain a copy of the License at
  194 +
  195 + http://www.apache.org/licenses/LICENSE-2.0
  196 +
  197 + Unless required by applicable law or agreed to in writing, software
  198 + distributed under the License is distributed on an "AS IS" BASIS,
  199 + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  200 + See the License for the specific language governing permissions and
  201 + limitations under the License.
  202 +
... ...
... ... @@ -15,4 +15,32 @@
15 15 *
16 16 * You should have received a copy of the GNU Lesser General Public License
17 17 * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
18   - */
19 18 \ No newline at end of file
  19 + */
  20 +*****************
  21 +ReadMe
  22 +*****************
  23 +The project is designed to work on one or more instances of Alfresco (Enterprise / Cloud / Hybrid).
  24 +More than one instances can be tested in parallel / at a time.
  25 +
  26 +It needs the following files in the resources per Alfresco Instance / node you wish to test.
  27 +
  28 +1> .properties file with properties for Alfresco Instance such as:
  29 +#Alfresco properties
  30 +api.target = https://test2api.alfresco.me
  31 +api.port = 443
  32 +api.version = MyAlfresco
  33 +
  34 +#Layer7 Enabled on Cloud Environment?
  35 +hybrid.layer7Enabled = false
  36 +hybrid.apiKey =
  37 +hybrid.apiSecretKey =
  38 +
  39 +#Comma separated List of users with a special password (different than username)
  40 +users = user1@freenet.test,admin
  41 +passwords = abcdef
  42 +
  43 +2> test-context.xml to read these properties.
  44 +
  45 +A ApiClient object then can be instantiated by providing the right context filename.
  46 +This will then need to be used to get access to all Cmis and PublicApi utilities.
  47 +
... ...
org/alfresco/test/utils/TestGroups.java
... ... @@ -0,0 +1,14 @@
  1 +package org.alfresco.test.utils;
  2 +
  3 +/**
  4 + * Class to store info about valid TestGroups being used in the tests
  5 + *
  6 + * @author Meenal Bhave
  7 + * @since 1.0
  8 + */
  9 +
  10 +public enum TestGroups
  11 +{
  12 + cloudOnly,
  13 + enterpriseOnly;
  14 +}
... ...
org/alfresco/test/utils/api/PublicApiUtilsOnEntTest.java
... ... @@ -0,0 +1,64 @@
  1 +/*
  2 + * Copyright (C) 2005-2015 Alfresco Software Limited.
  3 + * This file is part of Alfresco
  4 + * Alfresco is free software: you can redistribute it and/or modify
  5 + * it under the terms of the GNU Lesser General Public License as published by
  6 + * the Free Software Foundation, either version 3 of the License, or
  7 + * (at your option) any later version.
  8 + * Alfresco is distributed in the hope that it will be useful,
  9 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11 + * GNU Lesser General Public License for more details.
  12 + * You should have received a copy of the GNU Lesser General Public License
  13 + * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
  14 + */
  15 +
  16 +package org.alfresco.test.utils.api;
  17 +
  18 +import java.util.HashMap;
  19 +import java.util.Map;
  20 +
  21 +import org.alfresco.test.utils.api.ApiClient;
  22 +import org.testng.Assert;
  23 +import org.testng.annotations.Test;
  24 +
  25 +/**
  26 + * Test class to validate PublicApi Utils.
  27 + *
  28 + * @author Meenal Bhave
  29 + * @since 1.0
  30 + */
  31 +
  32 +public class PublicApiUtilsOnEntTest extends AbstractTestUtils
  33 +{
  34 + ApiClient apiClientEnt;
  35 +
  36 + Map<String, String> param = new HashMap<String, String>();
  37 + String[] authDetails = new String[] { "admin", "admin" };
  38 +
  39 +
  40 + @Test
  41 + public void testPublicApiUtilsForEnterprise()
  42 + {
  43 + try
  44 + {
  45 + authDetails[0] = "admin";
  46 + authDetails[1] = "admin";
  47 +
  48 + apiClientEnt = new ApiClient(contextFileNameEnt);
  49 +
  50 + param.put("maxItems", "100");
  51 +
  52 + System.out.println("Count of Favourites: " + apiClientEnt.getRemoteApiClient(authDetails,"-default-").favourites().getFavourites(authDetails[0], param).getList().size());
  53 +
  54 + System.out.println(apiClientEnt.getPublicApiClient().getMyFavourites(authDetails, "-default-", param).toString());
  55 +
  56 + System.out.println(apiClientEnt.getPublicApiClient().getMyFavourites(authDetails, "-default-", param).getJsonResponse().get("username"));
  57 + System.out.println(apiClientEnt.getPublicApiClient().getMyFavourites(authDetails, "-default-", param).getJsonResponse().get("networkId"));
  58 + }
  59 + catch (Throwable t)
  60 + {
  61 + Assert.fail("Error: " + t.getMessage(), t);
  62 + }
  63 + }
  64 +}
... ...
... ... @@ -0,0 +1,244 @@
  1 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  2 +
  3 + <modelVersion>4.0.0</modelVersion>
  4 + <groupId>org.alfresco.test</groupId>
  5 + <artifactId>alfresco-api-test-utils</artifactId>
  6 + <version>1.2</version>
  7 + <packaging>jar</packaging>
  8 + <name>alfresco-test-utils</name>
  9 + <description>Alfresco's utility lib used for end to end functional test project</description>
  10 +
  11 + <properties>
  12 + <java.version>1.8</java.version>
  13 + <remote.api.version>5.1.g</remote.api.version>
  14 + <testng.xml>src/test/resources/testngEnterprise.xml</testng.xml>
  15 + <uniqueTestRunName>test</uniqueTestRunName>
  16 + <enterprise.installer.path>/data/bamboo/artifacts/${enterprise.build.plan}/ALL/alfresco-enterprise-*-installer-linux-x64.???</enterprise.installer.path>
  17 + </properties>
  18 + <dependencies>
  19 + <dependency>
  20 + <groupId>org.apache.httpcomponents</groupId>
  21 + <artifactId>httpclient</artifactId>
  22 + <version>4.3.3</version>
  23 + </dependency>
  24 + <dependency>
  25 + <groupId>org.json</groupId>
  26 + <artifactId>json</artifactId>
  27 + <version>20140107</version>
  28 + </dependency>
  29 + <dependency>
  30 + <groupId>commons-io</groupId>
  31 + <artifactId>commons-io</artifactId>
  32 +<!-- --> <version>2.4</version>
  33 + </dependency>
  34 + <dependency>
  35 + <groupId>org.testng</groupId>
  36 + <artifactId>testng</artifactId>
  37 + <version>6.8.8</version>
  38 + <!-- <scope>test</scope>-->
  39 + </dependency>
  40 + <dependency>
  41 + <groupId>net.sourceforge.jexcelapi</groupId>
  42 + <artifactId>jxl</artifactId>
  43 + <version>2.6.12</version>
  44 + </dependency>
  45 + <dependency>
  46 + <groupId>org.alfresco</groupId>
  47 + <artifactId>alfresco-remote-api</artifactId>
  48 + <version>${remote.api.version}</version>
  49 + </dependency>
  50 + <dependency>
  51 + <groupId>org.alfresco</groupId>
  52 + <artifactId>alfresco-remote-api</artifactId>
  53 + <version>${remote.api.version}</version>
  54 + <classifier>tests</classifier>
  55 + </dependency>
  56 + </dependencies>
  57 + <!-- Plug back default Maven source folders -->
  58 + <build>
  59 + <directory>target/${uniqueTestRunName}</directory>
  60 + <sourceDirectory>src/main/java</sourceDirectory>
  61 + <testSourceDirectory>src/test/java</testSourceDirectory>
  62 + <resources>
  63 + <resource>
  64 + <directory>src/main/resources</directory>
  65 + </resource>
  66 + </resources>
  67 + <testResources>
  68 + <testResource>
  69 + <directory>src/test/resources</directory>
  70 + </testResource>
  71 + </testResources>
  72 + <plugins>
  73 + <plugin>
  74 + <groupId>org.apache.maven.plugins</groupId>
  75 + <artifactId>maven-compiler-plugin</artifactId>
  76 + <version>3.3</version>
  77 + <configuration>
  78 + <source>${java.version}</source>
  79 + <target>${java.version}</target>
  80 + </configuration>
  81 + </plugin>
  82 + <plugin>
  83 + <artifactId>maven-surefire-plugin</artifactId>
  84 + <version>2.16</version>
  85 + <configuration>
  86 + <suiteXmlFiles>
  87 + <suiteXmlFile>${testng.xml}</suiteXmlFile>
  88 + </suiteXmlFiles>
  89 + <excludedGroups>${test.exclude}</excludedGroups>
  90 + <groups>${test.include}</groups>
  91 + <runOrder>alphabetical</runOrder>
  92 + <workingDirectory>${basedir}</workingDirectory>
  93 + <redirectTestOutputToFile>false</redirectTestOutputToFile>
  94 + <parallel>classes</parallel>
  95 + </configuration>
  96 + </plugin>
  97 + <plugin>
  98 + <!-- Configuration triggered by mvn antrun:run, used by Bamboo to stop server -->
  99 + <artifactId>maven-antrun-plugin</artifactId>
  100 + <version>1.7</version>
  101 + <executions>
  102 + <execution>
  103 + <id>default-cli</id>
  104 + <configuration>
  105 + <target>
  106 + <echo>Stopping Alfresco...</echo>
  107 + <exec executable="${basedir}/target/alf-installation/alfresco.sh"
  108 + dir="target/alf-installation" failonerror="true">
  109 + <arg value="stop" />
  110 + </exec>
  111 + </target>
  112 + </configuration>
  113 + </execution>
  114 + </executions>
  115 + </plugin>
  116 + </plugins>
  117 + </build>
  118 + <profiles>
  119 + <profile>
  120 + <id>install-alfresco</id>
  121 + <build>
  122 + <plugins>
  123 + <!-- Download and install the latest enterprise alfresco installer -->
  124 + <plugin>
  125 + <artifactId>maven-antrun-plugin</artifactId>
  126 + <executions>
  127 + <execution>
  128 + <id>fetch-installer</id>
  129 + <phase>generate-test-resources</phase>
  130 + <goals>
  131 + <goal>run</goal>
  132 + </goals>
  133 + <configuration>
  134 + <target>
  135 + <echo>Recreating database...</echo>
  136 + <sql autocommit="true" driver="org.postgresql.Driver" password="alfresco" url="jdbc:postgresql:template1" userid="alfresco">drop
  137 + database if exists alfresco; create database alfresco</sql>
  138 + <echo>Downloading Alfresco installer...</echo>
  139 + <sshexec command="ls -rt ${enterprise.installer.path} | tail -1 | tr ' ' '?' " host="pbam01.alfresco.com" keyfile="${user.home}/.ssh/id_rsa" outputproperty="installerPath" username="tomcat"/>
  140 + <scp keyfile="${user.home}/.ssh/id_rsa" localTofile="target/alf-installer.bin" remoteFile="tomcat@pbam01.alfresco.com:${installerPath}"/>
  141 + <chmod file="target/alf-installer.bin" perm="a+x" verbose="true"/>
  142 + <echo>Installing Alfresco...</echo>
  143 + <exec dir="target" executable="${basedir}/target/alf-installer.bin" failonerror="true">
  144 + <arg line="--mode unattended --alfresco_admin_password admin --disable-components postgres,alfrescowcmqs --jdbc_username alfresco --jdbc_password alfresco --prefix ${basedir}/target/alf-installation"/>
  145 + </exec>
  146 + </target>
  147 + </configuration>
  148 + </execution>
  149 + </executions>
  150 + <dependencies>
  151 + <dependency>
  152 + <groupId>org.apache.ant</groupId>
  153 + <artifactId>ant-jsch</artifactId>
  154 + <version>1.8.2</version>
  155 + </dependency>
  156 + <dependency>
  157 + <groupId>postgresql</groupId>
  158 + <artifactId>postgresql</artifactId>
  159 + <version>9.1-901-1.jdbc4</version>
  160 + </dependency>
  161 + </dependencies>
  162 + </plugin>
  163 + </plugins>
  164 + </build>
  165 + </profile>
  166 + <profile>
  167 + <id>run-alfresco</id>
  168 + <build>
  169 + <plugins>
  170 + <!-- Starts/stop the installed Alfresco -->
  171 + <plugin>
  172 + <artifactId>maven-antrun-plugin</artifactId>
  173 + <executions>
  174 + <execution>
  175 + <id>start-alfresco</id>
  176 + <phase>process-test-classes</phase>
  177 + <goals>
  178 + <goal>run</goal>
  179 + </goals>
  180 + <configuration>
  181 + <target>
  182 + <echo>Starting Alfresco...</echo>
  183 + <exec dir="target/alf-installation" executable="${basedir}/target/alf-installation/alfresco.sh" failonerror="true">
  184 + <arg value="start"/>
  185 + <env key="CATALINA_OPTS" value="${argLine}"/>
  186 + </exec>
  187 + <sleep minutes="5"/>
  188 + </target>
  189 + </configuration>
  190 + </execution>
  191 + <execution>
  192 + <id>stop-alfresco</id>
  193 + <phase>post-integration-test</phase>
  194 + <goals>
  195 + <goal>run</goal>
  196 + </goals>
  197 + <configuration>
  198 + <target>
  199 + <echo>Stopping Alfresco...</echo>
  200 + <exec dir="target/alf-installation" executable="${basedir}/target/alf-installation/alfresco.sh" failonerror="true">
  201 + <arg value="stop"/>
  202 + </exec>
  203 + </target>
  204 + </configuration>
  205 + </execution>
  206 + </executions>
  207 + </plugin>
  208 + </plugins>
  209 + </build>
  210 + </profile>
  211 + </profiles>
  212 + <repositories>
  213 + <repository>
  214 + <id>alfresco-internal</id>
  215 + <url>https://nexus.alfresco.com/nexus/content/repositories/internal-releases</url>
  216 + <releases>
  217 + <enabled>true</enabled>
  218 + </releases>
  219 + <snapshots>
  220 + <enabled>false</enabled>
  221 + </snapshots>
  222 + </repository>
  223 + <repository>
  224 + <id>alfresco-internal-snapshots</id>
  225 + <url>https://nexus.alfresco.com/nexus/content/repositories/internal-snapshots</url>
  226 + <releases>
  227 + <enabled>false</enabled>
  228 + </releases>
  229 + <snapshots>
  230 + <enabled>true</enabled>
  231 + </snapshots>
  232 + </repository>
  233 + </repositories>
  234 + <distributionManagement>
  235 + <repository>
  236 + <id>alfresco-internal</id>
  237 + <url>https://nexus.alfresco.com/nexus/content/repositories/internal-releases</url>
  238 + </repository>
  239 + <snapshotRepository>
  240 + <id>alfresco-internal-snapshots</id>
  241 + <url>https://nexus.alfresco.com/nexus/content/repositories/internal-snapshots</url>
  242 + </snapshotRepository>
  243 + </distributionManagement>
  244 +</project>
0 245 \ No newline at end of file
... ...
src/main/java/org/alfresco/test/constants/Constants.java
... ... @@ -0,0 +1,38 @@
  1 +/*
  2 + * Copyright (C) 2005-2015 Alfresco Software Limited.
  3 + * This file is part of Alfresco
  4 + * Alfresco is free software: you can redistribute it and/or modify
  5 + * it under the terms of the GNU Lesser General Public License as published by
  6 + * the Free Software Foundation, either version 3 of the License, or
  7 + * (at your option) any later version.
  8 + * Alfresco is distributed in the hope that it will be useful,
  9 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11 + * GNU Lesser General Public License for more details.
  12 + * You should have received a copy of the GNU Lesser General Public License
  13 + * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
  14 + */
  15 +
  16 +package org.alfresco.test.constants;
  17 +
  18 +import java.io.File;
  19 +
  20 +/**
  21 + * Class to contain Constants
  22 + *
  23 + * @author Meenal Bhave
  24 + * @since 1.0
  25 + */
  26 +
  27 +public class Constants
  28 +{
  29 + public static final String EMPTY_STRING = "EMPTY";
  30 + public static final String ENTERPRISE_DEFAULT_DOMAIN = "-default-";
  31 +
  32 + public static final String DEFAULT_USER = "admin";
  33 + public static final String DEFAULT_PASSWORD = "admin";
  34 +
  35 + public static final String SLASH = File.separator;
  36 + public static final String SRC_ROOT = System.getProperty("user.dir") + SLASH;
  37 + public static final String DATA_FOLDER = SRC_ROOT + "testdata" + SLASH;
  38 +}
... ...
src/main/java/org/alfresco/test/enums/AlfrescoVersion.java
... ... @@ -0,0 +1,145 @@
  1 +/*
  2 + * Copyright (C) 2005-2015 Alfresco Software Limited.
  3 + * This file is part of Alfresco
  4 + * Alfresco is free software: you can redistribute it and/or modify
  5 + * it under the terms of the GNU Lesser General Public License as published by
  6 + * the Free Software Foundation, either version 3 of the License, or
  7 + * (at your option) any later version.
  8 + * Alfresco is distributed in the hope that it will be useful,
  9 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11 + * GNU Lesser General Public License for more details.
  12 + * You should have received a copy of the GNU Lesser General Public License
  13 + * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
  14 + */
  15 +
  16 +package org.alfresco.test.enums;
  17 +
  18 +/**
  19 + * The Alfresco version enum.
  20 + *
  21 + * @author Meenal Bhave
  22 + * @since 1.0
  23 + */
  24 +
  25 +public enum AlfrescoVersion
  26 +{
  27 + // The current
  28 + Share(null, 5.0, true,true),
  29 + Enterprise(null),
  30 + Enterprise41(Enterprise, 4.1, false, false),
  31 + Enterprise42(Enterprise, 4.2, true, false),
  32 + Enterprise43(Enterprise, 4.3, true, false),
  33 + Enterprise5(Enterprise, 5.0, true, true),
  34 + Cloud(null, 2.0, true, true),
  35 + CloudNonFacetSearch(Cloud, 2.0, true,false),
  36 + MyAlfresco(Cloud, 2.1, true, true);
  37 +
  38 + private static final String ALFRESCO_VERSION_DOES_NOT_MATCH_ERROR = "version %s does not match to an existing AlfrescoVersion:"
  39 + + " Enterprise41, Enterprise42, Enterprise43, Cloud1 or Cloud2 or MyAlfresco";
  40 + private AlfrescoVersion parent;
  41 + private Double version;
  42 + private boolean dojoSuport;
  43 + private boolean facetedSearch;
  44 +
  45 + private AlfrescoVersion(AlfrescoVersion parent)
  46 + {
  47 + this.parent = parent;
  48 + this.version = 0.0;
  49 + this.dojoSuport = false;
  50 + this.facetedSearch = false;
  51 + }
  52 +
  53 + /**
  54 + * Constructor.
  55 + *
  56 + * @param parent {@link AlfrescoVersion}
  57 + * @param version Alfresco version identifier
  58 + * @param dojoSupport Alfresco that have dojo in ui.
  59 + */
  60 + private AlfrescoVersion(AlfrescoVersion parent, Double version, boolean dojoSupport, boolean facetedSearch)
  61 + {
  62 + this.parent = parent;
  63 + this.version = version;
  64 + this.dojoSuport = dojoSupport;
  65 + this.facetedSearch = facetedSearch;
  66 + }
  67 +
  68 + /**
  69 + * Checks if its a cloud base enum.
  70 + *
  71 + * @return true if its cloud base enum
  72 + */
  73 + public boolean isCloud()
  74 + {
  75 + if (AlfrescoVersion.Cloud == this)
  76 + {
  77 + return true;
  78 + }
  79 + else if (parent != null && parent == Cloud)
  80 + {
  81 + return true;
  82 + }
  83 + return false;
  84 + }
  85 +
  86 + /**
  87 + * Flag to indicates if file upload is supported
  88 + * by HTML5
  89 + *
  90 + * @return true if supported which at present only cloud does
  91 + */
  92 + public boolean isFileUploadHtml5()
  93 + {
  94 + return !AlfrescoVersion.Enterprise41.equals(this);
  95 + }
  96 +
  97 + /**
  98 + * Create {@link AlfrescoVersion} from string.
  99 + *
  100 + * @param value String alfresco version
  101 + * @return {@link AlfrescoVersion} version
  102 + */
  103 + public AlfrescoVersion fromString(String value)
  104 + {
  105 + if (value == null || value.trim().isEmpty())
  106 + {
  107 + return AlfrescoVersion.Share;
  108 + }
  109 + String version = value;
  110 + if (value.startsWith("Enterprise") && value.contains("-"))
  111 + {
  112 + version = version.replace("-", "");
  113 + }
  114 + for (AlfrescoVersion alfrescoVersion : AlfrescoVersion.values())
  115 + {
  116 + if (version.equalsIgnoreCase(alfrescoVersion.name()))
  117 + {
  118 + return alfrescoVersion;
  119 + }
  120 + }
  121 + throw new IllegalArgumentException(String.format(ALFRESCO_VERSION_DOES_NOT_MATCH_ERROR, value));
  122 + }
  123 +
  124 + public Double getVersion()
  125 + {
  126 + return version;
  127 + }
  128 +
  129 + public boolean isDojoSupported()
  130 + {
  131 + return dojoSuport;
  132 + }
  133 +
  134 + public boolean isFacetedSearch()
  135 + {
  136 + return facetedSearch;
  137 + }
  138 +
  139 + public void setFacetedSearch(boolean facetedSearch)
  140 + {
  141 + this.facetedSearch = facetedSearch;
  142 + }
  143 +
  144 +
  145 +}
... ...
src/main/java/org/alfresco/test/enums/CMISBinding.java
... ... @@ -0,0 +1,76 @@
  1 +/*
  2 + * Copyright (C) 2005-2015 Alfresco Software Limited.
  3 + * This file is part of Alfresco
  4 + * Alfresco is free software: you can redistribute it and/or modify
  5 + * it under the terms of the GNU Lesser General Public License as published by
  6 + * the Free Software Foundation, either version 3 of the License, or
  7 + * (at your option) any later version.
  8 + * Alfresco is distributed in the hope that it will be useful,
  9 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11 + * GNU Lesser General Public License for more details.
  12 + * You should have received a copy of the GNU Lesser General Public License
  13 + * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
  14 + */
  15 +
  16 +package org.alfresco.test.enums;
  17 +
  18 +import org.alfresco.opencmis.CMISDispatcherRegistry.Binding;
  19 +import org.apache.chemistry.opencmis.commons.enums.BindingType;
  20 +
  21 +/**
  22 + * The CMISBinding enum.
  23 + *
  24 + * @author Meenal Bhave
  25 + * @since 1.0
  26 + */
  27 +
  28 +public enum CMISBinding
  29 +{
  30 + ATOMPUB10(Binding.atom, "1.0"), ATOMPUB11(Binding.atom, "1.1"), BROWSER11(Binding.browser, "1.1");
  31 +
  32 + private Binding binding;
  33 + private String version;
  34 + private BindingType bindingType;
  35 +
  36 + CMISBinding(Binding binding, String version)
  37 + {
  38 + this.binding = binding;
  39 + this.version = version;
  40 + setBindingType(binding);
  41 + }
  42 +
  43 + /**
  44 + * @return the binding
  45 + */
  46 + public Binding getBinding()
  47 + {
  48 + return binding;
  49 + }
  50 +
  51 + /**
  52 + * @return the version
  53 + */
  54 + public String getVersion()
  55 + {
  56 + return version;
  57 + }
  58 +
  59 + public BindingType getBindingType()
  60 + {
  61 + return bindingType;
  62 + }
  63 +
  64 + public void setBindingType(Binding binding)
  65 + {
  66 + if (Binding.browser.equals(binding))
  67 + {
  68 + this.bindingType = BindingType.BROWSER;
  69 + }
  70 + else
  71 + {
  72 + this.bindingType = BindingType.ATOMPUB;
  73 + }
  74 + }
  75 +
  76 +}
... ...
src/main/java/org/alfresco/test/enums/DocumentAspect.java
... ... @@ -0,0 +1,111 @@
  1 +/*
  2 + * Copyright (C) 2005-2015 Alfresco Software Limited.
  3 + * This file is part of Alfresco
  4 + * Alfresco is free software: you can redistribute it and/or modify
  5 + * it under the terms of the GNU Lesser General Public License as published by
  6 + * the Free Software Foundation, either version 3 of the License, or
  7 + * (at your option) any later version.
  8 + * Alfresco is distributed in the hope that it will be useful,
  9 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11 + * GNU Lesser General Public License for more details.
  12 + * You should have received a copy of the GNU Lesser General Public License
  13 + * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
  14 + */
  15 +
  16 +package org.alfresco.test.enums;
  17 +
  18 +import org.apache.commons.lang3.StringUtils;
  19 +
  20 +/**
  21 + * Different Aspects of Documents.
  22 + *
  23 + * @author Meenal Bhave
  24 + * @since 1.0
  25 + */
  26 +
  27 +public enum DocumentAspect
  28 +{
  29 + CLASSIFIABLE("Classifiable", "P:cm:generalclassifiable"),
  30 + VERSIONABLE("Versionable", "P:cm:versionable"),
  31 + AUDIO("Audio", "P:audio:audio"),
  32 + INDEX_CONTROL("Index Control", "P:cm:indexControl"),
  33 + COMPLIANCEABLE("Complianceable", "P:cm:complianceable"),
  34 + DUBLIN_CORE("Dublin Core", "P:cm:dublincore"),
  35 + EFFECTIVITY("Effectivity", "P:cm:effectivity"),
  36 + SUMMARIZABLE("Summarizable", "P:cm:summarizable"),
  37 + TEMPLATABLE("Templatable", "P:cm:templatable"),
  38 + EMAILED("Emailed", "P:cm:emailed"),
  39 + ALIASABLE_EMAIL("Aliasable (Email)", "P:emailserver:aliasable"),
  40 + TAGGABLE("Taggable", "P:cm:taggable"),
  41 + INLINE_EDITABLE("Inline Editable", "P:app:inlineeditable"),
  42 + GOOGLE_DOCS_EDITABLE("Google Docs Editable", "P:gd:googleEditable"),
  43 + GEOGRAPHIC("Geographic", "P:cm:geographic"),
  44 + EXIF("EXIF", "P:exif:exif"),
  45 + RESTRICTABLE("Restrictable", "P:dp:restrictable");
  46 +
  47 + private String aspectName;
  48 + private String aspectValue;
  49 +
  50 + private DocumentAspect(String aspectName, String aspectValue)
  51 + {
  52 + this.aspectName = aspectName;
  53 + this.aspectValue = aspectValue;
  54 + }
  55 +
  56 + public String getAspectName()
  57 + {
  58 + return this.aspectName;
  59 + }
  60 +
  61 + public String getAspectValue()
  62 + {
  63 + return this.aspectValue;
  64 + }
  65 +
  66 + /**
  67 + * Find the {@link DocumentAspect} based it is name.
  68 + *
  69 + * @param aspectName - Aspect's Name
  70 + * @return {@link DocumentAspect}
  71 + * @throws Exception - Throws {@link Exception} if not able to find
  72 + */
  73 + public static DocumentAspect getAspect(String aspectName) throws Exception
  74 + {
  75 + if (StringUtils.isEmpty(aspectName))
  76 + {
  77 + throw new UnsupportedOperationException("Name can't null or empty, It is required.");
  78 + }
  79 + for (DocumentAspect aspect : DocumentAspect.values())
  80 + {
  81 + if (aspect.aspectName != null && aspect.aspectName.equalsIgnoreCase(aspectName.trim()))
  82 + {
  83 + return aspect;
  84 + }
  85 + }
  86 + throw new IllegalArgumentException("Not able to find the Document Aspect for given name : " + aspectName);
  87 + }
  88 +
  89 + /**
  90 + * Find the {@link DocumentAspect} based it is property.
  91 + *
  92 + * @param property - Aspect's property
  93 + * @return {@link DocumentAspect}
  94 + * @throws Exception - Throws {@link Exception} if not able to find
  95 + */
  96 + public static DocumentAspect getAspectByProperty(String property) throws Exception
  97 + {
  98 + if (StringUtils.isEmpty(property))
  99 + {
  100 + throw new UnsupportedOperationException("Name can't null or empty, It is required.");
  101 + }
  102 + for (DocumentAspect aspect : DocumentAspect.values())
  103 + {
  104 + if (aspect.aspectValue != null && aspect.aspectValue.equalsIgnoreCase(property.trim()))
  105 + {
  106 + return aspect;
  107 + }
  108 + }
  109 + throw new IllegalArgumentException("Not able to find the Document Aspect for given name : " + property);
  110 + }
  111 +}
... ...
src/main/java/org/alfresco/test/enums/NodeType.java
... ... @@ -0,0 +1,28 @@
  1 +/*
  2 + * Copyright (C) 2005-2015 Alfresco Software Limited.
  3 + * This file is part of Alfresco
  4 + * Alfresco is free software: you can redistribute it and/or modify
  5 + * it under the terms of the GNU Lesser General Public License as published by
  6 + * the Free Software Foundation, either version 3 of the License, or
  7 + * (at your option) any later version.
  8 + * Alfresco is distributed in the hope that it will be useful,
  9 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11 + * GNU Lesser General Public License for more details.
  12 + * You should have received a copy of the GNU Lesser General Public License
  13 + * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
  14 + */
  15 +
  16 +package org.alfresco.test.enums;
  17 +
  18 +/**
  19 + * The Alfresco NodeType enum.
  20 + *
  21 + * @author Meenal Bhave
  22 + * @since 1.0
  23 + */
  24 +
  25 +public enum NodeType
  26 +{
  27 + SITE, FOLDER, FILE;
  28 +}
... ...
src/main/java/org/alfresco/test/utils/CommonUtils.java
... ... @@ -0,0 +1,77 @@
  1 +/*
  2 + * Copyright (C) 2005-2015 Alfresco Software Limited.
  3 + * This file is part of Alfresco
  4 + * Alfresco is free software: you can redistribute it and/or modify
  5 + * it under the terms of the GNU Lesser General Public License as published by
  6 + * the Free Software Foundation, either version 3 of the License, or
  7 + * (at your option) any later version.
  8 + * Alfresco is distributed in the hope that it will be useful,
  9 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11 + * GNU Lesser General Public License for more details.
  12 + * You should have received a copy of the GNU Lesser General Public License
  13 + * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
  14 + */
  15 +
  16 +package org.alfresco.test.utils;
  17 +
  18 +import java.util.Collection;
  19 +
  20 +import org.apache.commons.lang3.StringUtils;
  21 +
  22 +/**
  23 + * Class to contain Common Utils
  24 + *
  25 + * @author Meenal Bhave
  26 + * @since 1.0
  27 + */
  28 +
  29 +public class CommonUtils
  30 +{
  31 +
  32 + /**
  33 + * Helper method to check the parameters. This method should be used for all public methods.
  34 + *
  35 + * @author Tuna Aksoy
  36 + * @param <E>
  37 + * @param paramName {@link String} A name for the parameter to check
  38 + * @param object {@link Object} The object to check
  39 + * @exception IllegalArgumentException will be thrown if the parameter value is null
  40 + * (for {@link String} also if the value is empty or blank)
  41 + */
  42 + public static <E> void checkMandotaryParam(final String paramName, final Object object)
  43 + {
  44 + if (StringUtils.isBlank(paramName))
  45 + {
  46 + throw new IllegalArgumentException(String.format("The parameter paramName is required and can not be'%s'", paramName));
  47 + }
  48 + if (object == null)
  49 + {
  50 + throw new IllegalArgumentException(String.format("'%s' is a mandatory parameter and must have a value", paramName));
  51 + }
  52 + if (object instanceof String && StringUtils.isBlank((String) object))
  53 + {
  54 + throw new IllegalArgumentException(String.format("'%s' is a mandatory parameter", paramName));
  55 + }
  56 + if (object instanceof Collection<?> && ((Collection<?>) object).isEmpty())
  57 + {
  58 + throw new IllegalArgumentException(String.format("'%s' is a mandatory parameter and can not be empty", paramName));
  59 + }
  60 + }
  61 +
  62 + /**
  63 + * Helper to check the actual Result Vs expected
  64 + *