@@ -0,0 +1,2796 @@
+/*%0A * To change this license header, choose License Headers in Project Properties.%0A * To change this template file, choose Tools %7C Templates%0A * and open the template in the editor.%0A */%0Apackage org.mitre.taxii.messages.xml11;%0A%0Aimport java.io.BufferedWriter;%0Aimport java.io.File;%0Aimport java.io.FileOutputStream;%0Aimport java.io.IOException;%0Aimport java.io.OutputStreamWriter;%0Aimport java.io.PrintWriter;%0Aimport java.io.Writer;%0Aimport java.nio.file.FileVisitResult;%0Aimport java.nio.file.Files;%0Aimport java.nio.file.Path;%0Aimport java.nio.file.Paths;%0Aimport java.nio.file.SimpleFileVisitor;%0Aimport java.nio.file.attribute.BasicFileAttributes;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0Aimport javax.xml.bind.Unmarshaller;%0Aimport org.junit.BeforeClass;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.junit.runners.Parameterized;%0A%0A/**%0A *%0A * @author jasenj1%0A */%0A%0A@RunWith(Parameterized.class)%0Apublic class PythonTextOutputFileTests %7B%0A    private static TaxiiXml taxiiXml;%0A    private static Unmarshaller unmarshaller;%0A    %0A    private static final String inputPath = %22src/test/resources/python_output/1.1%22;%0A    private static final String outputPath = %22build/test-results%22;%0A    %0A    @Parameterized.Parameter(0)%0A    public File file;%0A    %0A    private static File outDir;%0A    %0A    @BeforeClass%0A    public static void init() throws Exception %7B%0A        TaxiiXmlFactory txf = new TaxiiXmlFactory();%0A        taxiiXml = txf.createTaxiiXml();%0A        unmarshaller = taxiiXml.getJaxbContext().createUnmarshaller();%0A        outDir = new File(outputPath);%0A    %7D%0A%0A    @Parameterized.Parameters(name=%22%7Bindex%7D - %7B0%7D%22)%0A    public static Iterable%3CFile%5B%5D%3E data() throws IOException %7B%0A        final List%3CFile%5B%5D%3E data = new ArrayList%3C%3E();        %0A        Files.walkFileTree(%0A                Paths.get(inputPath),%0A                new SimpleFileVisitor%3CPath%3E() %7B%0A                    @Override%0A                    public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException %7B%0A                        if (!file.toFile().isHidden()) %7B%0A                            data.add(new File%5B%5D %7B file.toFile() %7D);%0A                        %7D%0A                        return FileVisitResult.CONTINUE;%0A                    %7D%0A                %7D);%0A        return data;%0A    %7D%0A    %0A    @Test%0A    public void testFile() throws Exception %7B%0A        MessageType m = (MessageType) unmarshaller.unmarshal(file);%0A        String s = PythonTextOutput.toText(m);%0A        String outName = file.getName().replaceFirst(%22%5B.%5D%5B%5E.%5D+$%22, %22%22);%0A        File outFile = new File(outDir,outName + %22.txt%22);%0A        %0A        Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), %22utf-8%22));%0A        System.out.println(s);%0A        writer.write(s);%0A        writer.close();%0A    %7D%0A    %0A%7D%0A

Use XML files as input for Python output tests. Write Python output from the XML file tests to other files for comparison with the Python output.