MavenExecutionResult.java

  1. package com.soebes.itf.jupiter.maven;

  2. /*
  3.  * Licensed to the Apache Software Foundation (ASF) under one
  4.  * or more contributor license agreements.  See the NOTICE file
  5.  * distributed with this work for additional information
  6.  * regarding copyright ownership.  The ASF licenses this file
  7.  * to you under the Apache License, Version 2.0 (the
  8.  * "License"); you may not use this file except in compliance
  9.  * with the License.  You may obtain a copy of the License at
  10.  *
  11.  *  http://www.apache.org/licenses/LICENSE-2.0
  12.  *
  13.  * Unless required by applicable law or agreed to in writing,
  14.  * software distributed under the License is distributed on an
  15.  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  16.  * KIND, either express or implied.  See the License for the
  17.  * specific language governing permissions and limitations
  18.  * under the License.
  19.  */

  20. import org.apiguardian.api.API;

  21. import java.util.StringJoiner;

  22. import static org.apiguardian.api.API.Status.EXPERIMENTAL;

  23. /**
  24.  * @author Karl Heinz Marbaise
  25.  */
  26. @API(status = EXPERIMENTAL, since = "0.1.0")
  27. public class MavenExecutionResult {

  28.   private final ExecutionResult result;

  29.   private final int returnCode;

  30.   private final MavenLog mavenLog;

  31.   private final MavenProjectResult mavenProjectResult;

  32.   private final MavenCacheResult mavenCacheResult;

  33.   public MavenExecutionResult(ExecutionResult result, int returnCode, MavenLog mavenLog,
  34.                               MavenProjectResult mavenProjectResult, MavenCacheResult mavenCacheResult) {
  35.     this.result = result;
  36.     this.returnCode = returnCode;
  37.     this.mavenLog = mavenLog;
  38.     this.mavenProjectResult = mavenProjectResult;
  39.     this.mavenCacheResult = mavenCacheResult;
  40.   }

  41.   public int getReturnCode() {
  42.     return returnCode;
  43.   }

  44.   public boolean isSuccessful() {
  45.     return ExecutionResult.Successful.equals(this.result);
  46.   }

  47.   public boolean isFailure() {
  48.     return ExecutionResult.Failure.equals(this.result);
  49.   }

  50.   public ExecutionResult getResult() {
  51.     return this.result;
  52.   }

  53.   public MavenLog getMavenLog() {
  54.     return mavenLog;
  55.   }

  56.   public MavenCacheResult getMavenCacheResult() {
  57.     return mavenCacheResult;
  58.   }

  59.   public MavenProjectResult getMavenProjectResult() {
  60.     return mavenProjectResult;
  61.   }

  62.   @Override
  63.   public String toString() {
  64.     return new StringJoiner(", ", MavenExecutionResult.class.getSimpleName() + "[", "]").add("result=" + result)
  65.         .add("returnCode=" + returnCode)
  66.         .add("mavenLog=" + mavenLog)
  67.         .add("mavenProjectResult=" + mavenProjectResult)
  68.         .add("mavenCacheResult=" + mavenCacheResult)
  69.         .toString();
  70.   }

  71.   @SuppressWarnings("java:S115")
  72.   public enum ExecutionResult {
  73.     Successful,
  74.     Failure,
  75.   }
  76. }