...
 
Commits (65)

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

......@@ -2,6 +2,12 @@
All long running tests for Okapi should go here. Normally round trip tests or any tests that process full files.
**WARNING**
The `logback-test.xml` configuration file in `src\test\resources\` reduces the log level of `net.sf.okapi.common.pipelinedriver` to `WARN`.<br>
Without it the continuous integration build fails. The log limit is 4MB, and we can't change it (controlled by GitLab)<br>
Please don't change the level, and don't remove the file. If you do it in your local copy please don't commit it.
**Example Test File Directory Structure:**
......
<?xml version="1.0"?>
<settings>
<servers>
<server>
<id>sonatype</id>
<username>${MAVEN_REPO_USER}</username>
<password>${MAVEN_REPO_PASS}</password>
</server>
</servers>
<profiles>
<profile>
<id>sign_and_deploy</id>
<properties>
<gpg.executable>gpg</gpg.executable>
<gpg.passphrase>${GPG_PASSPHRASE}</gpg.passphrase>
</properties>
<repositories>
<repository>
<id>sonatype</id>
<name>Snapshots Repository for Downloads</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
</settings>
stages:
- verification
variables:
CI_GITLAB_PATH: "ci/gitlab"
CI_SCRIPTS_PATH: "${CI_GITLAB_PATH}/scripts"
DOCKER_DRIVER: "overlay2"
GIT_DEPTH: "3"
MAVEN_CLI_OPTS: "--settings ${CI_GITLAB_PATH}/.m2/settings.xml --batch-mode --errors --show-version"
# CI_DEBUG_TRACE: "true" # WARNING: all secret variables will be exposed to a job output!
image: registry.gitlab.com/okapiframework/okapi
before_script:
- ${CI_SCRIPTS_PATH}/before-job.sh
after_script:
- ${CI_SCRIPTS_PATH}/after-job.sh
verification:
stage: verification
cache:
paths:
- ${HOME}/.m2/repository/
before_script:
- ${CI_SCRIPTS_PATH}/before-job.sh
script:
- mvn verify --quiet ${MAVEN_CLI_OPTS}
- touch ${CI_GITLAB_PATH}/${CI_JOB_NAME}-passed
#!/usr/bin/env bash
if [ ! -f ${CI_GITLAB_PATH}/${CI_JOB_NAME}-passed ] ; then
BUILD_STATUS=failed ${CI_SCRIPTS_PATH}/build-status.sh;
else
BUILD_STATUS=passed ${CI_SCRIPTS_PATH}/build-status.sh;
fi
#!/usr/bin/env bash
rm -f ${CI_GITLAB_PATH}/${CI_JOB_NAME}-passed
BUILD_STATUS=running ${CI_SCRIPTS_PATH}/build-status.sh
#!/usr/bin/env bash
# Push GitLab CI/CD build status to Bitbucket Cloud
if [ -z "$BITBUCKET_ACCESS_TOKEN" ]; then
echo "ERROR: BITBUCKET_ACCESS_TOKEN is not set"
exit 1
fi
if [ -z "$BITBUCKET_USERNAME" ]; then
echo "ERROR: BITBUCKET_USERNAME is not set"
exit 1
fi
if [ -z "$BITBUCKET_NAMESPACE" ]; then
echo "Setting BITBUCKET_NAMESPACE to $CI_PROJECT_NAMESPACE"
BITBUCKET_NAMESPACE=$CI_PROJECT_NAMESPACE
fi
if [ -z "$BITBUCKET_REPOSITORY" ]; then
echo "Setting BITBUCKET_REPOSITORY to $CI_PROJECT_NAME"
BITBUCKET_REPOSITORY=$CI_PROJECT_NAME
fi
BITBUCKET_API_ROOT="https://api.bitbucket.org/2.0"
BITBUCKET_STATUS_API="$BITBUCKET_API_ROOT/repositories/$BITBUCKET_NAMESPACE/$BITBUCKET_REPOSITORY/commit/$CI_COMMIT_SHA/statuses/build"
BITBUCKET_KEY="$CI_GITLAB_PATH/$CI_JOB_NAME"
BITBUCKET_NAME="$CI_JOB_STAGE:$CI_JOB_NAME:$BUILD_STATUS"
BITBUCKET_DESCRIPTION="Pipeline #$CI_PIPELINE_ID"
case "$BUILD_STATUS" in
running)
BITBUCKET_STATE="INPROGRESS"
;;
passed)
BITBUCKET_STATE="SUCCESSFUL"
;;
failed)
BITBUCKET_STATE="FAILED"
;;
esac
echo "Pushing status to $BITBUCKET_STATUS_API..."
curl --request POST $BITBUCKET_STATUS_API \
--user $BITBUCKET_USERNAME:$BITBUCKET_ACCESS_TOKEN \
--header "Content-Type:application/json" \
--silent \
--data "{ \"state\": \"$BITBUCKET_STATE\",
\"key\": \"$BITBUCKET_KEY\",
\"name\": \"$BITBUCKET_NAME\",
\"description\": \"$BITBUCKET_DESCRIPTION\",
\"url\": \"$CI_JOB_URL\" }"
This diff is collapsed.
......@@ -16,9 +16,9 @@ import java.util.List;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import net.sf.okapi.common.ClassUtil;
import net.sf.okapi.common.Event;
import net.sf.okapi.common.FileCompare;
import net.sf.okapi.common.FileLocation;
import net.sf.okapi.common.FileUtil;
import net.sf.okapi.common.IParameters;
import net.sf.okapi.common.LocaleId;
......@@ -30,6 +30,7 @@ import net.sf.okapi.common.resource.ITextUnit;
import net.sf.okapi.common.resource.RawDocument;
public final class IntegrationtestUtils {
final static FileLocation root = FileLocation.fromClass(IntegrationtestUtils.class);
public static String GOLD_DIR = "/GOLDEN_COMPARE/gold_dummy.txt";
/**
......@@ -40,16 +41,12 @@ public final class IntegrationtestUtils {
*/
public void writeXliff(List<Event> events, String path) {
XLIFFWriter w = new XLIFFWriter();
try {
try (XLIFFWriter w = new XLIFFWriter()) {
w.setOptions(LocaleId.ENGLISH, "UTF-8");
w.setOutput(path);
for (Event event : events) {
w.handleEvent(event);
}
} finally {
if (w != null)
w.close();
}
}
......@@ -57,13 +54,12 @@ public final class IntegrationtestUtils {
final List<String> extensions, boolean isDirPath)
throws URISyntaxException {
File dir;
if (isDirPath) {
dir = new File(resourcePath);
} else {
dir = new File(ClassUtil.getResourceParent(IntegrationtestUtils.class, resourcePath));
dir = root.in(resourcePath).asFile();
}
FilenameFilter filter = new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
......@@ -80,8 +76,7 @@ public final class IntegrationtestUtils {
public static Collection<File> getTestFilesNoRecurse(String resourcePath, final List<String> extensions)
throws URISyntaxException {
File dir;
dir = new File(ClassUtil.getResourceParent(IntegrationtestUtils.class, resourcePath));
File dir = root.in(resourcePath).asFile();
FilenameFilter filter = new FilenameFilter() {
@Override
......@@ -113,8 +108,7 @@ public final class IntegrationtestUtils {
}
public static Collection<File> getSubDirs(String parentDirPath)
throws URISyntaxException {
public static Collection<File> getSubDirs(String parentDirPath) throws URISyntaxException {