+ assertXMLEqual("<config>1</config>", configSnapshotHolder.getConfigSnapshot());
+ assertEquals(Sets.newHashSet("f1-11", "f2-22"), storage.getPersistedFeatures());
+ }
+
+ @Test
+ public void testNoFeaturesStored() throws Exception {
+ PropertiesProviderTest pp = new PropertiesProviderTest();
+ pp.addProperty("fileStorage",file.getPath());
+ pp.addProperty("numberOfBackups",Integer.toString(Integer.MAX_VALUE));
+ storage.instantiate(pp);
+
+ com.google.common.io.Files.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
+ "<persisted-snapshots>\n" +
+ " <snapshots>\n" +
+ " <snapshot>\n" +
+ " <required-capabilities>\n" +
+ " <capability>cap12</capability>\n" +
+ " </required-capabilities>\n" +
+ " <configuration>\n" +
+ " <config>1</config>\n" +
+ " </configuration>\n" +
+ " </snapshot>\n" +
+ " </snapshots>\n" +
+ "</persisted-snapshots>", file, Charsets.UTF_8);
+
+ List<ConfigSnapshotHolder> lastConf = storage.loadLastConfigs();
+ assertEquals(1, lastConf.size());
+ ConfigSnapshotHolder configSnapshotHolder = lastConf.get(0);
+ assertXMLEqual("<config>1</config>", configSnapshotHolder.getConfigSnapshot());
+ assertTrue(storage.getPersistedFeatures().isEmpty());