mirror of
https://github.com/danieldemus/openhab-core.git
synced 2025-01-10 13:21:53 +01:00
Fix tests failing on windows (#1602)
* Fix tests failing on windows Signed-off-by: Anders Alfredsson <andersb86@gmail.com>
This commit is contained in:
parent
0de7ed3f49
commit
0173e23759
@ -26,7 +26,7 @@ public class ExecUtilTest {
|
||||
@Test
|
||||
public void testBasicExecuteCommandLine() {
|
||||
if (isWindowsSystem()) {
|
||||
ExecUtil.executeCommandLine("dir");
|
||||
ExecUtil.executeCommandLine("cmd@@/c@@dir");
|
||||
} else {
|
||||
ExecUtil.executeCommandLine("ls");
|
||||
}
|
||||
@ -36,7 +36,7 @@ public class ExecUtilTest {
|
||||
public void testBasicExecuteCommandLineAndWaitResponse() {
|
||||
final String result;
|
||||
if (isWindowsSystem()) {
|
||||
result = ExecUtil.executeCommandLineAndWaitResponse("dir", 1000);
|
||||
result = ExecUtil.executeCommandLineAndWaitResponse("cmd@@/c@@dir", 1000);
|
||||
} else {
|
||||
result = ExecUtil.executeCommandLineAndWaitResponse("ls", 1000);
|
||||
}
|
||||
@ -48,7 +48,7 @@ public class ExecUtilTest {
|
||||
public void testExecuteCommandLineAndWaitResponseWithArguments() {
|
||||
final String result;
|
||||
if (isWindowsSystem()) {
|
||||
result = ExecUtil.executeCommandLineAndWaitResponse("echo@@test", 1000);
|
||||
result = ExecUtil.executeCommandLineAndWaitResponse("cmd@@/c@@echo@@test", 1000);
|
||||
} else {
|
||||
result = ExecUtil.executeCommandLineAndWaitResponse("echo@@'test'", 1000);
|
||||
}
|
||||
|
@ -168,7 +168,8 @@ public class JSONResponse {
|
||||
}
|
||||
|
||||
Thread writerThread = new Thread(() -> {
|
||||
try (JsonWriter jsonWriter = new JsonWriter(new BufferedWriter(new OutputStreamWriter(out)))) {
|
||||
try (JsonWriter jsonWriter = new JsonWriter(
|
||||
new BufferedWriter(new OutputStreamWriter(out, StandardCharsets.UTF_8)))) {
|
||||
gson.toJson(entity, entity.getClass(), jsonWriter);
|
||||
jsonWriter.flush();
|
||||
} catch (IOException | JsonIOException e) {
|
||||
|
@ -413,7 +413,10 @@ public class FolderObserverTest extends JavaOSGiTest {
|
||||
File file = new File(UNWATCHED_DIRECTORY, filename);
|
||||
file.createNewFile();
|
||||
Files.setAttribute(file.toPath(), "dos:hidden", true);
|
||||
Files.move(file.toPath(), EXISTING_SUBDIR_PATH.toPath());
|
||||
try {
|
||||
Files.move(file.toPath(), EXISTING_SUBDIR_PATH.toPath());
|
||||
} catch (java.nio.file.FileAlreadyExistsException e) {
|
||||
}
|
||||
try (Stream<Path> walk = Files.walk(UNWATCHED_DIRECTORY.toPath())) {
|
||||
walk.sorted(Comparator.reverseOrder()).map(Path::toFile).forEach(File::delete);
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
@ -160,7 +161,8 @@ public class DSLRuleProviderTest extends JavaOSGiTest {
|
||||
" logInfo('Test', 'Test')\n" + //
|
||||
"end\n\n";
|
||||
|
||||
modelRepository.addOrRefreshModel(TESTMODEL_NAME, new ByteArrayInputStream(model.getBytes()));
|
||||
modelRepository.addOrRefreshModel(TESTMODEL_NAME,
|
||||
new ByteArrayInputStream(model.getBytes(StandardCharsets.UTF_8)));
|
||||
Collection<Rule> actualRules = dslRuleProvider.getAll();
|
||||
|
||||
assertThat(actualRules.size(), is(1));
|
||||
|
Loading…
Reference in New Issue
Block a user