Skip to content

Commit

Permalink
make test more efficient
Browse files Browse the repository at this point in the history
  • Loading branch information
umjammer committed Sep 11, 2023
1 parent 817c506 commit 29b68d6
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 19 deletions.
5 changes: 5 additions & 0 deletions local.properties.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
TEST_SMB_ACCOUNT=foo
TEST_SMB_DOMAIN=WORKGROUP
TEST_SMB_HOST=bar
TEST_SMB_PASSWORD=xxx
TEST_SMB_PATH=/yyy/baz
53 changes: 34 additions & 19 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,40 @@
</contributor>
</contributors>

<profiles>
<profile>
<id>props</id>
<activation>
<file>
<exists>${basedir}/local.properties</exists>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.1.0</version>
<executions>
<execution>
<id>read-properties</id>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${basedir}/local.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<build>
<plugins>
<plugin>
Expand All @@ -33,25 +67,6 @@
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0.0</version>
<executions>
<execution>
<id>read-properties</id>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${basedir}/local.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions src/test/java/SmbjTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.hierynomus.smbj.share.DiskShare;
import com.hierynomus.smbj.share.File;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledIf;
import vavi.util.Debug;

import static com.hierynomus.msdtyp.AccessMask.DELETE;
Expand All @@ -42,6 +43,10 @@
*/
public class SmbjTest {

static boolean localPropertiesExists() {
return Files.exists(Paths.get("local.properties"));
}

static {
// TODO move to pom.xml
System.setProperty("vavi.util.logging.VaviFormatter.extraClassMethod",
Expand All @@ -64,6 +69,7 @@ public class SmbjTest {
* - according to cyberduck it works with smbj 0.12.2 https://github.com/hierynomus/smbj/issues/584#issuecomment-1694759650
*/
@Test
@EnabledIf("localPropertiesExists")
void test_smbj() throws Exception {
String username = System.getenv("TEST_SMB_ACCOUNT");
String password = System.getenv("TEST_SMB_PASSWORD");
Expand Down

0 comments on commit 29b68d6

Please sign in to comment.