Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SOLR-15187: v2-POJO based SolrRequest classes #2422

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -102,8 +102,8 @@ public void restoreBackup(PayloadObj<RestoreCollectionPayload> obj) throws Excep
final Map<String, Object> v1Params = v2Body.toMap(new HashMap<>());

v1Params.put(ACTION, CollectionAction.RESTORE.toLower());
if (v2Body.createCollectionParams != null && !v2Body.createCollectionParams.isEmpty()) {
final Map<String, Object> createCollParams = (Map<String, Object>) v1Params.remove(V2ApiConstants.CREATE_COLLECTION_KEY);
if (v2Body.createCollectionParams != null) {
final Map<String, Object> createCollParams = v2Body.createCollectionParams.toMap(new HashMap<>());
convertV2CreateCollectionMapToV1ParamMap(createCollParams);
v1Params.putAll(createCollParams);
}
Expand Down
Expand Up @@ -633,8 +633,7 @@ private void doSplitShardWithRule(SolrIndexSplitter.SplitMethod splitMethod) thr

log.info("Starting testSplitShardWithRule");
String collectionName = "shardSplitWithRule_" + splitMethod.toLower();
CollectionAdminRequest.Create createRequest = CollectionAdminRequest.createCollection(collectionName, "conf1", 1, 2)
.setRule("shard:*,replica:<2,node:*");
CollectionAdminRequest.Create createRequest = CollectionAdminRequest.createCollection(collectionName, "conf1", 1, 2);

CollectionAdminResponse response = createRequest.process(cloudClient);
assertEquals(0, response.getStatus());
Expand Down
Expand Up @@ -216,6 +216,7 @@ public void testBackupAllProperties() throws Exception {
"'indexBackup': 'copy-files', " +
"'commitName': 'someSnapshotName', " +
"'incremental': true, " +
"'maxNumBackupPoints': 3, " +
"'async': 'requestTrackingId' " +
"}}");

Expand All @@ -228,6 +229,7 @@ public void testBackupAllProperties() throws Exception {
assertEquals("copy-files", v1Params.get(CollectionAdminParams.INDEX_BACKUP_STRATEGY));
assertEquals("someSnapshotName", v1Params.get(CoreAdminParams.COMMIT_NAME));
assertEquals(true, v1Params.getPrimitiveBool(CoreAdminParams.BACKUP_INCREMENTAL));
assertEquals(3, v1Params.getPrimitiveInt(CoreAdminParams.MAX_NUM_BACKUP_POINTS));
assertEquals("requestTrackingId", v1Params.get(CommonAdminParams.ASYNC));
}

Expand All @@ -242,7 +244,6 @@ public void testRestoreAllProperties() throws Exception {
"'backupId': 123, " +
"'async': 'requestTrackingId', " +
"'create-collection': {" +
" 'numShards': 1, " +
" 'properties': {'foo': 'bar', 'foo2': 'bar2'}, " +
" 'replicationFactor': 3 " +
"}" +
Expand All @@ -257,10 +258,9 @@ public void testRestoreAllProperties() throws Exception {
assertEquals("requestTrackingId", v1Params.get(CommonAdminParams.ASYNC));
// NOTE: Unlike other v2 APIs that have a nested object for collection-creation params, restore's v1 equivalent
// for these properties doesn't have a "create-collection." prefix.
assertEquals(1, v1Params.getPrimitiveInt(CollectionAdminParams.NUM_SHARDS));
assertEquals(3, v1Params.getPrimitiveInt(ZkStateReader.REPLICATION_FACTOR));
assertEquals("bar", v1Params.get("property.foo"));
assertEquals("bar2", v1Params.get("property.foo2"));
assertEquals(3, v1Params.getPrimitiveInt(ZkStateReader.REPLICATION_FACTOR));
}

private SolrParams captureConvertedV1Params(String path, String method, String v2RequestBody) throws Exception {
Expand Down