public void testAddTwice() {
   DummyConfigurationItem item = new DummyConfigurationItem(_applied);
   _config.addConfigurationItem(item);
   _config.addConfigurationItem(item);
   _config.applyConfigurationItems(new MockServer());
   Assert.areEqual(1, item.prepareCount());
   assertListsAreEqual(Arrays.asList(item), _applied);
 }
Exemple #2
0
 private void removeExistingOrderingFor(String[] fieldPath) {
   for (Ordering ordering : orderings()) {
     if (Arrays.equals(ordering.fieldPath(), fieldPath)) {
       orderings().remove(ordering);
       break;
     }
   }
 }
 public void testPrepareApply() {
   List<DummyConfigurationItem> items =
       Arrays.asList(new DummyConfigurationItem(_applied), new DummyConfigurationItem(_applied));
   for (DummyConfigurationItem item : items) {
     _config.addConfigurationItem(item);
     Assert.areEqual(1, item.prepareCount());
   }
   Assert.areEqual(0, _applied.size());
   _config.applyConfigurationItems(new MockServer());
   assertListsAreEqual(items, _applied);
   for (DummyConfigurationItem item : items) {
     Assert.areEqual(1, item.prepareCount());
   }
 }