|
25 | 25 | import com.apple.foundationdb.relational.api.metrics.MetricCollector;
|
26 | 26 | import com.apple.foundationdb.relational.recordlayer.EmbeddedRelationalConnection;
|
27 | 27 | import com.apple.foundationdb.relational.util.Assert;
|
| 28 | +import com.apple.foundationdb.relational.yamltests.server.SemanticVersion; |
28 | 29 | import org.apache.logging.log4j.LogManager;
|
29 | 30 | import org.apache.logging.log4j.Logger;
|
30 | 31 | import org.junit.jupiter.api.Assertions;
|
|
49 | 50 | public class MultiServerConnectionFactory implements YamlConnectionFactory {
|
50 | 51 | // The fixed index of the default connection
|
51 | 52 | public static final int DEFAULT_CONNECTION = 0;
|
52 |
| - private final Set<String> versionsUnderTest; |
| 53 | + private final Set<SemanticVersion> versionsUnderTest; |
53 | 54 |
|
54 | 55 | /**
|
55 | 56 | * Server selection policy.
|
@@ -96,7 +97,7 @@ public YamlConnection getNewConnection(@Nonnull URI connectPath) throws SQLExcep
|
96 | 97 | }
|
97 | 98 |
|
98 | 99 | @Override
|
99 |
| - public Set<String> getVersionsUnderTest() { |
| 100 | + public Set<SemanticVersion> getVersionsUnderTest() { |
100 | 101 | return versionsUnderTest;
|
101 | 102 | }
|
102 | 103 |
|
@@ -148,7 +149,7 @@ public static class MultiServerConnection implements YamlConnection {
|
148 | 149 | @Nonnull
|
149 | 150 | private final List<YamlConnection> underlyingConnections;
|
150 | 151 | @Nonnull
|
151 |
| - private final List<String> versions; |
| 152 | + private final List<SemanticVersion> versions; |
152 | 153 |
|
153 | 154 | public MultiServerConnection(@Nonnull ConnectionSelectionPolicy connectionSelectionPolicy,
|
154 | 155 | final int initialConnecion,
|
@@ -188,10 +189,16 @@ public EmbeddedRelationalConnection tryGetEmbedded() {
|
188 | 189 |
|
189 | 190 | @Nonnull
|
190 | 191 | @Override
|
191 |
| - public List<String> getVersions() { |
| 192 | + public List<SemanticVersion> getVersions() { |
192 | 193 | return this.versions;
|
193 | 194 | }
|
194 | 195 |
|
| 196 | + @Nonnull |
| 197 | + @Override |
| 198 | + public SemanticVersion getInitialVersion() { |
| 199 | + return versions.get(0); |
| 200 | + } |
| 201 | + |
195 | 202 | @Override
|
196 | 203 | public void close() throws SQLException {
|
197 | 204 | logger.info("Sending operation {} to all connections", "close");
|
@@ -228,16 +235,16 @@ private YamlConnection getCurrentConnection(boolean advance, String op) {
|
228 | 235 | throw new IllegalStateException("Unsupported selection policy " + connectionSelectionPolicy);
|
229 | 236 | }
|
230 | 237 |
|
231 |
| - private static List<String> createVersionsList(final int initialConnecion, |
232 |
| - final List<YamlConnection> relationalConnections) { |
233 |
| - List<String> versions = new ArrayList<>(); |
234 |
| - for (int i = initialConnecion; i < relationalConnections.size(); i++) { |
235 |
| - final List<String> underlying = relationalConnections.get(i).getVersions(); |
| 238 | + private static List<SemanticVersion> createVersionsList(final int initialConnection, |
| 239 | + final List<YamlConnection> relationalConnections) { |
| 240 | + List<SemanticVersion> versions = new ArrayList<>(); |
| 241 | + for (int i = initialConnection; i < relationalConnections.size(); i++) { |
| 242 | + final List<SemanticVersion> underlying = relationalConnections.get(i).getVersions(); |
236 | 243 | Assert.thatUnchecked(underlying.size() == 1, "Part of multi server config has more than one version");
|
237 | 244 | versions.add(underlying.get(0));
|
238 | 245 | }
|
239 |
| - for (int i = 0; i < initialConnecion; i++) { |
240 |
| - final List<String> underlying = relationalConnections.get(i).getVersions(); |
| 246 | + for (int i = 0; i < initialConnection; i++) { |
| 247 | + final List<SemanticVersion> underlying = relationalConnections.get(i).getVersions(); |
241 | 248 | Assert.thatUnchecked(underlying.size() == 1, "Part of multi server config has more than one version");
|
242 | 249 | versions.add(underlying.get(0));
|
243 | 250 | }
|
|
0 commit comments