From a5c856dc8f5eb4a55325cc1a2589ec2497659a8c Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Thu, 27 Feb 2020 17:18:16 +0100 Subject: [PATCH 01/57] test parallel execution --- .travis.yml | 26 +- pom.xml | 20 + ...EndToEndTest.java => Case1EndToEndIT.java} | 14 +- .../xavier/integrations/Case2EndToEndIT.java | 633 ++++++++++++++++++ 4 files changed, 675 insertions(+), 18 deletions(-) rename src/test/java/org/jboss/xavier/integrations/{EndToEndTest.java => Case1EndToEndIT.java} (98%) create mode 100644 src/test/java/org/jboss/xavier/integrations/Case2EndToEndIT.java diff --git a/.travis.yml b/.travis.yml index 22145665..1a1a4ec1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,6 +18,15 @@ addons: token: secure: $SONAR_TOKEN +env: + global: + - CAMEL_SPRINGBOOT_TRACING=false + - LOGGING_LEVEL_ROOT=info + - ANALYSIS_DATAINTEGRITY_LOG=false + jobs: + - TEST_PROFILE=unitTest CLASSES_TO_EXECUTE=* + - TEST_PROFILE=endToEnd CLASSES_TO_EXECUTE=Case1EndToEndIT + - TEST_PROFILE=endToEnd CLASSES_TO_EXECUTE=Case2EndToEndIT sudo: required @@ -42,16 +51,11 @@ before_install: install: - cp ./configuration/settings.xml $HOME/.m2/settings.xml - mvn install -P !fuse-fabric8-docker -DskipTests=true -Dmaven.javadoc.skip=true -B -V -jobs: - include: - - stage: Test - env: - - CAMEL_SPRINGBOOT_TRACING=false - - LOGGING_LEVEL_ROOT=info - - ANALYSIS_DATAINTEGRITY_LOG=false - script: - - mvn test -Pcoverage - - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then sonar-scanner; fi' - - bash <(curl -s https://codecov.io/bash) + +script: + - mvn test -P $TEST_PROFILE -Dtest=$CLASSES_TO_EXECUTE +# - mvn test -Pcoverage +# - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then sonar-scanner; fi' +# - bash <(curl -s https://codecov.io/bash) diff --git a/pom.xml b/pom.xml index f8178d0c..ece85d6f 100644 --- a/pom.xml +++ b/pom.xml @@ -422,5 +422,25 @@ + + endToEnd + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + + **/*EndToEndIT.java + + + **/*Test.java + + + + + + diff --git a/src/test/java/org/jboss/xavier/integrations/EndToEndTest.java b/src/test/java/org/jboss/xavier/integrations/Case1EndToEndIT.java similarity index 98% rename from src/test/java/org/jboss/xavier/integrations/EndToEndTest.java rename to src/test/java/org/jboss/xavier/integrations/Case1EndToEndIT.java index 1c596e5d..cbeced2b 100644 --- a/src/test/java/org/jboss/xavier/integrations/EndToEndTest.java +++ b/src/test/java/org/jboss/xavier/integrations/Case1EndToEndIT.java @@ -91,11 +91,11 @@ @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @UseAdviceWith // Disables automatic start of Camel context @SpringBootTest(classes = {Application.class}, webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT) -@ContextConfiguration(initializers = EndToEndTest.Initializer.class) +@ContextConfiguration(initializers = Case1EndToEndIT.Initializer.class) @Import(TestConfigurationS3.class) @ActiveProfiles("test") -public class EndToEndTest { - private static Logger logger = LoggerFactory.getLogger(EndToEndTest.class); +public class Case1EndToEndIT { + private static Logger logger = LoggerFactory.getLogger(Case1EndToEndIT.class); @ClassRule public static GenericContainer activemq = new GenericContainer<>("vromero/activemq-artemis") @@ -277,7 +277,7 @@ private static void cloneIngressRepoAndUnzip() throws IOException { } private static void unzipFile(File file, String outputDir) throws IOException { - java.util.zip.ZipFile zipFile = new ZipFile(file); + ZipFile zipFile = new ZipFile(file); try { Enumeration entries = zipFile.entries(); while (entries.hasMoreElements()) { @@ -412,7 +412,7 @@ public void configure() { ResponseEntity workloadSummaryReport = new RestTemplate().exchange("http://localhost:" + serverPort + String.format("/api/xavier/report/%d/workload-summary", analysisNum), HttpMethod.GET, getRequestEntity(), new ParameterizedTypeReference() {}); // Checks on Initial Savings Report - InitialSavingsEstimationReportModel initialSavingsEstimationReport_Expected = new ObjectMapper().readValue(IOUtils.resourceToString("cfme_inventory-20190912-demolab-withssa-initial-cost-savings-report.json", StandardCharsets.UTF_8, EndToEndTest.class.getClassLoader()), InitialSavingsEstimationReportModel.class); + InitialSavingsEstimationReportModel initialSavingsEstimationReport_Expected = new ObjectMapper().readValue(IOUtils.resourceToString("cfme_inventory-20190912-demolab-withssa-initial-cost-savings-report.json", StandardCharsets.UTF_8, Case1EndToEndIT.class.getClassLoader()), InitialSavingsEstimationReportModel.class); SoftAssertions.assertSoftly(softly -> softly.assertThat(initialCostSavingsReport.getBody()) .usingRecursiveComparison() .ignoringFieldsMatchingRegexes(".*id.*", ".*creationDate.*", ".*report.*") @@ -436,7 +436,7 @@ public void configure() { }); // Checks on Workload Summary Report - WorkloadSummaryReportModel workloadSummaryReport_Expected = new ObjectMapper().readValue(IOUtils.resourceToString("cfme_inventory-20190912-demolab-withssa-workload-summary-report.json", StandardCharsets.UTF_8, EndToEndTest.class.getClassLoader()), WorkloadSummaryReportModel.class); + WorkloadSummaryReportModel workloadSummaryReport_Expected = new ObjectMapper().readValue(IOUtils.resourceToString("cfme_inventory-20190912-demolab-withssa-workload-summary-report.json", StandardCharsets.UTF_8, Case1EndToEndIT.class.getClassLoader()), WorkloadSummaryReportModel.class); assertThat(workloadSummaryReport.getBody()) .usingRecursiveComparison() @@ -586,7 +586,7 @@ private HttpEntity> getRequestEntityForUploadRESTC LinkedMultiValueMap fileMap = new LinkedMultiValueMap<>(); fileMap.add(HttpHeaders.CONTENT_DISPOSITION, "form-data; name=filex; filename=" + filename); fileMap.add("Content-type", content_type_header); - body.add("file", new HttpEntity<>(IOUtils.resourceToByteArray(filename, EndToEndTest.class.getClassLoader()), fileMap)); + body.add("file", new HttpEntity<>(IOUtils.resourceToByteArray(filename, Case1EndToEndIT.class.getClassLoader()), fileMap)); // params Body parts body.add("percentageOfHypervisorsMigratedOnYear1", "50"); diff --git a/src/test/java/org/jboss/xavier/integrations/Case2EndToEndIT.java b/src/test/java/org/jboss/xavier/integrations/Case2EndToEndIT.java new file mode 100644 index 00000000..ab1e5078 --- /dev/null +++ b/src/test/java/org/jboss/xavier/integrations/Case2EndToEndIT.java @@ -0,0 +1,633 @@ +package org.jboss.xavier.integrations; + +import com.amazonaws.services.s3.AmazonS3; +import com.amazonaws.services.s3.model.ListObjectsV2Request; +import com.amazonaws.util.Base64; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.camel.CamelContext; +import org.apache.camel.Exchange; +import org.apache.camel.builder.AdviceWithRouteBuilder; +import org.apache.camel.component.aws.s3.S3Constants; +import org.apache.camel.test.spring.CamelSpringBootRunner; +import org.apache.camel.test.spring.UseAdviceWith; +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.IOUtils; +import org.assertj.core.api.SoftAssertions; +import org.awaitility.Duration; +import org.jboss.xavier.Application; +import org.jboss.xavier.analytics.pojo.output.InitialSavingsEstimationReportModel; +import org.jboss.xavier.analytics.pojo.output.workload.inventory.WorkloadInventoryReportModel; +import org.jboss.xavier.analytics.pojo.output.workload.summary.ScanRunModel; +import org.jboss.xavier.analytics.pojo.output.workload.summary.SummaryModel; +import org.jboss.xavier.analytics.pojo.output.workload.summary.WorkloadSummaryReportModel; +import org.jboss.xavier.analytics.pojo.output.workload.summary.WorkloadsDetectedOSTypeModel; +import org.jboss.xavier.integrations.jpa.repository.AnalysisRepository; +import org.jboss.xavier.integrations.jpa.repository.InitialSavingsEstimationReportRepository; +import org.jboss.xavier.integrations.jpa.service.InitialSavingsEstimationReportService; +import org.jboss.xavier.integrations.route.model.notification.FilePersistedNotification; +import org.jboss.xavier.integrations.route.model.user.User; +import org.jetbrains.annotations.NotNull; +import org.junit.After; +import org.junit.ClassRule; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.util.EnvironmentTestUtils; +import org.springframework.context.ApplicationContextInitializer; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.context.annotation.Import; +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.hateoas.PagedResources; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.client.RestClientException; +import org.springframework.web.client.RestTemplate; +import org.testcontainers.containers.GenericContainer; +import org.testcontainers.containers.KafkaContainer; +import org.testcontainers.containers.Network; +import org.testcontainers.containers.PostgreSQLContainer; +import org.testcontainers.containers.localstack.LocalStackContainer; +import org.testcontainers.containers.output.Slf4jLogConsumer; +import org.testcontainers.images.builder.ImageFromDockerfile; +import org.testcontainers.utility.MountableFile; + +import javax.inject.Inject; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.URL; +import java.nio.charset.StandardCharsets; +import java.nio.file.Paths; +import java.util.Comparator; +import java.util.Enumeration; +import java.util.List; +import java.util.Set; +import java.util.TreeSet; +import java.util.UUID; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.awaitility.Awaitility.await; +import static org.testcontainers.containers.localstack.LocalStackContainer.Service.S3; + +@RunWith(CamelSpringBootRunner.class) +@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) +@UseAdviceWith // Disables automatic start of Camel context +@SpringBootTest(classes = {Application.class}, webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT) +@ContextConfiguration(initializers = Case2EndToEndIT.Initializer.class) +@Import(TestConfigurationS3.class) +@ActiveProfiles("test") +public class Case2EndToEndIT { + private static Logger logger = LoggerFactory.getLogger(Case2EndToEndIT.class); + + @ClassRule + public static GenericContainer activemq = new GenericContainer<>("vromero/activemq-artemis") + .withExposedPorts(61616, 8161) + .withLogConsumer(new Slf4jLogConsumer(logger).withPrefix("AMQ-LOG")) + .withEnv("DISABLE_SECURITY", "true") + .withEnv("BROKER_CONFIG_GLOBAL_MAX_SIZE", "50000") + .withEnv("BROKER_CONFIG_MAX_SIZE_BYTES", "50000") + .withEnv("BROKER_CONFIG_MAX_DISK_USAGE", "100"); + + @ClassRule + public static GenericContainer kie_server = new GenericContainer<>("jboss/kie-server-showcase:7.18.0.Final") + .withNetworkAliases("kie-server") + .withExposedPorts(8080) + .withLogConsumer(new Slf4jLogConsumer(logger).withPrefix("KIE-LOG")) + .withEnv("KIE_SERVER_ID", "analytics-kieserver") + .withEnv("KIE_ADMIN_USER", "kieserver") + .withEnv("KIE_ADMIN_PWD", "kieserver1!") + .withEnv("KIE_SERVER_MODE", "DEVELOPMENT") + .withEnv("KIE_MAVEN_REPO", "https://oss.sonatype.org/content/repositories/snapshots") + .withEnv("KIE_REPOSITORY","https://repository.jboss.org/nexus/content/groups/public-jboss") + .withEnv("KIE_SERVER_CONTROLLER_PWD","admin") + .withEnv("KIE_SERVER_CONTROLLER_USER","admin") + .withEnv("KIE_SERVER_LOCATION","http://kie-server:8080/kie-server/services/rest/server") + .withEnv("KIE_SERVER_PWD","kieserver1!") + .withEnv("KIE_SERVER_USER","kieserver"); + + @ClassRule + public static PostgreSQLContainer postgreSQL = new PostgreSQLContainer() + .withDatabaseName("sampledb") + .withUsername("admin") + .withPassword("redhat"); + + @ClassRule + public static LocalStackContainer localstack = new LocalStackContainer() + .withLogConsumer(new Slf4jLogConsumer(logger).withPrefix("AWS-LOG")) + .withServices(S3); + + private static String ingressCommitHash = "3ea33a8d793c2154f7cfa12057ca005c5f6031fa"; // 2019-11-11 + + @Inject + private InitialSavingsEstimationReportService initialSavingsEstimationReportService; + + @Autowired + private InitialSavingsEstimationReportRepository initialSavingsEstimationReportRepository; + + @Inject + private AnalysisRepository analysisRepository; + + @Value("${S3_BUCKET}") + private String bucket; + + @Value("${server.port:8080}") + private String serverPort; + + @Value("${test.timeout.performance:60000}") // 1 minute + private int timeoutMilliseconds_PerformaceTest; + + @Value("${test.timeout.ics:10000}") // 10 seconds + private int timeoutMilliseconds_InitialCostSavingsReport; + + @Value("${minio.host}") // Set in the Initializer + private String minio_host; + + @Value("${test.timeout.ultraperformance:1200000}") // 20 minutes + private int timeoutMilliseconds_UltraPerformaceTest; + + @Value("${test.timeout.smallfilesummaryreport:10000}") // 10 seconds + private int timeoutMilliseconds_SmallFileSummaryReport; + + @Value("${test.bigfile.vms_expected:5254}") + private int numberVMsExpected_InBigFile; + + public static class Initializer implements ApplicationContextInitializer { + + @Override + public void initialize(ConfigurableApplicationContext configurableApplicationContext) { + try { + cloneIngressRepoAndUnzip(); + + Network network = Network.newNetwork(); + + GenericContainer minio = new GenericContainer<>("minio/minio") + .withCommand("server /data") + .withExposedPorts(9000) + .withNetworkAliases("minio") + .withNetwork(network) + .withLogConsumer(new Slf4jLogConsumer(logger).withPrefix("MINIO-LOG")) + .withEnv("MINIO_ACCESS_KEY", "BQA2GEXO711FVBVXDWKM") + .withEnv("MINIO_SECRET_KEY", "uvgz3LCwWM3e400cDkQIH/y1Y4xgU4iV91CwFSPC"); + minio.start(); + + Thread.sleep(5000); + GenericContainer createbuckets = new GenericContainer<>("minio/mc") + .dependsOn(minio) + .withNetwork(network) + .withLogConsumer(new Slf4jLogConsumer(logger).withPrefix("MINIO-MC-LOG")) + .withCopyFileToContainer(MountableFile.forClasspathResource("minio-bucket-creation-commands.sh"), "/") + .withCreateContainerCmdModifier(createContainerCmd -> createContainerCmd.withEntrypoint("sh", "/minio-bucket-creation-commands.sh", "minio:9000")); + createbuckets.start(); + + KafkaContainer kafka = new KafkaContainer() + .withLogConsumer(new Slf4jLogConsumer(logger).withPrefix("KAFKA-LOG")) + .withNetworkAliases("kafka") + .withNetwork(network); + kafka.start(); + + GenericContainer ingress = new GenericContainer(new ImageFromDockerfile() + .withDockerfile(Paths.get("src/test/resources/insights-ingress-go/Dockerfile"))) + .withExposedPorts(3000) + .withNetwork(network) + .withLogConsumer(new Slf4jLogConsumer(logger).withPrefix("INGRESS-LOG")) + .withEnv("AWS_ACCESS_KEY_ID","BQA2GEXO711FVBVXDWKM") + .withEnv("AWS_SECRET_ACCESS_KEY","uvgz3LCwWM3e400cDkQIH/y1Y4xgU4iV91CwFSPC") + .withEnv("AWS_REGION","us-east-1") + .withEnv("INGRESS_STAGEBUCKET","insights-upload-perma") + .withEnv("INGRESS_REJECTBUCKET","insights-upload-rejected") + .withEnv("INGRESS_INVENTORYURL","http://inventory:8080/api/inventory/v1/hosts") + .withEnv("INGRESS_VALIDTOPICS","xavier,testareno,advisortestareno,advisor") + .withEnv("OPENSHIFT_BUILD_COMMIT","woopwoop") + .withEnv("INGRESS_MINIODEV","true") + .withEnv("INGRESS_MINIOACCESSKEY","BQA2GEXO711FVBVXDWKM") + .withEnv("INGRESS_MINIOSECRETKEY","uvgz3LCwWM3e400cDkQIH/y1Y4xgU4iV91CwFSPC") + .withEnv("INGRESS_MINIOENDPOINT", "minio:9000") + .withEnv("INGRESS_KAFKABROKERS", "kafka:9092"); + ingress.start(); + + importProjectIntoKIE(); + + EnvironmentTestUtils.addEnvironment("environment", configurableApplicationContext.getEnvironment(), + "amq.server=" + activemq.getContainerIpAddress(), + "amq.port=" + activemq.getMappedPort(61616), + "minio.host=" + getContainerHost(minio, 9000), + "insights.upload.host=" + getContainerHost(ingress), + "insights.properties=yearOverYearGrowthRatePercentage,percentageOfHypervisorsMigratedOnYear1,percentageOfHypervisorsMigratedOnYear2,percentageOfHypervisorsMigratedOnYear3,reportName,reportDescription", + "camel.component.servlet.mapping.context-path=/api/xavier/*", + "insights.kafka.host=" + kafka.getBootstrapServers(), + "postgresql.service.name=" + postgreSQL.getContainerIpAddress(), + "postgresql.service.port=" + postgreSQL.getFirstMappedPort(), + "spring.datasource.username=" + postgreSQL.getUsername(), + "spring.datasource.password=" + postgreSQL.getPassword(), + "S3_HOST=" + localstack.getEndpointConfiguration(S3).getServiceEndpoint(), + "S3_REGION="+ localstack.getEndpointConfiguration(S3).getSigningRegion(), + "kieserver.devel-service=" + getHostForKie() + "/kie-server", + "spring.datasource.url = jdbc:postgresql://" + getContainerHost(postgreSQL) + "/sampledb" , + "spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQL9Dialect" , + "thread.concurrentConsumers=3"); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @NotNull + private String getContainerHost(GenericContainer container, Integer port) { + return container.getContainerIpAddress() + ":" + container.getMappedPort(port); + } + + @NotNull + private static String getContainerHost(GenericContainer container) { + return container.getContainerIpAddress() + ":" + container.getFirstMappedPort(); + } + } + + @Inject + CamelContext camelContext; + + @Inject + AmazonS3 amazonS3; + + private static void cloneIngressRepoAndUnzip() throws IOException { + // downloading, unzipping, renaming + String ingressRepoZipURL = "https://github.com/RedHatInsights/insights-ingress-go/archive/" + ingressCommitHash + ".zip"; + File compressedFile = new File("src/test/resources/ingressRepo.zip"); + FileUtils.copyURLToFile(new URL(ingressRepoZipURL), compressedFile, 1000, 10000); + unzipFile(compressedFile, "src/test/resources"); + + // we rename the directory because we had issues with Docker and the long folder + FileUtils.moveDirectory(new File("src/test/resources/insights-ingress-go-" + ingressCommitHash), new File("src/test/resources/insights-ingress-go")); + } + + private static void unzipFile(File file, String outputDir) throws IOException { + ZipFile zipFile = new ZipFile(file); + try { + Enumeration entries = zipFile.entries(); + while (entries.hasMoreElements()) { + ZipEntry entry = entries.nextElement(); + File entryDestination = new File(outputDir, entry.getName()); + if (entry.isDirectory()) { + entryDestination.mkdirs(); + } else { + entryDestination.getParentFile().mkdirs(); + InputStream in = zipFile.getInputStream(entry); + OutputStream out = new FileOutputStream(entryDestination); + IOUtils.copy(in, out); + in.close(); + out.close(); + } + } + } finally { + zipFile.close(); + } + } + + private static String getHostForKie() { + return kie_server.getContainerIpAddress() + ":" + kie_server.getFirstMappedPort(); + } + + private static void importProjectIntoKIE() throws InterruptedException, IOException { + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_JSON); + headers.setCacheControl("no-cache"); + headers.set("Authorization", "Basic YWRtaW46YWRtaW4="); // admin:admin + + String kieRestURL = "http://" + getHostForKie() + "/kie-server/services/rest/"; + + // KIE Container Creation + HttpHeaders kieheaders = new HttpHeaders(); + kieheaders.setContentType(MediaType.APPLICATION_JSON); + kieheaders.set("Authorization", "Basic a2llc2VydmVyOmtpZXNlcnZlcjEh"); + kieheaders.setCacheControl("no-cache"); + String kieContainerBody = "{\"container-id\" : \"xavier-analytics_0.0.1-SNAPSHOT\",\"release-id\" : {\"group-id\" : \"org.jboss.xavier\",\"artifact-id\" : \"xavier-analytics\",\"version\" : \"0.0.1-SNAPSHOT\" } }"; + try { + new RestTemplate().exchange(kieRestURL + "server/containers/xavier-analytics_0.0.1-SNAPSHOT", HttpMethod.PUT, new HttpEntity<>(kieContainerBody, kieheaders), String.class); + } catch (RestClientException e) { + e.printStackTrace(); + } + } + + @After + public void cleanUp() throws IOException { + // cleaning downloadable files/directories + FileUtils.deleteDirectory(new File("src/test/resources/insights-ingress-go")); + FileUtils.deleteQuietly(new File("src/test/resources/ingressRepo.zip")); + } + + private List getS3Objects(String bucket) { + ListObjectsV2Request req = new ListObjectsV2Request().withBucketName(bucket).withMaxKeys(2); + + return amazonS3.listObjectsV2(req).getObjectSummaries().stream().map(e -> e.getKey()).collect(Collectors.toList()); + } + + @Test + public void end2endTest() throws Exception { + Thread.sleep(2000); + + // given + camelContext.getGlobalOptions().put(Exchange.LOG_DEBUG_BODY_MAX_CHARS, "5000"); + camelContext.start(); + + camelContext.getRouteDefinition("store-in-s3").adviceWith(camelContext, new AdviceWithRouteBuilder() { + @Override + public void configure() { + weaveById("set-s3-key") + .replace().process(e -> e.getIn().setHeader(S3Constants.KEY, "S3KEY123" + UUID.randomUUID().toString())); + } + }); + + camelContext.getRouteDefinition("download-file").adviceWith(camelContext, new AdviceWithRouteBuilder() { + @Override + public void configure() { + weaveById("setHttpUri") + .replace() + .process(e -> { + String url = e.getIn().getBody(FilePersistedNotification.class).getUrl(); + url = url.replace("minio:9000", minio_host); + e.getIn().setHeader("httpUriReplaced", url); + }) + .setHeader("Exchange.HTTP_URI", header("httpUriReplaced")) + .setHeader("Host", constant("minio:9000")); + + weaveById("toOldHost") + .replace() + .to("http4:oldhost?preserveHostHeader=true"); + } + }); + + // 1. Check user has firstTime + ResponseEntity userEntity = new RestTemplate().exchange("http://localhost:" + serverPort + "/api/xavier/user", HttpMethod.GET, getRequestEntity(), new ParameterizedTypeReference() {}); + assertThat(userEntity.getBody().isFirstTimeCreatingReports()).isTrue(); + + // Start the camel route as if the UI was sending the file to the Camel Rest Upload route + int analysisNum = 0; + + logger.info("+++++++ Regular Test ++++++"); + analysisNum++; + new RestTemplate().postForEntity("http://localhost:" + serverPort + "/api/xavier/upload", getRequestEntityForUploadRESTCall("cfme_inventory-20190912-demolab_withSSA.tar.gz", "application/zip"), String.class); + + // then + await() + .atMost(timeoutMilliseconds_InitialCostSavingsReport, TimeUnit.MILLISECONDS) + .with().pollInterval(Duration.ONE_HUNDRED_MILLISECONDS) + .until( () -> { + // Check database for the ICSR to be created + List all = initialSavingsEstimationReportRepository.findAll(); + return all != null && !all.isEmpty(); + }); + + // Check S3 + assertThat(getS3Objects(bucket).stream().allMatch(e -> e.startsWith("S3KEY123"))).isTrue(); + assertThat(getS3Objects(bucket).size()).isEqualTo(1); + + // Check DB for initialCostSavingsReport with concrete values + InitialSavingsEstimationReportModel initialCostSavingsReportDB = initialSavingsEstimationReportService.findByAnalysisOwnerAndAnalysisId("dummy@redhat.com", 1L); + assertThat(initialCostSavingsReportDB.getEnvironmentModel().getHypervisors() == 2); + assertThat(initialCostSavingsReportDB.getSourceCostsModel().getYear1Server() == 42); + + // Call initialCostSavingsReport + ResponseEntity initialCostSavingsReport = new RestTemplate().exchange("http://localhost:" + serverPort + String.format("/api/xavier/report/%d/initial-saving-estimation", analysisNum), HttpMethod.GET, getRequestEntity(), new ParameterizedTypeReference() {}); + + // Call workloadInventoryReport + ResponseEntity> workloadInventoryReport = new RestTemplate().exchange("http://localhost:" + serverPort + String.format("/api/xavier/report/%d/workload-inventory?size=100", analysisNum), HttpMethod.GET, getRequestEntity(), new ParameterizedTypeReference>() {}); + + // Call workloadSummaryReport + ResponseEntity workloadSummaryReport = new RestTemplate().exchange("http://localhost:" + serverPort + String.format("/api/xavier/report/%d/workload-summary", analysisNum), HttpMethod.GET, getRequestEntity(), new ParameterizedTypeReference() {}); + + // Checks on Initial Savings Report + InitialSavingsEstimationReportModel initialSavingsEstimationReport_Expected = new ObjectMapper().readValue(IOUtils.resourceToString("cfme_inventory-20190912-demolab-withssa-initial-cost-savings-report.json", StandardCharsets.UTF_8, Case2EndToEndIT.class.getClassLoader()), InitialSavingsEstimationReportModel.class); + SoftAssertions.assertSoftly(softly -> softly.assertThat(initialCostSavingsReport.getBody()) + .usingRecursiveComparison() + .ignoringFieldsMatchingRegexes(".*id.*", ".*creationDate.*", ".*report.*") + .isEqualTo(initialSavingsEstimationReport_Expected)); + + // Checks on Workload Inventory Report + SoftAssertions.assertSoftly(softly -> { + softly.assertThat(workloadInventoryReport.getBody().getContent().size()).isEqualTo(14); + softly.assertThat(workloadInventoryReport.getBody().getContent().stream().flatMap(e -> e.getWorkloads().stream()).distinct().count()).isEqualTo(7); + softly.assertThat(workloadInventoryReport.getBody().getContent().stream().filter(e -> e.getWorkloads().contains("Red Hat JBoss EAP")).count()).isEqualTo(2); + softly.assertThat(workloadInventoryReport.getBody().getContent().stream().map(WorkloadInventoryReportModel::getOsName).distinct().count()).isEqualTo(4); + softly.assertThat(workloadInventoryReport.getBody().getContent().stream().filter(e -> e.getOsName().contains("CentOS 7 (64-bit)")).count()).isEqualTo(2); + softly.assertThat(workloadInventoryReport.getBody().getContent().stream().map(WorkloadInventoryReportModel::getComplexity).distinct().count()).isEqualTo(3); + softly.assertThat(workloadInventoryReport.getBody().getContent().stream().filter(e -> e.getComplexity().contains("Unknown")).count()).isEqualTo(0); + softly.assertThat(workloadInventoryReport.getBody().getContent().stream().filter(e -> e.getComplexity().contains("Unsupported")).count()).isEqualTo(1); + softly.assertThat(workloadInventoryReport.getBody().getContent().stream().flatMap(e -> e.getRecommendedTargetsIMS().stream()).distinct().count()).isEqualTo(4); + softly.assertThat(workloadInventoryReport.getBody().getContent().stream().filter(e -> e.getRecommendedTargetsIMS().contains("OSP")).count()).isEqualTo(11); + softly.assertThat(workloadInventoryReport.getBody().getContent().stream().flatMap(e -> e.getFlagsIMS().stream()).distinct().count()).isEqualTo(2); + softly.assertThat(workloadInventoryReport.getBody().getContent().stream().filter(e -> e.getFlagsIMS().contains("Shared Disk")).count()).isEqualTo(2); + softly.assertThat(workloadInventoryReport.getBody().getContent().stream().filter(e -> e.getOsName().contains("ServerNT") && e.getWorkloads().contains("Microsoft SQL Server")).count()).isEqualTo(1); + }); + + // Checks on Workload Summary Report + WorkloadSummaryReportModel workloadSummaryReport_Expected = new ObjectMapper().readValue(IOUtils.resourceToString("cfme_inventory-20190912-demolab-withssa-workload-summary-report.json", StandardCharsets.UTF_8, Case2EndToEndIT.class.getClassLoader()), WorkloadSummaryReportModel.class); + + assertThat(workloadSummaryReport.getBody()) + .usingRecursiveComparison() + .ignoringFieldsMatchingRegexes(".*id.*", ".*creationDate.*", ".*report.*", ".*workloadsDetectedOSTypeModels.*", ".*scanRunModels.*") + .isEqualTo(workloadSummaryReport_Expected); + + // WLSR.ScanRunModels + TreeSet wks_scanrunmodel_expected = getWks_scanrunmodel(workloadSummaryReport_Expected.getScanRunModels()); + TreeSet wks_scanrunmodel_actual = getWks_scanrunmodel(workloadSummaryReport.getBody().getScanRunModels()); + + // WLSR.WorkloadsDetectedOSTypeModel + TreeSet wks_ostypemodel_expected = getWks_ostypemodel(workloadSummaryReport_Expected.getWorkloadsDetectedOSTypeModels()); + TreeSet wks_ostypemodel_actual = getWks_ostypemodel(workloadSummaryReport.getBody().getWorkloadsDetectedOSTypeModels()); + + SoftAssertions.assertSoftly(softly -> { + softly.assertThat(wks_scanrunmodel_actual).isEqualTo(wks_scanrunmodel_expected); + softly.assertThat(wks_ostypemodel_actual).isEqualTo(wks_ostypemodel_expected); + }); + + // Performance test + logger.info("+++++++ Performance Test ++++++"); + + new RestTemplate().postForEntity("http://localhost:" + serverPort + "/api/xavier/upload", getRequestEntityForUploadRESTCall("cfme_inventory-20190829-16128-uq17dx.tar.gz", "application/zip"), String.class); + callSummaryReportAndCheckVMs(String.format("/api/xavier/report/%d/workload-summary", ++analysisNum), timeoutMilliseconds_PerformaceTest, 142); + + // Test with a file with VM without Host + logger.info("+++++++ Test with a file with VM without Host ++++++"); + + new RestTemplate().postForEntity("http://localhost:" + serverPort + "/api/xavier/upload", getRequestEntityForUploadRESTCall("cloudforms-export-v1_0_0-vm_without_host.json", "application/json"), String.class); + callSummaryReportAndCheckVMs(String.format("/api/xavier/report/%d/workload-summary", ++analysisNum), timeoutMilliseconds_InitialCostSavingsReport, 8); + + ResponseEntity> workloadInventoryReport_file_vm_without_host = new RestTemplate().exchange("http://localhost:" + serverPort + String.format("/api/xavier/report/%d/workload-inventory?size=100", analysisNum), HttpMethod.GET, getRequestEntity(), new ParameterizedTypeReference>() {}); + assertThat(workloadInventoryReport_file_vm_without_host.getBody().getContent().size()).isEqualTo(8); + assertThat(workloadInventoryReport_file_vm_without_host.getBody().getContent().stream().filter(e -> e.getDatacenter().equalsIgnoreCase("No datacenter defined") && e.getCluster().equalsIgnoreCase("No cluster defined")).count()).isEqualTo(2); + assertThat(workloadInventoryReport_file_vm_without_host.getBody().getContent().stream().filter(e -> !e.getDatacenter().equalsIgnoreCase("No datacenter defined") && !e.getCluster().equalsIgnoreCase("No cluster defined")).count()).isEqualTo(6); + + // Test with a file with Host without Cluster + logger.info("+++++++ Test with a file with Host without Cluster ++++++"); + new RestTemplate().postForEntity("http://localhost:" + serverPort + "/api/xavier/upload", getRequestEntityForUploadRESTCall("cloudforms-export-v1_0_0-host_without_cluster.json", "application/json"), String.class); + callSummaryReportAndCheckVMs(String.format("/api/xavier/report/%d/workload-summary", ++analysisNum), timeoutMilliseconds_InitialCostSavingsReport, 8); + + ResponseEntity> workloadInventoryReport_file_host_without_cluster = new RestTemplate().exchange("http://localhost:" + serverPort + String.format("/api/xavier/report/%d/workload-inventory?size=100", analysisNum), HttpMethod.GET, getRequestEntity(), new ParameterizedTypeReference>() {}); + // Total VMs + assertThat(workloadInventoryReport_file_host_without_cluster.getBody().getContent().size()).isEqualTo(8); + // Wrong VMs + assertThat(workloadInventoryReport_file_host_without_cluster.getBody().getContent().stream().filter(e -> e.getDatacenter().equalsIgnoreCase("No datacenter defined") && e.getCluster().equalsIgnoreCase("No cluster defined")).count()).isEqualTo(3); + // Right VMs + assertThat(workloadInventoryReport_file_host_without_cluster.getBody().getContent().stream().filter(e -> !e.getDatacenter().equalsIgnoreCase("No datacenter defined") && !e.getCluster().equalsIgnoreCase("No cluster defined")).count()).isEqualTo(5); + + // Test with a file with Wrong CPU cores per socket + logger.info("+++++++ Test with a file with Wrong CPU cores per socket ++++++"); + new RestTemplate().postForEntity("http://localhost:" + serverPort + "/api/xavier/upload", getRequestEntityForUploadRESTCall("cloudforms-export-v1_0_0-wrong_cpu_cores_per_socket.json", "application/json"), String.class); + callSummaryReportAndCheckVMs(String.format("/api/xavier/report/%d/workload-summary", ++analysisNum), timeoutMilliseconds_InitialCostSavingsReport, 5); + + ResponseEntity initialCostSavingsReport_wrong_cpu_cores = new RestTemplate().exchange("http://localhost:" + serverPort + String.format("/api/xavier/report/%d/initial-saving-estimation", analysisNum), HttpMethod.GET, getRequestEntity(), new ParameterizedTypeReference() {}); + assertThat(initialCostSavingsReport_wrong_cpu_cores.getBody().getEnvironmentModel().getHypervisors()).isEqualTo(2); + + ResponseEntity> workloadInventoryReport_file_wrong_cpu_cores = new RestTemplate().exchange("http://localhost:" + serverPort + String.format("/api/xavier/report/%d/workload-inventory?size=100", analysisNum), HttpMethod.GET, getRequestEntity(), new ParameterizedTypeReference>() {}); + assertThat(workloadInventoryReport_file_wrong_cpu_cores.getBody().getContent().stream().filter(e -> e.getCpuCores() == null).count()).isEqualTo(0); + assertThat(workloadInventoryReport_file_wrong_cpu_cores.getBody().getContent().stream().filter(e -> e.getCpuCores() != null).count()).isEqualTo(5); + assertThat(workloadInventoryReport_file_wrong_cpu_cores.getBody().getContent().size()).isEqualTo(5); + + + // Ultra Performance test + logger.info("+++++++ Ultra Performance Test ++++++"); + new RestTemplate().postForEntity("http://localhost:" + serverPort + "/api/xavier/upload", getRequestEntityForUploadRESTCall("cfme_inventory20190807-32152-jimd0q_large_dataset_5254_vms.tar.gz", "application/zip"), String.class); + callSummaryReportAndCheckVMs(String.format("/api/xavier/report/%d/workload-summary", ++analysisNum), timeoutMilliseconds_UltraPerformaceTest, numberVMsExpected_InBigFile); + + // Stress test + // We load 3 times a BIG file ( 8 Mb ) and 2 times a small file ( 316 Kb ) + // More or less 7 minutes each bunch of threads of Big Files + // 1 bunch of threads for 2 big files and 1 small file, while 1 big file and 1 small file wait in the queue + // We have 3 consumers + // To process the first small file it should take 10 seconds + // To process the second small file it should take 7 minutes of the first bunch of big files plus 10 seconds of the small file + logger.info("+++++++ Stress Test ++++++"); + new RestTemplate().postForEntity("http://localhost:" + serverPort + "/api/xavier/upload", getRequestEntityForUploadRESTCall("cfme_inventory20190807-32152-jimd0q_large_dataset_5254_vms.tar.gz", "application/zip"), String.class); + new RestTemplate().postForEntity("http://localhost:" + serverPort + "/api/xavier/upload", getRequestEntityForUploadRESTCall("cloudforms-export-v1_0_0.json", "application/json"), String.class); + new RestTemplate().postForEntity("http://localhost:" + serverPort + "/api/xavier/upload", getRequestEntityForUploadRESTCall("cfme_inventory20190807-32152-jimd0q_large_dataset_5254_vms.tar.gz", "application/zip"), String.class); + new RestTemplate().postForEntity("http://localhost:" + serverPort + "/api/xavier/upload", getRequestEntityForUploadRESTCall("cloudforms-export-v1_0_0.json", "application/json"), String.class); + + // We will check for time we retrieve the third file uploaded to see previous ones are not affecting + callSummaryReportAndCheckVMs(String.format("/api/xavier/report/%d/workload-summary", analysisNum + 2), timeoutMilliseconds_SmallFileSummaryReport, 8); + callSummaryReportAndCheckVMs(String.format("/api/xavier/report/%d/workload-summary", analysisNum + 1), timeoutMilliseconds_UltraPerformaceTest, numberVMsExpected_InBigFile); + callSummaryReportAndCheckVMs(String.format("/api/xavier/report/%d/workload-summary", analysisNum + 3), timeoutMilliseconds_UltraPerformaceTest, numberVMsExpected_InBigFile); + + int timeoutMilliseconds_secondSmallFile = timeoutMilliseconds_UltraPerformaceTest + timeoutMilliseconds_SmallFileSummaryReport; + callSummaryReportAndCheckVMs(String.format("/api/xavier/report/%d/workload-summary", analysisNum + 4), timeoutMilliseconds_secondSmallFile, 8); + + camelContext.stop(); + } + + private void callSummaryReportAndCheckVMs(final String reportUrl, int timeoutMilliseconds, int numberVMsExpected) { + await() + .atMost(timeoutMilliseconds, TimeUnit.MILLISECONDS) + .with().pollInterval(Duration.ONE_SECOND) + .until(() -> { + ResponseEntity workloadSummaryReport_stress_checkVMs = new RestTemplate().exchange("http://localhost:" + serverPort + reportUrl, HttpMethod.GET, getRequestEntity(), new ParameterizedTypeReference() { + }); + boolean success = (workloadSummaryReport_stress_checkVMs != null && + workloadSummaryReport_stress_checkVMs.getStatusCodeValue() == 200 && + workloadSummaryReport_stress_checkVMs.getBody() != null && + workloadSummaryReport_stress_checkVMs.getBody().getSummaryModels() != null ); + if (success) { + assertThat(workloadSummaryReport_stress_checkVMs.getBody().getSummaryModels().stream().mapToInt(SummaryModel::getVms).sum()).isEqualTo(numberVMsExpected); + } + return success; + }); + } + + private int getWorkloadSummaryReportModelResponseVMs(int analysisNum) { + final String workloadsummaryreport_stress_url = String.format("/api/xavier/report/%d/workload-summary", analysisNum ); + ResponseEntity response = new RestTemplate().exchange("http://localhost:" + serverPort + workloadsummaryreport_stress_url, HttpMethod.GET, getRequestEntity(), new ParameterizedTypeReference() { + }); + logger.info("URL [{}] response [{}]", workloadsummaryreport_stress_url, response.getBody()); + return response.getBody().getSummaryModels().stream().mapToInt(SummaryModel::getVms).sum(); + } + + @NotNull + private TreeSet getWks_ostypemodel(Set elements) { + TreeSet treeset = new TreeSet<>(new WorkloadsDetectedOSTypeModelComparator()); + treeset.addAll(elements); + return treeset; + } + + @NotNull + private TreeSet getWks_scanrunmodel(Set elements) { + TreeSet treeset = new TreeSet<>(new ScanRunModelComparator()); + treeset.addAll(elements); + return treeset; + } + + private HttpEntity getRequestEntity() { + return new HttpEntity(getHttpHeaders()); + } + + @NotNull + private HttpEntity> getRequestEntityForUploadRESTCall(String filename, String content_type_header) throws IOException { + // Headers + HttpHeaders headers = getHttpHeaders(); + headers.setContentType(MediaType.MULTIPART_FORM_DATA); + + // Body + MultiValueMap body = new LinkedMultiValueMap<>(); + + // File Body part + LinkedMultiValueMap fileMap = new LinkedMultiValueMap<>(); + fileMap.add(HttpHeaders.CONTENT_DISPOSITION, "form-data; name=filex; filename=" + filename); + fileMap.add("Content-type", content_type_header); + body.add("file", new HttpEntity<>(IOUtils.resourceToByteArray(filename, Case2EndToEndIT.class.getClassLoader()), fileMap)); + + // params Body parts + body.add("percentageOfHypervisorsMigratedOnYear1", "50"); + body.add("percentageOfHypervisorsMigratedOnYear2", "25"); + body.add("percentageOfHypervisorsMigratedOnYear3", "25"); + body.add("yearOverYearGrowthRatePercentage", "5"); + body.add("sourceproductindicator", "2"); + body.add("reportName", "report name test"); + body.add("reportDescription", "report desc test"); + body.add("payloadName", "payloadname"); + + return new HttpEntity<>(body, headers); + } + + @NotNull + private HttpHeaders getHttpHeaders() { + // Headers + HttpHeaders headers = new HttpHeaders(); + headers.set("x-rh-insights-request-id", UUID.randomUUID().toString()); + String rhIdentityJson = "{\"entitlements\":{\"insights\":{\"is_entitled\":true},\"openshift\":{\"is_entitled\":true},\"smart_management\":{\"is_entitled\":false},\"hybrid_cloud\":{\"is_entitled\":true}}," + + "\"identity\":{\"internal\":{\"auth_time\":0,\"auth_type\":\"jwt-auth\",\"org_id\":\"6340056\", " + + //"\"filename\":\"" + filename + "\"," + + "\"origin\":\"xavier\",\"customerid\":\"CID888\"}," + + // \"analysisId\":\"" + analysisId + "\"}," + + "\"account_number\":\"1460290\", \"user\":{\"first_name\":\"User\",\"is_active\":true,\"is_internal\":true,\"last_name\":\"Dumy\",\"locale\":\"en_US\",\"is_org_admin\":false,\"username\":\"dummy@redhat.com\",\"email\":\"dummy+qa@redhat.com\"},\"type\":\"User\"}}"; + headers.set("x-rh-identity", Base64.encodeAsString(rhIdentityJson.getBytes()) ); + headers.set("username", "dummy@redhat.com"); + return headers; + } + + private static class ScanRunModelComparator implements Comparator { + @Override + public int compare(ScanRunModel o1, ScanRunModel o2) { + return o1.getTarget().equals(o2.getTarget()) && o1.getType().equals(o2.getType()) ? 0 : 1; + } + } + + private static class WorkloadsDetectedOSTypeModelComparator implements Comparator { + @Override + public int compare(WorkloadsDetectedOSTypeModel o1, WorkloadsDetectedOSTypeModel o2) { + return o1.getOsName().equals(o2.getOsName()) && o1.getTotal().equals(o2.getTotal()) ? 0 : 1; + } + } +} From 68df7d7e80923394e1675f3f3192a11cb9b0b125 Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Thu, 27 Feb 2020 17:25:09 +0100 Subject: [PATCH 02/57] remove custom docker install --- .travis.yml | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1a1a4ec1..68e717fe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,21 +33,6 @@ sudo: required services: - docker -# Fix for https://travis-ci.community/t/problematic-docker-compose-version-1-23-1/5362/3 -before_install: - - docker-compose --version - - docker info - - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - - - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" - - sudo apt-get update - - sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce - - sudo rm /usr/local/bin/docker-compose - - curl -L https://github.com/docker/compose/releases/download/1.22.0/docker-compose-Linux-x86_64 > docker-compose - - chmod +x docker-compose - - sudo mv docker-compose /usr/local/bin - - docker-compose --version - - docker info - install: - cp ./configuration/settings.xml $HOME/.m2/settings.xml - mvn install -P !fuse-fabric8-docker -DskipTests=true -Dmaven.javadoc.skip=true -B -V From afea7a4336a9514240cb1d8154dfc49317663b6e Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Thu, 27 Feb 2020 17:29:44 +0100 Subject: [PATCH 03/57] exclude tests --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 68e717fe..ba12cc8b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,7 @@ env: - LOGGING_LEVEL_ROOT=info - ANALYSIS_DATAINTEGRITY_LOG=false jobs: - - TEST_PROFILE=unitTest CLASSES_TO_EXECUTE=* + - TEST_PROFILE=unitTest CLASSES_TO_EXECUTE=\!EndToEndIT* - TEST_PROFILE=endToEnd CLASSES_TO_EXECUTE=Case1EndToEndIT - TEST_PROFILE=endToEnd CLASSES_TO_EXECUTE=Case2EndToEndIT From 654620063c2a2a32dc818efe369fad7123901541 Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Thu, 27 Feb 2020 17:32:29 +0100 Subject: [PATCH 04/57] remove code from second end2end test --- .../xavier/integrations/Case2EndToEndIT.java | 623 +----------------- 1 file changed, 3 insertions(+), 620 deletions(-) diff --git a/src/test/java/org/jboss/xavier/integrations/Case2EndToEndIT.java b/src/test/java/org/jboss/xavier/integrations/Case2EndToEndIT.java index ab1e5078..73a957dc 100644 --- a/src/test/java/org/jboss/xavier/integrations/Case2EndToEndIT.java +++ b/src/test/java/org/jboss/xavier/integrations/Case2EndToEndIT.java @@ -1,633 +1,16 @@ package org.jboss.xavier.integrations; -import com.amazonaws.services.s3.AmazonS3; -import com.amazonaws.services.s3.model.ListObjectsV2Request; -import com.amazonaws.util.Base64; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.apache.camel.CamelContext; -import org.apache.camel.Exchange; -import org.apache.camel.builder.AdviceWithRouteBuilder; -import org.apache.camel.component.aws.s3.S3Constants; -import org.apache.camel.test.spring.CamelSpringBootRunner; -import org.apache.camel.test.spring.UseAdviceWith; -import org.apache.commons.io.FileUtils; -import org.apache.commons.io.IOUtils; -import org.assertj.core.api.SoftAssertions; -import org.awaitility.Duration; -import org.jboss.xavier.Application; -import org.jboss.xavier.analytics.pojo.output.InitialSavingsEstimationReportModel; -import org.jboss.xavier.analytics.pojo.output.workload.inventory.WorkloadInventoryReportModel; -import org.jboss.xavier.analytics.pojo.output.workload.summary.ScanRunModel; -import org.jboss.xavier.analytics.pojo.output.workload.summary.SummaryModel; -import org.jboss.xavier.analytics.pojo.output.workload.summary.WorkloadSummaryReportModel; -import org.jboss.xavier.analytics.pojo.output.workload.summary.WorkloadsDetectedOSTypeModel; -import org.jboss.xavier.integrations.jpa.repository.AnalysisRepository; -import org.jboss.xavier.integrations.jpa.repository.InitialSavingsEstimationReportRepository; -import org.jboss.xavier.integrations.jpa.service.InitialSavingsEstimationReportService; -import org.jboss.xavier.integrations.route.model.notification.FilePersistedNotification; -import org.jboss.xavier.integrations.route.model.user.User; -import org.jetbrains.annotations.NotNull; -import org.junit.After; -import org.junit.ClassRule; import org.junit.Test; -import org.junit.runner.RunWith; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.util.EnvironmentTestUtils; -import org.springframework.context.ApplicationContextInitializer; -import org.springframework.context.ConfigurableApplicationContext; -import org.springframework.context.annotation.Import; -import org.springframework.core.ParameterizedTypeReference; -import org.springframework.hateoas.PagedResources; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.util.LinkedMultiValueMap; -import org.springframework.util.MultiValueMap; -import org.springframework.web.client.RestClientException; -import org.springframework.web.client.RestTemplate; -import org.testcontainers.containers.GenericContainer; -import org.testcontainers.containers.KafkaContainer; -import org.testcontainers.containers.Network; -import org.testcontainers.containers.PostgreSQLContainer; -import org.testcontainers.containers.localstack.LocalStackContainer; -import org.testcontainers.containers.output.Slf4jLogConsumer; -import org.testcontainers.images.builder.ImageFromDockerfile; -import org.testcontainers.utility.MountableFile; - -import javax.inject.Inject; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.URL; -import java.nio.charset.StandardCharsets; -import java.nio.file.Paths; -import java.util.Comparator; -import java.util.Enumeration; -import java.util.List; -import java.util.Set; -import java.util.TreeSet; -import java.util.UUID; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; -import java.util.zip.ZipEntry; -import java.util.zip.ZipFile; import static org.assertj.core.api.Assertions.assertThat; -import static org.awaitility.Awaitility.await; -import static org.testcontainers.containers.localstack.LocalStackContainer.Service.S3; -@RunWith(CamelSpringBootRunner.class) -@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) -@UseAdviceWith // Disables automatic start of Camel context -@SpringBootTest(classes = {Application.class}, webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT) -@ContextConfiguration(initializers = Case2EndToEndIT.Initializer.class) -@Import(TestConfigurationS3.class) -@ActiveProfiles("test") public class Case2EndToEndIT { - private static Logger logger = LoggerFactory.getLogger(Case2EndToEndIT.class); - - @ClassRule - public static GenericContainer activemq = new GenericContainer<>("vromero/activemq-artemis") - .withExposedPorts(61616, 8161) - .withLogConsumer(new Slf4jLogConsumer(logger).withPrefix("AMQ-LOG")) - .withEnv("DISABLE_SECURITY", "true") - .withEnv("BROKER_CONFIG_GLOBAL_MAX_SIZE", "50000") - .withEnv("BROKER_CONFIG_MAX_SIZE_BYTES", "50000") - .withEnv("BROKER_CONFIG_MAX_DISK_USAGE", "100"); - - @ClassRule - public static GenericContainer kie_server = new GenericContainer<>("jboss/kie-server-showcase:7.18.0.Final") - .withNetworkAliases("kie-server") - .withExposedPorts(8080) - .withLogConsumer(new Slf4jLogConsumer(logger).withPrefix("KIE-LOG")) - .withEnv("KIE_SERVER_ID", "analytics-kieserver") - .withEnv("KIE_ADMIN_USER", "kieserver") - .withEnv("KIE_ADMIN_PWD", "kieserver1!") - .withEnv("KIE_SERVER_MODE", "DEVELOPMENT") - .withEnv("KIE_MAVEN_REPO", "https://oss.sonatype.org/content/repositories/snapshots") - .withEnv("KIE_REPOSITORY","https://repository.jboss.org/nexus/content/groups/public-jboss") - .withEnv("KIE_SERVER_CONTROLLER_PWD","admin") - .withEnv("KIE_SERVER_CONTROLLER_USER","admin") - .withEnv("KIE_SERVER_LOCATION","http://kie-server:8080/kie-server/services/rest/server") - .withEnv("KIE_SERVER_PWD","kieserver1!") - .withEnv("KIE_SERVER_USER","kieserver"); - - @ClassRule - public static PostgreSQLContainer postgreSQL = new PostgreSQLContainer() - .withDatabaseName("sampledb") - .withUsername("admin") - .withPassword("redhat"); - - @ClassRule - public static LocalStackContainer localstack = new LocalStackContainer() - .withLogConsumer(new Slf4jLogConsumer(logger).withPrefix("AWS-LOG")) - .withServices(S3); - - private static String ingressCommitHash = "3ea33a8d793c2154f7cfa12057ca005c5f6031fa"; // 2019-11-11 - - @Inject - private InitialSavingsEstimationReportService initialSavingsEstimationReportService; - - @Autowired - private InitialSavingsEstimationReportRepository initialSavingsEstimationReportRepository; - - @Inject - private AnalysisRepository analysisRepository; - - @Value("${S3_BUCKET}") - private String bucket; - - @Value("${server.port:8080}") - private String serverPort; - - @Value("${test.timeout.performance:60000}") // 1 minute - private int timeoutMilliseconds_PerformaceTest; - - @Value("${test.timeout.ics:10000}") // 10 seconds - private int timeoutMilliseconds_InitialCostSavingsReport; - - @Value("${minio.host}") // Set in the Initializer - private String minio_host; - - @Value("${test.timeout.ultraperformance:1200000}") // 20 minutes - private int timeoutMilliseconds_UltraPerformaceTest; - - @Value("${test.timeout.smallfilesummaryreport:10000}") // 10 seconds - private int timeoutMilliseconds_SmallFileSummaryReport; - - @Value("${test.bigfile.vms_expected:5254}") - private int numberVMsExpected_InBigFile; - - public static class Initializer implements ApplicationContextInitializer { - - @Override - public void initialize(ConfigurableApplicationContext configurableApplicationContext) { - try { - cloneIngressRepoAndUnzip(); - - Network network = Network.newNetwork(); - - GenericContainer minio = new GenericContainer<>("minio/minio") - .withCommand("server /data") - .withExposedPorts(9000) - .withNetworkAliases("minio") - .withNetwork(network) - .withLogConsumer(new Slf4jLogConsumer(logger).withPrefix("MINIO-LOG")) - .withEnv("MINIO_ACCESS_KEY", "BQA2GEXO711FVBVXDWKM") - .withEnv("MINIO_SECRET_KEY", "uvgz3LCwWM3e400cDkQIH/y1Y4xgU4iV91CwFSPC"); - minio.start(); - - Thread.sleep(5000); - GenericContainer createbuckets = new GenericContainer<>("minio/mc") - .dependsOn(minio) - .withNetwork(network) - .withLogConsumer(new Slf4jLogConsumer(logger).withPrefix("MINIO-MC-LOG")) - .withCopyFileToContainer(MountableFile.forClasspathResource("minio-bucket-creation-commands.sh"), "/") - .withCreateContainerCmdModifier(createContainerCmd -> createContainerCmd.withEntrypoint("sh", "/minio-bucket-creation-commands.sh", "minio:9000")); - createbuckets.start(); - - KafkaContainer kafka = new KafkaContainer() - .withLogConsumer(new Slf4jLogConsumer(logger).withPrefix("KAFKA-LOG")) - .withNetworkAliases("kafka") - .withNetwork(network); - kafka.start(); - - GenericContainer ingress = new GenericContainer(new ImageFromDockerfile() - .withDockerfile(Paths.get("src/test/resources/insights-ingress-go/Dockerfile"))) - .withExposedPorts(3000) - .withNetwork(network) - .withLogConsumer(new Slf4jLogConsumer(logger).withPrefix("INGRESS-LOG")) - .withEnv("AWS_ACCESS_KEY_ID","BQA2GEXO711FVBVXDWKM") - .withEnv("AWS_SECRET_ACCESS_KEY","uvgz3LCwWM3e400cDkQIH/y1Y4xgU4iV91CwFSPC") - .withEnv("AWS_REGION","us-east-1") - .withEnv("INGRESS_STAGEBUCKET","insights-upload-perma") - .withEnv("INGRESS_REJECTBUCKET","insights-upload-rejected") - .withEnv("INGRESS_INVENTORYURL","http://inventory:8080/api/inventory/v1/hosts") - .withEnv("INGRESS_VALIDTOPICS","xavier,testareno,advisortestareno,advisor") - .withEnv("OPENSHIFT_BUILD_COMMIT","woopwoop") - .withEnv("INGRESS_MINIODEV","true") - .withEnv("INGRESS_MINIOACCESSKEY","BQA2GEXO711FVBVXDWKM") - .withEnv("INGRESS_MINIOSECRETKEY","uvgz3LCwWM3e400cDkQIH/y1Y4xgU4iV91CwFSPC") - .withEnv("INGRESS_MINIOENDPOINT", "minio:9000") - .withEnv("INGRESS_KAFKABROKERS", "kafka:9092"); - ingress.start(); - - importProjectIntoKIE(); - - EnvironmentTestUtils.addEnvironment("environment", configurableApplicationContext.getEnvironment(), - "amq.server=" + activemq.getContainerIpAddress(), - "amq.port=" + activemq.getMappedPort(61616), - "minio.host=" + getContainerHost(minio, 9000), - "insights.upload.host=" + getContainerHost(ingress), - "insights.properties=yearOverYearGrowthRatePercentage,percentageOfHypervisorsMigratedOnYear1,percentageOfHypervisorsMigratedOnYear2,percentageOfHypervisorsMigratedOnYear3,reportName,reportDescription", - "camel.component.servlet.mapping.context-path=/api/xavier/*", - "insights.kafka.host=" + kafka.getBootstrapServers(), - "postgresql.service.name=" + postgreSQL.getContainerIpAddress(), - "postgresql.service.port=" + postgreSQL.getFirstMappedPort(), - "spring.datasource.username=" + postgreSQL.getUsername(), - "spring.datasource.password=" + postgreSQL.getPassword(), - "S3_HOST=" + localstack.getEndpointConfiguration(S3).getServiceEndpoint(), - "S3_REGION="+ localstack.getEndpointConfiguration(S3).getSigningRegion(), - "kieserver.devel-service=" + getHostForKie() + "/kie-server", - "spring.datasource.url = jdbc:postgresql://" + getContainerHost(postgreSQL) + "/sampledb" , - "spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQL9Dialect" , - "thread.concurrentConsumers=3"); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @NotNull - private String getContainerHost(GenericContainer container, Integer port) { - return container.getContainerIpAddress() + ":" + container.getMappedPort(port); - } - - @NotNull - private static String getContainerHost(GenericContainer container) { - return container.getContainerIpAddress() + ":" + container.getFirstMappedPort(); - } - } - - @Inject - CamelContext camelContext; - - @Inject - AmazonS3 amazonS3; - - private static void cloneIngressRepoAndUnzip() throws IOException { - // downloading, unzipping, renaming - String ingressRepoZipURL = "https://github.com/RedHatInsights/insights-ingress-go/archive/" + ingressCommitHash + ".zip"; - File compressedFile = new File("src/test/resources/ingressRepo.zip"); - FileUtils.copyURLToFile(new URL(ingressRepoZipURL), compressedFile, 1000, 10000); - unzipFile(compressedFile, "src/test/resources"); - - // we rename the directory because we had issues with Docker and the long folder - FileUtils.moveDirectory(new File("src/test/resources/insights-ingress-go-" + ingressCommitHash), new File("src/test/resources/insights-ingress-go")); - } - - private static void unzipFile(File file, String outputDir) throws IOException { - ZipFile zipFile = new ZipFile(file); - try { - Enumeration entries = zipFile.entries(); - while (entries.hasMoreElements()) { - ZipEntry entry = entries.nextElement(); - File entryDestination = new File(outputDir, entry.getName()); - if (entry.isDirectory()) { - entryDestination.mkdirs(); - } else { - entryDestination.getParentFile().mkdirs(); - InputStream in = zipFile.getInputStream(entry); - OutputStream out = new FileOutputStream(entryDestination); - IOUtils.copy(in, out); - in.close(); - out.close(); - } - } - } finally { - zipFile.close(); - } - } - - private static String getHostForKie() { - return kie_server.getContainerIpAddress() + ":" + kie_server.getFirstMappedPort(); - } - - private static void importProjectIntoKIE() throws InterruptedException, IOException { - HttpHeaders headers = new HttpHeaders(); - headers.setContentType(MediaType.APPLICATION_JSON); - headers.setCacheControl("no-cache"); - headers.set("Authorization", "Basic YWRtaW46YWRtaW4="); // admin:admin - - String kieRestURL = "http://" + getHostForKie() + "/kie-server/services/rest/"; - - // KIE Container Creation - HttpHeaders kieheaders = new HttpHeaders(); - kieheaders.setContentType(MediaType.APPLICATION_JSON); - kieheaders.set("Authorization", "Basic a2llc2VydmVyOmtpZXNlcnZlcjEh"); - kieheaders.setCacheControl("no-cache"); - String kieContainerBody = "{\"container-id\" : \"xavier-analytics_0.0.1-SNAPSHOT\",\"release-id\" : {\"group-id\" : \"org.jboss.xavier\",\"artifact-id\" : \"xavier-analytics\",\"version\" : \"0.0.1-SNAPSHOT\" } }"; - try { - new RestTemplate().exchange(kieRestURL + "server/containers/xavier-analytics_0.0.1-SNAPSHOT", HttpMethod.PUT, new HttpEntity<>(kieContainerBody, kieheaders), String.class); - } catch (RestClientException e) { - e.printStackTrace(); - } - } - - @After - public void cleanUp() throws IOException { - // cleaning downloadable files/directories - FileUtils.deleteDirectory(new File("src/test/resources/insights-ingress-go")); - FileUtils.deleteQuietly(new File("src/test/resources/ingressRepo.zip")); - } - - private List getS3Objects(String bucket) { - ListObjectsV2Request req = new ListObjectsV2Request().withBucketName(bucket).withMaxKeys(2); - - return amazonS3.listObjectsV2(req).getObjectSummaries().stream().map(e -> e.getKey()).collect(Collectors.toList()); - } @Test public void end2endTest() throws Exception { - Thread.sleep(2000); - - // given - camelContext.getGlobalOptions().put(Exchange.LOG_DEBUG_BODY_MAX_CHARS, "5000"); - camelContext.start(); - - camelContext.getRouteDefinition("store-in-s3").adviceWith(camelContext, new AdviceWithRouteBuilder() { - @Override - public void configure() { - weaveById("set-s3-key") - .replace().process(e -> e.getIn().setHeader(S3Constants.KEY, "S3KEY123" + UUID.randomUUID().toString())); - } - }); - - camelContext.getRouteDefinition("download-file").adviceWith(camelContext, new AdviceWithRouteBuilder() { - @Override - public void configure() { - weaveById("setHttpUri") - .replace() - .process(e -> { - String url = e.getIn().getBody(FilePersistedNotification.class).getUrl(); - url = url.replace("minio:9000", minio_host); - e.getIn().setHeader("httpUriReplaced", url); - }) - .setHeader("Exchange.HTTP_URI", header("httpUriReplaced")) - .setHeader("Host", constant("minio:9000")); - - weaveById("toOldHost") - .replace() - .to("http4:oldhost?preserveHostHeader=true"); - } - }); - - // 1. Check user has firstTime - ResponseEntity userEntity = new RestTemplate().exchange("http://localhost:" + serverPort + "/api/xavier/user", HttpMethod.GET, getRequestEntity(), new ParameterizedTypeReference() {}); - assertThat(userEntity.getBody().isFirstTimeCreatingReports()).isTrue(); - - // Start the camel route as if the UI was sending the file to the Camel Rest Upload route - int analysisNum = 0; - - logger.info("+++++++ Regular Test ++++++"); - analysisNum++; - new RestTemplate().postForEntity("http://localhost:" + serverPort + "/api/xavier/upload", getRequestEntityForUploadRESTCall("cfme_inventory-20190912-demolab_withSSA.tar.gz", "application/zip"), String.class); - - // then - await() - .atMost(timeoutMilliseconds_InitialCostSavingsReport, TimeUnit.MILLISECONDS) - .with().pollInterval(Duration.ONE_HUNDRED_MILLISECONDS) - .until( () -> { - // Check database for the ICSR to be created - List all = initialSavingsEstimationReportRepository.findAll(); - return all != null && !all.isEmpty(); - }); - - // Check S3 - assertThat(getS3Objects(bucket).stream().allMatch(e -> e.startsWith("S3KEY123"))).isTrue(); - assertThat(getS3Objects(bucket).size()).isEqualTo(1); - - // Check DB for initialCostSavingsReport with concrete values - InitialSavingsEstimationReportModel initialCostSavingsReportDB = initialSavingsEstimationReportService.findByAnalysisOwnerAndAnalysisId("dummy@redhat.com", 1L); - assertThat(initialCostSavingsReportDB.getEnvironmentModel().getHypervisors() == 2); - assertThat(initialCostSavingsReportDB.getSourceCostsModel().getYear1Server() == 42); - - // Call initialCostSavingsReport - ResponseEntity initialCostSavingsReport = new RestTemplate().exchange("http://localhost:" + serverPort + String.format("/api/xavier/report/%d/initial-saving-estimation", analysisNum), HttpMethod.GET, getRequestEntity(), new ParameterizedTypeReference() {}); - - // Call workloadInventoryReport - ResponseEntity> workloadInventoryReport = new RestTemplate().exchange("http://localhost:" + serverPort + String.format("/api/xavier/report/%d/workload-inventory?size=100", analysisNum), HttpMethod.GET, getRequestEntity(), new ParameterizedTypeReference>() {}); - - // Call workloadSummaryReport - ResponseEntity workloadSummaryReport = new RestTemplate().exchange("http://localhost:" + serverPort + String.format("/api/xavier/report/%d/workload-summary", analysisNum), HttpMethod.GET, getRequestEntity(), new ParameterizedTypeReference() {}); - - // Checks on Initial Savings Report - InitialSavingsEstimationReportModel initialSavingsEstimationReport_Expected = new ObjectMapper().readValue(IOUtils.resourceToString("cfme_inventory-20190912-demolab-withssa-initial-cost-savings-report.json", StandardCharsets.UTF_8, Case2EndToEndIT.class.getClassLoader()), InitialSavingsEstimationReportModel.class); - SoftAssertions.assertSoftly(softly -> softly.assertThat(initialCostSavingsReport.getBody()) - .usingRecursiveComparison() - .ignoringFieldsMatchingRegexes(".*id.*", ".*creationDate.*", ".*report.*") - .isEqualTo(initialSavingsEstimationReport_Expected)); - - // Checks on Workload Inventory Report - SoftAssertions.assertSoftly(softly -> { - softly.assertThat(workloadInventoryReport.getBody().getContent().size()).isEqualTo(14); - softly.assertThat(workloadInventoryReport.getBody().getContent().stream().flatMap(e -> e.getWorkloads().stream()).distinct().count()).isEqualTo(7); - softly.assertThat(workloadInventoryReport.getBody().getContent().stream().filter(e -> e.getWorkloads().contains("Red Hat JBoss EAP")).count()).isEqualTo(2); - softly.assertThat(workloadInventoryReport.getBody().getContent().stream().map(WorkloadInventoryReportModel::getOsName).distinct().count()).isEqualTo(4); - softly.assertThat(workloadInventoryReport.getBody().getContent().stream().filter(e -> e.getOsName().contains("CentOS 7 (64-bit)")).count()).isEqualTo(2); - softly.assertThat(workloadInventoryReport.getBody().getContent().stream().map(WorkloadInventoryReportModel::getComplexity).distinct().count()).isEqualTo(3); - softly.assertThat(workloadInventoryReport.getBody().getContent().stream().filter(e -> e.getComplexity().contains("Unknown")).count()).isEqualTo(0); - softly.assertThat(workloadInventoryReport.getBody().getContent().stream().filter(e -> e.getComplexity().contains("Unsupported")).count()).isEqualTo(1); - softly.assertThat(workloadInventoryReport.getBody().getContent().stream().flatMap(e -> e.getRecommendedTargetsIMS().stream()).distinct().count()).isEqualTo(4); - softly.assertThat(workloadInventoryReport.getBody().getContent().stream().filter(e -> e.getRecommendedTargetsIMS().contains("OSP")).count()).isEqualTo(11); - softly.assertThat(workloadInventoryReport.getBody().getContent().stream().flatMap(e -> e.getFlagsIMS().stream()).distinct().count()).isEqualTo(2); - softly.assertThat(workloadInventoryReport.getBody().getContent().stream().filter(e -> e.getFlagsIMS().contains("Shared Disk")).count()).isEqualTo(2); - softly.assertThat(workloadInventoryReport.getBody().getContent().stream().filter(e -> e.getOsName().contains("ServerNT") && e.getWorkloads().contains("Microsoft SQL Server")).count()).isEqualTo(1); - }); - - // Checks on Workload Summary Report - WorkloadSummaryReportModel workloadSummaryReport_Expected = new ObjectMapper().readValue(IOUtils.resourceToString("cfme_inventory-20190912-demolab-withssa-workload-summary-report.json", StandardCharsets.UTF_8, Case2EndToEndIT.class.getClassLoader()), WorkloadSummaryReportModel.class); - - assertThat(workloadSummaryReport.getBody()) - .usingRecursiveComparison() - .ignoringFieldsMatchingRegexes(".*id.*", ".*creationDate.*", ".*report.*", ".*workloadsDetectedOSTypeModels.*", ".*scanRunModels.*") - .isEqualTo(workloadSummaryReport_Expected); - - // WLSR.ScanRunModels - TreeSet wks_scanrunmodel_expected = getWks_scanrunmodel(workloadSummaryReport_Expected.getScanRunModels()); - TreeSet wks_scanrunmodel_actual = getWks_scanrunmodel(workloadSummaryReport.getBody().getScanRunModels()); - - // WLSR.WorkloadsDetectedOSTypeModel - TreeSet wks_ostypemodel_expected = getWks_ostypemodel(workloadSummaryReport_Expected.getWorkloadsDetectedOSTypeModels()); - TreeSet wks_ostypemodel_actual = getWks_ostypemodel(workloadSummaryReport.getBody().getWorkloadsDetectedOSTypeModels()); - - SoftAssertions.assertSoftly(softly -> { - softly.assertThat(wks_scanrunmodel_actual).isEqualTo(wks_scanrunmodel_expected); - softly.assertThat(wks_ostypemodel_actual).isEqualTo(wks_ostypemodel_expected); - }); - - // Performance test - logger.info("+++++++ Performance Test ++++++"); - - new RestTemplate().postForEntity("http://localhost:" + serverPort + "/api/xavier/upload", getRequestEntityForUploadRESTCall("cfme_inventory-20190829-16128-uq17dx.tar.gz", "application/zip"), String.class); - callSummaryReportAndCheckVMs(String.format("/api/xavier/report/%d/workload-summary", ++analysisNum), timeoutMilliseconds_PerformaceTest, 142); - - // Test with a file with VM without Host - logger.info("+++++++ Test with a file with VM without Host ++++++"); - - new RestTemplate().postForEntity("http://localhost:" + serverPort + "/api/xavier/upload", getRequestEntityForUploadRESTCall("cloudforms-export-v1_0_0-vm_without_host.json", "application/json"), String.class); - callSummaryReportAndCheckVMs(String.format("/api/xavier/report/%d/workload-summary", ++analysisNum), timeoutMilliseconds_InitialCostSavingsReport, 8); - - ResponseEntity> workloadInventoryReport_file_vm_without_host = new RestTemplate().exchange("http://localhost:" + serverPort + String.format("/api/xavier/report/%d/workload-inventory?size=100", analysisNum), HttpMethod.GET, getRequestEntity(), new ParameterizedTypeReference>() {}); - assertThat(workloadInventoryReport_file_vm_without_host.getBody().getContent().size()).isEqualTo(8); - assertThat(workloadInventoryReport_file_vm_without_host.getBody().getContent().stream().filter(e -> e.getDatacenter().equalsIgnoreCase("No datacenter defined") && e.getCluster().equalsIgnoreCase("No cluster defined")).count()).isEqualTo(2); - assertThat(workloadInventoryReport_file_vm_without_host.getBody().getContent().stream().filter(e -> !e.getDatacenter().equalsIgnoreCase("No datacenter defined") && !e.getCluster().equalsIgnoreCase("No cluster defined")).count()).isEqualTo(6); - - // Test with a file with Host without Cluster - logger.info("+++++++ Test with a file with Host without Cluster ++++++"); - new RestTemplate().postForEntity("http://localhost:" + serverPort + "/api/xavier/upload", getRequestEntityForUploadRESTCall("cloudforms-export-v1_0_0-host_without_cluster.json", "application/json"), String.class); - callSummaryReportAndCheckVMs(String.format("/api/xavier/report/%d/workload-summary", ++analysisNum), timeoutMilliseconds_InitialCostSavingsReport, 8); - - ResponseEntity> workloadInventoryReport_file_host_without_cluster = new RestTemplate().exchange("http://localhost:" + serverPort + String.format("/api/xavier/report/%d/workload-inventory?size=100", analysisNum), HttpMethod.GET, getRequestEntity(), new ParameterizedTypeReference>() {}); - // Total VMs - assertThat(workloadInventoryReport_file_host_without_cluster.getBody().getContent().size()).isEqualTo(8); - // Wrong VMs - assertThat(workloadInventoryReport_file_host_without_cluster.getBody().getContent().stream().filter(e -> e.getDatacenter().equalsIgnoreCase("No datacenter defined") && e.getCluster().equalsIgnoreCase("No cluster defined")).count()).isEqualTo(3); - // Right VMs - assertThat(workloadInventoryReport_file_host_without_cluster.getBody().getContent().stream().filter(e -> !e.getDatacenter().equalsIgnoreCase("No datacenter defined") && !e.getCluster().equalsIgnoreCase("No cluster defined")).count()).isEqualTo(5); - - // Test with a file with Wrong CPU cores per socket - logger.info("+++++++ Test with a file with Wrong CPU cores per socket ++++++"); - new RestTemplate().postForEntity("http://localhost:" + serverPort + "/api/xavier/upload", getRequestEntityForUploadRESTCall("cloudforms-export-v1_0_0-wrong_cpu_cores_per_socket.json", "application/json"), String.class); - callSummaryReportAndCheckVMs(String.format("/api/xavier/report/%d/workload-summary", ++analysisNum), timeoutMilliseconds_InitialCostSavingsReport, 5); - - ResponseEntity initialCostSavingsReport_wrong_cpu_cores = new RestTemplate().exchange("http://localhost:" + serverPort + String.format("/api/xavier/report/%d/initial-saving-estimation", analysisNum), HttpMethod.GET, getRequestEntity(), new ParameterizedTypeReference() {}); - assertThat(initialCostSavingsReport_wrong_cpu_cores.getBody().getEnvironmentModel().getHypervisors()).isEqualTo(2); - - ResponseEntity> workloadInventoryReport_file_wrong_cpu_cores = new RestTemplate().exchange("http://localhost:" + serverPort + String.format("/api/xavier/report/%d/workload-inventory?size=100", analysisNum), HttpMethod.GET, getRequestEntity(), new ParameterizedTypeReference>() {}); - assertThat(workloadInventoryReport_file_wrong_cpu_cores.getBody().getContent().stream().filter(e -> e.getCpuCores() == null).count()).isEqualTo(0); - assertThat(workloadInventoryReport_file_wrong_cpu_cores.getBody().getContent().stream().filter(e -> e.getCpuCores() != null).count()).isEqualTo(5); - assertThat(workloadInventoryReport_file_wrong_cpu_cores.getBody().getContent().size()).isEqualTo(5); - - - // Ultra Performance test - logger.info("+++++++ Ultra Performance Test ++++++"); - new RestTemplate().postForEntity("http://localhost:" + serverPort + "/api/xavier/upload", getRequestEntityForUploadRESTCall("cfme_inventory20190807-32152-jimd0q_large_dataset_5254_vms.tar.gz", "application/zip"), String.class); - callSummaryReportAndCheckVMs(String.format("/api/xavier/report/%d/workload-summary", ++analysisNum), timeoutMilliseconds_UltraPerformaceTest, numberVMsExpected_InBigFile); - - // Stress test - // We load 3 times a BIG file ( 8 Mb ) and 2 times a small file ( 316 Kb ) - // More or less 7 minutes each bunch of threads of Big Files - // 1 bunch of threads for 2 big files and 1 small file, while 1 big file and 1 small file wait in the queue - // We have 3 consumers - // To process the first small file it should take 10 seconds - // To process the second small file it should take 7 minutes of the first bunch of big files plus 10 seconds of the small file - logger.info("+++++++ Stress Test ++++++"); - new RestTemplate().postForEntity("http://localhost:" + serverPort + "/api/xavier/upload", getRequestEntityForUploadRESTCall("cfme_inventory20190807-32152-jimd0q_large_dataset_5254_vms.tar.gz", "application/zip"), String.class); - new RestTemplate().postForEntity("http://localhost:" + serverPort + "/api/xavier/upload", getRequestEntityForUploadRESTCall("cloudforms-export-v1_0_0.json", "application/json"), String.class); - new RestTemplate().postForEntity("http://localhost:" + serverPort + "/api/xavier/upload", getRequestEntityForUploadRESTCall("cfme_inventory20190807-32152-jimd0q_large_dataset_5254_vms.tar.gz", "application/zip"), String.class); - new RestTemplate().postForEntity("http://localhost:" + serverPort + "/api/xavier/upload", getRequestEntityForUploadRESTCall("cloudforms-export-v1_0_0.json", "application/json"), String.class); - - // We will check for time we retrieve the third file uploaded to see previous ones are not affecting - callSummaryReportAndCheckVMs(String.format("/api/xavier/report/%d/workload-summary", analysisNum + 2), timeoutMilliseconds_SmallFileSummaryReport, 8); - callSummaryReportAndCheckVMs(String.format("/api/xavier/report/%d/workload-summary", analysisNum + 1), timeoutMilliseconds_UltraPerformaceTest, numberVMsExpected_InBigFile); - callSummaryReportAndCheckVMs(String.format("/api/xavier/report/%d/workload-summary", analysisNum + 3), timeoutMilliseconds_UltraPerformaceTest, numberVMsExpected_InBigFile); - - int timeoutMilliseconds_secondSmallFile = timeoutMilliseconds_UltraPerformaceTest + timeoutMilliseconds_SmallFileSummaryReport; - callSummaryReportAndCheckVMs(String.format("/api/xavier/report/%d/workload-summary", analysisNum + 4), timeoutMilliseconds_secondSmallFile, 8); - - camelContext.stop(); - } - - private void callSummaryReportAndCheckVMs(final String reportUrl, int timeoutMilliseconds, int numberVMsExpected) { - await() - .atMost(timeoutMilliseconds, TimeUnit.MILLISECONDS) - .with().pollInterval(Duration.ONE_SECOND) - .until(() -> { - ResponseEntity workloadSummaryReport_stress_checkVMs = new RestTemplate().exchange("http://localhost:" + serverPort + reportUrl, HttpMethod.GET, getRequestEntity(), new ParameterizedTypeReference() { - }); - boolean success = (workloadSummaryReport_stress_checkVMs != null && - workloadSummaryReport_stress_checkVMs.getStatusCodeValue() == 200 && - workloadSummaryReport_stress_checkVMs.getBody() != null && - workloadSummaryReport_stress_checkVMs.getBody().getSummaryModels() != null ); - if (success) { - assertThat(workloadSummaryReport_stress_checkVMs.getBody().getSummaryModels().stream().mapToInt(SummaryModel::getVms).sum()).isEqualTo(numberVMsExpected); - } - return success; - }); - } - - private int getWorkloadSummaryReportModelResponseVMs(int analysisNum) { - final String workloadsummaryreport_stress_url = String.format("/api/xavier/report/%d/workload-summary", analysisNum ); - ResponseEntity response = new RestTemplate().exchange("http://localhost:" + serverPort + workloadsummaryreport_stress_url, HttpMethod.GET, getRequestEntity(), new ParameterizedTypeReference() { - }); - logger.info("URL [{}] response [{}]", workloadsummaryreport_stress_url, response.getBody()); - return response.getBody().getSummaryModels().stream().mapToInt(SummaryModel::getVms).sum(); - } - - @NotNull - private TreeSet getWks_ostypemodel(Set elements) { - TreeSet treeset = new TreeSet<>(new WorkloadsDetectedOSTypeModelComparator()); - treeset.addAll(elements); - return treeset; - } - - @NotNull - private TreeSet getWks_scanrunmodel(Set elements) { - TreeSet treeset = new TreeSet<>(new ScanRunModelComparator()); - treeset.addAll(elements); - return treeset; - } - - private HttpEntity getRequestEntity() { - return new HttpEntity(getHttpHeaders()); - } - - @NotNull - private HttpEntity> getRequestEntityForUploadRESTCall(String filename, String content_type_header) throws IOException { - // Headers - HttpHeaders headers = getHttpHeaders(); - headers.setContentType(MediaType.MULTIPART_FORM_DATA); - - // Body - MultiValueMap body = new LinkedMultiValueMap<>(); - - // File Body part - LinkedMultiValueMap fileMap = new LinkedMultiValueMap<>(); - fileMap.add(HttpHeaders.CONTENT_DISPOSITION, "form-data; name=filex; filename=" + filename); - fileMap.add("Content-type", content_type_header); - body.add("file", new HttpEntity<>(IOUtils.resourceToByteArray(filename, Case2EndToEndIT.class.getClassLoader()), fileMap)); - - // params Body parts - body.add("percentageOfHypervisorsMigratedOnYear1", "50"); - body.add("percentageOfHypervisorsMigratedOnYear2", "25"); - body.add("percentageOfHypervisorsMigratedOnYear3", "25"); - body.add("yearOverYearGrowthRatePercentage", "5"); - body.add("sourceproductindicator", "2"); - body.add("reportName", "report name test"); - body.add("reportDescription", "report desc test"); - body.add("payloadName", "payloadname"); - - return new HttpEntity<>(body, headers); - } - - @NotNull - private HttpHeaders getHttpHeaders() { - // Headers - HttpHeaders headers = new HttpHeaders(); - headers.set("x-rh-insights-request-id", UUID.randomUUID().toString()); - String rhIdentityJson = "{\"entitlements\":{\"insights\":{\"is_entitled\":true},\"openshift\":{\"is_entitled\":true},\"smart_management\":{\"is_entitled\":false},\"hybrid_cloud\":{\"is_entitled\":true}}," + - "\"identity\":{\"internal\":{\"auth_time\":0,\"auth_type\":\"jwt-auth\",\"org_id\":\"6340056\", " + - //"\"filename\":\"" + filename + "\"," + - "\"origin\":\"xavier\",\"customerid\":\"CID888\"}," + - // \"analysisId\":\"" + analysisId + "\"}," + - "\"account_number\":\"1460290\", \"user\":{\"first_name\":\"User\",\"is_active\":true,\"is_internal\":true,\"last_name\":\"Dumy\",\"locale\":\"en_US\",\"is_org_admin\":false,\"username\":\"dummy@redhat.com\",\"email\":\"dummy+qa@redhat.com\"},\"type\":\"User\"}}"; - headers.set("x-rh-identity", Base64.encodeAsString(rhIdentityJson.getBytes()) ); - headers.set("username", "dummy@redhat.com"); - return headers; - } - - private static class ScanRunModelComparator implements Comparator { - @Override - public int compare(ScanRunModel o1, ScanRunModel o2) { - return o1.getTarget().equals(o2.getTarget()) && o1.getType().equals(o2.getType()) ? 0 : 1; - } - } + Integer a = 1; + Integer b = 1; - private static class WorkloadsDetectedOSTypeModelComparator implements Comparator { - @Override - public int compare(WorkloadsDetectedOSTypeModel o1, WorkloadsDetectedOSTypeModel o2) { - return o1.getOsName().equals(o2.getOsName()) && o1.getTotal().equals(o2.getTotal()) ? 0 : 1; - } + assertThat(a + b).isEqualTo(2); } } From 91b24a6355206c9959460d6ee7c5404767d31dde Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Thu, 27 Feb 2020 18:06:58 +0100 Subject: [PATCH 05/57] ADD MAVEN PARAMS --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index ba12cc8b..394ce1c0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,9 +24,9 @@ env: - LOGGING_LEVEL_ROOT=info - ANALYSIS_DATAINTEGRITY_LOG=false jobs: - - TEST_PROFILE=unitTest CLASSES_TO_EXECUTE=\!EndToEndIT* - - TEST_PROFILE=endToEnd CLASSES_TO_EXECUTE=Case1EndToEndIT - - TEST_PROFILE=endToEnd CLASSES_TO_EXECUTE=Case2EndToEndIT + - TEST_PROFILE=unitTest MAVEN_PARAMS= + - TEST_PROFILE=endToEnd MAVEN_PARAMS='-Dtest=Case1EndToEndIT' + - TEST_PROFILE=endToEnd MAVEN_PARAMS='-Dtest=Case2EndToEndIT' sudo: required @@ -38,7 +38,7 @@ install: - mvn install -P !fuse-fabric8-docker -DskipTests=true -Dmaven.javadoc.skip=true -B -V script: - - mvn test -P $TEST_PROFILE -Dtest=$CLASSES_TO_EXECUTE + - mvn test -P $TEST_PROFILE $MAVEN_PARAMS # - mvn test -Pcoverage # - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then sonar-scanner; fi' # - bash <(curl -s https://codecov.io/bash) From fd077bd8f72dfacd8e4968f8ecb90e505137a4c3 Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Mon, 2 Mar 2020 08:32:35 +0100 Subject: [PATCH 06/57] change env for jobs --- .travis.yml | 49 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index 394ce1c0..0b85a748 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,29 +18,44 @@ addons: token: secure: $SONAR_TOKEN -env: - global: - - CAMEL_SPRINGBOOT_TRACING=false - - LOGGING_LEVEL_ROOT=info - - ANALYSIS_DATAINTEGRITY_LOG=false - jobs: - - TEST_PROFILE=unitTest MAVEN_PARAMS= - - TEST_PROFILE=endToEnd MAVEN_PARAMS='-Dtest=Case1EndToEndIT' - - TEST_PROFILE=endToEnd MAVEN_PARAMS='-Dtest=Case2EndToEndIT' sudo: required services: - - docker + - docker install: - cp ./configuration/settings.xml $HOME/.m2/settings.xml - - mvn install -P !fuse-fabric8-docker -DskipTests=true -Dmaven.javadoc.skip=true -B -V - -script: - - mvn test -P $TEST_PROFILE $MAVEN_PARAMS -# - mvn test -Pcoverage -# - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then sonar-scanner; fi' -# - bash <(curl -s https://codecov.io/bash) +jobs: + include: + - stage: Test + script: + - mvn test -Pcoverage + - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then sonar-scanner; fi' + - bash <(curl -s https://codecov.io/bash) + - stage: Test + env: + - CAMEL_SPRINGBOOT_TRACING=false + - LOGGING_LEVEL_ROOT=info + - ANALYSIS_DATAINTEGRITY_LOG=false + # Fix for https://travis-ci.community/t/problematic-docker-compose-version-1-23-1/5362/3 + before_install: + - docker-compose --version + - docker info + - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - + - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" + - sudo apt-get update + - sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce + - sudo rm /usr/local/bin/docker-compose + - curl -L https://github.com/docker/compose/releases/download/1.22.0/docker-compose-Linux-x86_64 > docker-compose + - chmod +x docker-compose + - sudo mv docker-compose /usr/local/bin + - docker-compose --version + - docker info + script: + - mvn test -PendToEnd + - stage: Release + script: + - echo Releasing From 274467553f68cf26bf088f4180c33934dde5aebf Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Mon, 2 Mar 2020 08:36:50 +0100 Subject: [PATCH 07/57] fix compilation error --- .../java/org/jboss/xavier/integrations/Case1EndToEndIT.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/org/jboss/xavier/integrations/Case1EndToEndIT.java b/src/test/java/org/jboss/xavier/integrations/Case1EndToEndIT.java index dee32e89..f9bf834d 100644 --- a/src/test/java/org/jboss/xavier/integrations/Case1EndToEndIT.java +++ b/src/test/java/org/jboss/xavier/integrations/Case1EndToEndIT.java @@ -437,7 +437,7 @@ public void configure() { softly.assertThat(workloadInventoryReport.getBody().getContent().stream().filter(e -> e.getOsName().contains("ServerNT") && e.getWorkloads().contains("Microsoft SQL Server")).count()).isEqualTo(1); }); - WorkloadInventoryReportModel[] workloadInventoryReportModelExpected = new ObjectMapper().readValue(IOUtils.resourceToString("cfme_inventory-20190912-demolab-withssa-workload-inventory-report.json", StandardCharsets.UTF_8, EndToEndTest.class.getClassLoader()), WorkloadInventoryReportModel[].class); + WorkloadInventoryReportModel[] workloadInventoryReportModelExpected = new ObjectMapper().readValue(IOUtils.resourceToString("cfme_inventory-20190912-demolab-withssa-workload-inventory-report.json", StandardCharsets.UTF_8, Case1EndToEndIT.class.getClassLoader()), WorkloadInventoryReportModel[].class); assertThat(workloadInventoryReport.getBody().getContent().toArray()) .usingRecursiveComparison() .ignoringFieldsMatchingRegexes(".*id.*", ".*creationDate.*") From 855132486245eed307ce79938adb37fc20022132 Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Mon, 2 Mar 2020 08:50:46 +0100 Subject: [PATCH 08/57] add global env var --- .travis.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0b85a748..80fcae6e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,6 +27,12 @@ services: install: - cp ./configuration/settings.xml $HOME/.m2/settings.xml +env: + global: + - CAMEL_SPRINGBOOT_TRACING=false + - LOGGING_LEVEL_ROOT=info + - ANALYSIS_DATAINTEGRITY_LOG=false + jobs: include: - stage: Test @@ -35,10 +41,6 @@ jobs: - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then sonar-scanner; fi' - bash <(curl -s https://codecov.io/bash) - stage: Test - env: - - CAMEL_SPRINGBOOT_TRACING=false - - LOGGING_LEVEL_ROOT=info - - ANALYSIS_DATAINTEGRITY_LOG=false # Fix for https://travis-ci.community/t/problematic-docker-compose-version-1-23-1/5362/3 before_install: - docker-compose --version From 5a7e00caa5e697543217a942998af726c9b0ad90 Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Mon, 2 Mar 2020 09:15:25 +0100 Subject: [PATCH 09/57] use envs and test logs limits --- .travis.yml | 46 ++++++++++++++-------------------------------- 1 file changed, 14 insertions(+), 32 deletions(-) diff --git a/.travis.yml b/.travis.yml index 80fcae6e..f25100a6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,6 +18,15 @@ addons: token: secure: $SONAR_TOKEN +env: +# global: +# - CAMEL_SPRINGBOOT_TRACING=false +# - LOGGING_LEVEL_ROOT=info +# - ANALYSIS_DATAINTEGRITY_LOG=false + jobs: + - TEST_PROFILE=unitTest MAVEN_PARAMS= + - TEST_PROFILE=endToEnd MAVEN_PARAMS='-Dtest=Case1EndToEndIT' + - TEST_PROFILE=endToEnd MAVEN_PARAMS='-Dtest=Case2EndToEndIT' sudo: required @@ -27,37 +36,10 @@ services: install: - cp ./configuration/settings.xml $HOME/.m2/settings.xml -env: - global: - - CAMEL_SPRINGBOOT_TRACING=false - - LOGGING_LEVEL_ROOT=info - - ANALYSIS_DATAINTEGRITY_LOG=false +script: + - mvn test -P $TEST_PROFILE $MAVEN_PARAMS +# - mvn test -Pcoverage +# - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then sonar-scanner; fi' +# - bash <(curl -s https://codecov.io/bash) -jobs: - include: - - stage: Test - script: - - mvn test -Pcoverage - - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then sonar-scanner; fi' - - bash <(curl -s https://codecov.io/bash) - - stage: Test - # Fix for https://travis-ci.community/t/problematic-docker-compose-version-1-23-1/5362/3 - before_install: - - docker-compose --version - - docker info - - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - - - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" - - sudo apt-get update - - sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce - - sudo rm /usr/local/bin/docker-compose - - curl -L https://github.com/docker/compose/releases/download/1.22.0/docker-compose-Linux-x86_64 > docker-compose - - chmod +x docker-compose - - sudo mv docker-compose /usr/local/bin - - docker-compose --version - - docker info - script: - - mvn test -PendToEnd - - stage: Release - script: - - echo Releasing From b4eb855d63b76c11dc3b6d85ce95e379a2a9b909 Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Tue, 3 Mar 2020 13:53:40 +0100 Subject: [PATCH 10/57] first draft --- .github/workflows/ci-actions.yml | 148 +++++++++++++++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 .github/workflows/ci-actions.yml diff --git a/.github/workflows/ci-actions.yml b/.github/workflows/ci-actions.yml new file mode 100644 index 00000000..2345619a --- /dev/null +++ b/.github/workflows/ci-actions.yml @@ -0,0 +1,148 @@ +name: Xavier Integration CI + +on: + push: + branches-ignore: + - 'dependabot/**' + paths-ignore: + - 'README.md' + - '.dependabot/**' + pull_request: + types: [assigned, opened, synchronize, reopened, ready_for_review, edited] + paths-ignore: + - 'README.md' +env: + # Workaround testsuite locale issue + LANG: en_US.UTF-8 + JVM_TEST_MAVEN_OPTS: "-e -B --settings configuration/settings.xml" +jobs: + build-jdk8: + name: "JDK 8 Build" + runs-on: ubuntu-latest + # Skip draft PRs and those with WIP in the subject, rerun as soon as its removed + if: "github.event_name != 'pull_request' || ( \ + github.event.pull_request.draft == false && \ + github.event.pull_request.state != 'closed' && \ + contains(github.event.pull_request.title, 'wip ') == false && \ + contains(github.event.pull_request.title, '[wip]') == false && \ + ( + github.event.action != 'edited' || \ + contains(github.event.changes.title.from, 'wip ') || \ + contains(github.event.changes.title.from, '[wip]') \ + ) \ + )" + steps: + - uses: actions/checkout@v2 + - uses: n1hility/cancel-previous-runs@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + - name: Set up JDK 8 + # Uses sha for added security since tags can be updated + uses: joschi/setup-jdk@7134ae95986e4e0a4f9f0b51345c93fcebfc4ea9 + with: + java-version: openjdk8 + - name: Compute cache restore key + # Always recompute on a push so that the maven repo doesnt grow indefinitely with old versions + run: | + if ${{ github.event_name == 'pull_request' }}; then echo "::set-env name=COMPUTED_RESTORE_KEY::q2maven-"; fi + - name: Cache Maven Repository + id: cache-maven + uses: n1hility/cache@v2 + with: + path: ~/.m2/repository + # Improves the reusability of the cache to limit key changes + key: q2maven-${{ hashFiles('pom.xml') }} + restore-keys: ${{ env.COMPUTED_RESTORE_KEY }} + restore-only: ${{ github.event_name == 'pull_request' }} + - name: Build + run: | + mvn -e -B -DskipTests=true -Dno-format -DskipDocs clean install + - name: Tar Maven Repo + shell: bash + run: tar -czvf maven-repo.tgz -C ~ .m2/repository + - name: Persist Maven Repo + uses: actions/upload-artifact@v1 + with: + name: maven-repo + path: maven-repo.tgz + - name: Cleanup Cache + shell: bash + run: | + find ~/.m2/repositoiry/org/jboss/xavier/ -mindepth 1 -maxdepth 1 \( ! -name http -a ! -name gizmo -a ! -name security \) -exec echo {} \; -exec rm -rf {} \; || true + linux-jvm-tests: + name: JDK ${{matrix.java-version}} JVM Tests + needs: build-jdk8 + timeout-minutes: 120 + strategy: + fail-fast: ${{ github.repository == 'project-xavier/xavier-integration' }} + matrix: + java-version: [8, 11, 12] + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up JDK ${{ matrix.java-version }} + # Uses sha for added security since tags can be updated + uses: joschi/setup-jdk@7134ae95986e4e0a4f9f0b51345c93fcebfc4ea9 + with: + java-version: openjdk${{ matrix.java-version }} + - name: Download Maven Repo + uses: actions/download-artifact@v1 + with: + name: maven-repo + path: . + - name: Extract Maven Repo + shell: bash + run: tar -xzvf maven-repo.tgz -C ~ + - name: Build with Maven + run: eval mvn $JVM_TEST_MAVEN_OPTS install + - name: Prepare failure archive (if maven failed) + if: failure() + shell: bash + run: find . -name '*-reports' -type d | tar -czvf test-reports.tgz -T - + - name: Upload failure Archive (if maven failed) + uses: actions/upload-artifact@v1 + if: failure() + with: + name: test-reports-linux-jvm${{matrix.java-version}} + path: 'test-reports.tgz' + + windows-jdk8-jvm-tests: + name: Windows JDK 8 JVM Tests + needs: build-jdk8 + runs-on: windows-latest + timeout-minutes: 120 + env: + MAVEN_OPTS: -Xmx1408m + + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 1.8 + # Uses sha for added security since tags can be updated + uses: joschi/setup-jdk@7134ae95986e4e0a4f9f0b51345c93fcebfc4ea9 + with: + java-version: openjdk8 + - name: Download Maven Repo + uses: actions/download-artifact@v1 + with: + name: maven-repo + path: . + - name: Extract Maven Repo + shell: bash + run: tar -xzvf maven-repo.tgz -C ~ + - name: Build with Maven + shell: bash + run: mvn -B --settings azure-mvn-settings.xml -Dno-native -Dno-format install + - name: Prepare failure archive (if maven failed) + if: failure() + shell: bash + run: | + # Disambiguate windows find from cygwin find + /usr/bin/find . -name '*-reports' -type d | tar -czvf test-reports.tgz -T - + - name: Upload failure Archive (if maven failed) + uses: actions/upload-artifact@v1 + if: failure() + with: + name: test-reports-windows-jdk8-jvm + path: 'test-reports.tgz' From d94a5071221f0f2bd1a8b06c418527a9e13098d8 Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Tue, 3 Mar 2020 14:01:29 +0100 Subject: [PATCH 11/57] add settings.xml --- .github/workflows/ci-actions.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-actions.yml b/.github/workflows/ci-actions.yml index 2345619a..53583995 100644 --- a/.github/workflows/ci-actions.yml +++ b/.github/workflows/ci-actions.yml @@ -56,7 +56,7 @@ jobs: restore-only: ${{ github.event_name == 'pull_request' }} - name: Build run: | - mvn -e -B -DskipTests=true -Dno-format -DskipDocs clean install + mvn -e -B -DskipTests=true -DskipDocs --settings configuration/settings.xml clean install - name: Tar Maven Repo shell: bash run: tar -czvf maven-repo.tgz -C ~ .m2/repository @@ -133,7 +133,7 @@ jobs: run: tar -xzvf maven-repo.tgz -C ~ - name: Build with Maven shell: bash - run: mvn -B --settings azure-mvn-settings.xml -Dno-native -Dno-format install + run: mvn -B --settings configuration/settings.xml install - name: Prepare failure archive (if maven failed) if: failure() shell: bash From cd76da1b197d69c78e3c2bb70f225535ef528c4e Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Tue, 3 Mar 2020 14:10:54 +0100 Subject: [PATCH 12/57] add settings.xml --- .github/workflows/ci-actions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-actions.yml b/.github/workflows/ci-actions.yml index 53583995..e583c068 100644 --- a/.github/workflows/ci-actions.yml +++ b/.github/workflows/ci-actions.yml @@ -56,7 +56,7 @@ jobs: restore-only: ${{ github.event_name == 'pull_request' }} - name: Build run: | - mvn -e -B -DskipTests=true -DskipDocs --settings configuration/settings.xml clean install + mvn -e -B -DskipTests=true -DskipDocs -P !fuse-fabric8-docker --settings configuration/settings.xml clean install - name: Tar Maven Repo shell: bash run: tar -czvf maven-repo.tgz -C ~ .m2/repository From 947c79f52d73e2bec47930c68f70fc41e50eaa7b Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Tue, 3 Mar 2020 15:22:11 +0100 Subject: [PATCH 13/57] omit fuse profile --- .github/workflows/ci-actions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-actions.yml b/.github/workflows/ci-actions.yml index e583c068..de79f572 100644 --- a/.github/workflows/ci-actions.yml +++ b/.github/workflows/ci-actions.yml @@ -14,7 +14,7 @@ on: env: # Workaround testsuite locale issue LANG: en_US.UTF-8 - JVM_TEST_MAVEN_OPTS: "-e -B --settings configuration/settings.xml" + JVM_TEST_MAVEN_OPTS: "-e -B -P !fuse-fabric8-docker --settings configuration/settings.xml" jobs: build-jdk8: name: "JDK 8 Build" From 79cabd115576c434f78d8e41a6423ad4a69f6be7 Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Wed, 4 Mar 2020 13:26:21 +0100 Subject: [PATCH 14/57] add github actions --- .github/workflows/ci-actions.yml | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci-actions.yml b/.github/workflows/ci-actions.yml index de79f572..9035f504 100644 --- a/.github/workflows/ci-actions.yml +++ b/.github/workflows/ci-actions.yml @@ -108,13 +108,15 @@ jobs: name: test-reports-linux-jvm${{matrix.java-version}} path: 'test-reports.tgz' - windows-jdk8-jvm-tests: - name: Windows JDK 8 JVM Tests + linux-jdk8-jvm-end2end-tests: + name: JDK 8 JVM ${{matrix.class-name}} Test needs: build-jdk8 - runs-on: windows-latest timeout-minutes: 120 - env: - MAVEN_OPTS: -Xmx1408m + strategy: + fail-fast: ${{ github.repository == 'project-xavier/xavier-integration' }} + matrix: + class-name: [Case1EndToEndIT, Case2EndToEndIT] + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -132,17 +134,14 @@ jobs: shell: bash run: tar -xzvf maven-repo.tgz -C ~ - name: Build with Maven - shell: bash - run: mvn -B --settings configuration/settings.xml install + run: eval mvn $JVM_TEST_MAVEN_OPTS -Dtest=${{ matrix.class-name }} test - name: Prepare failure archive (if maven failed) if: failure() shell: bash - run: | - # Disambiguate windows find from cygwin find - /usr/bin/find . -name '*-reports' -type d | tar -czvf test-reports.tgz -T - + run: find . -name '*-reports' -type d | tar -czvf test-reports.tgz -T - - name: Upload failure Archive (if maven failed) uses: actions/upload-artifact@v1 if: failure() with: - name: test-reports-windows-jdk8-jvm + name: test-reports-linux-jvm-${{matrix.class-name}} path: 'test-reports.tgz' From 2789e8466a7bc3aacf57aeff3b83cf9e734ff509 Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Mon, 9 Mar 2020 16:31:48 +0100 Subject: [PATCH 15/57] simplify actions --- .github/workflows/ci-actions.yml | 89 ++++---------------------------- pom.xml | 1 + 2 files changed, 10 insertions(+), 80 deletions(-) diff --git a/.github/workflows/ci-actions.yml b/.github/workflows/ci-actions.yml index 9035f504..f7b097d2 100644 --- a/.github/workflows/ci-actions.yml +++ b/.github/workflows/ci-actions.yml @@ -12,91 +12,28 @@ on: paths-ignore: - 'README.md' env: - # Workaround testsuite locale issue - LANG: en_US.UTF-8 JVM_TEST_MAVEN_OPTS: "-e -B -P !fuse-fabric8-docker --settings configuration/settings.xml" + jobs: - build-jdk8: - name: "JDK 8 Build" - runs-on: ubuntu-latest - # Skip draft PRs and those with WIP in the subject, rerun as soon as its removed - if: "github.event_name != 'pull_request' || ( \ - github.event.pull_request.draft == false && \ - github.event.pull_request.state != 'closed' && \ - contains(github.event.pull_request.title, 'wip ') == false && \ - contains(github.event.pull_request.title, '[wip]') == false && \ - ( - github.event.action != 'edited' || \ - contains(github.event.changes.title.from, 'wip ') || \ - contains(github.event.changes.title.from, '[wip]') \ - ) \ - )" - steps: - - uses: actions/checkout@v2 - - uses: n1hility/cancel-previous-runs@v2 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - name: Set up JDK 8 - # Uses sha for added security since tags can be updated - uses: joschi/setup-jdk@7134ae95986e4e0a4f9f0b51345c93fcebfc4ea9 - with: - java-version: openjdk8 - - name: Compute cache restore key - # Always recompute on a push so that the maven repo doesnt grow indefinitely with old versions - run: | - if ${{ github.event_name == 'pull_request' }}; then echo "::set-env name=COMPUTED_RESTORE_KEY::q2maven-"; fi - - name: Cache Maven Repository - id: cache-maven - uses: n1hility/cache@v2 - with: - path: ~/.m2/repository - # Improves the reusability of the cache to limit key changes - key: q2maven-${{ hashFiles('pom.xml') }} - restore-keys: ${{ env.COMPUTED_RESTORE_KEY }} - restore-only: ${{ github.event_name == 'pull_request' }} - - name: Build - run: | - mvn -e -B -DskipTests=true -DskipDocs -P !fuse-fabric8-docker --settings configuration/settings.xml clean install - - name: Tar Maven Repo - shell: bash - run: tar -czvf maven-repo.tgz -C ~ .m2/repository - - name: Persist Maven Repo - uses: actions/upload-artifact@v1 - with: - name: maven-repo - path: maven-repo.tgz - - name: Cleanup Cache - shell: bash - run: | - find ~/.m2/repositoiry/org/jboss/xavier/ -mindepth 1 -maxdepth 1 \( ! -name http -a ! -name gizmo -a ! -name security \) -exec echo {} \; -exec rm -rf {} \; || true linux-jvm-tests: - name: JDK ${{matrix.java-version}} JVM Tests + name: JDK 8 JVM Tests needs: build-jdk8 timeout-minutes: 120 - strategy: - fail-fast: ${{ github.repository == 'project-xavier/xavier-integration' }} - matrix: - java-version: [8, 11, 12] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Set up JDK ${{ matrix.java-version }} + - name: Set up JDK 8 # Uses sha for added security since tags can be updated uses: joschi/setup-jdk@7134ae95986e4e0a4f9f0b51345c93fcebfc4ea9 with: - java-version: openjdk${{ matrix.java-version }} - - name: Download Maven Repo - uses: actions/download-artifact@v1 - with: - name: maven-repo - path: . - - name: Extract Maven Repo - shell: bash - run: tar -xzvf maven-repo.tgz -C ~ + java-version: openjdk8 - name: Build with Maven - run: eval mvn $JVM_TEST_MAVEN_OPTS install + run: eval mvn $JVM_TEST_MAVEN_OPTS verify + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - name: Prepare failure archive (if maven failed) if: failure() shell: bash @@ -105,7 +42,7 @@ jobs: uses: actions/upload-artifact@v1 if: failure() with: - name: test-reports-linux-jvm${{matrix.java-version}} + name: test-reports-linux-jvm8 path: 'test-reports.tgz' linux-jdk8-jvm-end2end-tests: @@ -125,14 +62,6 @@ jobs: uses: joschi/setup-jdk@7134ae95986e4e0a4f9f0b51345c93fcebfc4ea9 with: java-version: openjdk8 - - name: Download Maven Repo - uses: actions/download-artifact@v1 - with: - name: maven-repo - path: . - - name: Extract Maven Repo - shell: bash - run: tar -xzvf maven-repo.tgz -C ~ - name: Build with Maven run: eval mvn $JVM_TEST_MAVEN_OPTS -Dtest=${{ matrix.class-name }} test - name: Prepare failure archive (if maven failed) diff --git a/pom.xml b/pom.xml index 6b9a3706..b6e9d1ce 100644 --- a/pom.xml +++ b/pom.xml @@ -346,6 +346,7 @@ https://sonarcloud.io project-xavier project-xavier_xavier-integration + Xavier Integration From c0fa866b038309865e17b6565a89d60850740ba9 Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Mon, 9 Mar 2020 16:36:06 +0100 Subject: [PATCH 16/57] remove needs --- .github/workflows/ci-actions.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci-actions.yml b/.github/workflows/ci-actions.yml index f7b097d2..3411de90 100644 --- a/.github/workflows/ci-actions.yml +++ b/.github/workflows/ci-actions.yml @@ -17,7 +17,6 @@ env: jobs: linux-jvm-tests: name: JDK 8 JVM Tests - needs: build-jdk8 timeout-minutes: 120 runs-on: ubuntu-latest @@ -47,7 +46,6 @@ jobs: linux-jdk8-jvm-end2end-tests: name: JDK 8 JVM ${{matrix.class-name}} Test - needs: build-jdk8 timeout-minutes: 120 strategy: fail-fast: ${{ github.repository == 'project-xavier/xavier-integration' }} From b00f810be1fb7272f2d6bcd62d6ecea48279249d Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Mon, 9 Mar 2020 16:58:56 +0100 Subject: [PATCH 17/57] ignore tests --- .github/workflows/ci-actions.yml | 2 +- pom.xml | 2 +- .../jpa/service/AnalysisServiceTest.java | 3 ++- .../jpa/service/FlagServiceTest.java | 3 ++- ...ialSavingsEstimationReportServiceTest.java | 3 ++- .../jpa/service/UserServiceTest.java | 5 ++-- .../WorkloadInventoryReportServiceTest.java | 3 ++- .../jpa/service/WorkloadServiceTest.java | 3 ++- .../WorkloadSummaryReportServiceTest.java | 3 ++- .../FlagSharedDisksCalculatorTest.java | 3 ++- .../business/ParamsCalculatorTest.java | 3 ++- .../VMWorkloadInventoryCalculatorTest.java | 3 ++- .../ManifestVersionServiceTest.java | 3 ++- ...teBuilder_DirectAddUsernameHeaderTest.java | 3 ++- ...er_DirectCalculateFlagSharedDisksTest.java | 3 ++- .../MainRouteBuilder_DirectCalculateTest.java | 3 ++- ...irectCalculateVMWorkloadInventoryTest.java | 3 ++- .../MainRouteBuilder_DirectInsightsTest.java | 3 ++- ...eBuilder_DirectStoreAnalysisModelTest.java | 3 ++- .../MainRouteBuilder_DirectStoreTest.java | 3 ++- .../MainRouteBuilder_DirectUnzipFileTest.java | 3 ++- .../MainRouteBuilder_DirectUploadTest.java | 3 ++- ...teBuilder_DirectWorkloadInventoryTest.java | 3 ++- .../route/MainRouteBuilder_GetRHIdentity.java | 3 ++- .../route/MainRouteBuilder_KafkaTest.java | 3 ++- .../MainRouteBuilder_RestUploadTest.java | 5 ++-- .../route/MainRouteBuilder_S3Test.java | 2 +- .../MainRouteBuilder_SedaDownloadTest.java | 3 ++- ...BeanRouter_DirectToPaginationBeanTest.java | 3 ++- .../ToBeanRouter_DirectToSortBeanTest.java | 3 ++- ...DirectWorkloadInventoryFilterBeanTest.java | 3 ++- ...CalculateVMWorkloadInventoryModelTest.java | 3 ++- .../integrations/route/XavierCamelTest.java | 3 ++- .../XmlRoutes_DirectDecisionServerTest.java | 3 ++- .../route/XmlRoutes_InterceptorTest.java | 3 ++- .../route/XmlRoutes_RestMappingTest.java | 3 ++- .../route/XmlRoutes_RestReportTest.java | 3 ++- .../route/XmlRoutes_RestUserTest.java | 3 ++- .../route/XmlRoutes_RouteMaTest.java | 3 ++- .../CustomizedMultipartDataFormatTest.java | 23 ++++++++++--------- 40 files changed, 89 insertions(+), 52 deletions(-) diff --git a/.github/workflows/ci-actions.yml b/.github/workflows/ci-actions.yml index 3411de90..cf53992b 100644 --- a/.github/workflows/ci-actions.yml +++ b/.github/workflows/ci-actions.yml @@ -29,7 +29,7 @@ jobs: with: java-version: openjdk8 - name: Build with Maven - run: eval mvn $JVM_TEST_MAVEN_OPTS verify + run: eval mvn $JVM_TEST_MAVEN_OPTS verify -Pcoverage env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/pom.xml b/pom.xml index b6e9d1ce..76fa81e2 100644 --- a/pom.xml +++ b/pom.xml @@ -344,7 +344,7 @@ coverage https://sonarcloud.io - project-xavier + carlosthe19916 project-xavier_xavier-integration Xavier Integration diff --git a/src/test/java/org/jboss/xavier/integrations/jpa/service/AnalysisServiceTest.java b/src/test/java/org/jboss/xavier/integrations/jpa/service/AnalysisServiceTest.java index df92d8d8..704c80dd 100644 --- a/src/test/java/org/jboss/xavier/integrations/jpa/service/AnalysisServiceTest.java +++ b/src/test/java/org/jboss/xavier/integrations/jpa/service/AnalysisServiceTest.java @@ -4,6 +4,7 @@ import org.apache.camel.test.spring.UseAdviceWith; import org.jboss.xavier.Application; import org.jboss.xavier.analytics.pojo.output.AnalysisModel; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; @@ -14,7 +15,7 @@ import static org.assertj.core.api.Java6Assertions.assertThat; - +@Ignore @RunWith(CamelSpringBootRunner.class) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @SpringBootTest(classes = {Application.class}) diff --git a/src/test/java/org/jboss/xavier/integrations/jpa/service/FlagServiceTest.java b/src/test/java/org/jboss/xavier/integrations/jpa/service/FlagServiceTest.java index 7e84b979..6ed4451f 100644 --- a/src/test/java/org/jboss/xavier/integrations/jpa/service/FlagServiceTest.java +++ b/src/test/java/org/jboss/xavier/integrations/jpa/service/FlagServiceTest.java @@ -9,6 +9,7 @@ import org.jboss.xavier.analytics.pojo.output.workload.summary.WorkloadSummaryReportModel; import org.jboss.xavier.integrations.route.model.PageBean; import org.jboss.xavier.integrations.route.model.SortBean; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; @@ -21,7 +22,7 @@ import static org.assertj.core.api.Java6Assertions.assertThat; - +@Ignore @RunWith(CamelSpringBootRunner.class) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @SpringBootTest(classes = {Application.class}) diff --git a/src/test/java/org/jboss/xavier/integrations/jpa/service/InitialSavingsEstimationReportServiceTest.java b/src/test/java/org/jboss/xavier/integrations/jpa/service/InitialSavingsEstimationReportServiceTest.java index 4f73d28d..455290d6 100644 --- a/src/test/java/org/jboss/xavier/integrations/jpa/service/InitialSavingsEstimationReportServiceTest.java +++ b/src/test/java/org/jboss/xavier/integrations/jpa/service/InitialSavingsEstimationReportServiceTest.java @@ -5,6 +5,7 @@ import org.jboss.xavier.Application; import org.jboss.xavier.analytics.pojo.output.AnalysisModel; import org.jboss.xavier.analytics.pojo.output.InitialSavingsEstimationReportModel; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; @@ -17,7 +18,7 @@ import static org.assertj.core.api.Java6Assertions.assertThat; - +@Ignore @RunWith(CamelSpringBootRunner.class) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @SpringBootTest(classes = {Application.class}) diff --git a/src/test/java/org/jboss/xavier/integrations/jpa/service/UserServiceTest.java b/src/test/java/org/jboss/xavier/integrations/jpa/service/UserServiceTest.java index 1929c45c..2748395e 100644 --- a/src/test/java/org/jboss/xavier/integrations/jpa/service/UserServiceTest.java +++ b/src/test/java/org/jboss/xavier/integrations/jpa/service/UserServiceTest.java @@ -3,6 +3,7 @@ import org.apache.camel.test.spring.CamelSpringBootRunner; import org.apache.camel.test.spring.UseAdviceWith; import org.jboss.xavier.Application; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; @@ -14,7 +15,7 @@ import static org.assertj.core.api.Java6Assertions.assertThat; - +@Ignore @RunWith(CamelSpringBootRunner.class) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @SpringBootTest(classes = {Application.class}) @@ -44,7 +45,7 @@ public void userService_AuthorizedUsersEmpty_ShouldReturnNotAllowed() { ReflectionTestUtils.setField(userService, "authorizedAdminUsers", new String[0]); assertThat(userService.isUserAllowedToAdministratorResources("myUsername")).isEqualTo(false); } - + @Test public void userService_AuthorizedUsersGiven_ShouldReturnAllowedOrNot() { assertThat(userService.isUserAllowedToAdministratorResources("admin1")).isEqualTo(true); diff --git a/src/test/java/org/jboss/xavier/integrations/jpa/service/WorkloadInventoryReportServiceTest.java b/src/test/java/org/jboss/xavier/integrations/jpa/service/WorkloadInventoryReportServiceTest.java index e6c572a9..e5f106e1 100644 --- a/src/test/java/org/jboss/xavier/integrations/jpa/service/WorkloadInventoryReportServiceTest.java +++ b/src/test/java/org/jboss/xavier/integrations/jpa/service/WorkloadInventoryReportServiceTest.java @@ -8,6 +8,7 @@ import org.jboss.xavier.integrations.route.model.PageBean; import org.jboss.xavier.integrations.route.model.SortBean; import org.jboss.xavier.integrations.route.model.WorkloadInventoryFilterBean; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; @@ -26,7 +27,7 @@ import static org.assertj.core.api.Java6Assertions.assertThat; - +@Ignore @RunWith(CamelSpringBootRunner.class) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @SpringBootTest(classes = {Application.class}) diff --git a/src/test/java/org/jboss/xavier/integrations/jpa/service/WorkloadServiceTest.java b/src/test/java/org/jboss/xavier/integrations/jpa/service/WorkloadServiceTest.java index 3371663c..8b24ac2b 100644 --- a/src/test/java/org/jboss/xavier/integrations/jpa/service/WorkloadServiceTest.java +++ b/src/test/java/org/jboss/xavier/integrations/jpa/service/WorkloadServiceTest.java @@ -8,6 +8,7 @@ import org.jboss.xavier.analytics.pojo.output.workload.summary.WorkloadSummaryReportModel; import org.jboss.xavier.integrations.route.model.PageBean; import org.jboss.xavier.integrations.route.model.SortBean; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; @@ -21,7 +22,7 @@ import static org.assertj.core.api.Java6Assertions.assertThat; - +@Ignore @RunWith(CamelSpringBootRunner.class) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @SpringBootTest(classes = {Application.class}) diff --git a/src/test/java/org/jboss/xavier/integrations/jpa/service/WorkloadSummaryReportServiceTest.java b/src/test/java/org/jboss/xavier/integrations/jpa/service/WorkloadSummaryReportServiceTest.java index f0a9011f..cfc48ef2 100644 --- a/src/test/java/org/jboss/xavier/integrations/jpa/service/WorkloadSummaryReportServiceTest.java +++ b/src/test/java/org/jboss/xavier/integrations/jpa/service/WorkloadSummaryReportServiceTest.java @@ -6,6 +6,7 @@ import org.jboss.xavier.analytics.pojo.output.AnalysisModel; import org.jboss.xavier.analytics.pojo.output.InitialSavingsEstimationReportModel; import org.jboss.xavier.analytics.pojo.output.workload.summary.WorkloadSummaryReportModel; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; @@ -17,7 +18,7 @@ import static org.assertj.core.api.Java6Assertions.assertThat; - +@Ignore @RunWith(CamelSpringBootRunner.class) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @SpringBootTest(classes = {Application.class}) diff --git a/src/test/java/org/jboss/xavier/integrations/migrationanalytics/business/FlagSharedDisksCalculatorTest.java b/src/test/java/org/jboss/xavier/integrations/migrationanalytics/business/FlagSharedDisksCalculatorTest.java index 0d791b4f..75974da4 100644 --- a/src/test/java/org/jboss/xavier/integrations/migrationanalytics/business/FlagSharedDisksCalculatorTest.java +++ b/src/test/java/org/jboss/xavier/integrations/migrationanalytics/business/FlagSharedDisksCalculatorTest.java @@ -5,6 +5,7 @@ import org.apache.commons.io.IOUtils; import org.jboss.xavier.Application; import org.jboss.xavier.integrations.route.RouteBuilderExceptionHandler; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; @@ -20,7 +21,7 @@ import java.util.Set; import static org.assertj.core.api.Assertions.assertThat; - +@Ignore @RunWith(CamelSpringBootRunner.class) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @SpringBootTest(classes = {Application.class}) diff --git a/src/test/java/org/jboss/xavier/integrations/migrationanalytics/business/ParamsCalculatorTest.java b/src/test/java/org/jboss/xavier/integrations/migrationanalytics/business/ParamsCalculatorTest.java index 3c115a1b..3aa8e7a5 100644 --- a/src/test/java/org/jboss/xavier/integrations/migrationanalytics/business/ParamsCalculatorTest.java +++ b/src/test/java/org/jboss/xavier/integrations/migrationanalytics/business/ParamsCalculatorTest.java @@ -6,6 +6,7 @@ import org.jboss.xavier.Application; import org.jboss.xavier.analytics.pojo.input.UploadFormInputDataModel; import org.jboss.xavier.integrations.route.RouteBuilderExceptionHandler; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; @@ -21,7 +22,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Mockito.doReturn; - +@Ignore @RunWith(CamelSpringBootRunner.class) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @SpringBootTest(classes = {Application.class}) diff --git a/src/test/java/org/jboss/xavier/integrations/migrationanalytics/business/VMWorkloadInventoryCalculatorTest.java b/src/test/java/org/jboss/xavier/integrations/migrationanalytics/business/VMWorkloadInventoryCalculatorTest.java index 6646f05b..21396a29 100644 --- a/src/test/java/org/jboss/xavier/integrations/migrationanalytics/business/VMWorkloadInventoryCalculatorTest.java +++ b/src/test/java/org/jboss/xavier/integrations/migrationanalytics/business/VMWorkloadInventoryCalculatorTest.java @@ -6,6 +6,7 @@ import org.jboss.xavier.Application; import org.jboss.xavier.analytics.pojo.input.workload.inventory.VMWorkloadInventoryModel; import org.jboss.xavier.integrations.route.RouteBuilderExceptionHandler; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; @@ -24,7 +25,7 @@ import java.util.Map; import static org.assertj.core.api.Assertions.assertThat; - +@Ignore @RunWith(CamelSpringBootRunner.class) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @SpringBootTest(classes = {Application.class}) diff --git a/src/test/java/org/jboss/xavier/integrations/migrationanalytics/business/versioning/ManifestVersionServiceTest.java b/src/test/java/org/jboss/xavier/integrations/migrationanalytics/business/versioning/ManifestVersionServiceTest.java index 0f311b4b..cc252288 100644 --- a/src/test/java/org/jboss/xavier/integrations/migrationanalytics/business/versioning/ManifestVersionServiceTest.java +++ b/src/test/java/org/jboss/xavier/integrations/migrationanalytics/business/versioning/ManifestVersionServiceTest.java @@ -3,6 +3,7 @@ import org.apache.camel.test.spring.CamelSpringBootRunner; import org.apache.camel.test.spring.UseAdviceWith; import org.jboss.xavier.Application; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; @@ -14,7 +15,7 @@ import java.util.Map; import static org.assertj.core.api.Java6Assertions.assertThat; - +@Ignore @RunWith(CamelSpringBootRunner.class) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @SpringBootTest(classes = {Application.class}) diff --git a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectAddUsernameHeaderTest.java b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectAddUsernameHeaderTest.java index c7f1ff69..30511121 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectAddUsernameHeaderTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectAddUsernameHeaderTest.java @@ -1,6 +1,7 @@ package org.jboss.xavier.integrations.route; import org.apache.camel.Exchange; +import org.junit.Ignore; import org.junit.Test; import java.util.Base64; @@ -8,7 +9,7 @@ import java.util.Map; import static org.assertj.core.api.Java6Assertions.assertThat; - +@Ignore public class MainRouteBuilder_DirectAddUsernameHeaderTest extends XavierCamelTest { @Test diff --git a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectCalculateFlagSharedDisksTest.java b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectCalculateFlagSharedDisksTest.java index 1bc59253..db90b626 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectCalculateFlagSharedDisksTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectCalculateFlagSharedDisksTest.java @@ -7,6 +7,7 @@ import org.jboss.xavier.analytics.pojo.output.workload.inventory.WorkloadInventoryReportModel; import org.jboss.xavier.integrations.jpa.service.AnalysisService; import org.jboss.xavier.integrations.jpa.service.WorkloadInventoryReportService; +import org.junit.Ignore; import org.junit.Test; import org.springframework.boot.test.mock.mockito.MockBean; @@ -22,7 +23,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; - +@Ignore public class MainRouteBuilder_DirectCalculateFlagSharedDisksTest extends XavierCamelTest { @Inject AnalysisService analysisService; diff --git a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectCalculateTest.java b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectCalculateTest.java index 40c479ed..bb691373 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectCalculateTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectCalculateTest.java @@ -10,6 +10,7 @@ import org.jboss.xavier.analytics.pojo.output.AnalysisModel; import org.jboss.xavier.integrations.jpa.service.AnalysisService; import org.jboss.xavier.integrations.migrationanalytics.business.Calculator; +import org.junit.Ignore; import org.junit.Test; import javax.inject.Inject; @@ -19,7 +20,7 @@ import static org.assertj.core.api.Assertions.assertThat; - +@Ignore @MockEndpointsAndSkip("jms:queue:uploadFormInputDataModel|direct:vm-workload-inventory|direct:calculate-workloadsummaryreportmodel|direct:flags-shared-disks") public class MainRouteBuilder_DirectCalculateTest extends XavierCamelTest { @Inject diff --git a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectCalculateVMWorkloadInventoryTest.java b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectCalculateVMWorkloadInventoryTest.java index c7908c82..565bd31f 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectCalculateVMWorkloadInventoryTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectCalculateVMWorkloadInventoryTest.java @@ -7,6 +7,7 @@ import org.jboss.xavier.analytics.pojo.input.workload.inventory.VMWorkloadInventoryModel; import org.jboss.xavier.analytics.pojo.output.AnalysisModel; import org.jboss.xavier.integrations.jpa.service.AnalysisService; +import org.junit.Ignore; import org.junit.Test; import javax.inject.Inject; @@ -19,7 +20,7 @@ import static org.assertj.core.api.Assertions.assertThat; - +@Ignore @MockEndpointsAndSkip("direct:vm-workload-inventory") public class MainRouteBuilder_DirectCalculateVMWorkloadInventoryTest extends XavierCamelTest { @Inject diff --git a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectInsightsTest.java b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectInsightsTest.java index e5445ad1..3fb561ae 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectInsightsTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectInsightsTest.java @@ -9,6 +9,7 @@ import org.apache.http.HttpEntity; import org.jboss.xavier.analytics.pojo.output.AnalysisModel; import org.jboss.xavier.integrations.jpa.service.AnalysisService; +import org.junit.Ignore; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -20,7 +21,7 @@ import static org.assertj.core.api.Assertions.assertThat; - +@Ignore @MockEndpointsAndSkip("http4:{{insights.upload.host}}/api/ingress/v1/upload") public class MainRouteBuilder_DirectInsightsTest extends XavierCamelTest { @EndpointInject(uri = "mock:http4:{{insights.upload.host}}/api/ingress/v1/upload") diff --git a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectStoreAnalysisModelTest.java b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectStoreAnalysisModelTest.java index 880d2ca8..38e9314f 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectStoreAnalysisModelTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectStoreAnalysisModelTest.java @@ -6,6 +6,7 @@ import org.apache.camel.test.spring.MockEndpointsAndSkip; import org.jboss.xavier.analytics.pojo.output.AnalysisModel; import org.jboss.xavier.integrations.jpa.repository.AnalysisRepository; +import org.junit.Ignore; import org.junit.Test; import javax.inject.Inject; @@ -15,7 +16,7 @@ import static org.assertj.core.api.Java6Assertions.assertThat; - +@Ignore @MockEndpointsAndSkip("direct:insights|file:*") public class MainRouteBuilder_DirectStoreAnalysisModelTest extends XavierCamelTest { diff --git a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectStoreTest.java b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectStoreTest.java index 43e0b7e5..07e4c7b2 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectStoreTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectStoreTest.java @@ -4,8 +4,9 @@ import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.test.spring.MockEndpointsAndSkip; import org.apache.commons.io.IOUtils; +import org.junit.Ignore; import org.junit.Test; - +@Ignore @MockEndpointsAndSkip("direct:insights|file:*|direct:analysis-model") public class MainRouteBuilder_DirectStoreTest extends XavierCamelTest { @EndpointInject(uri = "mock:direct:insights") diff --git a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectUnzipFileTest.java b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectUnzipFileTest.java index 6f171307..31be36ec 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectUnzipFileTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectUnzipFileTest.java @@ -7,6 +7,7 @@ import org.jboss.xavier.analytics.pojo.output.AnalysisModel; import org.jboss.xavier.integrations.jpa.service.AnalysisService; import org.jboss.xavier.integrations.migrationanalytics.business.Calculator; +import org.junit.Ignore; import org.junit.Test; import org.springframework.beans.factory.annotation.Value; @@ -15,7 +16,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; - +@Ignore @MockEndpointsAndSkip("jms:queue:uploadFormInputDataModel|direct:send-costsavings|direct:calculate-vmworkloadinventory|direct:vm-workload-inventory|direct:calculate-workloadsummaryreportmodel|direct:flags-shared-disks") public class MainRouteBuilder_DirectUnzipFileTest extends XavierCamelTest { diff --git a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectUploadTest.java b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectUploadTest.java index 15e69132..257ea848 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectUploadTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectUploadTest.java @@ -5,6 +5,7 @@ import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.test.spring.MockEndpointsAndSkip; import org.apache.commons.io.IOUtils; +import org.junit.Ignore; import org.junit.Test; import org.springframework.beans.factory.annotation.Value; @@ -18,7 +19,7 @@ import java.util.Map; import static org.assertj.core.api.Assertions.assertThat; - +@Ignore @MockEndpointsAndSkip("direct:store") public class MainRouteBuilder_DirectUploadTest extends XavierCamelTest { @EndpointInject(uri = "mock:direct:store") diff --git a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectWorkloadInventoryTest.java b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectWorkloadInventoryTest.java index d3165bbf..f6c6d073 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectWorkloadInventoryTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectWorkloadInventoryTest.java @@ -8,6 +8,7 @@ import org.jboss.xavier.analytics.pojo.output.workload.inventory.WorkloadInventoryReportModel; import org.jboss.xavier.integrations.jpa.service.AnalysisService; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import javax.inject.Inject; @@ -16,7 +17,7 @@ import java.util.Map; import static org.assertj.core.api.Assertions.assertThat; - +@Ignore @MockEndpointsAndSkip("direct:decisionserver") public class MainRouteBuilder_DirectWorkloadInventoryTest extends XavierCamelTest { @Inject diff --git a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_GetRHIdentity.java b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_GetRHIdentity.java index 6016c961..2a146d66 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_GetRHIdentity.java +++ b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_GetRHIdentity.java @@ -1,6 +1,7 @@ package org.jboss.xavier.integrations.route; import org.apache.camel.test.spring.MockEndpointsAndSkip; +import org.junit.Ignore; import org.junit.Test; import javax.inject.Inject; @@ -9,7 +10,7 @@ import java.util.Map; import static org.assertj.core.api.Assertions.assertThat; - +@Ignore @MockEndpointsAndSkip("direct:store") public class MainRouteBuilder_GetRHIdentity extends XavierCamelTest { @Inject diff --git a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_KafkaTest.java b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_KafkaTest.java index 5c96263e..d2f1949b 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_KafkaTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_KafkaTest.java @@ -6,10 +6,11 @@ import org.apache.camel.test.spring.MockEndpointsAndSkip; import org.apache.commons.io.IOUtils; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import java.nio.charset.Charset; - +@Ignore @MockEndpointsAndSkip("kafka:*|seda:download-file") public class MainRouteBuilder_KafkaTest extends XavierCamelTest { diff --git a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_RestUploadTest.java b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_RestUploadTest.java index bdb7df4c..cf89238a 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_RestUploadTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_RestUploadTest.java @@ -5,6 +5,7 @@ import org.jboss.xavier.integrations.route.model.notification.FilePersistedNotification; import org.jboss.xavier.integrations.util.TestUtil; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -21,7 +22,7 @@ import java.util.Map; import static org.assertj.core.api.Assertions.assertThat; - +@Ignore @SpringBootTest(classes = {Application.class}, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @MockEndpointsAndSkip("direct:upload") public class MainRouteBuilder_RestUploadTest extends XavierCamelTest { @@ -38,7 +39,7 @@ public class MainRouteBuilder_RestUploadTest extends XavierCamelTest { public void setup() { camel_context = camel_context.substring(0, camel_context.indexOf("*")); } - + @Test public void mainRouteBuilder_routeRestUpload_ContentGiven_ShouldUpload() throws Exception { //Given diff --git a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_S3Test.java b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_S3Test.java index 3c722c46..29951970 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_S3Test.java +++ b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_S3Test.java @@ -15,7 +15,7 @@ import javax.inject.Inject; import java.util.UUID; - +@Ignore @RunWith(CamelSpringBootRunner.class) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @UseAdviceWith // Disables automatic start of Camel context diff --git a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_SedaDownloadTest.java b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_SedaDownloadTest.java index 15ce0cfe..0c1b4e22 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_SedaDownloadTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_SedaDownloadTest.java @@ -10,6 +10,7 @@ import org.jboss.xavier.analytics.pojo.output.AnalysisModel; import org.jboss.xavier.integrations.jpa.service.AnalysisService; import org.jboss.xavier.integrations.route.model.notification.FilePersistedNotification; +import org.junit.Ignore; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -20,7 +21,7 @@ import static org.assertj.core.api.Assertions.assertThat; - +@Ignore @MockEndpointsAndSkip("http.*|direct:unzip-file") public class MainRouteBuilder_SedaDownloadTest extends XavierCamelTest { @Autowired diff --git a/src/test/java/org/jboss/xavier/integrations/route/ToBeanRouter_DirectToPaginationBeanTest.java b/src/test/java/org/jboss/xavier/integrations/route/ToBeanRouter_DirectToPaginationBeanTest.java index e89a6503..d269881e 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/ToBeanRouter_DirectToPaginationBeanTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/ToBeanRouter_DirectToPaginationBeanTest.java @@ -2,6 +2,7 @@ import org.apache.camel.Exchange; import org.jboss.xavier.integrations.route.model.PageBean; +import org.junit.Ignore; import org.junit.Test; import java.util.HashMap; @@ -9,7 +10,7 @@ import static org.assertj.core.api.Assertions.assertThat; - +@Ignore public class ToBeanRouter_DirectToPaginationBeanTest extends XavierCamelTest { @Test diff --git a/src/test/java/org/jboss/xavier/integrations/route/ToBeanRouter_DirectToSortBeanTest.java b/src/test/java/org/jboss/xavier/integrations/route/ToBeanRouter_DirectToSortBeanTest.java index 66f106cb..6827d8fc 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/ToBeanRouter_DirectToSortBeanTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/ToBeanRouter_DirectToSortBeanTest.java @@ -2,13 +2,14 @@ import org.apache.camel.Exchange; import org.jboss.xavier.integrations.route.model.SortBean; +import org.junit.Ignore; import org.junit.Test; import java.util.HashMap; import java.util.Map; import static org.assertj.core.api.Assertions.assertThat; - +@Ignore public class ToBeanRouter_DirectToSortBeanTest extends XavierCamelTest { @Test diff --git a/src/test/java/org/jboss/xavier/integrations/route/ToBeanRouter_DirectWorkloadInventoryFilterBeanTest.java b/src/test/java/org/jboss/xavier/integrations/route/ToBeanRouter_DirectWorkloadInventoryFilterBeanTest.java index 27ff4f42..108d1def 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/ToBeanRouter_DirectWorkloadInventoryFilterBeanTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/ToBeanRouter_DirectWorkloadInventoryFilterBeanTest.java @@ -2,6 +2,7 @@ import org.apache.camel.Exchange; import org.jboss.xavier.integrations.route.model.WorkloadInventoryFilterBean; +import org.junit.Ignore; import org.junit.Test; import java.util.Arrays; @@ -12,7 +13,7 @@ import java.util.Set; import static org.assertj.core.api.Assertions.assertThat; - +@Ignore public class ToBeanRouter_DirectWorkloadInventoryFilterBeanTest extends XavierCamelTest { @Test diff --git a/src/test/java/org/jboss/xavier/integrations/route/WorkloadSummaryReportRoutes_DirectCalculateVMWorkloadInventoryModelTest.java b/src/test/java/org/jboss/xavier/integrations/route/WorkloadSummaryReportRoutes_DirectCalculateVMWorkloadInventoryModelTest.java index f4c9598e..9d3bf20e 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/WorkloadSummaryReportRoutes_DirectCalculateVMWorkloadInventoryModelTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/WorkloadSummaryReportRoutes_DirectCalculateVMWorkloadInventoryModelTest.java @@ -19,6 +19,7 @@ import org.jboss.xavier.integrations.jpa.repository.WorkloadSummaryReportRepository; import org.junit.Assert; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.PageRequest; @@ -33,7 +34,7 @@ import java.util.Set; import java.util.stream.Collectors; import java.util.stream.IntStream; - +@Ignore public class WorkloadSummaryReportRoutes_DirectCalculateVMWorkloadInventoryModelTest extends XavierCamelTest { @Autowired WorkloadInventoryReportRepository workloadInventoryReportRepository; diff --git a/src/test/java/org/jboss/xavier/integrations/route/XavierCamelTest.java b/src/test/java/org/jboss/xavier/integrations/route/XavierCamelTest.java index 67aa5b8c..9e86e8f0 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/XavierCamelTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/XavierCamelTest.java @@ -5,12 +5,13 @@ import org.apache.camel.test.spring.UseAdviceWith; import org.jboss.xavier.Application; import org.junit.Before; +import org.junit.Ignore; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ActiveProfiles; - +@Ignore @RunWith(CamelSpringBootRunner.class) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @UseAdviceWith // Disables automatic start of Camel context diff --git a/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_DirectDecisionServerTest.java b/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_DirectDecisionServerTest.java index a950ade3..6000c4f0 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_DirectDecisionServerTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_DirectDecisionServerTest.java @@ -7,10 +7,11 @@ import org.apache.camel.test.spring.MockEndpointsAndSkip; import org.jboss.xavier.analytics.pojo.input.UploadFormInputDataModel; import org.jboss.xavier.integrations.DecisionServerHelper; +import org.junit.Ignore; import org.junit.Test; import org.kie.api.command.BatchExecutionCommand; import org.springframework.beans.factory.annotation.Autowired; - +@Ignore @MockEndpointsAndSkip("http:*") public class XmlRoutes_DirectDecisionServerTest extends XavierCamelTest { diff --git a/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_InterceptorTest.java b/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_InterceptorTest.java index 2bd95da6..77f59d9e 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_InterceptorTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_InterceptorTest.java @@ -14,6 +14,7 @@ import org.jboss.xavier.integrations.jpa.service.WorkloadSummaryReportService; import org.jboss.xavier.integrations.util.TestUtil; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -35,7 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.*; - +@Ignore @SpringBootTest(classes = {Application.class}, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class XmlRoutes_InterceptorTest extends XavierCamelTest { @Autowired diff --git a/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_RestMappingTest.java b/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_RestMappingTest.java index edb7b580..fc08c29c 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_RestMappingTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_RestMappingTest.java @@ -4,6 +4,7 @@ import org.jboss.xavier.integrations.jpa.service.FlagAssessmentService; import org.jboss.xavier.integrations.util.TestUtil; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -16,7 +17,7 @@ import static org.mockito.Mockito.verify; - +@Ignore @SpringBootTest(classes = {Application.class}, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class XmlRoutes_RestMappingTest extends XavierCamelTest { @Autowired diff --git a/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_RestReportTest.java b/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_RestReportTest.java index 2e359508..e1fe50fb 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_RestReportTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_RestReportTest.java @@ -19,6 +19,7 @@ import org.jboss.xavier.integrations.util.TestUtil; import org.junit.Assert; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -50,7 +51,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; - +@Ignore @SpringBootTest(classes = {Application.class}, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class XmlRoutes_RestReportTest extends XavierCamelTest { @Autowired diff --git a/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_RestUserTest.java b/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_RestUserTest.java index b3ab666a..b02adac8 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_RestUserTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_RestUserTest.java @@ -4,6 +4,7 @@ import org.jboss.xavier.integrations.jpa.service.AnalysisService; import org.jboss.xavier.integrations.util.TestUtil; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -17,7 +18,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.when; - +@Ignore @SpringBootTest(classes = {Application.class}, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class XmlRoutes_RestUserTest extends XavierCamelTest { diff --git a/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_RouteMaTest.java b/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_RouteMaTest.java index 20126f6e..0626c88c 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_RouteMaTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_RouteMaTest.java @@ -8,6 +8,7 @@ import org.jboss.xavier.analytics.pojo.output.AnalysisModel; import org.jboss.xavier.integrations.DecisionServerHelper; import org.jboss.xavier.integrations.jpa.service.AnalysisService; +import org.junit.Ignore; import org.junit.Test; import org.springframework.boot.test.mock.mockito.SpyBean; @@ -18,7 +19,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Mockito.doThrow; - +@Ignore public class XmlRoutes_RouteMaTest extends XavierCamelTest { @SpyBean diff --git a/src/test/java/org/jboss/xavier/integrations/route/dataformat/CustomizedMultipartDataFormatTest.java b/src/test/java/org/jboss/xavier/integrations/route/dataformat/CustomizedMultipartDataFormatTest.java index 859d3d82..bac7a716 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/dataformat/CustomizedMultipartDataFormatTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/dataformat/CustomizedMultipartDataFormatTest.java @@ -4,6 +4,7 @@ import org.apache.camel.Message; import org.apache.camel.impl.DefaultCamelContext; import org.apache.camel.impl.DefaultExchange; +import org.junit.Ignore; import org.junit.Test; import javax.mail.MessagingException; @@ -12,38 +13,38 @@ import java.io.InputStream; import static org.assertj.core.api.Assertions.assertThat; - +@Ignore public class CustomizedMultipartDataFormatTest { - + @Test public void customizedMultipartDataFormat_unmarshal_MultipartMessage5FilesGiven_ShouldReturn5Attachments() throws IOException, MessagingException { // Given CustomizedMultipartDataFormat customizedMultipartDataFormat = new CustomizedMultipartDataFormat(); Exchange exchange = new DefaultExchange(new DefaultCamelContext()); exchange.getIn().setHeader("Content-Type", "multipart/text"); - + InputStream stream = this.getClass().getClassLoader().getResourceAsStream("mime-message-several-files-sample.txt"); - + // When Message message = (Message) customizedMultipartDataFormat.unmarshal(exchange, stream); - + // Then assertThat(message.getAttachments().size()).isEqualTo(5); - } - + } + @Test public void customizedMultipartDataFormat_unmarshal_TextHtmlMessageGiven_ShouldReturnSameInput() throws IOException, MessagingException { // Given CustomizedMultipartDataFormat customizedMultipartDataFormat = new CustomizedMultipartDataFormat(); Exchange exchange = new DefaultExchange(new DefaultCamelContext()); exchange.getIn().setHeader("Content-Type", "text/html"); - + InputStream stream = new ByteArrayInputStream("This is a text".getBytes()); - + // When Object message = customizedMultipartDataFormat.unmarshal(exchange, stream); - + // Then assertThat(message).isEqualTo(stream); } -} \ No newline at end of file +} From a676af5f252444ff292b66afa178d5a9954eef15 Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Mon, 9 Mar 2020 17:07:10 +0100 Subject: [PATCH 18/57] change projectKey --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 76fa81e2..1091f385 100644 --- a/pom.xml +++ b/pom.xml @@ -345,7 +345,7 @@ https://sonarcloud.io carlosthe19916 - project-xavier_xavier-integration + carlosthe19916_xavier-integration Xavier Integration From 13fea17e7de5b6b5e6da71d0b3668b75bf2c1d29 Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Mon, 9 Mar 2020 17:13:32 +0100 Subject: [PATCH 19/57] remove end2end test just for now --- .github/workflows/ci-actions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-actions.yml b/.github/workflows/ci-actions.yml index cf53992b..eacfe0fd 100644 --- a/.github/workflows/ci-actions.yml +++ b/.github/workflows/ci-actions.yml @@ -50,7 +50,7 @@ jobs: strategy: fail-fast: ${{ github.repository == 'project-xavier/xavier-integration' }} matrix: - class-name: [Case1EndToEndIT, Case2EndToEndIT] + class-name: [Case2EndToEndIT] runs-on: ubuntu-latest steps: From d57b048711ec4459f6cee6ccd8d63d96a5d9de9c Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Mon, 9 Mar 2020 17:15:06 +0100 Subject: [PATCH 20/57] remove min coverate ratio --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1091f385..fe0936b7 100644 --- a/pom.xml +++ b/pom.xml @@ -395,7 +395,7 @@ INSTRUCTION COVEREDRATIO - 0.1 + From f34a9e8c9cf55e885ff8b5777195540b36ab8d40 Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Mon, 9 Mar 2020 17:21:32 +0100 Subject: [PATCH 21/57] add codecov --- .github/workflows/ci-actions.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci-actions.yml b/.github/workflows/ci-actions.yml index eacfe0fd..5720b7e8 100644 --- a/.github/workflows/ci-actions.yml +++ b/.github/workflows/ci-actions.yml @@ -62,6 +62,8 @@ jobs: java-version: openjdk8 - name: Build with Maven run: eval mvn $JVM_TEST_MAVEN_OPTS -Dtest=${{ matrix.class-name }} test + - name: Codecov metrics + run: bash <(curl -s https://codecov.io/bash) - name: Prepare failure archive (if maven failed) if: failure() shell: bash From 1a7945980b1d31d8cc9f284c2d1042388cf01aab Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Mon, 9 Mar 2020 17:29:26 +0100 Subject: [PATCH 22/57] add codecov metrics --- .github/workflows/ci-actions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-actions.yml b/.github/workflows/ci-actions.yml index 5720b7e8..28e665c2 100644 --- a/.github/workflows/ci-actions.yml +++ b/.github/workflows/ci-actions.yml @@ -63,7 +63,7 @@ jobs: - name: Build with Maven run: eval mvn $JVM_TEST_MAVEN_OPTS -Dtest=${{ matrix.class-name }} test - name: Codecov metrics - run: bash <(curl -s https://codecov.io/bash) + uses: codecov/codecov-action@v1 - name: Prepare failure archive (if maven failed) if: failure() shell: bash From 12e90512fd1a4016ca7368a4915d165d6d13b51c Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Mon, 9 Mar 2020 17:37:46 +0100 Subject: [PATCH 23/57] add codecov metrics --- .github/workflows/ci-actions.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci-actions.yml b/.github/workflows/ci-actions.yml index 28e665c2..fd6f10fd 100644 --- a/.github/workflows/ci-actions.yml +++ b/.github/workflows/ci-actions.yml @@ -64,6 +64,8 @@ jobs: run: eval mvn $JVM_TEST_MAVEN_OPTS -Dtest=${{ matrix.class-name }} test - name: Codecov metrics uses: codecov/codecov-action@v1 + with: + fail_ci_if_error: false - name: Prepare failure archive (if maven failed) if: failure() shell: bash From 5680bef7a5a69d5bc6b9888316df56e2fb1fc5c3 Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Mon, 9 Mar 2020 17:48:38 +0100 Subject: [PATCH 24/57] add codecov metrics --- .github/workflows/ci-actions.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci-actions.yml b/.github/workflows/ci-actions.yml index fd6f10fd..2a12e7bf 100644 --- a/.github/workflows/ci-actions.yml +++ b/.github/workflows/ci-actions.yml @@ -65,6 +65,7 @@ jobs: - name: Codecov metrics uses: codecov/codecov-action@v1 with: + file: ./target/site/jacoco/jacoco.xml fail_ci_if_error: false - name: Prepare failure archive (if maven failed) if: failure() From bb1436f70b8de804249b95661e0fe58e5be6b1ae Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Mon, 9 Mar 2020 18:00:26 +0100 Subject: [PATCH 25/57] move codecov --- .github/workflows/ci-actions.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci-actions.yml b/.github/workflows/ci-actions.yml index 2a12e7bf..cd880a6c 100644 --- a/.github/workflows/ci-actions.yml +++ b/.github/workflows/ci-actions.yml @@ -33,6 +33,8 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + - name: Codecov metrics + uses: codecov/codecov-action@v1 - name: Prepare failure archive (if maven failed) if: failure() shell: bash @@ -62,11 +64,6 @@ jobs: java-version: openjdk8 - name: Build with Maven run: eval mvn $JVM_TEST_MAVEN_OPTS -Dtest=${{ matrix.class-name }} test - - name: Codecov metrics - uses: codecov/codecov-action@v1 - with: - file: ./target/site/jacoco/jacoco.xml - fail_ci_if_error: false - name: Prepare failure archive (if maven failed) if: failure() shell: bash From f058a7352865555f643d9c873c8a41ce9cf1c6c8 Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Mon, 9 Mar 2020 18:08:18 +0100 Subject: [PATCH 26/57] restore tests --- .../xavier/integrations/jpa/service/AnalysisServiceTest.java | 3 +-- .../jboss/xavier/integrations/jpa/service/FlagServiceTest.java | 3 +-- .../jpa/service/InitialSavingsEstimationReportServiceTest.java | 3 +-- .../jboss/xavier/integrations/jpa/service/UserServiceTest.java | 3 +-- .../jpa/service/WorkloadInventoryReportServiceTest.java | 3 +-- .../xavier/integrations/jpa/service/WorkloadServiceTest.java | 3 +-- .../jpa/service/WorkloadSummaryReportServiceTest.java | 3 +-- .../business/FlagSharedDisksCalculatorTest.java | 3 +-- .../migrationanalytics/business/ParamsCalculatorTest.java | 3 +-- .../business/VMWorkloadInventoryCalculatorTest.java | 3 +-- .../business/versioning/ManifestVersionServiceTest.java | 3 +-- .../route/MainRouteBuilder_DirectAddUsernameHeaderTest.java | 3 +-- .../MainRouteBuilder_DirectCalculateFlagSharedDisksTest.java | 3 +-- .../route/MainRouteBuilder_DirectCalculateTest.java | 3 +-- ...ainRouteBuilder_DirectCalculateVMWorkloadInventoryTest.java | 3 +-- .../route/MainRouteBuilder_DirectInsightsTest.java | 3 +-- .../route/MainRouteBuilder_DirectStoreAnalysisModelTest.java | 3 +-- .../integrations/route/MainRouteBuilder_DirectStoreTest.java | 3 +-- .../route/MainRouteBuilder_DirectUnzipFileTest.java | 3 +-- .../integrations/route/MainRouteBuilder_DirectUploadTest.java | 3 +-- .../route/MainRouteBuilder_DirectWorkloadInventoryTest.java | 3 +-- .../integrations/route/MainRouteBuilder_GetRHIdentity.java | 3 +-- .../xavier/integrations/route/MainRouteBuilder_KafkaTest.java | 3 +-- .../integrations/route/MainRouteBuilder_RestUploadTest.java | 3 +-- .../xavier/integrations/route/MainRouteBuilder_S3Test.java | 2 +- .../integrations/route/MainRouteBuilder_SedaDownloadTest.java | 3 +-- .../route/ToBeanRouter_DirectToPaginationBeanTest.java | 3 +-- .../integrations/route/ToBeanRouter_DirectToSortBeanTest.java | 3 +-- .../ToBeanRouter_DirectWorkloadInventoryFilterBeanTest.java | 3 +-- ...portRoutes_DirectCalculateVMWorkloadInventoryModelTest.java | 3 +-- .../org/jboss/xavier/integrations/route/XavierCamelTest.java | 3 +-- .../integrations/route/XmlRoutes_DirectDecisionServerTest.java | 3 +-- .../xavier/integrations/route/XmlRoutes_InterceptorTest.java | 3 +-- .../xavier/integrations/route/XmlRoutes_RestMappingTest.java | 3 +-- .../xavier/integrations/route/XmlRoutes_RestReportTest.java | 3 +-- .../xavier/integrations/route/XmlRoutes_RestUserTest.java | 3 +-- .../jboss/xavier/integrations/route/XmlRoutes_RouteMaTest.java | 3 +-- .../route/dataformat/CustomizedMultipartDataFormatTest.java | 3 +-- 38 files changed, 38 insertions(+), 75 deletions(-) diff --git a/src/test/java/org/jboss/xavier/integrations/jpa/service/AnalysisServiceTest.java b/src/test/java/org/jboss/xavier/integrations/jpa/service/AnalysisServiceTest.java index 704c80dd..df92d8d8 100644 --- a/src/test/java/org/jboss/xavier/integrations/jpa/service/AnalysisServiceTest.java +++ b/src/test/java/org/jboss/xavier/integrations/jpa/service/AnalysisServiceTest.java @@ -4,7 +4,6 @@ import org.apache.camel.test.spring.UseAdviceWith; import org.jboss.xavier.Application; import org.jboss.xavier.analytics.pojo.output.AnalysisModel; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; @@ -15,7 +14,7 @@ import static org.assertj.core.api.Java6Assertions.assertThat; -@Ignore + @RunWith(CamelSpringBootRunner.class) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @SpringBootTest(classes = {Application.class}) diff --git a/src/test/java/org/jboss/xavier/integrations/jpa/service/FlagServiceTest.java b/src/test/java/org/jboss/xavier/integrations/jpa/service/FlagServiceTest.java index 6ed4451f..7e84b979 100644 --- a/src/test/java/org/jboss/xavier/integrations/jpa/service/FlagServiceTest.java +++ b/src/test/java/org/jboss/xavier/integrations/jpa/service/FlagServiceTest.java @@ -9,7 +9,6 @@ import org.jboss.xavier.analytics.pojo.output.workload.summary.WorkloadSummaryReportModel; import org.jboss.xavier.integrations.route.model.PageBean; import org.jboss.xavier.integrations.route.model.SortBean; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; @@ -22,7 +21,7 @@ import static org.assertj.core.api.Java6Assertions.assertThat; -@Ignore + @RunWith(CamelSpringBootRunner.class) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @SpringBootTest(classes = {Application.class}) diff --git a/src/test/java/org/jboss/xavier/integrations/jpa/service/InitialSavingsEstimationReportServiceTest.java b/src/test/java/org/jboss/xavier/integrations/jpa/service/InitialSavingsEstimationReportServiceTest.java index 455290d6..4f73d28d 100644 --- a/src/test/java/org/jboss/xavier/integrations/jpa/service/InitialSavingsEstimationReportServiceTest.java +++ b/src/test/java/org/jboss/xavier/integrations/jpa/service/InitialSavingsEstimationReportServiceTest.java @@ -5,7 +5,6 @@ import org.jboss.xavier.Application; import org.jboss.xavier.analytics.pojo.output.AnalysisModel; import org.jboss.xavier.analytics.pojo.output.InitialSavingsEstimationReportModel; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; @@ -18,7 +17,7 @@ import static org.assertj.core.api.Java6Assertions.assertThat; -@Ignore + @RunWith(CamelSpringBootRunner.class) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @SpringBootTest(classes = {Application.class}) diff --git a/src/test/java/org/jboss/xavier/integrations/jpa/service/UserServiceTest.java b/src/test/java/org/jboss/xavier/integrations/jpa/service/UserServiceTest.java index 2748395e..ec94ac41 100644 --- a/src/test/java/org/jboss/xavier/integrations/jpa/service/UserServiceTest.java +++ b/src/test/java/org/jboss/xavier/integrations/jpa/service/UserServiceTest.java @@ -3,7 +3,6 @@ import org.apache.camel.test.spring.CamelSpringBootRunner; import org.apache.camel.test.spring.UseAdviceWith; import org.jboss.xavier.Application; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; @@ -15,7 +14,7 @@ import static org.assertj.core.api.Java6Assertions.assertThat; -@Ignore + @RunWith(CamelSpringBootRunner.class) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @SpringBootTest(classes = {Application.class}) diff --git a/src/test/java/org/jboss/xavier/integrations/jpa/service/WorkloadInventoryReportServiceTest.java b/src/test/java/org/jboss/xavier/integrations/jpa/service/WorkloadInventoryReportServiceTest.java index e5f106e1..e6c572a9 100644 --- a/src/test/java/org/jboss/xavier/integrations/jpa/service/WorkloadInventoryReportServiceTest.java +++ b/src/test/java/org/jboss/xavier/integrations/jpa/service/WorkloadInventoryReportServiceTest.java @@ -8,7 +8,6 @@ import org.jboss.xavier.integrations.route.model.PageBean; import org.jboss.xavier.integrations.route.model.SortBean; import org.jboss.xavier.integrations.route.model.WorkloadInventoryFilterBean; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; @@ -27,7 +26,7 @@ import static org.assertj.core.api.Java6Assertions.assertThat; -@Ignore + @RunWith(CamelSpringBootRunner.class) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @SpringBootTest(classes = {Application.class}) diff --git a/src/test/java/org/jboss/xavier/integrations/jpa/service/WorkloadServiceTest.java b/src/test/java/org/jboss/xavier/integrations/jpa/service/WorkloadServiceTest.java index 8b24ac2b..3371663c 100644 --- a/src/test/java/org/jboss/xavier/integrations/jpa/service/WorkloadServiceTest.java +++ b/src/test/java/org/jboss/xavier/integrations/jpa/service/WorkloadServiceTest.java @@ -8,7 +8,6 @@ import org.jboss.xavier.analytics.pojo.output.workload.summary.WorkloadSummaryReportModel; import org.jboss.xavier.integrations.route.model.PageBean; import org.jboss.xavier.integrations.route.model.SortBean; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; @@ -22,7 +21,7 @@ import static org.assertj.core.api.Java6Assertions.assertThat; -@Ignore + @RunWith(CamelSpringBootRunner.class) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @SpringBootTest(classes = {Application.class}) diff --git a/src/test/java/org/jboss/xavier/integrations/jpa/service/WorkloadSummaryReportServiceTest.java b/src/test/java/org/jboss/xavier/integrations/jpa/service/WorkloadSummaryReportServiceTest.java index cfc48ef2..f0a9011f 100644 --- a/src/test/java/org/jboss/xavier/integrations/jpa/service/WorkloadSummaryReportServiceTest.java +++ b/src/test/java/org/jboss/xavier/integrations/jpa/service/WorkloadSummaryReportServiceTest.java @@ -6,7 +6,6 @@ import org.jboss.xavier.analytics.pojo.output.AnalysisModel; import org.jboss.xavier.analytics.pojo.output.InitialSavingsEstimationReportModel; import org.jboss.xavier.analytics.pojo.output.workload.summary.WorkloadSummaryReportModel; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; @@ -18,7 +17,7 @@ import static org.assertj.core.api.Java6Assertions.assertThat; -@Ignore + @RunWith(CamelSpringBootRunner.class) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @SpringBootTest(classes = {Application.class}) diff --git a/src/test/java/org/jboss/xavier/integrations/migrationanalytics/business/FlagSharedDisksCalculatorTest.java b/src/test/java/org/jboss/xavier/integrations/migrationanalytics/business/FlagSharedDisksCalculatorTest.java index 75974da4..0d791b4f 100644 --- a/src/test/java/org/jboss/xavier/integrations/migrationanalytics/business/FlagSharedDisksCalculatorTest.java +++ b/src/test/java/org/jboss/xavier/integrations/migrationanalytics/business/FlagSharedDisksCalculatorTest.java @@ -5,7 +5,6 @@ import org.apache.commons.io.IOUtils; import org.jboss.xavier.Application; import org.jboss.xavier.integrations.route.RouteBuilderExceptionHandler; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; @@ -21,7 +20,7 @@ import java.util.Set; import static org.assertj.core.api.Assertions.assertThat; -@Ignore + @RunWith(CamelSpringBootRunner.class) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @SpringBootTest(classes = {Application.class}) diff --git a/src/test/java/org/jboss/xavier/integrations/migrationanalytics/business/ParamsCalculatorTest.java b/src/test/java/org/jboss/xavier/integrations/migrationanalytics/business/ParamsCalculatorTest.java index 3aa8e7a5..3c115a1b 100644 --- a/src/test/java/org/jboss/xavier/integrations/migrationanalytics/business/ParamsCalculatorTest.java +++ b/src/test/java/org/jboss/xavier/integrations/migrationanalytics/business/ParamsCalculatorTest.java @@ -6,7 +6,6 @@ import org.jboss.xavier.Application; import org.jboss.xavier.analytics.pojo.input.UploadFormInputDataModel; import org.jboss.xavier.integrations.route.RouteBuilderExceptionHandler; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; @@ -22,7 +21,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Mockito.doReturn; -@Ignore + @RunWith(CamelSpringBootRunner.class) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @SpringBootTest(classes = {Application.class}) diff --git a/src/test/java/org/jboss/xavier/integrations/migrationanalytics/business/VMWorkloadInventoryCalculatorTest.java b/src/test/java/org/jboss/xavier/integrations/migrationanalytics/business/VMWorkloadInventoryCalculatorTest.java index 21396a29..6646f05b 100644 --- a/src/test/java/org/jboss/xavier/integrations/migrationanalytics/business/VMWorkloadInventoryCalculatorTest.java +++ b/src/test/java/org/jboss/xavier/integrations/migrationanalytics/business/VMWorkloadInventoryCalculatorTest.java @@ -6,7 +6,6 @@ import org.jboss.xavier.Application; import org.jboss.xavier.analytics.pojo.input.workload.inventory.VMWorkloadInventoryModel; import org.jboss.xavier.integrations.route.RouteBuilderExceptionHandler; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; @@ -25,7 +24,7 @@ import java.util.Map; import static org.assertj.core.api.Assertions.assertThat; -@Ignore + @RunWith(CamelSpringBootRunner.class) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @SpringBootTest(classes = {Application.class}) diff --git a/src/test/java/org/jboss/xavier/integrations/migrationanalytics/business/versioning/ManifestVersionServiceTest.java b/src/test/java/org/jboss/xavier/integrations/migrationanalytics/business/versioning/ManifestVersionServiceTest.java index cc252288..0f311b4b 100644 --- a/src/test/java/org/jboss/xavier/integrations/migrationanalytics/business/versioning/ManifestVersionServiceTest.java +++ b/src/test/java/org/jboss/xavier/integrations/migrationanalytics/business/versioning/ManifestVersionServiceTest.java @@ -3,7 +3,6 @@ import org.apache.camel.test.spring.CamelSpringBootRunner; import org.apache.camel.test.spring.UseAdviceWith; import org.jboss.xavier.Application; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; @@ -15,7 +14,7 @@ import java.util.Map; import static org.assertj.core.api.Java6Assertions.assertThat; -@Ignore + @RunWith(CamelSpringBootRunner.class) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @SpringBootTest(classes = {Application.class}) diff --git a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectAddUsernameHeaderTest.java b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectAddUsernameHeaderTest.java index 30511121..c7f1ff69 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectAddUsernameHeaderTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectAddUsernameHeaderTest.java @@ -1,7 +1,6 @@ package org.jboss.xavier.integrations.route; import org.apache.camel.Exchange; -import org.junit.Ignore; import org.junit.Test; import java.util.Base64; @@ -9,7 +8,7 @@ import java.util.Map; import static org.assertj.core.api.Java6Assertions.assertThat; -@Ignore + public class MainRouteBuilder_DirectAddUsernameHeaderTest extends XavierCamelTest { @Test diff --git a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectCalculateFlagSharedDisksTest.java b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectCalculateFlagSharedDisksTest.java index db90b626..1bc59253 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectCalculateFlagSharedDisksTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectCalculateFlagSharedDisksTest.java @@ -7,7 +7,6 @@ import org.jboss.xavier.analytics.pojo.output.workload.inventory.WorkloadInventoryReportModel; import org.jboss.xavier.integrations.jpa.service.AnalysisService; import org.jboss.xavier.integrations.jpa.service.WorkloadInventoryReportService; -import org.junit.Ignore; import org.junit.Test; import org.springframework.boot.test.mock.mockito.MockBean; @@ -23,7 +22,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -@Ignore + public class MainRouteBuilder_DirectCalculateFlagSharedDisksTest extends XavierCamelTest { @Inject AnalysisService analysisService; diff --git a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectCalculateTest.java b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectCalculateTest.java index bb691373..40c479ed 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectCalculateTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectCalculateTest.java @@ -10,7 +10,6 @@ import org.jboss.xavier.analytics.pojo.output.AnalysisModel; import org.jboss.xavier.integrations.jpa.service.AnalysisService; import org.jboss.xavier.integrations.migrationanalytics.business.Calculator; -import org.junit.Ignore; import org.junit.Test; import javax.inject.Inject; @@ -20,7 +19,7 @@ import static org.assertj.core.api.Assertions.assertThat; -@Ignore + @MockEndpointsAndSkip("jms:queue:uploadFormInputDataModel|direct:vm-workload-inventory|direct:calculate-workloadsummaryreportmodel|direct:flags-shared-disks") public class MainRouteBuilder_DirectCalculateTest extends XavierCamelTest { @Inject diff --git a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectCalculateVMWorkloadInventoryTest.java b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectCalculateVMWorkloadInventoryTest.java index 565bd31f..c7908c82 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectCalculateVMWorkloadInventoryTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectCalculateVMWorkloadInventoryTest.java @@ -7,7 +7,6 @@ import org.jboss.xavier.analytics.pojo.input.workload.inventory.VMWorkloadInventoryModel; import org.jboss.xavier.analytics.pojo.output.AnalysisModel; import org.jboss.xavier.integrations.jpa.service.AnalysisService; -import org.junit.Ignore; import org.junit.Test; import javax.inject.Inject; @@ -20,7 +19,7 @@ import static org.assertj.core.api.Assertions.assertThat; -@Ignore + @MockEndpointsAndSkip("direct:vm-workload-inventory") public class MainRouteBuilder_DirectCalculateVMWorkloadInventoryTest extends XavierCamelTest { @Inject diff --git a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectInsightsTest.java b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectInsightsTest.java index 3fb561ae..e5445ad1 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectInsightsTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectInsightsTest.java @@ -9,7 +9,6 @@ import org.apache.http.HttpEntity; import org.jboss.xavier.analytics.pojo.output.AnalysisModel; import org.jboss.xavier.integrations.jpa.service.AnalysisService; -import org.junit.Ignore; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -21,7 +20,7 @@ import static org.assertj.core.api.Assertions.assertThat; -@Ignore + @MockEndpointsAndSkip("http4:{{insights.upload.host}}/api/ingress/v1/upload") public class MainRouteBuilder_DirectInsightsTest extends XavierCamelTest { @EndpointInject(uri = "mock:http4:{{insights.upload.host}}/api/ingress/v1/upload") diff --git a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectStoreAnalysisModelTest.java b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectStoreAnalysisModelTest.java index 38e9314f..880d2ca8 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectStoreAnalysisModelTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectStoreAnalysisModelTest.java @@ -6,7 +6,6 @@ import org.apache.camel.test.spring.MockEndpointsAndSkip; import org.jboss.xavier.analytics.pojo.output.AnalysisModel; import org.jboss.xavier.integrations.jpa.repository.AnalysisRepository; -import org.junit.Ignore; import org.junit.Test; import javax.inject.Inject; @@ -16,7 +15,7 @@ import static org.assertj.core.api.Java6Assertions.assertThat; -@Ignore + @MockEndpointsAndSkip("direct:insights|file:*") public class MainRouteBuilder_DirectStoreAnalysisModelTest extends XavierCamelTest { diff --git a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectStoreTest.java b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectStoreTest.java index 07e4c7b2..43e0b7e5 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectStoreTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectStoreTest.java @@ -4,9 +4,8 @@ import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.test.spring.MockEndpointsAndSkip; import org.apache.commons.io.IOUtils; -import org.junit.Ignore; import org.junit.Test; -@Ignore + @MockEndpointsAndSkip("direct:insights|file:*|direct:analysis-model") public class MainRouteBuilder_DirectStoreTest extends XavierCamelTest { @EndpointInject(uri = "mock:direct:insights") diff --git a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectUnzipFileTest.java b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectUnzipFileTest.java index 31be36ec..6f171307 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectUnzipFileTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectUnzipFileTest.java @@ -7,7 +7,6 @@ import org.jboss.xavier.analytics.pojo.output.AnalysisModel; import org.jboss.xavier.integrations.jpa.service.AnalysisService; import org.jboss.xavier.integrations.migrationanalytics.business.Calculator; -import org.junit.Ignore; import org.junit.Test; import org.springframework.beans.factory.annotation.Value; @@ -16,7 +15,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -@Ignore + @MockEndpointsAndSkip("jms:queue:uploadFormInputDataModel|direct:send-costsavings|direct:calculate-vmworkloadinventory|direct:vm-workload-inventory|direct:calculate-workloadsummaryreportmodel|direct:flags-shared-disks") public class MainRouteBuilder_DirectUnzipFileTest extends XavierCamelTest { diff --git a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectUploadTest.java b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectUploadTest.java index 257ea848..15e69132 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectUploadTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectUploadTest.java @@ -5,7 +5,6 @@ import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.test.spring.MockEndpointsAndSkip; import org.apache.commons.io.IOUtils; -import org.junit.Ignore; import org.junit.Test; import org.springframework.beans.factory.annotation.Value; @@ -19,7 +18,7 @@ import java.util.Map; import static org.assertj.core.api.Assertions.assertThat; -@Ignore + @MockEndpointsAndSkip("direct:store") public class MainRouteBuilder_DirectUploadTest extends XavierCamelTest { @EndpointInject(uri = "mock:direct:store") diff --git a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectWorkloadInventoryTest.java b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectWorkloadInventoryTest.java index f6c6d073..d3165bbf 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectWorkloadInventoryTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_DirectWorkloadInventoryTest.java @@ -8,7 +8,6 @@ import org.jboss.xavier.analytics.pojo.output.workload.inventory.WorkloadInventoryReportModel; import org.jboss.xavier.integrations.jpa.service.AnalysisService; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import javax.inject.Inject; @@ -17,7 +16,7 @@ import java.util.Map; import static org.assertj.core.api.Assertions.assertThat; -@Ignore + @MockEndpointsAndSkip("direct:decisionserver") public class MainRouteBuilder_DirectWorkloadInventoryTest extends XavierCamelTest { @Inject diff --git a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_GetRHIdentity.java b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_GetRHIdentity.java index 2a146d66..6016c961 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_GetRHIdentity.java +++ b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_GetRHIdentity.java @@ -1,7 +1,6 @@ package org.jboss.xavier.integrations.route; import org.apache.camel.test.spring.MockEndpointsAndSkip; -import org.junit.Ignore; import org.junit.Test; import javax.inject.Inject; @@ -10,7 +9,7 @@ import java.util.Map; import static org.assertj.core.api.Assertions.assertThat; -@Ignore + @MockEndpointsAndSkip("direct:store") public class MainRouteBuilder_GetRHIdentity extends XavierCamelTest { @Inject diff --git a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_KafkaTest.java b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_KafkaTest.java index d2f1949b..5c96263e 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_KafkaTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_KafkaTest.java @@ -6,11 +6,10 @@ import org.apache.camel.test.spring.MockEndpointsAndSkip; import org.apache.commons.io.IOUtils; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import java.nio.charset.Charset; -@Ignore + @MockEndpointsAndSkip("kafka:*|seda:download-file") public class MainRouteBuilder_KafkaTest extends XavierCamelTest { diff --git a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_RestUploadTest.java b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_RestUploadTest.java index cf89238a..aa2f48d9 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_RestUploadTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_RestUploadTest.java @@ -5,7 +5,6 @@ import org.jboss.xavier.integrations.route.model.notification.FilePersistedNotification; import org.jboss.xavier.integrations.util.TestUtil; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -22,7 +21,7 @@ import java.util.Map; import static org.assertj.core.api.Assertions.assertThat; -@Ignore + @SpringBootTest(classes = {Application.class}, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @MockEndpointsAndSkip("direct:upload") public class MainRouteBuilder_RestUploadTest extends XavierCamelTest { diff --git a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_S3Test.java b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_S3Test.java index 29951970..3c722c46 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_S3Test.java +++ b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_S3Test.java @@ -15,7 +15,7 @@ import javax.inject.Inject; import java.util.UUID; -@Ignore + @RunWith(CamelSpringBootRunner.class) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @UseAdviceWith // Disables automatic start of Camel context diff --git a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_SedaDownloadTest.java b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_SedaDownloadTest.java index 0c1b4e22..15ce0cfe 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_SedaDownloadTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_SedaDownloadTest.java @@ -10,7 +10,6 @@ import org.jboss.xavier.analytics.pojo.output.AnalysisModel; import org.jboss.xavier.integrations.jpa.service.AnalysisService; import org.jboss.xavier.integrations.route.model.notification.FilePersistedNotification; -import org.junit.Ignore; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -21,7 +20,7 @@ import static org.assertj.core.api.Assertions.assertThat; -@Ignore + @MockEndpointsAndSkip("http.*|direct:unzip-file") public class MainRouteBuilder_SedaDownloadTest extends XavierCamelTest { @Autowired diff --git a/src/test/java/org/jboss/xavier/integrations/route/ToBeanRouter_DirectToPaginationBeanTest.java b/src/test/java/org/jboss/xavier/integrations/route/ToBeanRouter_DirectToPaginationBeanTest.java index d269881e..e89a6503 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/ToBeanRouter_DirectToPaginationBeanTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/ToBeanRouter_DirectToPaginationBeanTest.java @@ -2,7 +2,6 @@ import org.apache.camel.Exchange; import org.jboss.xavier.integrations.route.model.PageBean; -import org.junit.Ignore; import org.junit.Test; import java.util.HashMap; @@ -10,7 +9,7 @@ import static org.assertj.core.api.Assertions.assertThat; -@Ignore + public class ToBeanRouter_DirectToPaginationBeanTest extends XavierCamelTest { @Test diff --git a/src/test/java/org/jboss/xavier/integrations/route/ToBeanRouter_DirectToSortBeanTest.java b/src/test/java/org/jboss/xavier/integrations/route/ToBeanRouter_DirectToSortBeanTest.java index 6827d8fc..66f106cb 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/ToBeanRouter_DirectToSortBeanTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/ToBeanRouter_DirectToSortBeanTest.java @@ -2,14 +2,13 @@ import org.apache.camel.Exchange; import org.jboss.xavier.integrations.route.model.SortBean; -import org.junit.Ignore; import org.junit.Test; import java.util.HashMap; import java.util.Map; import static org.assertj.core.api.Assertions.assertThat; -@Ignore + public class ToBeanRouter_DirectToSortBeanTest extends XavierCamelTest { @Test diff --git a/src/test/java/org/jboss/xavier/integrations/route/ToBeanRouter_DirectWorkloadInventoryFilterBeanTest.java b/src/test/java/org/jboss/xavier/integrations/route/ToBeanRouter_DirectWorkloadInventoryFilterBeanTest.java index 108d1def..27ff4f42 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/ToBeanRouter_DirectWorkloadInventoryFilterBeanTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/ToBeanRouter_DirectWorkloadInventoryFilterBeanTest.java @@ -2,7 +2,6 @@ import org.apache.camel.Exchange; import org.jboss.xavier.integrations.route.model.WorkloadInventoryFilterBean; -import org.junit.Ignore; import org.junit.Test; import java.util.Arrays; @@ -13,7 +12,7 @@ import java.util.Set; import static org.assertj.core.api.Assertions.assertThat; -@Ignore + public class ToBeanRouter_DirectWorkloadInventoryFilterBeanTest extends XavierCamelTest { @Test diff --git a/src/test/java/org/jboss/xavier/integrations/route/WorkloadSummaryReportRoutes_DirectCalculateVMWorkloadInventoryModelTest.java b/src/test/java/org/jboss/xavier/integrations/route/WorkloadSummaryReportRoutes_DirectCalculateVMWorkloadInventoryModelTest.java index 9d3bf20e..f4c9598e 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/WorkloadSummaryReportRoutes_DirectCalculateVMWorkloadInventoryModelTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/WorkloadSummaryReportRoutes_DirectCalculateVMWorkloadInventoryModelTest.java @@ -19,7 +19,6 @@ import org.jboss.xavier.integrations.jpa.repository.WorkloadSummaryReportRepository; import org.junit.Assert; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.PageRequest; @@ -34,7 +33,7 @@ import java.util.Set; import java.util.stream.Collectors; import java.util.stream.IntStream; -@Ignore + public class WorkloadSummaryReportRoutes_DirectCalculateVMWorkloadInventoryModelTest extends XavierCamelTest { @Autowired WorkloadInventoryReportRepository workloadInventoryReportRepository; diff --git a/src/test/java/org/jboss/xavier/integrations/route/XavierCamelTest.java b/src/test/java/org/jboss/xavier/integrations/route/XavierCamelTest.java index 9e86e8f0..67aa5b8c 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/XavierCamelTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/XavierCamelTest.java @@ -5,13 +5,12 @@ import org.apache.camel.test.spring.UseAdviceWith; import org.jboss.xavier.Application; import org.junit.Before; -import org.junit.Ignore; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ActiveProfiles; -@Ignore + @RunWith(CamelSpringBootRunner.class) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @UseAdviceWith // Disables automatic start of Camel context diff --git a/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_DirectDecisionServerTest.java b/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_DirectDecisionServerTest.java index 6000c4f0..a950ade3 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_DirectDecisionServerTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_DirectDecisionServerTest.java @@ -7,11 +7,10 @@ import org.apache.camel.test.spring.MockEndpointsAndSkip; import org.jboss.xavier.analytics.pojo.input.UploadFormInputDataModel; import org.jboss.xavier.integrations.DecisionServerHelper; -import org.junit.Ignore; import org.junit.Test; import org.kie.api.command.BatchExecutionCommand; import org.springframework.beans.factory.annotation.Autowired; -@Ignore + @MockEndpointsAndSkip("http:*") public class XmlRoutes_DirectDecisionServerTest extends XavierCamelTest { diff --git a/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_InterceptorTest.java b/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_InterceptorTest.java index 77f59d9e..2bd95da6 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_InterceptorTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_InterceptorTest.java @@ -14,7 +14,6 @@ import org.jboss.xavier.integrations.jpa.service.WorkloadSummaryReportService; import org.jboss.xavier.integrations.util.TestUtil; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -36,7 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.*; -@Ignore + @SpringBootTest(classes = {Application.class}, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class XmlRoutes_InterceptorTest extends XavierCamelTest { @Autowired diff --git a/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_RestMappingTest.java b/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_RestMappingTest.java index fc08c29c..edb7b580 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_RestMappingTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_RestMappingTest.java @@ -4,7 +4,6 @@ import org.jboss.xavier.integrations.jpa.service.FlagAssessmentService; import org.jboss.xavier.integrations.util.TestUtil; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -17,7 +16,7 @@ import static org.mockito.Mockito.verify; -@Ignore + @SpringBootTest(classes = {Application.class}, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class XmlRoutes_RestMappingTest extends XavierCamelTest { @Autowired diff --git a/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_RestReportTest.java b/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_RestReportTest.java index e1fe50fb..2e359508 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_RestReportTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_RestReportTest.java @@ -19,7 +19,6 @@ import org.jboss.xavier.integrations.util.TestUtil; import org.junit.Assert; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -51,7 +50,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; -@Ignore + @SpringBootTest(classes = {Application.class}, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class XmlRoutes_RestReportTest extends XavierCamelTest { @Autowired diff --git a/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_RestUserTest.java b/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_RestUserTest.java index b02adac8..b3ab666a 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_RestUserTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_RestUserTest.java @@ -4,7 +4,6 @@ import org.jboss.xavier.integrations.jpa.service.AnalysisService; import org.jboss.xavier.integrations.util.TestUtil; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -18,7 +17,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.when; -@Ignore + @SpringBootTest(classes = {Application.class}, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class XmlRoutes_RestUserTest extends XavierCamelTest { diff --git a/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_RouteMaTest.java b/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_RouteMaTest.java index 0626c88c..20126f6e 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_RouteMaTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/XmlRoutes_RouteMaTest.java @@ -8,7 +8,6 @@ import org.jboss.xavier.analytics.pojo.output.AnalysisModel; import org.jboss.xavier.integrations.DecisionServerHelper; import org.jboss.xavier.integrations.jpa.service.AnalysisService; -import org.junit.Ignore; import org.junit.Test; import org.springframework.boot.test.mock.mockito.SpyBean; @@ -19,7 +18,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Mockito.doThrow; -@Ignore + public class XmlRoutes_RouteMaTest extends XavierCamelTest { @SpyBean diff --git a/src/test/java/org/jboss/xavier/integrations/route/dataformat/CustomizedMultipartDataFormatTest.java b/src/test/java/org/jboss/xavier/integrations/route/dataformat/CustomizedMultipartDataFormatTest.java index bac7a716..4aa52854 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/dataformat/CustomizedMultipartDataFormatTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/dataformat/CustomizedMultipartDataFormatTest.java @@ -4,7 +4,6 @@ import org.apache.camel.Message; import org.apache.camel.impl.DefaultCamelContext; import org.apache.camel.impl.DefaultExchange; -import org.junit.Ignore; import org.junit.Test; import javax.mail.MessagingException; @@ -13,7 +12,7 @@ import java.io.InputStream; import static org.assertj.core.api.Assertions.assertThat; -@Ignore + public class CustomizedMultipartDataFormatTest { @Test From 638fdae836ffa55bba09c30a1293bcb175f7de29 Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Mon, 9 Mar 2020 18:28:39 +0100 Subject: [PATCH 27/57] remove pull request types --- .github/workflows/ci-actions.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci-actions.yml b/.github/workflows/ci-actions.yml index cd880a6c..39225852 100644 --- a/.github/workflows/ci-actions.yml +++ b/.github/workflows/ci-actions.yml @@ -8,7 +8,6 @@ on: - 'README.md' - '.dependabot/**' pull_request: - types: [assigned, opened, synchronize, reopened, ready_for_review, edited] paths-ignore: - 'README.md' env: From 366ebedabf1534599afef0b1ff3907d130f05982 Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Mon, 9 Mar 2020 18:41:59 +0100 Subject: [PATCH 28/57] remove no needed changes --- .github/workflows/ci-actions.yml | 2 +- pom.xml | 2 +- .../jpa/service/UserServiceTest.java | 2 +- .../MainRouteBuilder_RestUploadTest.java | 2 +- .../CustomizedMultipartDataFormatTest.java | 20 +++++++++---------- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci-actions.yml b/.github/workflows/ci-actions.yml index 39225852..9503ef05 100644 --- a/.github/workflows/ci-actions.yml +++ b/.github/workflows/ci-actions.yml @@ -51,7 +51,7 @@ jobs: strategy: fail-fast: ${{ github.repository == 'project-xavier/xavier-integration' }} matrix: - class-name: [Case2EndToEndIT] + class-name: [Case1EndToEndIT,Case2EndToEndIT] runs-on: ubuntu-latest steps: diff --git a/pom.xml b/pom.xml index fe0936b7..1091f385 100644 --- a/pom.xml +++ b/pom.xml @@ -395,7 +395,7 @@ INSTRUCTION COVEREDRATIO - + 0.1 diff --git a/src/test/java/org/jboss/xavier/integrations/jpa/service/UserServiceTest.java b/src/test/java/org/jboss/xavier/integrations/jpa/service/UserServiceTest.java index ec94ac41..1929c45c 100644 --- a/src/test/java/org/jboss/xavier/integrations/jpa/service/UserServiceTest.java +++ b/src/test/java/org/jboss/xavier/integrations/jpa/service/UserServiceTest.java @@ -44,7 +44,7 @@ public void userService_AuthorizedUsersEmpty_ShouldReturnNotAllowed() { ReflectionTestUtils.setField(userService, "authorizedAdminUsers", new String[0]); assertThat(userService.isUserAllowedToAdministratorResources("myUsername")).isEqualTo(false); } - + @Test public void userService_AuthorizedUsersGiven_ShouldReturnAllowedOrNot() { assertThat(userService.isUserAllowedToAdministratorResources("admin1")).isEqualTo(true); diff --git a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_RestUploadTest.java b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_RestUploadTest.java index aa2f48d9..bdb7df4c 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_RestUploadTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/MainRouteBuilder_RestUploadTest.java @@ -38,7 +38,7 @@ public class MainRouteBuilder_RestUploadTest extends XavierCamelTest { public void setup() { camel_context = camel_context.substring(0, camel_context.indexOf("*")); } - + @Test public void mainRouteBuilder_routeRestUpload_ContentGiven_ShouldUpload() throws Exception { //Given diff --git a/src/test/java/org/jboss/xavier/integrations/route/dataformat/CustomizedMultipartDataFormatTest.java b/src/test/java/org/jboss/xavier/integrations/route/dataformat/CustomizedMultipartDataFormatTest.java index 4aa52854..859d3d82 100644 --- a/src/test/java/org/jboss/xavier/integrations/route/dataformat/CustomizedMultipartDataFormatTest.java +++ b/src/test/java/org/jboss/xavier/integrations/route/dataformat/CustomizedMultipartDataFormatTest.java @@ -14,36 +14,36 @@ import static org.assertj.core.api.Assertions.assertThat; public class CustomizedMultipartDataFormatTest { - + @Test public void customizedMultipartDataFormat_unmarshal_MultipartMessage5FilesGiven_ShouldReturn5Attachments() throws IOException, MessagingException { // Given CustomizedMultipartDataFormat customizedMultipartDataFormat = new CustomizedMultipartDataFormat(); Exchange exchange = new DefaultExchange(new DefaultCamelContext()); exchange.getIn().setHeader("Content-Type", "multipart/text"); - + InputStream stream = this.getClass().getClassLoader().getResourceAsStream("mime-message-several-files-sample.txt"); - + // When Message message = (Message) customizedMultipartDataFormat.unmarshal(exchange, stream); - + // Then assertThat(message.getAttachments().size()).isEqualTo(5); - } - + } + @Test public void customizedMultipartDataFormat_unmarshal_TextHtmlMessageGiven_ShouldReturnSameInput() throws IOException, MessagingException { // Given CustomizedMultipartDataFormat customizedMultipartDataFormat = new CustomizedMultipartDataFormat(); Exchange exchange = new DefaultExchange(new DefaultCamelContext()); exchange.getIn().setHeader("Content-Type", "text/html"); - + InputStream stream = new ByteArrayInputStream("This is a text".getBytes()); - + // When Object message = customizedMultipartDataFormat.unmarshal(exchange, stream); - + // Then assertThat(message).isEqualTo(stream); } -} +} \ No newline at end of file From 11dd7b17e1288ef875815554a2ba414fb3f3ded0 Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Mon, 9 Mar 2020 19:29:18 +0100 Subject: [PATCH 29/57] add maven conditionals --- .github/workflows/ci-actions.yml | 4 ++++ pom.xml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-actions.yml b/.github/workflows/ci-actions.yml index 9503ef05..23dd18ef 100644 --- a/.github/workflows/ci-actions.yml +++ b/.github/workflows/ci-actions.yml @@ -28,6 +28,10 @@ jobs: with: java-version: openjdk8 - name: Build with Maven + if: github.event_name == 'pull_request' + run: eval mvn $JVM_TEST_MAVEN_OPTS verify + - name: Build with Maven and Coverage + if: github.event_name != 'pull_request' && github.ref == 'master' run: eval mvn $JVM_TEST_MAVEN_OPTS verify -Pcoverage env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/pom.xml b/pom.xml index 1091f385..6a638a8d 100644 --- a/pom.xml +++ b/pom.xml @@ -353,7 +353,7 @@ org.sonarsource.scanner.maven sonar-maven-plugin - 3.5.0.1254 + 3.7.0.1746 verify From 7584bb405a921af0619a957ac2160d51c3d93f78 Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Mon, 9 Mar 2020 19:48:55 +0100 Subject: [PATCH 30/57] split coverage profile --- .github/workflows/ci-actions.yml | 4 +-- pom.xml | 45 ++++++++++++++++++-------------- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci-actions.yml b/.github/workflows/ci-actions.yml index 23dd18ef..6a14518d 100644 --- a/.github/workflows/ci-actions.yml +++ b/.github/workflows/ci-actions.yml @@ -29,10 +29,10 @@ jobs: java-version: openjdk8 - name: Build with Maven if: github.event_name == 'pull_request' - run: eval mvn $JVM_TEST_MAVEN_OPTS verify + run: eval mvn $JVM_TEST_MAVEN_OPTS verify -P coverage - name: Build with Maven and Coverage if: github.event_name != 'pull_request' && github.ref == 'master' - run: eval mvn $JVM_TEST_MAVEN_OPTS verify -Pcoverage + run: eval mvn $JVM_TEST_MAVEN_OPTS verify -P coverage,sonar env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/pom.xml b/pom.xml index 6a638a8d..f5bea52e 100644 --- a/pom.xml +++ b/pom.xml @@ -342,27 +342,8 @@ coverage - - https://sonarcloud.io - carlosthe19916 - carlosthe19916_xavier-integration - Xavier Integration - - - org.sonarsource.scanner.maven - sonar-maven-plugin - 3.7.0.1746 - - - verify - - sonar - - - - org.jacoco jacoco-maven-plugin @@ -407,6 +388,32 @@ + + sonar + + https://sonarcloud.io + carlosthe19916 + carlosthe19916_xavier-integration + Xavier Integration + + + + + org.sonarsource.scanner.maven + sonar-maven-plugin + 3.7.0.1746 + + + verify + + sonar + + + + + + + fuse-fabric8-docker From d6ae38c2fc6f601ae9e1fb88928a0a8da146d7ab Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Mon, 9 Mar 2020 19:51:43 +0100 Subject: [PATCH 31/57] split coverage profile --- .github/workflows/ci-actions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-actions.yml b/.github/workflows/ci-actions.yml index 6a14518d..c798af83 100644 --- a/.github/workflows/ci-actions.yml +++ b/.github/workflows/ci-actions.yml @@ -30,7 +30,7 @@ jobs: - name: Build with Maven if: github.event_name == 'pull_request' run: eval mvn $JVM_TEST_MAVEN_OPTS verify -P coverage - - name: Build with Maven and Coverage + - name: Build with Maven and Sonar if: github.event_name != 'pull_request' && github.ref == 'master' run: eval mvn $JVM_TEST_MAVEN_OPTS verify -P coverage,sonar env: From bb0d088a0ac639f8359d692b38604125439b31cb Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Mon, 9 Mar 2020 20:36:38 +0100 Subject: [PATCH 32/57] add github token for coverage --- .github/workflows/ci-actions.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci-actions.yml b/.github/workflows/ci-actions.yml index c798af83..455c836f 100644 --- a/.github/workflows/ci-actions.yml +++ b/.github/workflows/ci-actions.yml @@ -30,6 +30,8 @@ jobs: - name: Build with Maven if: github.event_name == 'pull_request' run: eval mvn $JVM_TEST_MAVEN_OPTS verify -P coverage + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Build with Maven and Sonar if: github.event_name != 'pull_request' && github.ref == 'master' run: eval mvn $JVM_TEST_MAVEN_OPTS verify -P coverage,sonar From 60b630760bbda681b830f823a788f6c91c65f80f Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Mon, 9 Mar 2020 21:09:06 +0100 Subject: [PATCH 33/57] remove env --- .github/workflows/ci-actions.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci-actions.yml b/.github/workflows/ci-actions.yml index 455c836f..c798af83 100644 --- a/.github/workflows/ci-actions.yml +++ b/.github/workflows/ci-actions.yml @@ -30,8 +30,6 @@ jobs: - name: Build with Maven if: github.event_name == 'pull_request' run: eval mvn $JVM_TEST_MAVEN_OPTS verify -P coverage - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Build with Maven and Sonar if: github.event_name != 'pull_request' && github.ref == 'master' run: eval mvn $JVM_TEST_MAVEN_OPTS verify -P coverage,sonar From 7a92b3fd0beaaa7bc5f7be786a69607d7a1b3945 Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Tue, 10 Mar 2020 09:28:40 +0100 Subject: [PATCH 34/57] add maven cache --- .github/workflows/ci-actions.yml | 70 ++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/.github/workflows/ci-actions.yml b/.github/workflows/ci-actions.yml index c798af83..15a50251 100644 --- a/.github/workflows/ci-actions.yml +++ b/.github/workflows/ci-actions.yml @@ -14,6 +14,60 @@ env: JVM_TEST_MAVEN_OPTS: "-e -B -P !fuse-fabric8-docker --settings configuration/settings.xml" jobs: + build-jdk8: + name: "JDK 8 Build" + runs-on: ubuntu-latest + # Skip draft PRs and those with WIP in the subject, rerun as soon as its removed + if: "github.event_name != 'pull_request' || ( \ + github.event.pull_request.draft == false && \ + github.event.pull_request.state != 'closed' && \ + contains(github.event.pull_request.title, 'wip ') == false && \ + contains(github.event.pull_request.title, '[wip]') == false && \ + ( + github.event.action != 'edited' || \ + contains(github.event.changes.title.from, 'wip ') || \ + contains(github.event.changes.title.from, '[wip]') \ + ) \ + )" + steps: + - uses: actions/checkout@v2 + - uses: n1hility/cancel-previous-runs@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + - name: Set up JDK 8 + # Uses sha for added security since tags can be updated + uses: joschi/setup-jdk@7134ae95986e4e0a4f9f0b51345c93fcebfc4ea9 + with: + java-version: openjdk8 + - name: Compute cache restore key + # Always recompute on a push so that the maven repo doesnt grow indefinitely with old versions + run: | + if ${{ github.event_name == 'pull_request' }}; then echo "::set-env name=COMPUTED_RESTORE_KEY::q2maven-"; fi + - name: Cache Maven Repository + id: cache-maven + uses: n1hility/cache@v2 + with: + path: ~/.m2/repository + # Improves the reusability of the cache to limit key changes + key: q2maven-${{ hashFiles('pom.xml') }} + restore-keys: ${{ env.COMPUTED_RESTORE_KEY }} + restore-only: ${{ github.event_name == 'pull_request' }} + - name: Build + run: | + mvn -e -B -DskipTests=true -Dno-format -DskipDocs -P !fuse-fabric8-docker --settings configuration/settings.xml clean install + - name: Tar Maven Repo + shell: bash + run: tar -czvf maven-repo.tgz -C ~ .m2/repository + - name: Persist Maven Repo + uses: actions/upload-artifact@v1 + with: + name: maven-repo + path: maven-repo.tgz + - name: Cleanup Cache + shell: bash + run: | + find ~/.m2/repository/org/jboss/xavier/ -mindepth 1 -maxdepth 1 \( ! -name http -a ! -name gizmo -a ! -name security \) -exec echo {} \; -exec rm -rf {} \; || true + linux-jvm-tests: name: JDK 8 JVM Tests timeout-minutes: 120 @@ -27,6 +81,14 @@ jobs: uses: joschi/setup-jdk@7134ae95986e4e0a4f9f0b51345c93fcebfc4ea9 with: java-version: openjdk8 + - name: Download Maven Repo + uses: actions/download-artifact@v1 + with: + name: maven-repo + path: . + - name: Extract Maven Repo + shell: bash + run: tar -xzvf maven-repo.tgz -C ~ - name: Build with Maven if: github.event_name == 'pull_request' run: eval mvn $JVM_TEST_MAVEN_OPTS verify -P coverage @@ -65,6 +127,14 @@ jobs: uses: joschi/setup-jdk@7134ae95986e4e0a4f9f0b51345c93fcebfc4ea9 with: java-version: openjdk8 + - name: Download Maven Repo + uses: actions/download-artifact@v1 + with: + name: maven-repo + path: . + - name: Extract Maven Repo + shell: bash + run: tar -xzvf maven-repo.tgz -C ~ - name: Build with Maven run: eval mvn $JVM_TEST_MAVEN_OPTS -Dtest=${{ matrix.class-name }} test - name: Prepare failure archive (if maven failed) From c4202a890238ceefedf2300a8ee7b4f9e2cebb37 Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Tue, 10 Mar 2020 09:30:50 +0100 Subject: [PATCH 35/57] add maven cache --- .github/workflows/ci-actions.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci-actions.yml b/.github/workflows/ci-actions.yml index 15a50251..f3470e8d 100644 --- a/.github/workflows/ci-actions.yml +++ b/.github/workflows/ci-actions.yml @@ -70,6 +70,7 @@ jobs: linux-jvm-tests: name: JDK 8 JVM Tests + needs: build-jdk8 timeout-minutes: 120 runs-on: ubuntu-latest @@ -113,6 +114,7 @@ jobs: linux-jdk8-jvm-end2end-tests: name: JDK 8 JVM ${{matrix.class-name}} Test + needs: build-jdk8 timeout-minutes: 120 strategy: fail-fast: ${{ github.repository == 'project-xavier/xavier-integration' }} From 01eb5c5d141ebcfff8d39960f972575747501215 Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Tue, 10 Mar 2020 14:02:03 +0100 Subject: [PATCH 36/57] remove cached since time has been increased in 3 minutes --- .github/workflows/ci-actions.yml | 79 ++------------------------------ 1 file changed, 3 insertions(+), 76 deletions(-) diff --git a/.github/workflows/ci-actions.yml b/.github/workflows/ci-actions.yml index f3470e8d..43b00dda 100644 --- a/.github/workflows/ci-actions.yml +++ b/.github/workflows/ci-actions.yml @@ -8,69 +8,15 @@ on: - 'README.md' - '.dependabot/**' pull_request: + types: [assigned, opened, synchronize, reopened, ready_for_review, edited] paths-ignore: - 'README.md' env: JVM_TEST_MAVEN_OPTS: "-e -B -P !fuse-fabric8-docker --settings configuration/settings.xml" jobs: - build-jdk8: - name: "JDK 8 Build" - runs-on: ubuntu-latest - # Skip draft PRs and those with WIP in the subject, rerun as soon as its removed - if: "github.event_name != 'pull_request' || ( \ - github.event.pull_request.draft == false && \ - github.event.pull_request.state != 'closed' && \ - contains(github.event.pull_request.title, 'wip ') == false && \ - contains(github.event.pull_request.title, '[wip]') == false && \ - ( - github.event.action != 'edited' || \ - contains(github.event.changes.title.from, 'wip ') || \ - contains(github.event.changes.title.from, '[wip]') \ - ) \ - )" - steps: - - uses: actions/checkout@v2 - - uses: n1hility/cancel-previous-runs@v2 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - name: Set up JDK 8 - # Uses sha for added security since tags can be updated - uses: joschi/setup-jdk@7134ae95986e4e0a4f9f0b51345c93fcebfc4ea9 - with: - java-version: openjdk8 - - name: Compute cache restore key - # Always recompute on a push so that the maven repo doesnt grow indefinitely with old versions - run: | - if ${{ github.event_name == 'pull_request' }}; then echo "::set-env name=COMPUTED_RESTORE_KEY::q2maven-"; fi - - name: Cache Maven Repository - id: cache-maven - uses: n1hility/cache@v2 - with: - path: ~/.m2/repository - # Improves the reusability of the cache to limit key changes - key: q2maven-${{ hashFiles('pom.xml') }} - restore-keys: ${{ env.COMPUTED_RESTORE_KEY }} - restore-only: ${{ github.event_name == 'pull_request' }} - - name: Build - run: | - mvn -e -B -DskipTests=true -Dno-format -DskipDocs -P !fuse-fabric8-docker --settings configuration/settings.xml clean install - - name: Tar Maven Repo - shell: bash - run: tar -czvf maven-repo.tgz -C ~ .m2/repository - - name: Persist Maven Repo - uses: actions/upload-artifact@v1 - with: - name: maven-repo - path: maven-repo.tgz - - name: Cleanup Cache - shell: bash - run: | - find ~/.m2/repository/org/jboss/xavier/ -mindepth 1 -maxdepth 1 \( ! -name http -a ! -name gizmo -a ! -name security \) -exec echo {} \; -exec rm -rf {} \; || true - linux-jvm-tests: name: JDK 8 JVM Tests - needs: build-jdk8 timeout-minutes: 120 runs-on: ubuntu-latest @@ -82,20 +28,10 @@ jobs: uses: joschi/setup-jdk@7134ae95986e4e0a4f9f0b51345c93fcebfc4ea9 with: java-version: openjdk8 - - name: Download Maven Repo - uses: actions/download-artifact@v1 - with: - name: maven-repo - path: . - - name: Extract Maven Repo - shell: bash - run: tar -xzvf maven-repo.tgz -C ~ - name: Build with Maven if: github.event_name == 'pull_request' - run: eval mvn $JVM_TEST_MAVEN_OPTS verify -P coverage - - name: Build with Maven and Sonar - if: github.event_name != 'pull_request' && github.ref == 'master' - run: eval mvn $JVM_TEST_MAVEN_OPTS verify -P coverage,sonar + run: | + if ${{ github.event_name == 'pull_request' }}; then eval mvn $JVM_TEST_MAVEN_OPTS verify -P coverage; else eval mvn $JVM_TEST_MAVEN_OPTS verify -P coverage,sonar fi env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} @@ -114,7 +50,6 @@ jobs: linux-jdk8-jvm-end2end-tests: name: JDK 8 JVM ${{matrix.class-name}} Test - needs: build-jdk8 timeout-minutes: 120 strategy: fail-fast: ${{ github.repository == 'project-xavier/xavier-integration' }} @@ -129,14 +64,6 @@ jobs: uses: joschi/setup-jdk@7134ae95986e4e0a4f9f0b51345c93fcebfc4ea9 with: java-version: openjdk8 - - name: Download Maven Repo - uses: actions/download-artifact@v1 - with: - name: maven-repo - path: . - - name: Extract Maven Repo - shell: bash - run: tar -xzvf maven-repo.tgz -C ~ - name: Build with Maven run: eval mvn $JVM_TEST_MAVEN_OPTS -Dtest=${{ matrix.class-name }} test - name: Prepare failure archive (if maven failed) From ba6341699a89f6601651537fa0f0c04c19f0a25d Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Tue, 10 Mar 2020 15:17:13 +0100 Subject: [PATCH 37/57] fix github actions on PR and parallel travis --- .github/workflows/ci-actions.yml | 4 ++-- .travis.yml | 36 +++++++++++++------------------- 2 files changed, 17 insertions(+), 23 deletions(-) diff --git a/.github/workflows/ci-actions.yml b/.github/workflows/ci-actions.yml index 43b00dda..9c7228d1 100644 --- a/.github/workflows/ci-actions.yml +++ b/.github/workflows/ci-actions.yml @@ -31,7 +31,7 @@ jobs: - name: Build with Maven if: github.event_name == 'pull_request' run: | - if ${{ github.event_name == 'pull_request' }}; then eval mvn $JVM_TEST_MAVEN_OPTS verify -P coverage; else eval mvn $JVM_TEST_MAVEN_OPTS verify -P coverage,sonar fi + if ${{ github.event_name == 'pull_request' }}; then eval mvn $JVM_TEST_MAVEN_OPTS verify -P coverage; else eval mvn $JVM_TEST_MAVEN_OPTS verify -P coverage,sonar; fi env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} @@ -65,7 +65,7 @@ jobs: with: java-version: openjdk8 - name: Build with Maven - run: eval mvn $JVM_TEST_MAVEN_OPTS -Dtest=${{ matrix.class-name }} test + run: eval mvn $JVM_TEST_MAVEN_OPTS -P endToEnd -Dtest=${{ matrix.class-name }} test - name: Prepare failure archive (if maven failed) if: failure() shell: bash diff --git a/.travis.yml b/.travis.yml index 17ef7da7..623dfb6a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,33 +12,27 @@ notifications: on_failure: always jdk: - openjdk8 -addons: - sonarcloud: - organization: project-xavier - token: $SONAR_TOKEN - -env: -# global: -# - CAMEL_SPRINGBOOT_TRACING=false -# - LOGGING_LEVEL_ROOT=info -# - ANALYSIS_DATAINTEGRITY_LOG=false - jobs: - - TEST_PROFILE=unitTest MAVEN_PARAMS= - - TEST_PROFILE=endToEnd MAVEN_PARAMS='-Dtest=Case1EndToEndIT' - - TEST_PROFILE=endToEnd MAVEN_PARAMS='-Dtest=Case2EndToEndIT' - -sudo: required services: - docker +env: + global: + - CAMEL_SPRINGBOOT_TRACING=false + - LOGGING_LEVEL_ROOT=info + - ANALYSIS_DATAINTEGRITY_LOG=false + install: - cp ./configuration/settings.xml $HOME/.m2/settings.xml -script: - - mvn test -P $TEST_PROFILE $MAVEN_PARAMS -# - mvn test -Pcoverage -# - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then sonar-scanner; fi' -# - bash <(curl -s https://codecov.io/bash) +jobs: + include: + - stage: Test + script: + - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then mvn test -P coverage,sonar; else mvn test -P coverage; fi' + - bash <(curl -s https://codecov.io/bash) + - stage: Test + script: + - mvn test -PendToEnd From 1987abc448532ef40e985df60d6711a83c209410 Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Tue, 10 Mar 2020 15:31:32 +0100 Subject: [PATCH 38/57] fix github actions typos --- .github/workflows/ci-actions.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-actions.yml b/.github/workflows/ci-actions.yml index 9c7228d1..98375cf5 100644 --- a/.github/workflows/ci-actions.yml +++ b/.github/workflows/ci-actions.yml @@ -30,8 +30,10 @@ jobs: java-version: openjdk8 - name: Build with Maven if: github.event_name == 'pull_request' - run: | - if ${{ github.event_name == 'pull_request' }}; then eval mvn $JVM_TEST_MAVEN_OPTS verify -P coverage; else eval mvn $JVM_TEST_MAVEN_OPTS verify -P coverage,sonar; fi + run: eval mvn $JVM_TEST_MAVEN_OPTS verify -P coverage + - name: Build with Maven + if: github.event_name != 'pull_request' + run: eval mvn $JVM_TEST_MAVEN_OPTS verify -P coverage,sonar env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} From 95378c523c0230208301b261ee26403408e4e677 Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Tue, 10 Mar 2020 15:34:43 +0100 Subject: [PATCH 39/57] fix travis --- .travis.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 623dfb6a..2cf8ff04 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,22 +16,26 @@ jdk: services: - docker -env: - global: - - CAMEL_SPRINGBOOT_TRACING=false - - LOGGING_LEVEL_ROOT=info - - ANALYSIS_DATAINTEGRITY_LOG=false - install: - cp ./configuration/settings.xml $HOME/.m2/settings.xml jobs: include: - stage: Test + env: + global: + - CAMEL_SPRINGBOOT_TRACING=false + - LOGGING_LEVEL_ROOT=info + - ANALYSIS_DATAINTEGRITY_LOG=false script: - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then mvn test -P coverage,sonar; else mvn test -P coverage; fi' - bash <(curl -s https://codecov.io/bash) - stage: Test + env: + global: + - CAMEL_SPRINGBOOT_TRACING=false + - LOGGING_LEVEL_ROOT=info + - ANALYSIS_DATAINTEGRITY_LOG=false script: - mvn test -PendToEnd From 3dc43efb014d140eb76caf4fafae8c5ce060962d Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Tue, 10 Mar 2020 15:48:25 +0100 Subject: [PATCH 40/57] fix travis env variables --- .travis.yml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2cf8ff04..024d59fc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,19 +23,17 @@ jobs: include: - stage: Test env: - global: - - CAMEL_SPRINGBOOT_TRACING=false - - LOGGING_LEVEL_ROOT=info - - ANALYSIS_DATAINTEGRITY_LOG=false + - CAMEL_SPRINGBOOT_TRACING=false + - LOGGING_LEVEL_ROOT=info + - ANALYSIS_DATAINTEGRITY_LOG=false script: - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then mvn test -P coverage,sonar; else mvn test -P coverage; fi' - bash <(curl -s https://codecov.io/bash) - stage: Test env: - global: - - CAMEL_SPRINGBOOT_TRACING=false - - LOGGING_LEVEL_ROOT=info - - ANALYSIS_DATAINTEGRITY_LOG=false + - CAMEL_SPRINGBOOT_TRACING=false + - LOGGING_LEVEL_ROOT=info + - ANALYSIS_DATAINTEGRITY_LOG=false script: - mvn test -PendToEnd From b358f48bdd4c397bd8748b335aedf0e09f2ab9a8 Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Tue, 10 Mar 2020 17:06:57 +0100 Subject: [PATCH 41/57] restore travis config --- .travis.yml | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 024d59fc..e3127e09 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,13 +12,35 @@ notifications: on_failure: always jdk: - openjdk8 +addons: + sonarcloud: + organization: project-xavier + token: $SONAR_TOKEN + + +sudo: required services: - docker +# Fix for https://travis-ci.community/t/problematic-docker-compose-version-1-23-1/5362/3 +before_install: + - docker-compose --version + - docker info + - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - + - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" + - sudo apt-get update + - sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce + - sudo rm /usr/local/bin/docker-compose + - curl -L https://github.com/docker/compose/releases/download/1.22.0/docker-compose-Linux-x86_64 > docker-compose + - chmod +x docker-compose + - sudo mv docker-compose /usr/local/bin + - docker-compose --version + - docker info + install: - cp ./configuration/settings.xml $HOME/.m2/settings.xml - + - mvn install -P !fuse-fabric8-docker -DskipTests=true -Dmaven.javadoc.skip=true -B -V jobs: include: - stage: Test @@ -27,14 +49,8 @@ jobs: - LOGGING_LEVEL_ROOT=info - ANALYSIS_DATAINTEGRITY_LOG=false script: - - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then mvn test -P coverage,sonar; else mvn test -P coverage; fi' + - mvn test -Pcoverage + - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then sonar-scanner; fi' - bash <(curl -s https://codecov.io/bash) - - stage: Test - env: - - CAMEL_SPRINGBOOT_TRACING=false - - LOGGING_LEVEL_ROOT=info - - ANALYSIS_DATAINTEGRITY_LOG=false - script: - - mvn test -PendToEnd From ca76c27a5c949769eb29e3c94ffe3251a999b369 Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Tue, 10 Mar 2020 17:22:57 +0100 Subject: [PATCH 42/57] add scheduler --- .github/workflows/ci-actions.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci-actions.yml b/.github/workflows/ci-actions.yml index 98375cf5..a8080101 100644 --- a/.github/workflows/ci-actions.yml +++ b/.github/workflows/ci-actions.yml @@ -11,6 +11,8 @@ on: types: [assigned, opened, synchronize, reopened, ready_for_review, edited] paths-ignore: - 'README.md' + schedule: + - cron: '0 0 * * *' env: JVM_TEST_MAVEN_OPTS: "-e -B -P !fuse-fabric8-docker --settings configuration/settings.xml" From b38d446800c8c66234860e720bef62928e726126 Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Tue, 10 Mar 2020 17:27:59 +0100 Subject: [PATCH 43/57] not break travis with new changes --- .travis.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.travis.yml b/.travis.yml index e3127e09..1d5c9e06 100644 --- a/.travis.yml +++ b/.travis.yml @@ -52,5 +52,12 @@ jobs: - mvn test -Pcoverage - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then sonar-scanner; fi' - bash <(curl -s https://codecov.io/bash) + - stage: EndToEnd Test + env: + - CAMEL_SPRINGBOOT_TRACING=false + - LOGGING_LEVEL_ROOT=info + - ANALYSIS_DATAINTEGRITY_LOG=false + script: + - mvn test -PendToEnd From 789de4e7790124dabce5e67f6656ffe5d555a8b8 Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Tue, 10 Mar 2020 18:30:34 +0100 Subject: [PATCH 44/57] remove upload files --- .github/workflows/ci-actions.yml | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/.github/workflows/ci-actions.yml b/.github/workflows/ci-actions.yml index a8080101..75fa3f00 100644 --- a/.github/workflows/ci-actions.yml +++ b/.github/workflows/ci-actions.yml @@ -41,16 +41,6 @@ jobs: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - name: Codecov metrics uses: codecov/codecov-action@v1 - - name: Prepare failure archive (if maven failed) - if: failure() - shell: bash - run: find . -name '*-reports' -type d | tar -czvf test-reports.tgz -T - - - name: Upload failure Archive (if maven failed) - uses: actions/upload-artifact@v1 - if: failure() - with: - name: test-reports-linux-jvm8 - path: 'test-reports.tgz' linux-jdk8-jvm-end2end-tests: name: JDK 8 JVM ${{matrix.class-name}} Test @@ -70,13 +60,3 @@ jobs: java-version: openjdk8 - name: Build with Maven run: eval mvn $JVM_TEST_MAVEN_OPTS -P endToEnd -Dtest=${{ matrix.class-name }} test - - name: Prepare failure archive (if maven failed) - if: failure() - shell: bash - run: find . -name '*-reports' -type d | tar -czvf test-reports.tgz -T - - - name: Upload failure Archive (if maven failed) - uses: actions/upload-artifact@v1 - if: failure() - with: - name: test-reports-linux-jvm-${{matrix.class-name}} - path: 'test-reports.tgz' From c98aa3066aaa9169de5ad0657ebf7dc6976f9c78 Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Wed, 11 Mar 2020 14:19:29 +0100 Subject: [PATCH 45/57] add real sonar org and key --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index f5bea52e..6311f9fe 100644 --- a/pom.xml +++ b/pom.xml @@ -392,8 +392,8 @@ sonar https://sonarcloud.io - carlosthe19916 - carlosthe19916_xavier-integration + project-xavier + project-xavier_xavier-integration Xavier Integration From c045bdb0b8253676b13f09cc232364a90f7d0715 Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Fri, 13 Mar 2020 10:07:29 +0100 Subject: [PATCH 46/57] rename end2end test --- .github/workflows/ci-actions.yml | 2 +- .../xavier/integrations/Case2EndToEndIT.java | 16 ---------------- ...ToEndIT.java => UploadPayloadEndToEndIT.java} | 16 ++++++++-------- 3 files changed, 9 insertions(+), 25 deletions(-) delete mode 100644 src/test/java/org/jboss/xavier/integrations/Case2EndToEndIT.java rename src/test/java/org/jboss/xavier/integrations/{Case1EndToEndIT.java => UploadPayloadEndToEndIT.java} (98%) diff --git a/.github/workflows/ci-actions.yml b/.github/workflows/ci-actions.yml index 75fa3f00..3899e979 100644 --- a/.github/workflows/ci-actions.yml +++ b/.github/workflows/ci-actions.yml @@ -48,7 +48,7 @@ jobs: strategy: fail-fast: ${{ github.repository == 'project-xavier/xavier-integration' }} matrix: - class-name: [Case1EndToEndIT,Case2EndToEndIT] + class-name: [UploadPayloadEndToEndIT] runs-on: ubuntu-latest steps: diff --git a/src/test/java/org/jboss/xavier/integrations/Case2EndToEndIT.java b/src/test/java/org/jboss/xavier/integrations/Case2EndToEndIT.java deleted file mode 100644 index 73a957dc..00000000 --- a/src/test/java/org/jboss/xavier/integrations/Case2EndToEndIT.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jboss.xavier.integrations; - -import org.junit.Test; - -import static org.assertj.core.api.Assertions.assertThat; - -public class Case2EndToEndIT { - - @Test - public void end2endTest() throws Exception { - Integer a = 1; - Integer b = 1; - - assertThat(a + b).isEqualTo(2); - } -} diff --git a/src/test/java/org/jboss/xavier/integrations/Case1EndToEndIT.java b/src/test/java/org/jboss/xavier/integrations/UploadPayloadEndToEndIT.java similarity index 98% rename from src/test/java/org/jboss/xavier/integrations/Case1EndToEndIT.java rename to src/test/java/org/jboss/xavier/integrations/UploadPayloadEndToEndIT.java index b194ee17..ec8fe6bc 100644 --- a/src/test/java/org/jboss/xavier/integrations/Case1EndToEndIT.java +++ b/src/test/java/org/jboss/xavier/integrations/UploadPayloadEndToEndIT.java @@ -92,11 +92,11 @@ @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @UseAdviceWith // Disables automatic start of Camel context @SpringBootTest(classes = {Application.class}, webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT) -@ContextConfiguration(initializers = Case1EndToEndIT.Initializer.class) +@ContextConfiguration(initializers = UploadPayloadEndToEndIT.Initializer.class) @Import(TestConfigurationS3.class) @ActiveProfiles("test") -public class Case1EndToEndIT { - private static Logger logger = LoggerFactory.getLogger(Case1EndToEndIT.class); +public class UploadPayloadEndToEndIT { + private static Logger logger = LoggerFactory.getLogger(UploadPayloadEndToEndIT.class); @ClassRule public static GenericContainer activemq = new GenericContainer<>("vromero/activemq-artemis") @@ -327,7 +327,7 @@ private static void cloneInsightsRbacRepo_UnzipAndConfigure() throws IOException } private static void unzipFile(File file, String outputDir) throws IOException { - ZipFile zipFile = new ZipFile(file); + java.util.zip.ZipFile zipFile = new ZipFile(file); try { Enumeration entries = zipFile.entries(); while (entries.hasMoreElements()) { @@ -465,7 +465,7 @@ public void configure() { ResponseEntity workloadSummaryReport = new RestTemplate().exchange("http://localhost:" + serverPort + String.format("/api/xavier/report/%d/workload-summary", analysisNum), HttpMethod.GET, getRequestEntity(), new ParameterizedTypeReference() {}); // Checks on Initial Savings Report - InitialSavingsEstimationReportModel initialSavingsEstimationReport_Expected = new ObjectMapper().readValue(IOUtils.resourceToString("cfme_inventory-20190912-demolab-withssa-initial-cost-savings-report.json", StandardCharsets.UTF_8, Case1EndToEndIT.class.getClassLoader()), InitialSavingsEstimationReportModel.class); + InitialSavingsEstimationReportModel initialSavingsEstimationReport_Expected = new ObjectMapper().readValue(IOUtils.resourceToString("cfme_inventory-20190912-demolab-withssa-initial-cost-savings-report.json", StandardCharsets.UTF_8, UploadPayloadEndToEndIT.class.getClassLoader()), InitialSavingsEstimationReportModel.class); SoftAssertions.assertSoftly(softly -> softly.assertThat(initialCostSavingsReport.getBody()) .usingRecursiveComparison() .ignoringFieldsMatchingRegexes(".*id.*", ".*creationDate.*", ".*report.*") @@ -490,14 +490,14 @@ public void configure() { softly.assertThat(workloadInventoryReport.getBody().getContent().stream().filter(e -> e.getOsName().contains("ServerNT") && e.getWorkloads().contains("Microsoft SQL Server")).count()).isEqualTo(1); }); - WorkloadInventoryReportModel[] workloadInventoryReportModelExpected = new ObjectMapper().readValue(IOUtils.resourceToString("cfme_inventory-20190912-demolab-withssa-workload-inventory-report.json", StandardCharsets.UTF_8, Case1EndToEndIT.class.getClassLoader()), WorkloadInventoryReportModel[].class); + WorkloadInventoryReportModel[] workloadInventoryReportModelExpected = new ObjectMapper().readValue(IOUtils.resourceToString("cfme_inventory-20190912-demolab-withssa-workload-inventory-report.json", StandardCharsets.UTF_8, UploadPayloadEndToEndIT.class.getClassLoader()), WorkloadInventoryReportModel[].class); assertThat(workloadInventoryReport.getBody().getContent().toArray()) .usingRecursiveComparison() .ignoringFieldsMatchingRegexes(".*id.*", ".*creationDate.*") .isEqualTo(workloadInventoryReportModelExpected); // Checks on Workload Summary Report - WorkloadSummaryReportModel workloadSummaryReport_Expected = new ObjectMapper().readValue(IOUtils.resourceToString("cfme_inventory-20190912-demolab-withssa-workload-summary-report.json", StandardCharsets.UTF_8, Case1EndToEndIT.class.getClassLoader()), WorkloadSummaryReportModel.class); + WorkloadSummaryReportModel workloadSummaryReport_Expected = new ObjectMapper().readValue(IOUtils.resourceToString("cfme_inventory-20190912-demolab-withssa-workload-summary-report.json", StandardCharsets.UTF_8, UploadPayloadEndToEndIT.class.getClassLoader()), WorkloadSummaryReportModel.class); assertThat(workloadSummaryReport.getBody()) .usingRecursiveComparison() @@ -654,7 +654,7 @@ private HttpEntity> getRequestEntityForUploadRESTC LinkedMultiValueMap fileMap = new LinkedMultiValueMap<>(); fileMap.add(HttpHeaders.CONTENT_DISPOSITION, "form-data; name=filex; filename=" + filename); fileMap.add("Content-type", content_type_header); - body.add("file", new HttpEntity<>(IOUtils.resourceToByteArray(filename, Case1EndToEndIT.class.getClassLoader()), fileMap)); + body.add("file", new HttpEntity<>(IOUtils.resourceToByteArray(filename, UploadPayloadEndToEndIT.class.getClassLoader()), fileMap)); // params Body parts body.add("percentageOfHypervisorsMigratedOnYear1", "50"); From 7aae60f5b868987ade1095afd55f0a638c53e274 Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Fri, 13 Mar 2020 11:07:28 +0100 Subject: [PATCH 47/57] fire build --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1d5c9e06..b04ef953 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,6 @@ addons: organization: project-xavier token: $SONAR_TOKEN - sudo: required services: From 508e148a4de2cde8dd0f97f25752314a7cf29743 Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Fri, 13 Mar 2020 11:43:03 +0100 Subject: [PATCH 48/57] remove install since it is execute twice in every stage --- .travis.yml | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index b04ef953..733ab98f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,24 +22,9 @@ sudo: required services: - docker -# Fix for https://travis-ci.community/t/problematic-docker-compose-version-1-23-1/5362/3 -before_install: - - docker-compose --version - - docker info - - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - - - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" - - sudo apt-get update - - sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce - - sudo rm /usr/local/bin/docker-compose - - curl -L https://github.com/docker/compose/releases/download/1.22.0/docker-compose-Linux-x86_64 > docker-compose - - chmod +x docker-compose - - sudo mv docker-compose /usr/local/bin - - docker-compose --version - - docker info - install: - cp ./configuration/settings.xml $HOME/.m2/settings.xml - - mvn install -P !fuse-fabric8-docker -DskipTests=true -Dmaven.javadoc.skip=true -B -V + jobs: include: - stage: Test @@ -48,7 +33,7 @@ jobs: - LOGGING_LEVEL_ROOT=info - ANALYSIS_DATAINTEGRITY_LOG=false script: - - mvn test -Pcoverage + - mvn test -P !fuse-fabric8-docker,coverage - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then sonar-scanner; fi' - bash <(curl -s https://codecov.io/bash) - stage: EndToEnd Test @@ -56,7 +41,21 @@ jobs: - CAMEL_SPRINGBOOT_TRACING=false - LOGGING_LEVEL_ROOT=info - ANALYSIS_DATAINTEGRITY_LOG=false + # Fix for https://travis-ci.community/t/problematic-docker-compose-version-1-23-1/5362/3 + before_install: + - docker-compose --version + - docker info + - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - + - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" + - sudo apt-get update + - sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce + - sudo rm /usr/local/bin/docker-compose + - curl -L https://github.com/docker/compose/releases/download/1.22.0/docker-compose-Linux-x86_64 > docker-compose + - chmod +x docker-compose + - sudo mv docker-compose /usr/local/bin + - docker-compose --version + - docker info script: - - mvn test -PendToEnd + - mvn test -P !fuse-fabric8-docker,endToEnd From bda8caaba01c466d9768195badb43ad9644857ea Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Fri, 13 Mar 2020 12:00:12 +0100 Subject: [PATCH 49/57] restore install since it caused LOG error in travis --- .travis.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 733ab98f..cb8e38a3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,6 +17,7 @@ addons: organization: project-xavier token: $SONAR_TOKEN + sudo: required services: @@ -24,7 +25,7 @@ services: install: - cp ./configuration/settings.xml $HOME/.m2/settings.xml - + - mvn install -P !fuse-fabric8-docker -DskipTests=true -Dmaven.javadoc.skip=true -B -V jobs: include: - stage: Test @@ -33,7 +34,7 @@ jobs: - LOGGING_LEVEL_ROOT=info - ANALYSIS_DATAINTEGRITY_LOG=false script: - - mvn test -P !fuse-fabric8-docker,coverage + - mvn test -Pcoverage - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then sonar-scanner; fi' - bash <(curl -s https://codecov.io/bash) - stage: EndToEnd Test @@ -56,6 +57,6 @@ jobs: - docker-compose --version - docker info script: - - mvn test -P !fuse-fabric8-docker,endToEnd + - mvn test -PendToEnd From 7aed395857a4698c7da0d371b55341a08eab3d0e Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Mon, 30 Mar 2020 18:22:50 +0200 Subject: [PATCH 50/57] add docs for Github Actions --- .github/workflows/ci-actions.yml | 21 ++++++++++++++++++--- README.md | 6 +++++- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-actions.yml b/.github/workflows/ci-actions.yml index 3899e979..6df1fb2c 100644 --- a/.github/workflows/ci-actions.yml +++ b/.github/workflows/ci-actions.yml @@ -1,22 +1,30 @@ name: Xavier Integration CI on: + # Will execute the jobs when a push even (new commit) appears in the repository. This includes all branches including 'master' branch. push: branches-ignore: - 'dependabot/**' paths-ignore: - 'README.md' - '.dependabot/**' + # Will execute the jobs when a new Pull Request is registered in the repository pull_request: types: [assigned, opened, synchronize, reopened, ready_for_review, edited] paths-ignore: - 'README.md' + # Will execute the jobs daily at 00:00:00 schedule: - cron: '0 0 * * *' + +# Declare ENV variables that will be available in every Job env: JVM_TEST_MAVEN_OPTS: "-e -B -P !fuse-fabric8-docker --settings configuration/settings.xml" +# Jobs are executed in parallel unless we use 'needs' field to describe dependencies between jobs jobs: + + # Execute all unit tests linux-jvm-tests: name: JDK 8 JVM Tests timeout-minutes: 120 @@ -24,31 +32,38 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - name: Clone Repo + uses: actions/checkout@v2 - name: Set up JDK 8 # Uses sha for added security since tags can be updated uses: joschi/setup-jdk@7134ae95986e4e0a4f9f0b51345c93fcebfc4ea9 with: java-version: openjdk8 - name: Build with Maven + # If 'pull_request' just execute tests if: github.event_name == 'pull_request' run: eval mvn $JVM_TEST_MAVEN_OPTS verify -P coverage - - name: Build with Maven + - name: Build with Maven and Sonar + # If not 'pull_request' execute tests and analyze the code using Sonar maven profile if: github.event_name != 'pull_request' run: eval mvn $JVM_TEST_MAVEN_OPTS verify -P coverage,sonar env: + # No need to add GITHUB_TOKEN to the list of secrets in Github since it is available by default. + # But we do need to add SONAR_TOKEN in the Github Secrets Page. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - name: Codecov metrics uses: codecov/codecov-action@v1 + # Execute all end-to-end tests. We need to add the names of the end-to-end classes to 'strategy.matrix.class-name' field + # so all our end-to-end tests run in parallel. linux-jdk8-jvm-end2end-tests: name: JDK 8 JVM ${{matrix.class-name}} Test timeout-minutes: 120 strategy: fail-fast: ${{ github.repository == 'project-xavier/xavier-integration' }} matrix: - class-name: [UploadPayloadEndToEndIT] + class-name: [UploadPayloadEndToEndIT] # List of end-to-end classes runs-on: ubuntu-latest steps: diff --git a/README.md b/README.md index 784af68a..3fcb4745 100644 --- a/README.md +++ b/README.md @@ -115,4 +115,8 @@ If using the Fedora docker package it is needed to set the *ryuk.container.privi # References - +# Github Actions +Github Actions is used to manage the software development workflow of this project. Every single Workflow should be placed in +the folder `.github/workflows/` using the `.yml` extension; e.g. `my-action.yml`. Currently we have: +- `.github/workflows/ci-actions.yml` used for executing unit tests and end-to-end tests on Pull Requests, new Commits in the `master` branch, and it also executes +tests daily using the `schedule:cron` feature. See the comments inside the file for more details. From ac6feac324c51cbdea44c8a5c0be160d66f9213f Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Mon, 30 Mar 2020 18:50:59 +0200 Subject: [PATCH 51/57] remove the double stage in Travis --- .travis.yml | 40 ++++++++++++++++------------------------ 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/.travis.yml b/.travis.yml index cb8e38a3..99329dd5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,6 +23,21 @@ sudo: required services: - docker +# Fix for https://travis-ci.community/t/problematic-docker-compose-version-1-23-1/5362/3 +before_install: + - docker-compose --version + - docker info + - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - + - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" + - sudo apt-get update + - sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce + - sudo rm /usr/local/bin/docker-compose + - curl -L https://github.com/docker/compose/releases/download/1.22.0/docker-compose-Linux-x86_64 > docker-compose + - chmod +x docker-compose + - sudo mv docker-compose /usr/local/bin + - docker-compose --version + - docker info + install: - cp ./configuration/settings.xml $HOME/.m2/settings.xml - mvn install -P !fuse-fabric8-docker -DskipTests=true -Dmaven.javadoc.skip=true -B -V @@ -34,29 +49,6 @@ jobs: - LOGGING_LEVEL_ROOT=info - ANALYSIS_DATAINTEGRITY_LOG=false script: - - mvn test -Pcoverage + - mvn test -Pcoverage -PendToEnd - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then sonar-scanner; fi' - bash <(curl -s https://codecov.io/bash) - - stage: EndToEnd Test - env: - - CAMEL_SPRINGBOOT_TRACING=false - - LOGGING_LEVEL_ROOT=info - - ANALYSIS_DATAINTEGRITY_LOG=false - # Fix for https://travis-ci.community/t/problematic-docker-compose-version-1-23-1/5362/3 - before_install: - - docker-compose --version - - docker info - - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - - - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" - - sudo apt-get update - - sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce - - sudo rm /usr/local/bin/docker-compose - - curl -L https://github.com/docker/compose/releases/download/1.22.0/docker-compose-Linux-x86_64 > docker-compose - - chmod +x docker-compose - - sudo mv docker-compose /usr/local/bin - - docker-compose --version - - docker info - script: - - mvn test -PendToEnd - - From 44697b37e0ed591e6432699ba5278c9f93cb062a Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Mon, 30 Mar 2020 18:53:01 +0200 Subject: [PATCH 52/57] remove coverage from GH Actions --- .github/workflows/ci-actions.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-actions.yml b/.github/workflows/ci-actions.yml index 6df1fb2c..9d87459b 100644 --- a/.github/workflows/ci-actions.yml +++ b/.github/workflows/ci-actions.yml @@ -52,8 +52,9 @@ jobs: # But we do need to add SONAR_TOKEN in the Github Secrets Page. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - - name: Codecov metrics - uses: codecov/codecov-action@v1 +# The coverage will come from Travis CI for now +# - name: Codecov metrics +# uses: codecov/codecov-action@v1 # Execute all end-to-end tests. We need to add the names of the end-to-end classes to 'strategy.matrix.class-name' field # so all our end-to-end tests run in parallel. From 87ae913a089ab68870d4ea85762206af5e80ea4d Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Tue, 31 Mar 2020 09:48:15 +0200 Subject: [PATCH 53/57] Remove Sonar Analysis and upload files when failed --- .github/workflows/ci-actions.yml | 37 ++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci-actions.yml b/.github/workflows/ci-actions.yml index 9d87459b..9255fa24 100644 --- a/.github/workflows/ci-actions.yml +++ b/.github/workflows/ci-actions.yml @@ -41,18 +41,33 @@ jobs: java-version: openjdk8 - name: Build with Maven # If 'pull_request' just execute tests - if: github.event_name == 'pull_request' +# if: github.event_name == 'pull_request' run: eval mvn $JVM_TEST_MAVEN_OPTS verify -P coverage - - name: Build with Maven and Sonar - # If not 'pull_request' execute tests and analyze the code using Sonar maven profile - if: github.event_name != 'pull_request' - run: eval mvn $JVM_TEST_MAVEN_OPTS verify -P coverage,sonar - env: - # No need to add GITHUB_TOKEN to the list of secrets in Github since it is available by default. - # But we do need to add SONAR_TOKEN in the Github Secrets Page. - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} -# The coverage will come from Travis CI for now + - name: Prepare failure archive (if maven failed) + if: failure() + shell: bash + run: find . -name '*-reports' -type d | tar -czvf test-reports.tgz -T - + - name: Upload failure Archive (if maven failed) + uses: actions/upload-artifact@v1 + if: failure() + with: + name: test-reports-linux-jvm${{matrix.java-version}} + path: 'test-reports.tgz' +## +## THE SONAR ANALYSIS WILL BE DONE IN TRAVIS +## +# - name: Build with Maven and Sonar +# # If not 'pull_request' execute tests and analyze the code using Sonar maven profile +# if: github.event_name != 'pull_request' +# run: eval mvn $JVM_TEST_MAVEN_OPTS verify -P coverage,sonar +# env: +# # No need to add GITHUB_TOKEN to the list of secrets in Github since it is available by default. +# # But we do need to add SONAR_TOKEN in the Github Secrets Page. +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} +## +## THE COVERAGE REPORT SHOULD BE GENERATED IN TRAVIS +## # - name: Codecov metrics # uses: codecov/codecov-action@v1 From e00b56382cfde43fe773efeb899da932ff63e9c2 Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Tue, 31 Mar 2020 10:11:48 +0200 Subject: [PATCH 54/57] upload failure reports if build fails --- .github/workflows/ci-actions.yml | 14 ++++++++++++-- pom.xml | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-actions.yml b/.github/workflows/ci-actions.yml index 9255fa24..7fbdd510 100644 --- a/.github/workflows/ci-actions.yml +++ b/.github/workflows/ci-actions.yml @@ -51,7 +51,7 @@ jobs: uses: actions/upload-artifact@v1 if: failure() with: - name: test-reports-linux-jvm${{matrix.java-version}} + name: test-reports path: 'test-reports.tgz' ## ## THE SONAR ANALYSIS WILL BE DONE IN TRAVIS @@ -90,4 +90,14 @@ jobs: with: java-version: openjdk8 - name: Build with Maven - run: eval mvn $JVM_TEST_MAVEN_OPTS -P endToEnd -Dtest=${{ matrix.class-name }} test + run: eval mvn $JVM_TEST_MAVEN_OPTS -P coverage,endToEnd -Dtest=${{ matrix.class-name }} test + - name: Prepare failure archive (if maven failed) + if: failure() + shell: bash + run: find . -name '*-reports' -type d | tar -czvf test-reports.tgz -T - + - name: Upload failure Archive (if maven failed) + uses: actions/upload-artifact@v1 + if: failure() + with: + name: test-reports-${{matrix.class-name}} + path: 'test-reports.tgz' diff --git a/pom.xml b/pom.xml index 6311f9fe..f6b22816 100644 --- a/pom.xml +++ b/pom.xml @@ -444,7 +444,7 @@ org.apache.maven.plugins maven-surefire-plugin - 2.22.2 + ${maven-surefire-plugin.version} **/*EndToEndIT.java From b341b651e22151149c04ef3adee53029e2e90387 Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Tue, 31 Mar 2020 10:22:06 +0200 Subject: [PATCH 55/57] add profile for travis so it executes unit tests and end2end tests --- .travis.yml | 2 +- pom.xml | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 99329dd5..5434a112 100644 --- a/.travis.yml +++ b/.travis.yml @@ -49,6 +49,6 @@ jobs: - LOGGING_LEVEL_ROOT=info - ANALYSIS_DATAINTEGRITY_LOG=false script: - - mvn test -Pcoverage -PendToEnd + - mvn test -P coverage,unitTests-endToEnd - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then sonar-scanner; fi' - bash <(curl -s https://codecov.io/bash) diff --git a/pom.xml b/pom.xml index f6b22816..c5381a3f 100644 --- a/pom.xml +++ b/pom.xml @@ -457,5 +457,22 @@ + + unitTests-endToEnd + + + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + **/*EndToEndIT.java + + + + + + From ce8227b6cd7277212c47dd87a6b1b706ee343cb0 Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Tue, 31 Mar 2020 11:20:50 +0200 Subject: [PATCH 56/57] include *Tests in new profile --- pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/pom.xml b/pom.xml index c5381a3f..c7064a6d 100644 --- a/pom.xml +++ b/pom.xml @@ -467,6 +467,7 @@ ${maven-surefire-plugin.version} + **/*Test.java **/*EndToEndIT.java From 476fcb8b9927b6f1ad5d3ff32f6b9500b53fdc90 Mon Sep 17 00:00:00 2001 From: Carlos Esteban Feria Vila <2582866+carlosthe19916@users.noreply.github.com> Date: Thu, 4 Jun 2020 16:47:57 +0200 Subject: [PATCH 57/57] fix test --- .../xavier/integrations/UploadPayloadEndToEndIT.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/java/org/jboss/xavier/integrations/UploadPayloadEndToEndIT.java b/src/test/java/org/jboss/xavier/integrations/UploadPayloadEndToEndIT.java index 5ccf203b..58377d0d 100644 --- a/src/test/java/org/jboss/xavier/integrations/UploadPayloadEndToEndIT.java +++ b/src/test/java/org/jboss/xavier/integrations/UploadPayloadEndToEndIT.java @@ -565,7 +565,7 @@ public void configure() { ResponseEntity workloadSummaryReport = new RestTemplate().exchange(getBaseURLAPIPath() + String.format("/report/%d/workload-summary", analysisNum), HttpMethod.GET, getRequestEntity(), new ParameterizedTypeReference() {}); // Checks on Initial Savings Report - InitialSavingsEstimationReportModel initialSavingsEstimationReport_Expected = objectMapper.readValue(IOUtils.resourceToString("cfme_inventory-20190912-demolab-withssa-initial-cost-savings-report.json", StandardCharsets.UTF_8, EndToEndTest.class.getClassLoader()), InitialSavingsEstimationReportModel.class); + InitialSavingsEstimationReportModel initialSavingsEstimationReport_Expected = objectMapper.readValue(IOUtils.resourceToString("cfme_inventory-20190912-demolab-withssa-initial-cost-savings-report.json", StandardCharsets.UTF_8, UploadPayloadEndToEndIT.class.getClassLoader()), InitialSavingsEstimationReportModel.class); SoftAssertions.assertSoftly(softly -> softly.assertThat(initialCostSavingsReport.getBody()) .usingRecursiveComparison() .ignoringFieldsMatchingRegexes(".*id.*", ".*creationDate.*", ".*report.*") @@ -590,14 +590,14 @@ public void configure() { softly.assertThat(workloadInventoryReport.getBody().getContent().stream().filter(e -> e.getOsName().contains("ServerNT") && e.getWorkloads().contains("Microsoft SQL Server")).count()).isEqualTo(1); }); - WorkloadInventoryReportModel[] workloadInventoryReportModelExpected = objectMapper.readValue(IOUtils.resourceToString("cfme_inventory-20190912-demolab-withssa-workload-inventory-report.json", StandardCharsets.UTF_8, EndToEndTest.class.getClassLoader()), WorkloadInventoryReportModel[].class); + WorkloadInventoryReportModel[] workloadInventoryReportModelExpected = objectMapper.readValue(IOUtils.resourceToString("cfme_inventory-20190912-demolab-withssa-workload-inventory-report.json", StandardCharsets.UTF_8, UploadPayloadEndToEndIT.class.getClassLoader()), WorkloadInventoryReportModel[].class); assertThat(workloadInventoryReport.getBody().getContent().toArray()) .usingRecursiveComparison() .ignoringFieldsMatchingRegexes(".*id.*", ".*creationDate.*") .isEqualTo(workloadInventoryReportModelExpected); // Checks on Workload Summary Report - WorkloadSummaryReportModel workloadSummaryReport_Expected = objectMapper.readValue(IOUtils.resourceToString("cfme_inventory-20190912-demolab-withssa-workload-summary-report.json", StandardCharsets.UTF_8, EndToEndTest.class.getClassLoader()), WorkloadSummaryReportModel.class); + WorkloadSummaryReportModel workloadSummaryReport_Expected = objectMapper.readValue(IOUtils.resourceToString("cfme_inventory-20190912-demolab-withssa-workload-summary-report.json", StandardCharsets.UTF_8, UploadPayloadEndToEndIT.class.getClassLoader()), WorkloadSummaryReportModel.class); assertThat(workloadSummaryReport.getBody()) .usingRecursiveComparison() @@ -716,7 +716,7 @@ public void configure() { assertThat(callSummaryReportAndCheckVMs(String.format("/report/%d/workload-summary", ++analysisNum), timeoutMilliseconds_InitialCostSavingsReport)).isEqualTo(14); ResponseEntity workloadSummaryReportJavaRuntimes = new RestTemplate().exchange(getBaseURLAPIPath() + String.format("/report/%d/workload-summary", analysisNum), HttpMethod.GET, getRequestEntity(), new ParameterizedTypeReference() {}); - WorkloadSummaryReportModel workloadSummaryReport_JavaRuntimesExpected = new ObjectMapper().readValue(IOUtils.resourceToString("cfme_inventory-20200304-Linux_JDK-summary-report.json", StandardCharsets.UTF_8, EndToEndTest.class.getClassLoader()), WorkloadSummaryReportModel.class); + WorkloadSummaryReportModel workloadSummaryReport_JavaRuntimesExpected = new ObjectMapper().readValue(IOUtils.resourceToString("cfme_inventory-20200304-Linux_JDK-summary-report.json", StandardCharsets.UTF_8, UploadPayloadEndToEndIT.class.getClassLoader()), WorkloadSummaryReportModel.class); assertThat(workloadSummaryReportJavaRuntimes.getBody()) .usingRecursiveComparison()