2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.config.persist.storage.directory.autodetect;
10 import junit.framework.Assert;
11 import org.junit.Test;
12 import org.junit.matchers.JUnitMatchers;
13 import org.opendaylight.controller.config.persist.api.ConfigSnapshotHolder;
16 import java.util.List;
18 public class AutodetectDirectoryPersisterTest {
21 public void testCombined() throws Exception {
22 File resourcePath = FileTypeTest.getResourceAsFile("/combined/1controller.txt.config");
24 AutodetectDirectoryPersister persister = new AutodetectDirectoryPersister(resourcePath.getParentFile());
25 List<ConfigSnapshotHolder> configs = persister.loadLastConfigs();
27 Assert.assertEquals(2, configs.size());
28 String snapFromTxt = configs.get(0).getConfigSnapshot();
29 org.junit.Assert.assertThat(snapFromTxt, JUnitMatchers.containsString("<config>txt</config>"));
30 org.junit.Assert.assertThat(snapFromTxt, JUnitMatchers.containsString("<service>txt</service>"));
32 String snapFromXml = configs.get(1).getConfigSnapshot();
33 org.junit.Assert.assertThat(snapFromXml, JUnitMatchers.containsString("<config>xml</config>"));
35 Assert.assertEquals(configs.get(0).getCapabilities(), configs.get(1).getCapabilities());