Selaa lähdekoodia

NO-JIRA fixed unit test that was not passing on windows

tags/9.2.0.49834
Lukasz Jarocki 2 vuotta sitten
vanhempi
commit
e896520041

+ 1
- 1
server/sonar-webserver-api/src/test/java/org/sonar/server/plugins/PluginDownloaderTest.java Näytä tiedosto

Plugin test = Plugin.factory("test"); Plugin test = Plugin.factory("test");
File file = testFolder.newFile("test-1.0.jar"); File file = testFolder.newFile("test-1.0.jar");
file.createNewFile(); file.createNewFile();
Release test10 = new Release(test, "1.0").setDownloadUrl("file://" + separatorsToUnix(file.getCanonicalPath()));
Release test10 = new Release(test, "1.0").setDownloadUrl("file://" + separatorsToUnix(file.getAbsolutePath()));
test.addRelease(test10); test.addRelease(test10);


when(updateCenter.findInstallablePlugins("foo", create("1.0"))).thenReturn(newArrayList(test10)); when(updateCenter.findInstallablePlugins("foo", create("1.0"))).thenReturn(newArrayList(test10));

+ 6
- 4
sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/fs/DefaultInputModuleTest.java Näytä tiedosto

import java.io.IOException; import java.io.IOException;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.LinkOption;
import java.nio.file.Path; import java.nio.file.Path;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;


assertThat(module.key()).isEqualTo("moduleKey"); assertThat(module.key()).isEqualTo("moduleKey");
assertThat(module.definition()).isEqualTo(def); assertThat(module.definition()).isEqualTo(def);
assertThat(module.getBaseDir()).isEqualTo(baseDir.toPath());
assertThat(module.getBaseDir())
.isEqualTo(baseDir.toPath().toRealPath(LinkOption.NOFOLLOW_LINKS));
assertThat(module.getWorkDir()).isEqualTo(workDir.toPath()); assertThat(module.getWorkDir()).isEqualTo(workDir.toPath());
assertThat(module.getEncoding()).isEqualTo(Charset.defaultCharset()); assertThat(module.getEncoding()).isEqualTo(Charset.defaultCharset());
assertThat(module.getSourceDirsOrFiles().get()).containsExactlyInAnyOrder(src);
assertThat(module.getTestDirsOrFiles().get()).containsExactlyInAnyOrder(test);
assertThat(module.getSourceDirsOrFiles().get()).containsExactlyInAnyOrder(src.toRealPath(LinkOption.NOFOLLOW_LINKS));
assertThat(module.getTestDirsOrFiles().get()).containsExactlyInAnyOrder(test.toRealPath(LinkOption.NOFOLLOW_LINKS));
assertThat(module.getEncoding()).isEqualTo(Charset.defaultCharset()); assertThat(module.getEncoding()).isEqualTo(Charset.defaultCharset());


assertThat(module.isFile()).isFalse(); assertThat(module.isFile()).isFalse();


assertThat(module.key()).isEqualTo("moduleKey"); assertThat(module.key()).isEqualTo("moduleKey");
assertThat(module.definition()).isEqualTo(def); assertThat(module.definition()).isEqualTo(def);
assertThat(module.getBaseDir()).isEqualTo(baseDir.toPath());
assertThat(module.getBaseDir()).isEqualTo(baseDir.toPath().toRealPath(LinkOption.NOFOLLOW_LINKS));
assertThat(module.getWorkDir()).isEqualTo(workDir.toPath()); assertThat(module.getWorkDir()).isEqualTo(workDir.toPath());
assertThat(module.getEncoding()).isEqualTo(Charset.defaultCharset()); assertThat(module.getEncoding()).isEqualTo(Charset.defaultCharset());
assertThat(module.getSourceDirsOrFiles()).isNotPresent(); assertThat(module.getSourceDirsOrFiles()).isNotPresent();

+ 2
- 1
sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/fs/DefaultInputProjectTest.java Näytä tiedosto

import java.io.IOException; import java.io.IOException;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.nio.file.LinkOption;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.TemporaryFolder; import org.junit.rules.TemporaryFolder;
assertThat(project.getName()).isEqualTo("projectName"); assertThat(project.getName()).isEqualTo("projectName");
assertThat(project.getOriginalName()).isEqualTo("projectName"); assertThat(project.getOriginalName()).isEqualTo("projectName");
assertThat(project.definition()).isEqualTo(def); assertThat(project.definition()).isEqualTo(def);
assertThat(project.getBaseDir()).isEqualTo(baseDir.toPath());
assertThat(project.getBaseDir()).isEqualTo(baseDir.toPath().toRealPath(LinkOption.NOFOLLOW_LINKS));
assertThat(project.getDescription()).isEqualTo("desc"); assertThat(project.getDescription()).isEqualTo("desc");
assertThat(project.getWorkDir()).isEqualTo(workDir.toPath()); assertThat(project.getWorkDir()).isEqualTo(workDir.toPath());
assertThat(project.getEncoding()).isEqualTo(Charset.defaultCharset()); assertThat(project.getEncoding()).isEqualTo(Charset.defaultCharset());

+ 2
- 1
sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/fs/TestInputFileBuilderTest.java Näytä tiedosto

import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.nio.file.LinkOption;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
File baseDir = temp.newFolder(); File baseDir = temp.newFolder();
AbstractProjectOrModule module = TestInputFileBuilder.newDefaultInputModule("key", baseDir); AbstractProjectOrModule module = TestInputFileBuilder.newDefaultInputModule("key", baseDir);
assertThat(module.key()).isEqualTo("key"); assertThat(module.key()).isEqualTo("key");
assertThat(module.getBaseDir()).isEqualTo(baseDir.toPath());
assertThat(module.getBaseDir()).isEqualTo(baseDir.toPath().toRealPath(LinkOption.NOFOLLOW_LINKS));
} }
} }

Loading…
Peruuta
Tallenna