mirror of
https://github.com/Alfresco/acs-community-packaging.git
synced 2025-09-10 14:12:09 +00:00
ACS-106: No tests check that the distribution zip contains files from the main components (#1452)
* Community Distribution Zip basic tests added * Includes fix for a real bug found by the new test. The share.war not being unpacked unless the acs-community-packaging and acs-packaging versions were identical Co-authored-by: alandavis <alan.davis@alfresco.com>
This commit is contained in:
@@ -119,6 +119,12 @@ jobs:
|
|||||||
script:
|
script:
|
||||||
- travis_wait 30 mvn -B install -f tests/tas-integration/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false
|
- travis_wait 30 mvn -B install -f tests/tas-integration/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false
|
||||||
|
|
||||||
|
- name: "Community Distribution Zip content tests"
|
||||||
|
before_script:
|
||||||
|
- travis_retry travis_wait 20 mvn -B -V clean install -Pags -DskipTests -Dmaven.javadoc.skip=true
|
||||||
|
script:
|
||||||
|
- travis_wait 20 mvn -B install -f tests/tas-distribution-zip/pom.xml -Prun-distribution-zip-contents-check -DrunBugs=false
|
||||||
|
|
||||||
- name: "Update latest images"
|
- name: "Update latest images"
|
||||||
stage: docker_latest
|
stage: docker_latest
|
||||||
script: travis_retry travis_wait 30 mvn -B -V clean install -DskipTests -Dmaven.javadoc.skip=true -Pags -Ppush-docker-images
|
script: travis_retry travis_wait 30 mvn -B -V clean install -DskipTests -Dmaven.javadoc.skip=true -Pags -Ppush-docker-images
|
||||||
|
@@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
<!-- Share -->
|
<!-- Share -->
|
||||||
<fileSet>
|
<fileSet>
|
||||||
<directory>${project.build.directory}/dependency/alfresco-content-services-share-distribution-${project.version}</directory>
|
<directory>${project.build.directory}/dependency/alfresco-content-services-share-distribution-${dependency.acs-packaging.version}</directory>
|
||||||
<outputDirectory/>
|
<outputDirectory/>
|
||||||
<includes>
|
<includes>
|
||||||
<include>web-server/**</include>
|
<include>web-server/**</include>
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
</includes>
|
</includes>
|
||||||
</fileSet>
|
</fileSet>
|
||||||
<fileSet>
|
<fileSet>
|
||||||
<directory>${project.build.directory}/dependency/alfresco-content-services-share-distribution-${project.version}/web-extension-samples</directory>
|
<directory>${project.build.directory}/dependency/alfresco-content-services-share-distribution-${dependency.acs-packaging.version}/web-extension-samples</directory>
|
||||||
<outputDirectory>web-server/shared/classes/alfresco/web-extension</outputDirectory>
|
<outputDirectory>web-server/shared/classes/alfresco/web-extension</outputDirectory>
|
||||||
</fileSet>
|
</fileSet>
|
||||||
</fileSets>
|
</fileSets>
|
||||||
|
@@ -15,6 +15,7 @@
|
|||||||
<module>tas-email</module>
|
<module>tas-email</module>
|
||||||
<module>tas-webdav</module>
|
<module>tas-webdav</module>
|
||||||
<module>tas-integration</module>
|
<module>tas-integration</module>
|
||||||
|
<module>tas-distribution-zip</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
76
tests/tas-distribution-zip/pom.xml
Normal file
76
tests/tas-distribution-zip/pom.xml
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<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">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>org.alfresco.tas</groupId>
|
||||||
|
<artifactId>content-repository-community-distribution-test</artifactId>
|
||||||
|
<name>Community Distribution test</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>org.alfresco</groupId>
|
||||||
|
<artifactId>content-repository-community-tests</artifactId>
|
||||||
|
<version>7.2.0-A7-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<dependency.assertj-core.version>3.13.2</dependency.assertj-core.version>
|
||||||
|
<suiteXmlFile>${project.basedir}/src/test/resources/distribution-suite.xml</suiteXmlFile>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.assertj</groupId>
|
||||||
|
<artifactId>assertj-core</artifactId>
|
||||||
|
<version>3.13.2</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.alfresco.tas</groupId>
|
||||||
|
<artifactId>restapi</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven</groupId>
|
||||||
|
<artifactId>maven-model</artifactId>
|
||||||
|
<version>3.8.2</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>run-distribution-zip-contents-check</id>
|
||||||
|
<properties>
|
||||||
|
<suiteXmlFile>${project.basedir}/src/test/resources/distribution-suite.xml</suiteXmlFile>
|
||||||
|
</properties>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<suiteXmlFiles>
|
||||||
|
<suiteXmlFile>${suiteXmlFile}</suiteXmlFile>
|
||||||
|
</suiteXmlFiles>
|
||||||
|
<argLine>
|
||||||
|
--illegal-access=warn
|
||||||
|
</argLine>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<!-- Build only test jar -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>test-jar</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
@@ -0,0 +1,134 @@
|
|||||||
|
/*
|
||||||
|
* #%L
|
||||||
|
* Alfresco Remote API
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||||
|
* %%
|
||||||
|
* This file is part of the Alfresco software.
|
||||||
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
|
* provided under the following open source license terms:
|
||||||
|
*
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
package org.alfresco.distribution;
|
||||||
|
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.FilenameFilter;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Enumeration;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.zip.ZipEntry;
|
||||||
|
import java.util.zip.ZipFile;
|
||||||
|
|
||||||
|
import org.apache.maven.model.Model;
|
||||||
|
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
|
||||||
|
|
||||||
|
public class CheckDistributionZipContents
|
||||||
|
{
|
||||||
|
public static final String ACS_PREFIX = "alfresco-content-services-community-distribution";
|
||||||
|
public static final String ACS_DIR_NAME = "distribution";
|
||||||
|
public static final String AGS_PREFIX = "alfresco-governance-services-community";
|
||||||
|
public static final String AGS_DIR_NAME = "distribution-ags";
|
||||||
|
public static final String FORMAT = ".zip";
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAcsDistributionZipContents() throws Exception
|
||||||
|
{
|
||||||
|
File filesList[] = getDistributionZip(ACS_DIR_NAME, ACS_PREFIX);
|
||||||
|
for (File file : filesList)
|
||||||
|
{
|
||||||
|
List<String> zipEntries = getZipEntries(file.getAbsolutePath());
|
||||||
|
assertThat(zipEntries).
|
||||||
|
contains(
|
||||||
|
"keystore/metadata-keystore/keystore-passwords.properties",
|
||||||
|
"keystore/metadata-keystore/keystore",
|
||||||
|
"keystore/generate_keystores.bat",
|
||||||
|
"keystore/generate_keystores.sh",
|
||||||
|
"bin/alfresco-mmt.jar",
|
||||||
|
"bin/apply_amps.bat",
|
||||||
|
"bin/apply_amps.sh",
|
||||||
|
"web-server/webapps/ROOT.war",
|
||||||
|
"web-server/webapps/alfresco.war",
|
||||||
|
"web-server/webapps/share.war",
|
||||||
|
"web-server/webapps/_vti_bin.war",
|
||||||
|
"web-server/conf/Catalina/localhost/alfresco.xml",
|
||||||
|
"web-server/shared/classes/alfresco/web-extension/share-config-custom.xml"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAgsDistributionZipContents() throws Exception
|
||||||
|
{
|
||||||
|
String repoVersion = getPomValues().getProperties().getProperty("dependency.alfresco-community-repo.version");
|
||||||
|
String shareVersion = getPomValues().getProperties().getProperty("dependency.alfresco-community-share.version");
|
||||||
|
File filesList[] = getDistributionZip(AGS_DIR_NAME, AGS_PREFIX);
|
||||||
|
for (File file : filesList)
|
||||||
|
{
|
||||||
|
List<String> zipEntries = getZipEntries(file.getAbsolutePath());
|
||||||
|
assertThat(zipEntries).
|
||||||
|
contains(
|
||||||
|
"alfresco-governance-services-community-repo-" + repoVersion + ".amp",
|
||||||
|
"alfresco-governance-services-community-rest-api-explorer-" + repoVersion + ".war",
|
||||||
|
"alfresco-governance-services-community-share-" + shareVersion + ".amp"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private File[] getDistributionZip(String dirName, String prefix) throws Exception
|
||||||
|
{
|
||||||
|
String resourcePath = Paths.get("").toAbsolutePath().getParent().getParent().toString() + "/" + dirName + "/" + "target" + "/";
|
||||||
|
File distributionZip = new File(resourcePath);
|
||||||
|
FilenameFilter zipFileFilter = (dir, name) -> {
|
||||||
|
if (name.startsWith(prefix) && name.endsWith(FORMAT))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return distributionZip.listFiles(zipFileFilter);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> getZipEntries(String filePath) throws Exception
|
||||||
|
{
|
||||||
|
List<String> zipEntries = new ArrayList<>();
|
||||||
|
ZipFile zipFile = new ZipFile(new File(filePath));
|
||||||
|
Enumeration<? extends ZipEntry> entries = zipFile.entries();
|
||||||
|
while (entries.hasMoreElements())
|
||||||
|
{
|
||||||
|
ZipEntry entry = entries.nextElement();
|
||||||
|
zipEntries.add(entry.toString());
|
||||||
|
}
|
||||||
|
return zipEntries;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Model getPomValues() throws Exception
|
||||||
|
{
|
||||||
|
String parentPom = Paths.get("").toAbsolutePath().getParent().getParent().toString() + "/pom.xml";
|
||||||
|
MavenXpp3Reader reader = new MavenXpp3Reader();
|
||||||
|
Model model = reader.read(new FileReader(parentPom));
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
|
||||||
|
<suite name="Alfresco tests Community Distribution Zip" preserve-order="true" verbose="1">
|
||||||
|
<test name="distribution" verbose="3" preserve-order="true">
|
||||||
|
<classes>
|
||||||
|
<class name="org.alfresco.distribution.CheckDistributionZipContents"></class>
|
||||||
|
</classes>
|
||||||
|
</test>
|
||||||
|
</suite>
|
Reference in New Issue
Block a user