Skip to content

Commit

Permalink
Fixes #336 - Invalid path for Snapshot location (#337)
Browse files Browse the repository at this point in the history
  • Loading branch information
petruki authored Dec 5, 2024
1 parent 3f235e1 commit a1cb61b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<groupId>com.github.switcherapi</groupId>
<artifactId>switcher-client</artifactId>
<packaging>jar</packaging>
<version>2.2.1</version>
<version>2.2.2</version>

<name>Switcher Client</name>
<description>Switcher Client SDK for working with Switcher API</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@
import com.github.switcherapi.client.service.remote.ClientRemote;
import com.github.switcherapi.client.utils.SnapshotLoader;
import com.github.switcherapi.client.utils.SwitcherUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Objects;

public abstract class SwitcherExecutorImpl implements SwitcherExecutor {

private static final Logger logger = LoggerFactory.getLogger(SwitcherExecutorImpl.class);
Expand Down Expand Up @@ -40,7 +39,7 @@ protected Domain initializeSnapshotFromAPI(ClientRemote clientRemote)
final Snapshot snapshot = clientRemote.resolveSnapshot();
final String snapshotLocation = switcherProperties.getValue(ContextKey.SNAPSHOT_LOCATION);

if (Objects.nonNull(snapshotLocation)) {
if (StringUtils.isNotBlank(snapshotLocation)) {
SnapshotLoader.saveSnapshot(snapshot, snapshotLocation, environment);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ void shouldUpdateSnapshot_remote_inMemory() {
.apiKey("[API_KEY]")
.environment("generated_mock_default_5")
.local(true)
.snapshotLocation("")
.snapshotAutoLoad(true)
.snapshotAutoUpdateInterval("1m"));

Expand All @@ -182,6 +183,7 @@ void shouldUpdateSnapshot_remote_inMemory() {
//test
CountDownHelper.wait(2);
assertEquals(2, Switchers.getSnapshotVersion());
assertTrue(Files.notExists(Paths.get("/generated_mock_default_5.json")));
}

@Test
Expand Down

0 comments on commit a1cb61b

Please sign in to comment.