Search in sources :

Example 1 with AlterTableRequest

use of io.crate.execution.ddl.tables.AlterTableRequest in project crate by crate.

the class AlterTableClusterStateExecutorTest method testAddExistingMetaDoNotAddEmptyValues.

@Test
public void testAddExistingMetaDoNotAddEmptyValues() throws IOException {
    AlterTableRequest request = mock(AlterTableRequest.class);
    when(request.mappingDeltaAsMap()).thenReturn(Collections.singletonMap("_meta", new HashMap<String, Object>()));
    var currentMeta = new HashMap<String, Object>();
    assertThat(AlterTableClusterStateExecutor.addExistingMeta(request, currentMeta), containsString("{\"_meta\":{}}"));
    verify(request, times(1)).mappingDeltaAsMap();
// DO NOT WANT empty containers and nulls: "{"_meta":{"indices":{},"partitioned_by":[],"primary_keys":null,"check_constraints":null,"constraints":{}}}"
}
Also used : HashMap(java.util.HashMap) AlterTableRequest(io.crate.execution.ddl.tables.AlterTableRequest) Test(org.junit.Test)

Aggregations

AlterTableRequest (io.crate.execution.ddl.tables.AlterTableRequest)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1