content: /*
   *  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 harry.model;
  
  import java.util.Arrays;
  
  import org.junit.Test;
  
  import harry.ddl.ColumnSpec;
  import harry.ddl.SchemaSpec;
  import harry.dsl.ReplayingHistoryBuilder;
  import harry.generators.DataGenerators;
  
  public class ReconcilerIntegrationTest extends IntegrationTestBase
  {
      private final long seed = 1; // 88
  
  
      @Test
      public void testTrackingWithStatics() throws Throwable
      {
          SchemaSpec schema = new SchemaSpec(KEYSPACE, "tbl1",
                                             Arrays.asList(ColumnSpec.pk("pk1", ColumnSpec.int64Type)),
                                             Arrays.asList(ColumnSpec.ck("ck1", ColumnSpec.int64Type)),
                                             Arrays.asList(ColumnSpec.regularColumn("v1", ColumnSpec.int64Type),
                                                           ColumnSpec.regularColumn("v2", ColumnSpec.int64Type)),
                                             Arrays.asList(ColumnSpec.staticColumn("static1", ColumnSpec.int64Type),
                                                           ColumnSpec.staticColumn("static2", ColumnSpec.int64Type)))
                              .trackLts();
  
          beforeEach();
          sut.schemaChange(schema.compile().cql());
  
          ReplayingHistoryBuilder historyBuilder = new ReplayingHistoryBuilder(seed, 100, 1, schema, sut);
          historyBuilder.visitPartition(1).insert(1,
                                                  new long[]{ DataGenerators.UNSET_DESCR, DataGenerators.UNSET_DESCR },
                                                  new long[]{ 1L, 1L });
          historyBuilder.validate(1);
  
          historyBuilder.visitPartition(2).insert(2,
                                                  new long[]{ 1L, 1L },
                                                  new long[]{ 1L, 1L });
          historyBuilder.visitPartition(2).deleteRowRange(1, 3, true, true);
          historyBuilder.validate(2);
      }
  
      @Test
      public void testTrackingWithoutStatics() throws Throwable
      {
          SchemaSpec schema = new SchemaSpec(KEYSPACE, "tbl1",
                                             Arrays.asList(ColumnSpec.pk("pk1", ColumnSpec.int64Type)),
                                             Arrays.asList(ColumnSpec.ck("ck1", ColumnSpec.int64Type)),
                                             Arrays.asList(ColumnSpec.regularColumn("v1", ColumnSpec.int64Type),
                                                           ColumnSpec.regularColumn("v2", ColumnSpec.int64Type)),
                                             Arrays.asList())
                              .trackLts();
  
          beforeEach();
          sut.schemaChange(schema.compile().cql());
  
          ReplayingHistoryBuilder historyBuilder = new ReplayingHistoryBuilder(seed, 100, 1, schema, sut);
          historyBuilder.visitPartition(2).insert(2,
                                                  new long[]{ 1L, 1L });
          historyBuilder.visitPartition(2).deleteRowRange(1, 3, true, true);
          historyBuilder.validate(2);
  
          historyBuilder = new ReplayingHistoryBuilder(seed, 100, 1, schema, sut);
          historyBuilder.visitPartition(2).insert(2,
                                                  new long[]{ 1L, 1L });
          historyBuilder.visitPartition(2).deleteRowRange(1, 3, true, true);
          historyBuilder.validate(2);
      }
  }
  