Skip to content

Commit

Permalink
Merge pull request #106 from paypal/develop
Browse files Browse the repository at this point in the history
Release 2.3.0
  • Loading branch information
fabiocarvalho777 authored Feb 20, 2018
2 parents 610dc3f + 51470f0 commit 293ce1a
Show file tree
Hide file tree
Showing 378 changed files with 85,982 additions and 152 deletions.
28 changes: 11 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,18 @@ branches:
only:
- develop

before_install:
# Importing key used to sign jars, necessary for release artifacts deployment in Maven Central
- openssl aes-256-cbc -K $encrypted_dd05710e44e2_key -iv $encrypted_dd05710e44e2_iv -in secring.gpg.enc -out secring.gpg -d
- gpg --import secring.gpg

install:
# Building and deploying artifacts to Maven Central
- mvn -B -s settings.xml deploy -Possrh
- mvn -B install

after_success:
after_script:
# Installing Codacy code coverage reporter upload tool
- wget https://github.com/codacy/codacy-coverage-reporter/releases/download/1.0.13/codacy-coverage-reporter-1.0.13-assembly.jar -O ccr.jar
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then wget https://github.com/codacy/codacy-coverage-reporter/releases/download/1.0.13/codacy-coverage-reporter-1.0.13-assembly.jar -O ccr.jar; fi'
# Uploading Cobertura report to Codacy
- java -cp ccr.jar com.codacy.CodacyCoverageReporter -l Java -r ./butterfly-cli/target/site/cobertura/coverage.xml --projectToken $CODACY_PROJECT_TOKEN
- java -cp ccr.jar com.codacy.CodacyCoverageReporter -l Java -r ./butterfly-cli-package/target/site/cobertura/coverage.xml --projectToken $CODACY_PROJECT_TOKEN
- java -cp ccr.jar com.codacy.CodacyCoverageReporter -l Java -r ./butterfly-core/target/site/cobertura/coverage.xml --projectToken $CODACY_PROJECT_TOKEN
- java -cp ccr.jar com.codacy.CodacyCoverageReporter -l Java -r ./butterfly-extensions-api/target/site/cobertura/coverage.xml --projectToken $CODACY_PROJECT_TOKEN
- java -cp ccr.jar com.codacy.CodacyCoverageReporter -l Java -r ./butterfly-facade/target/site/cobertura/coverage.xml --projectToken $CODACY_PROJECT_TOKEN
- java -cp ccr.jar com.codacy.CodacyCoverageReporter -l Java -r ./butterfly-metrics-couchdb/target/site/cobertura/coverage.xml --projectToken $CODACY_PROJECT_TOKEN
- java -cp ccr.jar com.codacy.CodacyCoverageReporter -l Java -r ./butterfly-metrics-file/target/site/cobertura/coverage.xml --projectToken $CODACY_PROJECT_TOKEN
- java -cp ccr.jar com.codacy.CodacyCoverageReporter -l Java -r ./butterfly-utilities/target/site/cobertura/coverage.xml --projectToken $CODACY_PROJECT_TOKEN
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then java -cp ccr.jar com.codacy.CodacyCoverageReporter -l Java -r ./butterfly-cli/target/site/cobertura/coverage.xml --projectToken $CODACY_PROJECT_TOKEN; fi'
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then java -cp ccr.jar com.codacy.CodacyCoverageReporter -l Java -r ./butterfly-cli-package/target/site/cobertura/coverage.xml --projectToken $CODACY_PROJECT_TOKEN; fi'
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then java -cp ccr.jar com.codacy.CodacyCoverageReporter -l Java -r ./butterfly-core/target/site/cobertura/coverage.xml --projectToken $CODACY_PROJECT_TOKEN; fi'
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then java -cp ccr.jar com.codacy.CodacyCoverageReporter -l Java -r ./butterfly-extensions-api/target/site/cobertura/coverage.xml --projectToken $CODACY_PROJECT_TOKEN; fi'
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then java -cp ccr.jar com.codacy.CodacyCoverageReporter -l Java -r ./butterfly-facade/target/site/cobertura/coverage.xml --projectToken $CODACY_PROJECT_TOKEN; fi'
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then java -cp ccr.jar com.codacy.CodacyCoverageReporter -l Java -r ./butterfly-metrics-couchdb/target/site/cobertura/coverage.xml --projectToken $CODACY_PROJECT_TOKEN; fi'
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then java -cp ccr.jar com.codacy.CodacyCoverageReporter -l Java -r ./butterfly-metrics-file/target/site/cobertura/coverage.xml --projectToken $CODACY_PROJECT_TOKEN; fi'
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then java -cp ccr.jar com.codacy.CodacyCoverageReporter -l Java -r ./butterfly-utilities/target/site/cobertura/coverage.xml --projectToken $CODACY_PROJECT_TOKEN; fi'
32 changes: 32 additions & 0 deletions .travis_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
language: java
sudo: required

jdk:
- oraclejdk8

branches:
only:
- master

before_install:
- openssl aes-256-cbc -K $encrypted_dd05710e44e2_key -iv $encrypted_dd05710e44e2_iv -in secring.gpg.enc -out secring.gpg -d
- gpg --import secring.gpg

install:
- mvn -B install

after_success:
# Installing Codacy code coverage reporter upload tool
- wget https://github.com/codacy/codacy-coverage-reporter/releases/download/1.0.13/codacy-coverage-reporter-1.0.13-assembly.jar -O ccr.jar
# Uploading Cobertura report to Codacy
- java -cp ccr.jar com.codacy.CodacyCoverageReporter -l Java -r ./butterfly-cli/target/site/cobertura/coverage.xml --projectToken $CODACY_PROJECT_TOKEN
- java -cp ccr.jar com.codacy.CodacyCoverageReporter -l Java -r ./butterfly-cli-package/target/site/cobertura/coverage.xml --projectToken $CODACY_PROJECT_TOKEN
- java -cp ccr.jar com.codacy.CodacyCoverageReporter -l Java -r ./butterfly-core/target/site/cobertura/coverage.xml --projectToken $CODACY_PROJECT_TOKEN
- java -cp ccr.jar com.codacy.CodacyCoverageReporter -l Java -r ./butterfly-extensions-api/target/site/cobertura/coverage.xml --projectToken $CODACY_PROJECT_TOKEN
- java -cp ccr.jar com.codacy.CodacyCoverageReporter -l Java -r ./butterfly-facade/target/site/cobertura/coverage.xml --projectToken $CODACY_PROJECT_TOKEN
- java -cp ccr.jar com.codacy.CodacyCoverageReporter -l Java -r ./butterfly-metrics-couchdb/target/site/cobertura/coverage.xml --projectToken $CODACY_PROJECT_TOKEN
- java -cp ccr.jar com.codacy.CodacyCoverageReporter -l Java -r ./butterfly-metrics-file/target/site/cobertura/coverage.xml --projectToken $CODACY_PROJECT_TOKEN
- java -cp ccr.jar com.codacy.CodacyCoverageReporter -l Java -r ./butterfly-utilities/target/site/cobertura/coverage.xml --projectToken $CODACY_PROJECT_TOKEN

deploy:
- mvn -B -s settings.xml deploy -Possrh
15 changes: 15 additions & 0 deletions .travis_snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
language: java
sudo: required

jdk:
- oraclejdk8

branches:
only:
- develop

install:
- mvn -B install

deploy:
- mvn -B -s settings.xml deploy -Possrh
2 changes: 1 addition & 1 deletion butterfly-cli-package/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.paypal.butterfly</groupId>
<artifactId>butterfly-parent</artifactId>
<version>2.2.0</version>
<version>2.3.0</version>
<relativePath>..</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion butterfly-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.paypal.butterfly</groupId>
<artifactId>butterfly-parent</artifactId>
<version>2.2.0</version>
<version>2.3.0</version>
<relativePath>..</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,12 @@ public ButterflyCliRun run() throws IOException {
} catch (ClassNotFoundException e) {
registerError(run, "The specified transformation template class has not been found", e);
return run;
} catch (IllegalArgumentException e) {
registerError(run, "This transformation request input arguments are invalid", e);
return run;
} catch (Exception e) {
registerError(run, "An unexpected exception happened when processing this transformation request", e);
return run;
}

return run;
Expand Down Expand Up @@ -250,10 +256,12 @@ private void registerError(ButterflyCliRun run, String errorMessage) {
}

private void registerError(ButterflyCliRun run, String errorMessage, Exception exception) {
if (exception == null) {
if (exception == null || !logConfigurator.isVerboseMode()) {
logger.error(errorMessage);
} else {
logger.error(errorMessage, exception);
}
if (exception != null) {
run.setExceptionMessage(exception.getMessage());
}
run.setErrorMessage(errorMessage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,6 @@ public void setDebugMode(boolean on) {

public abstract void setLogToFile(boolean on);

public abstract boolean isVerboseMode();

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public class LogbackLogConfigurator extends LogConfigurator {

private static final LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();

private boolean verboseMode = false;

@Override
public void setLoggerLevel(String logger, org.slf4j.event.Level level) {
if(level == null) {
Expand All @@ -46,24 +48,35 @@ private Level getLogbackLogLevel(org.slf4j.event.Level slf4jLevel) {
}

@Override
public void setVerboseMode(boolean on) {
PatternLayoutEncoder patternLayoutEncoder = new PatternLayoutEncoder();
patternLayoutEncoder.setPattern("[%d{HH:mm:ss.SSS}] [%highlight(%level)] %msg%n");
patternLayoutEncoder.setContext(loggerContext);
patternLayoutEncoder.start();
public void setVerboseMode(boolean verboseMode) {
this.verboseMode = verboseMode;

if (verboseMode) {
PatternLayoutEncoder patternLayoutEncoder = new PatternLayoutEncoder();
patternLayoutEncoder.setPattern("[%d{HH:mm:ss.SSS}] [%highlight(%level)] %msg%n");
patternLayoutEncoder.setContext(loggerContext);
patternLayoutEncoder.start();

Appender<ILoggingEvent> consoleAppender = new ConsoleAppender();
((OutputStreamAppender) consoleAppender).setEncoder(patternLayoutEncoder);
consoleAppender.setContext(loggerContext);
consoleAppender.start();
Appender<ILoggingEvent> consoleAppender = new ConsoleAppender();
((OutputStreamAppender) consoleAppender).setEncoder(patternLayoutEncoder);
consoleAppender.setContext(loggerContext);
consoleAppender.start();

loggerContext.getLogger("com.paypal.butterfly.cli").detachAppender("CONSOLE");
loggerContext.getLogger("ROOT").addAppender(consoleAppender);
loggerContext.getLogger("com.paypal.butterfly.cli").detachAppender("CONSOLE");
loggerContext.getLogger("ROOT").addAppender(consoleAppender);
// } else {
// TODO
}
}

@Override
public void setLogToFile(boolean on) {
loggerContext.getLogger("ROOT").detachAppender("FILE");
}

@Override
public boolean isVerboseMode() {
return verboseMode;
}

}
2 changes: 1 addition & 1 deletion butterfly-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.paypal.butterfly</groupId>
<artifactId>butterfly-parent</artifactId>
<version>2.2.0</version>
<version>2.3.0</version>
<relativePath>..</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion butterfly-extensions-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.paypal.butterfly</groupId>
<artifactId>butterfly-parent</artifactId>
<version>2.2.0</version>
<version>2.3.0</version>
<relativePath>..</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion butterfly-facade/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.paypal.butterfly</groupId>
<artifactId>butterfly-parent</artifactId>
<version>2.2.0</version>
<version>2.3.0</version>
<relativePath>..</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion butterfly-metrics-couchdb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.paypal.butterfly</groupId>
<artifactId>butterfly-parent</artifactId>
<version>2.2.0</version>
<version>2.3.0</version>
<relativePath>..</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion butterfly-metrics-file/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.paypal.butterfly</groupId>
<artifactId>butterfly-parent</artifactId>
<version>2.2.0</version>
<version>2.3.0</version>
<relativePath>..</relativePath>
</parent>

Expand Down
7 changes: 6 additions & 1 deletion butterfly-utilities/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.paypal.butterfly</groupId>
<artifactId>butterfly-parent</artifactId>
<version>2.2.0</version>
<version>2.3.0</version>
<relativePath>..</relativePath>
</parent>

Expand Down Expand Up @@ -59,6 +59,11 @@
<artifactId>xmlunit</artifactId>
<version>1.5</version>
</dependency>
<dependency>
<groupId>com.fasterxml.woodstox</groupId>
<artifactId>woodstox-core</artifactId>
<version>5.0.3</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ public String readLineKeepEol() throws IOException {
}

/**
* Some times it might be preferable to read a text file line by line, but keeping the EOL character(s)
* Sometimes it might be preferable to read a text file line by line, but keeping the EOL character(s)
* in the beginning of the next line, instead of the in the end of the previous one.
* This method reads a line of text preserving end-of-line (EOL) characters in the beginning of the line.
* A line is considered to be terminated by any one of a line feed ('\n'), a carriage return ('\r'),
* or a carriage return followed immediately by a linefeed.
*
* @return A String containing the contents of the line, including
* any EOL characters in the end of the line, or null if the end of the
* stream has been reached
* any EOL characters in the beginning of the line (unless the returned line is the first),
* or null if the end of the stream has been reached
* @throws IOException if an I/O error occurs
*/
public String readLineKeepStartEol() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.paypal.butterfly.extensions.api.TOExecutionResult;
import com.paypal.butterfly.extensions.api.TransformationContext;
import com.paypal.butterfly.extensions.api.TransformationOperation;
import com.paypal.butterfly.extensions.api.exception.TransformationOperationException;
import com.paypal.butterfly.extensions.api.exception.TransformationUtilityException;
import org.apache.commons.io.FileUtils;

Expand All @@ -11,6 +12,7 @@

/**
* Deletes a single file or folder (empty or not).
* If the specified file does not exist, the result will be a {@link TOExecutionResult.Type#NO_OP}.
*
* @author facarvalho
*/
Expand All @@ -27,6 +29,7 @@ public class DeleteFile extends TransformationOperation<DeleteFile> {
@SuppressWarnings("PMD.UnnecessaryConstructor")
/**
* Deletes a single file or folder (empty or not).
* If the specified file does not exist, the result will be a {@link TOExecutionResult.Type#NO_OP}.
*/
public DeleteFile() {
}
Expand All @@ -42,8 +45,10 @@ protected TOExecutionResult execution(File transformedAppFolder, TransformationC
try {
fileToBeRemoved = getAbsoluteFile(transformedAppFolder, transformationContext);
} catch (TransformationUtilityException e) {
String result = String.format("No file has been removed because file path has not been resolved");
return TOExecutionResult.noOp(this, result);
// TODO
// This error should be done automatically for every TO in the TransformationOperation class
TransformationOperationException toe = new TransformationOperationException("No file has been removed because the file path has not been resolved");
return TOExecutionResult.error(this, toe);
}
if(!fileToBeRemoved.exists()) {
String result = String.format("File '%s' was not removed because it does not exist", getRelativePath());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,7 @@ public boolean equals(Object obj) {

@Override
public int hashCode() {
return hashCode(super.hashCode(),
groupId,
artifactId);
return hashCode(super.hashCode(), groupId, artifactId);
}

}
Loading

0 comments on commit 293ce1a

Please sign in to comment.