Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

for debug #76

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@
<properties>
<test-it.sonarqube.keepRunning>true</test-it.sonarqube.keepRunning>
<test-it.sonarqube.port>9000</test-it.sonarqube.port>
<!-- <test-it.sonarqube.port>33333</test-it.sonarqube.port>-->
</properties>
</profile>
</profiles>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private static void launchSonarqube() {
}

@BeforeAll
static void setup() {
static void setup() throws InterruptedException {
LOGGER.log(
INFO,
"\n" +
Expand Down Expand Up @@ -102,8 +102,20 @@ static void setup() {
)
.collect(Collectors.joining("\n", "\n\n", "\n\n"))
);
LOGGER.log(INFO, "----------");
LOGGER.log(INFO, "----- DDC ----- SonarQube starting ... Waiting 5 seconds before starting ...");
LOGGER.log(INFO, "----------");
Thread.sleep(5000);
launchSonarqube();
LOGGER.log(INFO, "----------");
LOGGER.log(INFO, "----- DDC ----- SonarQube server started. Waiting 5 seconds before launching analysis...");
LOGGER.log(INFO, "----------");
Thread.sleep(5000);
launchAnalysis();
LOGGER.log(INFO, "----------");
LOGGER.log(INFO, "----- DDC ----- Analysis done. Waiting 5 seconds before running tests...");
LOGGER.log(INFO, "----------");
Thread.sleep(5000);
}

private static void launchAnalysis() {
Expand All @@ -125,7 +137,7 @@ private static void launchAnalysis() {
}

@Test
void test() {
void test() throws InterruptedException {
String projectKey = analyzedProjects.get(0).projectKey;

Map<String, Measures.Measure> measures = getMeasures(projectKey);
Expand All @@ -136,7 +148,14 @@ void test() {
List<Issues.Issue> projectIssues = issuesForComponent(projectKey);
assertThat(projectIssues).isNotEmpty();

List<Issues.Issue> issuesForArrayCopyCheck = issuesForFile(projectKey, "src/main/java/fr/greencodeinitiative/java/checks/AvoidGettingSizeCollectionInForLoopIgnored.java");
String file = "src/main/java/fr/greencodeinitiative/java/checks/AvoidGettingSizeCollectionInForLoopIgnored.java";
List<Issues.Issue> issuesForArrayCopyCheck = issuesForFile(projectKey, file);

LOGGER.log(INFO, "----------");
LOGGER.log(INFO, () -> MessageFormat.format("----- DDC ----- Issues for file {0} : ", file));
LOGGER.log(INFO, () -> MessageFormat.format("{0}", issuesForArrayCopyCheck));
LOGGER.log(INFO, "----------");
Thread.sleep(5000);

assertThat(issuesForArrayCopyCheck)
.hasSize(1)
Expand All @@ -153,6 +172,9 @@ void test() {
assertThat(issue.getEffort()).isEqualTo("5min");
assertThat(issue.getType()).isEqualTo(CODE_SMELL);
});

LOGGER.log(INFO, "DDC - Test done. Waiting 5 seconds before stopping SonarQube server...");
Thread.sleep(5000);
}

@AfterAll
Expand Down
Loading