dsmiley commented on code in PR #2078:
URL: https://github.com/apache/solr/pull/2078#discussion_r1399806266


##########
solr/core/src/test/org/apache/solr/update/UuidAtomicUpdateTest.java:
##########
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.update;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+import org.apache.solr.client.solrj.SolrServerException;
+import org.apache.solr.client.solrj.request.CollectionAdminRequest;
+import org.apache.solr.client.solrj.request.QueryRequest;
+import org.apache.solr.client.solrj.request.UpdateRequest;
+import org.apache.solr.client.solrj.response.QueryResponse;
+import org.apache.solr.client.solrj.response.UpdateResponse;
+import org.apache.solr.cloud.SolrCloudTestCase;
+import org.apache.solr.common.SolrDocument;
+import org.apache.solr.common.SolrInputDocument;
+import org.apache.solr.common.params.ModifiableSolrParams;
+import org.apache.solr.common.util.NamedList;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class UuidAtomicUpdateTest extends SolrCloudTestCase {
+  private static final String COMMITTED_DOC_ID = "1";
+  private static final String UNCOMMITTED_DOC_ID = "2";
+  private static final String COLLECTION = "collection1";
+  private static final int NUM_SHARDS = 1;
+  private static final int NUM_REPLICAS = 2;
+
+  private static String committedUuidAfter = UUID.randomUUID().toString();
+  private static String uncommittedUuidAfter = UUID.randomUUID().toString();
+
+  @BeforeClass
+  public static void setupCluster() throws Exception {
+    configureCluster(1).addConfig("conf", 
configset("cloud-dynamic")).configure();
+
+    CollectionAdminRequest.createCollection(COLLECTION, "conf", NUM_SHARDS, 
NUM_REPLICAS)
+        .process(cluster.getSolrClient());
+
+    cluster.waitForActiveCollection(COLLECTION, NUM_SHARDS, NUM_REPLICAS * 
NUM_SHARDS);
+  }
+
+  @Override
+  @Before
+  public void setUp() throws Exception {
+    super.setUp();
+    String committedUuidBefore = UUID.randomUUID().toString();
+    final SolrInputDocument committedDoc =
+        sdoc("id", COMMITTED_DOC_ID, "title_s", "title_1", "uuid", 
committedUuidBefore);
+    final UpdateRequest committedRequest = new 
UpdateRequest().add(committedDoc);
+    committedRequest.commit(cluster.getSolrClient(), COLLECTION);
+
+    String uncommittedUuidBefore = UUID.randomUUID().toString();
+    final SolrInputDocument uncommittedDoc =
+        sdoc("id", UNCOMMITTED_DOC_ID, "title_s", "title_2", "uuid", 
uncommittedUuidBefore);
+    final UpdateRequest uncommittedRequest = new 
UpdateRequest().add(uncommittedDoc);
+    uncommittedRequest.process(cluster.getSolrClient(), COLLECTION);
+  }
+
+  @Test
+  public void testUpdateCommittedTextField() throws Exception {
+    atomicSetValue(COMMITTED_DOC_ID, "title_s", "CHANGED");
+    ensureFieldHasValues(COMMITTED_DOC_ID, "title_s", "CHANGED");
+    commit();
+    ensureFieldHasValues(COMMITTED_DOC_ID, "title_s", "CHANGED");
+  }
+
+  @Test
+  public void testUpdateUncommittedTextField() throws Exception {
+    atomicSetValue(UNCOMMITTED_DOC_ID, "title_s", "CHANGED");
+    ensureFieldHasValues(UNCOMMITTED_DOC_ID, "title_s", "CHANGED");
+    commit();
+    ensureFieldHasValues(UNCOMMITTED_DOC_ID, "title_s", "CHANGED");
+  }
+
+  @Test
+  public void testUpdateCommittedUuidField() throws Exception {
+    atomicSetValue(COMMITTED_DOC_ID, "uuid", committedUuidAfter);
+    ensureFieldHasValues(COMMITTED_DOC_ID, "uuid", committedUuidAfter);
+    commit();
+    ensureFieldHasValues(COMMITTED_DOC_ID, "uuid", committedUuidAfter);
+  }
+
+  @Test
+  public void testUpdateUncommittedUuidField() throws Exception {
+    atomicSetValue(UNCOMMITTED_DOC_ID, "uuid", uncommittedUuidAfter);
+    ensureFieldHasValues(UNCOMMITTED_DOC_ID, "uuid", uncommittedUuidAfter);
+    commit();
+    ensureFieldHasValues(UNCOMMITTED_DOC_ID, "uuid", uncommittedUuidAfter);
+  }
+
+  private static void commit() throws IOException, SolrServerException {
+    final UpdateRequest committedRequest = new UpdateRequest();
+    committedRequest.commit(cluster.getSolrClient(), COLLECTION);
+  }
+
+  @AfterClass
+  public static void afterAll() throws Exception {
+    final UpdateRequest committedRequest = new UpdateRequest();
+    committedRequest.deleteByQuery("*:*");
+    committedRequest.commit(cluster.getSolrClient(), COLLECTION);
+  }
+
+  private static void atomicSetValue(String docId, String fieldName, Object 
value)
+      throws Exception {
+    final SolrInputDocument doc = new SolrInputDocument();
+    doc.setField("id", docId);
+    Map<String, Object> atomicUpdateRemoval = new HashMap<>(1);

Review Comment:
   minor: use Map.of



##########
solr/core/src/test/org/apache/solr/update/UuidAtomicUpdateTest.java:
##########
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.update;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+import org.apache.solr.client.solrj.SolrServerException;
+import org.apache.solr.client.solrj.request.CollectionAdminRequest;
+import org.apache.solr.client.solrj.request.QueryRequest;
+import org.apache.solr.client.solrj.request.UpdateRequest;
+import org.apache.solr.client.solrj.response.QueryResponse;
+import org.apache.solr.client.solrj.response.UpdateResponse;
+import org.apache.solr.cloud.SolrCloudTestCase;
+import org.apache.solr.common.SolrDocument;
+import org.apache.solr.common.SolrInputDocument;
+import org.apache.solr.common.params.ModifiableSolrParams;
+import org.apache.solr.common.util.NamedList;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class UuidAtomicUpdateTest extends SolrCloudTestCase {
+  private static final String COMMITTED_DOC_ID = "1";
+  private static final String UNCOMMITTED_DOC_ID = "2";
+  private static final String COLLECTION = "collection1";
+  private static final int NUM_SHARDS = 1;
+  private static final int NUM_REPLICAS = 2;
+
+  private static String committedUuidAfter = UUID.randomUUID().toString();
+  private static String uncommittedUuidAfter = UUID.randomUUID().toString();
+
+  @BeforeClass
+  public static void setupCluster() throws Exception {
+    configureCluster(1).addConfig("conf", 
configset("cloud-dynamic")).configure();
+
+    CollectionAdminRequest.createCollection(COLLECTION, "conf", NUM_SHARDS, 
NUM_REPLICAS)
+        .process(cluster.getSolrClient());
+
+    cluster.waitForActiveCollection(COLLECTION, NUM_SHARDS, NUM_REPLICAS * 
NUM_SHARDS);
+  }
+
+  @Override
+  @Before
+  public void setUp() throws Exception {
+    super.setUp();
+    String committedUuidBefore = UUID.randomUUID().toString();
+    final SolrInputDocument committedDoc =
+        sdoc("id", COMMITTED_DOC_ID, "title_s", "title_1", "uuid", 
committedUuidBefore);
+    final UpdateRequest committedRequest = new 
UpdateRequest().add(committedDoc);
+    committedRequest.commit(cluster.getSolrClient(), COLLECTION);

Review Comment:
   Minor: in general, I see you creating UpdateRequest and saving to a named 
variable and then later calling commit or process.  But you can chain the call; 
no need to declare a variable and come up with a name or use "final".



##########
solr/core/src/test/org/apache/solr/update/UuidAtomicUpdateTest.java:
##########
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.update;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+import org.apache.solr.client.solrj.SolrServerException;
+import org.apache.solr.client.solrj.request.CollectionAdminRequest;
+import org.apache.solr.client.solrj.request.QueryRequest;
+import org.apache.solr.client.solrj.request.UpdateRequest;
+import org.apache.solr.client.solrj.response.QueryResponse;
+import org.apache.solr.client.solrj.response.UpdateResponse;
+import org.apache.solr.cloud.SolrCloudTestCase;
+import org.apache.solr.common.SolrDocument;
+import org.apache.solr.common.SolrInputDocument;
+import org.apache.solr.common.params.ModifiableSolrParams;
+import org.apache.solr.common.util.NamedList;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class UuidAtomicUpdateTest extends SolrCloudTestCase {
+  private static final String COMMITTED_DOC_ID = "1";
+  private static final String UNCOMMITTED_DOC_ID = "2";
+  private static final String COLLECTION = "collection1";
+  private static final int NUM_SHARDS = 1;
+  private static final int NUM_REPLICAS = 2;
+
+  private static String committedUuidAfter = UUID.randomUUID().toString();
+  private static String uncommittedUuidAfter = UUID.randomUUID().toString();
+
+  @BeforeClass
+  public static void setupCluster() throws Exception {
+    configureCluster(1).addConfig("conf", 
configset("cloud-dynamic")).configure();
+
+    CollectionAdminRequest.createCollection(COLLECTION, "conf", NUM_SHARDS, 
NUM_REPLICAS)
+        .process(cluster.getSolrClient());
+
+    cluster.waitForActiveCollection(COLLECTION, NUM_SHARDS, NUM_REPLICAS * 
NUM_SHARDS);
+  }
+
+  @Override
+  @Before
+  public void setUp() throws Exception {
+    super.setUp();
+    String committedUuidBefore = UUID.randomUUID().toString();

Review Comment:
   this variable masks the static field by the same name; maybe you didn't mean 
that?



##########
solr/core/src/test/org/apache/solr/update/UuidAtomicUpdateTest.java:
##########
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.update;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+import org.apache.solr.client.solrj.SolrServerException;
+import org.apache.solr.client.solrj.request.CollectionAdminRequest;
+import org.apache.solr.client.solrj.request.QueryRequest;
+import org.apache.solr.client.solrj.request.UpdateRequest;
+import org.apache.solr.client.solrj.response.QueryResponse;
+import org.apache.solr.client.solrj.response.UpdateResponse;
+import org.apache.solr.cloud.SolrCloudTestCase;
+import org.apache.solr.common.SolrDocument;
+import org.apache.solr.common.SolrInputDocument;
+import org.apache.solr.common.params.ModifiableSolrParams;
+import org.apache.solr.common.util.NamedList;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class UuidAtomicUpdateTest extends SolrCloudTestCase {
+  private static final String COMMITTED_DOC_ID = "1";
+  private static final String UNCOMMITTED_DOC_ID = "2";
+  private static final String COLLECTION = "collection1";
+  private static final int NUM_SHARDS = 1;
+  private static final int NUM_REPLICAS = 2;
+
+  private static String committedUuidAfter = UUID.randomUUID().toString();
+  private static String uncommittedUuidAfter = UUID.randomUUID().toString();
+
+  @BeforeClass
+  public static void setupCluster() throws Exception {
+    configureCluster(1).addConfig("conf", 
configset("cloud-dynamic")).configure();
+
+    CollectionAdminRequest.createCollection(COLLECTION, "conf", NUM_SHARDS, 
NUM_REPLICAS)
+        .process(cluster.getSolrClient());
+
+    cluster.waitForActiveCollection(COLLECTION, NUM_SHARDS, NUM_REPLICAS * 
NUM_SHARDS);
+  }
+
+  @Override
+  @Before
+  public void setUp() throws Exception {
+    super.setUp();
+    String committedUuidBefore = UUID.randomUUID().toString();
+    final SolrInputDocument committedDoc =
+        sdoc("id", COMMITTED_DOC_ID, "title_s", "title_1", "uuid", 
committedUuidBefore);
+    final UpdateRequest committedRequest = new 
UpdateRequest().add(committedDoc);
+    committedRequest.commit(cluster.getSolrClient(), COLLECTION);
+
+    String uncommittedUuidBefore = UUID.randomUUID().toString();
+    final SolrInputDocument uncommittedDoc =
+        sdoc("id", UNCOMMITTED_DOC_ID, "title_s", "title_2", "uuid", 
uncommittedUuidBefore);
+    final UpdateRequest uncommittedRequest = new 
UpdateRequest().add(uncommittedDoc);
+    uncommittedRequest.process(cluster.getSolrClient(), COLLECTION);
+  }
+
+  @Test
+  public void testUpdateCommittedTextField() throws Exception {
+    atomicSetValue(COMMITTED_DOC_ID, "title_s", "CHANGED");
+    ensureFieldHasValues(COMMITTED_DOC_ID, "title_s", "CHANGED");
+    commit();
+    ensureFieldHasValues(COMMITTED_DOC_ID, "title_s", "CHANGED");
+  }
+
+  @Test
+  public void testUpdateUncommittedTextField() throws Exception {
+    atomicSetValue(UNCOMMITTED_DOC_ID, "title_s", "CHANGED");
+    ensureFieldHasValues(UNCOMMITTED_DOC_ID, "title_s", "CHANGED");
+    commit();
+    ensureFieldHasValues(UNCOMMITTED_DOC_ID, "title_s", "CHANGED");
+  }
+
+  @Test
+  public void testUpdateCommittedUuidField() throws Exception {
+    atomicSetValue(COMMITTED_DOC_ID, "uuid", committedUuidAfter);
+    ensureFieldHasValues(COMMITTED_DOC_ID, "uuid", committedUuidAfter);
+    commit();
+    ensureFieldHasValues(COMMITTED_DOC_ID, "uuid", committedUuidAfter);
+  }
+
+  @Test
+  public void testUpdateUncommittedUuidField() throws Exception {
+    atomicSetValue(UNCOMMITTED_DOC_ID, "uuid", uncommittedUuidAfter);
+    ensureFieldHasValues(UNCOMMITTED_DOC_ID, "uuid", uncommittedUuidAfter);
+    commit();
+    ensureFieldHasValues(UNCOMMITTED_DOC_ID, "uuid", uncommittedUuidAfter);
+  }
+
+  private static void commit() throws IOException, SolrServerException {
+    final UpdateRequest committedRequest = new UpdateRequest();
+    committedRequest.commit(cluster.getSolrClient(), COLLECTION);
+  }
+
+  @AfterClass
+  public static void afterAll() throws Exception {

Review Comment:
   Why bother?  The test is about to be shut down.



##########
solr/core/src/test/org/apache/solr/update/UuidAtomicUpdateTest.java:
##########
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.update;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+import org.apache.solr.client.solrj.SolrServerException;
+import org.apache.solr.client.solrj.request.CollectionAdminRequest;
+import org.apache.solr.client.solrj.request.QueryRequest;
+import org.apache.solr.client.solrj.request.UpdateRequest;
+import org.apache.solr.client.solrj.response.QueryResponse;
+import org.apache.solr.client.solrj.response.UpdateResponse;
+import org.apache.solr.cloud.SolrCloudTestCase;
+import org.apache.solr.common.SolrDocument;
+import org.apache.solr.common.SolrInputDocument;
+import org.apache.solr.common.params.ModifiableSolrParams;
+import org.apache.solr.common.util.NamedList;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class UuidAtomicUpdateTest extends SolrCloudTestCase {
+  private static final String COMMITTED_DOC_ID = "1";
+  private static final String UNCOMMITTED_DOC_ID = "2";
+  private static final String COLLECTION = "collection1";
+  private static final int NUM_SHARDS = 1;
+  private static final int NUM_REPLICAS = 2;
+
+  private static String committedUuidAfter = UUID.randomUUID().toString();
+  private static String uncommittedUuidAfter = UUID.randomUUID().toString();
+
+  @BeforeClass
+  public static void setupCluster() throws Exception {
+    configureCluster(1).addConfig("conf", 
configset("cloud-dynamic")).configure();
+
+    CollectionAdminRequest.createCollection(COLLECTION, "conf", NUM_SHARDS, 
NUM_REPLICAS)
+        .process(cluster.getSolrClient());
+
+    cluster.waitForActiveCollection(COLLECTION, NUM_SHARDS, NUM_REPLICAS * 
NUM_SHARDS);
+  }
+
+  @Override
+  @Before
+  public void setUp() throws Exception {

Review Comment:
   no clear of existing data first?  It's hard to reason how this might not be 
necessary given the particularly high sensitivity this test has to documents 
that are added but not committed.  I'd explain this in a comment if there's a 
good reason.  Otherwise, why not just clean all to be sure we know what the 
state is.



##########
solr/core/src/test/org/apache/solr/update/UuidAtomicUpdateTest.java:
##########
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.update;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+import org.apache.solr.client.solrj.SolrServerException;
+import org.apache.solr.client.solrj.request.CollectionAdminRequest;
+import org.apache.solr.client.solrj.request.QueryRequest;
+import org.apache.solr.client.solrj.request.UpdateRequest;
+import org.apache.solr.client.solrj.response.QueryResponse;
+import org.apache.solr.client.solrj.response.UpdateResponse;
+import org.apache.solr.cloud.SolrCloudTestCase;
+import org.apache.solr.common.SolrDocument;
+import org.apache.solr.common.SolrInputDocument;
+import org.apache.solr.common.params.ModifiableSolrParams;
+import org.apache.solr.common.util.NamedList;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class UuidAtomicUpdateTest extends SolrCloudTestCase {
+  private static final String COMMITTED_DOC_ID = "1";
+  private static final String UNCOMMITTED_DOC_ID = "2";
+  private static final String COLLECTION = "collection1";
+  private static final int NUM_SHARDS = 1;
+  private static final int NUM_REPLICAS = 2;
+
+  private static String committedUuidAfter = UUID.randomUUID().toString();
+  private static String uncommittedUuidAfter = UUID.randomUUID().toString();
+
+  @BeforeClass
+  public static void setupCluster() throws Exception {
+    configureCluster(1).addConfig("conf", 
configset("cloud-dynamic")).configure();
+
+    CollectionAdminRequest.createCollection(COLLECTION, "conf", NUM_SHARDS, 
NUM_REPLICAS)
+        .process(cluster.getSolrClient());
+
+    cluster.waitForActiveCollection(COLLECTION, NUM_SHARDS, NUM_REPLICAS * 
NUM_SHARDS);
+  }
+
+  @Override
+  @Before
+  public void setUp() throws Exception {
+    super.setUp();
+    String committedUuidBefore = UUID.randomUUID().toString();
+    final SolrInputDocument committedDoc =
+        sdoc("id", COMMITTED_DOC_ID, "title_s", "title_1", "uuid", 
committedUuidBefore);
+    final UpdateRequest committedRequest = new 
UpdateRequest().add(committedDoc);
+    committedRequest.commit(cluster.getSolrClient(), COLLECTION);
+
+    String uncommittedUuidBefore = UUID.randomUUID().toString();
+    final SolrInputDocument uncommittedDoc =
+        sdoc("id", UNCOMMITTED_DOC_ID, "title_s", "title_2", "uuid", 
uncommittedUuidBefore);
+    final UpdateRequest uncommittedRequest = new 
UpdateRequest().add(uncommittedDoc);
+    uncommittedRequest.process(cluster.getSolrClient(), COLLECTION);
+  }
+
+  @Test
+  public void testUpdateCommittedTextField() throws Exception {
+    atomicSetValue(COMMITTED_DOC_ID, "title_s", "CHANGED");
+    ensureFieldHasValues(COMMITTED_DOC_ID, "title_s", "CHANGED");
+    commit();
+    ensureFieldHasValues(COMMITTED_DOC_ID, "title_s", "CHANGED");
+  }
+
+  @Test
+  public void testUpdateUncommittedTextField() throws Exception {
+    atomicSetValue(UNCOMMITTED_DOC_ID, "title_s", "CHANGED");
+    ensureFieldHasValues(UNCOMMITTED_DOC_ID, "title_s", "CHANGED");
+    commit();
+    ensureFieldHasValues(UNCOMMITTED_DOC_ID, "title_s", "CHANGED");
+  }
+
+  @Test
+  public void testUpdateCommittedUuidField() throws Exception {
+    atomicSetValue(COMMITTED_DOC_ID, "uuid", committedUuidAfter);
+    ensureFieldHasValues(COMMITTED_DOC_ID, "uuid", committedUuidAfter);
+    commit();
+    ensureFieldHasValues(COMMITTED_DOC_ID, "uuid", committedUuidAfter);
+  }
+
+  @Test
+  public void testUpdateUncommittedUuidField() throws Exception {
+    atomicSetValue(UNCOMMITTED_DOC_ID, "uuid", uncommittedUuidAfter);
+    ensureFieldHasValues(UNCOMMITTED_DOC_ID, "uuid", uncommittedUuidAfter);
+    commit();
+    ensureFieldHasValues(UNCOMMITTED_DOC_ID, "uuid", uncommittedUuidAfter);
+  }
+
+  private static void commit() throws IOException, SolrServerException {
+    final UpdateRequest committedRequest = new UpdateRequest();
+    committedRequest.commit(cluster.getSolrClient(), COLLECTION);

Review Comment:
   ```suggestion
       cluster.getSolrClient().commit(collection);
   ```



##########
solr/core/src/test/org/apache/solr/update/UuidAtomicUpdateTest.java:
##########
@@ -0,0 +1,155 @@
+package org.apache.solr.update;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+import org.apache.solr.client.solrj.request.CollectionAdminRequest;
+import org.apache.solr.client.solrj.request.QueryRequest;
+import org.apache.solr.client.solrj.request.UpdateRequest;
+import org.apache.solr.client.solrj.response.QueryResponse;
+import org.apache.solr.client.solrj.response.UpdateResponse;
+import org.apache.solr.cloud.SolrCloudTestCase;
+import org.apache.solr.common.SolrDocument;
+import org.apache.solr.common.SolrInputDocument;
+import org.apache.solr.common.params.ModifiableSolrParams;
+import org.apache.solr.common.util.NamedList;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class UuidAtomicUpdateTest extends SolrCloudTestCase {
+  private static final String COMMITTED_DOC_ID = "1";
+  private static final String UNCOMMITTED_DOC_ID = "2";
+  private static final String COLLECTION = "collection1";
+  private static final int NUM_SHARDS = 1;
+  private static final int NUM_REPLICAS = 2;

Review Comment:
   Then say that in a comment



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to