Skip to content

Commit

Permalink
Remove applySystemFileSeparator() from SmbTestSupport
Browse files Browse the repository at this point in the history
Related to: #9453

The `SmbSession` does not rely on a system file separator anymore
and just use regular Unix `/` separator all the time.
Therefore, `TestUtils.applySystemFileSeparator()` is wrong from test perspective on Windows

(cherry picked from commit 64b49d1)
  • Loading branch information
artembilan authored and spring-builds committed Sep 17, 2024
1 parent 671c906 commit d302804
Showing 1 changed file with 5 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 the original author or authors.
* Copyright 2022-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -33,7 +33,6 @@
import org.springframework.integration.file.remote.session.Session;
import org.springframework.integration.file.remote.session.SessionFactory;
import org.springframework.integration.smb.session.SmbSessionFactory;
import org.springframework.integration.test.util.TestUtils;

/**
* Provides a connection to a Testcontainers-driven SMB Server for test cases.
Expand Down Expand Up @@ -101,17 +100,12 @@ public static void connectToSMBServer() throws IOException {
try (Session<SmbFile> smbFileSession = smbSessionFactory.getSession()) {
smbFileSession.mkdir("smbTarget");
Charset charset = StandardCharsets.UTF_8;
smbFileSession.write(IOUtils.toInputStream("source1", charset),
TestUtils.applySystemFileSeparator("smbSource/smbSource1.txt"));
smbFileSession.write(IOUtils.toInputStream("source2", charset),
TestUtils.applySystemFileSeparator("smbSource/smbSource2.txt"));
smbFileSession.write(IOUtils.toInputStream("source1", charset), "smbSource/smbSource1.txt");
smbFileSession.write(IOUtils.toInputStream("source2", charset), "smbSource/smbSource2.txt");
smbFileSession.write(IOUtils.toInputStream("", charset), "SMBSOURCE1.TXT.a");
smbFileSession.write(IOUtils.toInputStream("", charset), "SMBSOURCE2.TXT.a");

smbFileSession.write(IOUtils.toInputStream("subSource1", charset),
TestUtils.applySystemFileSeparator("smbSource/subSmbSource/subSmbSource1.txt"));
smbFileSession.write(IOUtils.toInputStream("subSource2", charset),
TestUtils.applySystemFileSeparator("smbSource/subSmbSource/subSmbSource2.txt"));
smbFileSession.write(IOUtils.toInputStream("subSource1", charset), "smbSource/subSmbSource/subSmbSource1.txt");
smbFileSession.write(IOUtils.toInputStream("subSource2", charset), "smbSource/subSmbSource/subSmbSource2.txt");
}
}

Expand Down

0 comments on commit d302804

Please sign in to comment.