@Test public void testJuniper() { for (String fileText : ImmutableList.of( "firewall {\n}\n", "policy-options {\n}\n", "!RANCID-CONTENT-TYPE: juniper\n!\nsomething {\n blah;\n}\n", "#RANCID-CONTENT-TYPE: juniper\n!\nsomething {\n blah;\n}\n", "#RANCID-CONTENT-TYPE: juniper-srx\n!\nsomething {\n blah;\n}\n", "snmp {\n}\n")) { assertThat(fileText, identifyConfigurationFormat(fileText), equalTo(JUNIPER)); } for (String fileText : ImmutableList.of( "#\nset system host-name blah", "!RANCID-CONTENT-TYPE: juniper\n!\nset blah\n", "#RANCID-CONTENT-TYPE: juniper\n!\nset blah\n", "#RANCID-CONTENT-TYPE: juniper-srx\n!\nset blah\n", "#\nset apply-groups blah\n", "####BATFISH FLATTENED JUNIPER CONFIG####\n")) { assertThat(identifyConfigurationFormat(fileText), equalTo(FLAT_JUNIPER)); } assertThat(identifyConfigurationFormat("set hostname\n"), equalTo(JUNIPER_SWITCH)); }
public static ConfigurationFormat identifyConfigurationFormat(String fileText) { return new VendorConfigurationFormatDetector(fileText).identifyConfigurationFormat(); }
VendorConfigurationFormatDetector { public static ConfigurationFormat identifyConfigurationFormat(String fileText) { return new VendorConfigurationFormatDetector(fileText).identifyConfigurationFormat(); } }
VendorConfigurationFormatDetector { public static ConfigurationFormat identifyConfigurationFormat(String fileText) { return new VendorConfigurationFormatDetector(fileText).identifyConfigurationFormat(); } private  VendorConfigurationFormatDetector(String fileText); }
VendorConfigurationFormatDetector { public static ConfigurationFormat identifyConfigurationFormat(String fileText) { return new VendorConfigurationFormatDetector(fileText).identifyConfigurationFormat(); } private  VendorConfigurationFormatDetector(String fileText); static ConfigurationFormat identifyConfigurationFormat(String fileText); }
VendorConfigurationFormatDetector { public static ConfigurationFormat identifyConfigurationFormat(String fileText) { return new VendorConfigurationFormatDetector(fileText).identifyConfigurationFormat(); } private  VendorConfigurationFormatDetector(String fileText); static ConfigurationFormat identifyConfigurationFormat(String fileText); static final String BATFISH_FLATTENED_JUNIPER_HEADER; static final String BATFISH_FLATTENED_PALO_ALTO_HEADER; static final String BATFISH_FLATTENED_VYOS_HEADER; }