Skip to content

Commit

Permalink
rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
kirill-knize-sonarsource committed Jan 20, 2025
1 parent a07c332 commit d4b6ca9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/
package org.sonarsource.sonarlint.core.file;

import ch.qos.logback.classic.spi.ILoggingEvent;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
Expand Down Expand Up @@ -110,8 +109,7 @@ void log_when_connection_not_exist() {

underTest.getServerPaths(new Binding("conId", null), cancelMonitor);

assertThat(logTester.logs())
.containsExactly("Connection 'conId' does not exist");
assertThat(logTester.logs()).contains("Connection 'conId' does not exist");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@
*/
package mediumtest;

import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.sonarsource.sonarlint.core.commons.log.SonarLintLogTester;
import org.sonarsource.sonarlint.core.rpc.protocol.backend.connection.config.DidChangeCredentialsParams;
import org.sonarsource.sonarlint.core.rpc.protocol.common.Language;
import org.sonarsource.sonarlint.core.test.utils.junit5.SonarLintTest;
import org.sonarsource.sonarlint.core.test.utils.junit5.SonarLintTestHarness;
import utils.TestPlugin;
Expand All @@ -41,22 +39,17 @@ class NotebookLanguageMediumTests {

@SonarLintTest
void should_not_enable_sync_for_notebook_python_language(SonarLintTestHarness harness) {
client = harness.newFakeClient()
var fakeClient = harness.newFakeClient()
.build();
var backend = harness.newBackend()
.withStorage(CONNECTION_ID, s -> s.withPlugins(TestPlugin.JAVASCRIPT, TestPlugin.JAVA)
.withProject("test-project")
.withProject(JAVA_MODULE_KEY))
.withBoundConfigScope(SCOPE_ID, CONNECTION_ID, JAVA_MODULE_KEY)
.withEnabledLanguageInStandaloneMode(Language.JAVA)
.withEnabledLanguageInStandaloneMode(Language.JS)
.withEnabledLanguageInStandaloneMode(Language.IPYTHON)
.withFullSynchronization()
.build(client);
.build(fakeClient);

backend.getConnectionService().didChangeCredentials(new DidChangeCredentialsParams(CONNECTION_ID));

await().untilAsserted(() -> assertThat(client.getLogMessages()).contains("[SYNC] Languages enabled for synchronization: [java, js]"));
await().untilAsserted(() -> assertThat(fakeClient.getLogMessages()).contains("[SYNC] Languages enabled for synchronization: [java, js]"));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
import java.time.temporal.ChronoUnit;
import java.util.List;
import java.util.concurrent.ExecutionException;
import mediumtest.fixtures.TestPlugin;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.sonarsource.sonarlint.core.commons.RuleType;
Expand All @@ -45,6 +42,9 @@
import static org.awaitility.Awaitility.await;
import static org.mockito.Mockito.when;
import static org.sonarsource.sonarlint.core.rpc.protocol.common.Language.JAVA;
import static org.sonarsource.sonarlint.core.test.utils.SonarLintBackendFixture.newBackend;
import static org.sonarsource.sonarlint.core.test.utils.SonarLintBackendFixture.newFakeClient;
import static org.sonarsource.sonarlint.core.test.utils.server.ServerFixture.newSonarQubeServer;

class ConnectionSyncMediumTests {
public static final String CONNECTION_ID = "connectionId";
Expand Down Expand Up @@ -146,7 +146,7 @@ void it_should_notify_client_if_invalid_token(Integer status) {
.withResponseCode(status)
.start();

backend = newBackend()
var backend = newBackend()
.withSonarQubeConnection(CONNECTION_ID, server, storage -> storage.withPlugin(TestPlugin.JAVA).withProject("projectKey"))
.withBoundConfigScope(SCOPE_ID, CONNECTION_ID, "projectKey")
.withEnabledLanguageInStandaloneMode(JAVA)
Expand Down

0 comments on commit d4b6ca9

Please sign in to comment.