Skip to content

Commit

Permalink
Remove useless constant package
Browse files Browse the repository at this point in the history
  • Loading branch information
FabienVSymphony committed Nov 12, 2024
1 parent 7883eab commit c463839
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.symphony.bdk.core.auth.AuthSession;
import com.symphony.bdk.core.auth.exception.AuthUnauthorizedException;
import com.symphony.bdk.core.auth.jwt.JwtHelper;
import com.symphony.bdk.core.service.version.constant.AgentVersions;
import com.symphony.bdk.core.service.version.model.AgentVersion;
import com.symphony.bdk.gen.api.model.Token;

Expand Down Expand Up @@ -132,6 +131,6 @@ protected boolean isSkdSupported() {
if (currentVersion.isEmpty()) {
return false;
}
return currentVersion.get().isHigher(AgentVersions.AGENT_24_12);
return currentVersion.get().isHigher(AgentVersion.AGENT_24_12);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,8 @@ private Optional<AgentVersion> parse(String versionString) {

String maj = matcher.group(1);
String min = matcher.group(2);
try {
return Optional.of(new AgentVersion(Integer.parseInt(maj), Integer.parseInt(min)));
} catch (NumberFormatException nbe) {
return Optional.empty();
}

return Optional.of(new AgentVersion(Integer.parseInt(maj), Integer.parseInt(min)));
}


Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

@API(status = API.Status.INTERNAL)
public class AgentVersion {
public static final AgentVersion AGENT_24_12 = new AgentVersion(24,12);


private final int major;
private final int minor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import com.symphony.bdk.core.auth.JwtHelperTest;
import com.symphony.bdk.core.auth.exception.AuthUnauthorizedException;
import com.symphony.bdk.core.service.version.AgentVersionService;
import com.symphony.bdk.core.service.version.constant.AgentVersions;
import com.symphony.bdk.core.service.version.model.AgentVersion;
import com.symphony.bdk.gen.api.model.Token;

Expand Down Expand Up @@ -170,7 +169,7 @@ void testRefresh_skd() throws AuthUnauthorizedException {
when(auth.retrieveKeyManagerToken()).thenReturn(kmToken);

when(auth.getAgentVersionService()).thenReturn(agentVersionService);
when(agentVersionService.retrieveAgentVersion()).thenReturn(Optional.of(AgentVersions.AGENT_24_12));
when(agentVersionService.retrieveAgentVersion()).thenReturn(Optional.of(AgentVersion.AGENT_24_12));

final AuthSessionImpl session = new AuthSessionImpl(auth);
session.refresh();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.symphony.bdk.core.service.version;

import com.symphony.bdk.core.service.version.constant.AgentVersions;
import com.symphony.bdk.core.service.version.model.AgentVersion;
import com.symphony.bdk.core.test.MockApiClient;
import com.symphony.bdk.gen.api.SignalsApi;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class AgentVersionTest {
Expand All @@ -17,4 +18,10 @@ public void testHigherVersion() {
assertTrue(agent_25_01.isHigher(agent_20_9));
assertTrue(agent_25_01.isHigher(agent_24_12));
}

@Test
public void testConstants() {
assertEquals(24, AgentVersion.AGENT_24_12.getMajor());
assertEquals(12, AgentVersion.AGENT_24_12.getMinor());
}
}

0 comments on commit c463839

Please sign in to comment.