/** * Checks an xml file is well formed. * * @param metaA * The ValueMetaInterface * @param dataA * The value (filename) * @return true if the file is well formed. * @deprecated Use {@link ValueDataUtil#isXMLFileWellFormed(ValueMetaInterface, Object, boolean)} instead */ @Deprecated public static boolean isXMLFileWellFormed( ValueMetaInterface metaA, Object dataA ) { boolean xmlWellFormed = false; try { xmlWellFormed = isXMLFileWellFormed( metaA, dataA, false ); } catch ( KettleFileNotFoundException e ) { // Ignore } return xmlWellFormed; }
@Test public void xmlFileBadlyFormedTest() { String invalidXmlFilePath = getClass().getResource( "invalid-xml-sample.xml" ).getPath(); boolean wellFormed = ValueDataUtil.isXMLFileWellFormed( new ValueMetaString(), invalidXmlFilePath ); assertFalse( wellFormed ); }
@Test public void xmlFileBadlyFormedWithNoFailIfNoFileTest() throws KettleFileNotFoundException { String invalidXmlFilePath = getClass().getResource( "invalid-xml-sample.xml" ).getPath(); boolean wellFormed = ValueDataUtil.isXMLFileWellFormed( new ValueMetaString(), invalidXmlFilePath, false ); assertFalse( wellFormed ); }
@Test public void xmlFileBadlyFormedWithFailIfNoFileTest() throws KettleFileNotFoundException { String invalidXmlFilePath = getClass().getResource( "invalid-xml-sample.xml" ).getPath(); boolean wellFormed = ValueDataUtil.isXMLFileWellFormed( new ValueMetaString(), invalidXmlFilePath, true ); assertFalse( wellFormed ); }
@Test public void xmlFileWellFormedWithFailIfNoFileTest() throws KettleFileNotFoundException { String xmlFilePath = getClass().getResource( "xml-sample.xml" ).getPath(); boolean wellFormed = ValueDataUtil.isXMLFileWellFormed( new ValueMetaString(), xmlFilePath, true ); assertTrue( wellFormed ); }
@Test public void xmlFileWellFormedWithoutFailIfNoFileTest() throws KettleFileNotFoundException { String xmlFilePath = getClass().getResource( "xml-sample.xml" ).getPath(); boolean wellFormed = ValueDataUtil.isXMLFileWellFormed( new ValueMetaString(), xmlFilePath, false ); assertTrue( wellFormed ); }
@Test public void xmlFileWellFormedTest() { String xmlFilePath = getClass().getResource( "xml-sample.xml" ).getPath(); boolean wellFormed = ValueDataUtil.isXMLFileWellFormed( new ValueMetaString(), xmlFilePath ); assertTrue( wellFormed ); }
@Test( expected = KettleFileNotFoundException.class ) public void xmlFileWellFormedFailIfNoFileTest() throws KettleFileNotFoundException { String nonExistingPath = "nonExistingPath"; ValueDataUtil.isXMLFileWellFormed( new ValueMetaString(), nonExistingPath, true ); }
@Test public void xmlFileWellFormedNoFailIfNoFileTest() throws KettleFileNotFoundException { String nonExistingPath = "nonExistingPath"; boolean wellFormed = ValueDataUtil.isXMLFileWellFormed( new ValueMetaString(), nonExistingPath, false ); assertFalse( wellFormed ); }
@Test public void xmlFileWellFormedNullPathNoFailTest() throws KettleFileNotFoundException { boolean wellFormed = ValueDataUtil.isXMLFileWellFormed( new ValueMetaString(), null, false ); assertFalse( wellFormed ); }
@Test public void xmlFileWellFormedNullPathFailTest() throws KettleFileNotFoundException { boolean wellFormed = ValueDataUtil.isXMLFileWellFormed( new ValueMetaString(), null, true ); assertFalse( wellFormed ); }
break; case CalculatorMetaFunction.CALC_CHECK_XML_FILE_WELL_FORMED: // Check if file A is well formed calcData[index] = ValueDataUtil.isXMLFileWellFormed( metaA, dataA, meta.isFailIfNoFile() ); resultType = CalculatorMetaFunction.calcDefaultResultType[calcType]; break;