Search in sources :

Example 6 with EnabledIfEnvironmentVariable

use of org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable in project camel-quarkus by apache.

the class NatsTest method tlsAuthProduceConsumeRoundTripShouldSucceed.

@Test
@EnabledIfEnvironmentVariable(named = "ENABLE_TLS_TESTS", matches = "true")
void tlsAuthProduceConsumeRoundTripShouldSucceed() {
    Header header = new Header("sendToEndpointUri", "natsTlsAuth:test?sslContextParameters=#ssl&secure=true");
    given().when().header(header).body("tls-auth-msg").post("/nats/send").then().statusCode(204);
    await().atMost(10L, TimeUnit.SECONDS).until(() -> {
        return given().get("/nats/messages/tls-auth").path("size()").equals(1);
    });
    String[] messages = given().get("/nats/messages/tls-auth").then().statusCode(200).extract().as(String[].class);
    assertEquals(1, messages.length);
    assertEquals("tls-auth-msg", messages[0]);
}
Also used : Header(io.restassured.http.Header) Test(org.junit.jupiter.api.Test) QuarkusTest(io.quarkus.test.junit.QuarkusTest) EnabledIfEnvironmentVariable(org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable)

Example 7 with EnabledIfEnvironmentVariable

use of org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable in project nfdiv-case-api by hmcts.

the class SystemNotifyApplicantDisputeFormOverdueFT method shouldSearchForDisputeFormOverdueCases.

@Test
@EnabledIfEnvironmentVariable(named = "ELASTIC_SEARCH_ENABLED", matches = "true")
public void shouldSearchForDisputeFormOverdueCases() {
    final BoolQueryBuilder query = boolQuery().must(matchQuery(STATE, Holding)).must(matchQuery(AOS_RESPONSE, DISPUTE_DIVORCE.getType())).filter(rangeQuery(ISSUE_DATE).lte(LocalDate.now().minusDays(disputeDueDateOffsetDays))).mustNot(matchQuery(String.format(DATA, NOTIFICATION_SENT_FLAG), YesOrNo.YES));
    searchForCasesWithQuery(query).forEach(caseDetails -> {
        assertThat(caseDetails.getState().equals(Holding));
        CaseData caseData = getCaseData(caseDetails.getData());
        assertThat(DISPUTE_DIVORCE.getType().equals(caseData.getAcknowledgementOfService().getHowToRespondApplication()));
        assertThat(caseData.getApplication().getIssueDate().plusDays(10)).isBeforeOrEqualTo(LocalDate.now());
        assertThat(caseData.getAcknowledgementOfService().getApplicantNotifiedDisputeFormOverdue()).isNotEqualTo(YesOrNo.YES);
    });
}
Also used : CaseData(uk.gov.hmcts.divorce.divorcecase.model.CaseData) BoolQueryBuilder(org.elasticsearch.index.query.BoolQueryBuilder) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) EnabledIfEnvironmentVariable(org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable)

Example 8 with EnabledIfEnvironmentVariable

use of org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable in project nfdiv-case-api by hmcts.

the class SystemProgressHeldCasesFT method shouldSearchForCasesWhereHoldingPeriodHasEnded.

@Test
@EnabledIfEnvironmentVariable(named = "ELASTIC_SEARCH_ENABLED", matches = "true")
public void shouldSearchForCasesWhereHoldingPeriodHasEnded() {
    final BoolQueryBuilder query = boolQuery().must(matchQuery(STATE, Holding)).filter(rangeQuery(CcdSearchService.DUE_DATE).lte(LocalDate.now()));
    searchForCasesWithQuery(query).forEach(caseDetails -> {
        CaseData caseData = getCaseData(caseDetails.getData());
        assertThat(caseDetails.getState().equals(Holding));
        assertThat(caseData.getDueDate()).isBeforeOrEqualTo(LocalDate.now());
    });
}
Also used : CaseData(uk.gov.hmcts.divorce.divorcecase.model.CaseData) BoolQueryBuilder(org.elasticsearch.index.query.BoolQueryBuilder) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) EnabledIfEnvironmentVariable(org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable)

Example 9 with EnabledIfEnvironmentVariable

use of org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable in project blackduck-alert by blackducksoftware.

the class LargeNotificationTest method largePolicyNotificationTest.

@Test
@EnabledIfEnvironmentVariable(named = "ALERT_RUN_PERFORMANCE", matches = "true")
void largePolicyNotificationTest() throws IntegrationException, InterruptedException {
    LocalDateTime startingTime = LocalDateTime.now();
    logger.info(String.format("Starting time: %s", dateTimeFormatter.format(startingTime)));
    JiraServerGlobalConfigModel jiraServerGlobalConfigModel = jiraServerPerformanceUtility.createGlobalConfigModel(testProperties);
    // Create Black Duck Global Provider configuration
    LocalDateTime startingProviderCreateTime = LocalDateTime.now();
    String blackDuckProviderID = blackDuckProviderService.setupBlackDuck();
    logTimeElapsedWithMessage("Setting up the Black Duck provider took %s", startingProviderCreateTime, LocalDateTime.now());
    // Create Jira Server global config
    LocalDateTime startingCreateGlobalConfigTime = LocalDateTime.now();
    JiraServerGlobalConfigModel globalConfiguration = jiraServerPerformanceUtility.createJiraGlobalConfiguration(jiraServerGlobalConfigModel);
    logTimeElapsedWithMessage("Installing the jira server plugin and creating global configuration took %s", startingCreateGlobalConfigTime, LocalDateTime.now());
    // Create distribution job fields
    Map<String, FieldValueModel> channelFieldsMap = jiraServerPerformanceUtility.createChannelFieldsMap(testProperties, DEFAULT_JOB_NAME, globalConfiguration.getId());
    // Clear existing policies
    PolicyRuleView policyRuleView = blackDuckProviderService.createBlackDuckPolicyRuleView(PERFORMANCE_POLICY_NAME, BlackDuckProviderService.getDefaultExternalIdSupplier());
    blackDuckProviderService.deleteExistingBlackDuckPolicy(policyRuleView);
    // Create N number of Blackduck projects and add a vulnerable component to each
    // Note: Setup for this test can take anywhere from 5-20 minutes depending on the instance of Blackduck. By pre-populating the server
    // with projects and components using 'createProjectsAndNotificationsTest' the code below can be skipped.
    /*
        LocalDateTime startingProjectCreationTime = LocalDateTime.now();
        for (int index = 1; index <= NUMBER_OF_PROJECTS_TO_CREATE; index++) {
            ProjectVersionWrapper projectVersionWrapper = createBlackDuckProject(index);
            triggerBlackDuckNotification(projectVersionWrapper.getProjectVersionView());
        }
        String createProjectsLogMessage = String.format("Creating %s projects took", NUMBER_OF_PROJECTS_TO_CREATE);
        logTimeElapsedWithMessage(String.format("%s %s", createProjectsLogMessage, "%s"), startingProjectCreationTime, LocalDateTime.now());
        */
    LocalDateTime executionStartTime = LocalDateTime.now();
    testRunner.runPolicyNotificationTest(channelFieldsMap, "performanceJob", blackDuckProviderID, PERFORMANCE_POLICY_NAME, numberOfProjectsToCreate, true);
    logTimeElapsedWithMessage("Execution and processing test time: %s", executionStartTime, LocalDateTime.now());
    logTimeElapsedWithMessage("Total test time: %s", startingTime, LocalDateTime.now());
}
Also used : LocalDateTime(java.time.LocalDateTime) JiraServerGlobalConfigModel(com.synopsys.integration.alert.channel.jira.server.model.JiraServerGlobalConfigModel) PolicyRuleView(com.synopsys.integration.blackduck.api.generated.view.PolicyRuleView) FieldValueModel(com.synopsys.integration.alert.common.rest.model.FieldValueModel) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) EnabledIfEnvironmentVariable(org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable)

Example 10 with EnabledIfEnvironmentVariable

use of org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable in project blackduck-alert by blackducksoftware.

the class LargeNotificationTest method deleteProjectsAndVersionsTest.

@Test
@EnabledIfEnvironmentVariable(named = "ALERT_RUN_PERFORMANCE", matches = "true")
void deleteProjectsAndVersionsTest() throws IntegrationException {
    LocalDateTime startingTime = LocalDateTime.now();
    logger.info(String.format("Starting time: %s", dateTimeFormatter.format(startingTime)));
    // Create Black Duck Global Provider configuration
    LocalDateTime startingProviderCreateTime = LocalDateTime.now();
    blackDuckProviderService.setupBlackDuck();
    logTimeElapsedWithMessage("Setting up the Black Duck provider took %s", startingProviderCreateTime, LocalDateTime.now());
    // create  blackduck projects
    deleteBlackDuckProjects(numberOfProjectsToCreate);
    logTimeElapsedWithMessage("Total test time: %s", startingTime, LocalDateTime.now());
}
Also used : LocalDateTime(java.time.LocalDateTime) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) EnabledIfEnvironmentVariable(org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable)

Aggregations

EnabledIfEnvironmentVariable (org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable)21 Test (org.junit.jupiter.api.Test)20 LocalDateTime (java.time.LocalDateTime)13 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)13 JiraServerGlobalConfigModel (com.synopsys.integration.alert.channel.jira.server.model.JiraServerGlobalConfigModel)9 FieldValueModel (com.synopsys.integration.alert.common.rest.model.FieldValueModel)9 PolicyRuleView (com.synopsys.integration.blackduck.api.generated.view.PolicyRuleView)7 ProjectVersionWrapper (com.synopsys.integration.blackduck.service.model.ProjectVersionWrapper)4 BoolQueryBuilder (org.elasticsearch.index.query.BoolQueryBuilder)4 CaseData (uk.gov.hmcts.divorce.divorcecase.model.CaseData)4 HashSet (java.util.HashSet)2 DeleteOneModelElementBaselineEval (edu.kit.kastel.mcse.ardoco.core.tests.inconsistencies.baseline.DeleteOneModelElementBaselineEval)1 AbstractEvalStrategy (edu.kit.kastel.mcse.ardoco.core.tests.inconsistencies.eval.AbstractEvalStrategy)1 QuarkusTest (io.quarkus.test.junit.QuarkusTest)1 Header (io.restassured.http.Header)1 Connection (java.sql.Connection)1 ResultSet (java.sql.ResultSet)1 Statement (java.sql.Statement)1 ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1