Package org.milyn.ect.formats.unedifact

Examples of org.milyn.ect.formats.unedifact.UnEdifactSpecificationReader


     * @param urn The URN for the EDI Mapping model configuration set.
     * @throws IOException Error writing Mapping Model configuration set.
     */
    public static void fromUnEdifactSpec(ZipInputStream specification, ZipOutputStream modelSetOutStream, String urn, boolean useShortName) throws IOException {
        try {
            fromSpec(new UnEdifactSpecificationReader(specification, true, useShortName), modelSetOutStream, urn);
        } finally {
            specification.close();
        }
    }
View Full Code Here


            definitionZipStream = new ZipInputStream(new FileInputStream(specification));
        } catch (FileNotFoundException e) {
            throw new EdiParseException("Error opening zip file containing the Un/Edifact specification '" + specification.getAbsoluteFile() + "'.", e);
        }

        return createArchive(new UnEdifactSpecificationReader(definitionZipStream, true), urn, messages);
    }
View Full Code Here

     * @param urn The URN for the EDI Mapping model configuration set.
     * @throws IOException Error writing Mapping Model configuration set.
     */
    public static void fromUnEdifactSpec(ZipInputStream specification, File modelSetOutFolder, String urn, boolean useShortName) throws IOException {
        try {
            fromSpec(new UnEdifactSpecificationReader(specification, true, useShortName), modelSetOutFolder, urn);
        } finally {
            specification.close();
        }
    }
View Full Code Here

    String directory = "d03b";
    String pluginID = "org.milyn.edi.unedifact." + directory;
    String pathPrefix = pluginID.replace('.', '/');
    InputStream inputStream = getClass().getResourceAsStream("/" + directory + ".zip");
    ZipInputStream zipInputStream = new ZipInputStream(inputStream);
    UnEdifactSpecificationReader ediSpecificationReader = new UnEdifactSpecificationReader(
        zipInputStream, false, false);
    ECoreGenerator ecoreGen = new ECoreGenerator();
    Set<EPackage> packages = ecoreGen
        .generatePackages(ediSpecificationReader.getEdiDirectory());
    // To make tests execution faster let us just select a small subset of packages
    Set<EPackage> smallerSet = new HashSet<EPackage>();
    for (EPackage pkg : packages) {
      if ("cuscar".equals(pkg.getName()) || "invoic".equals(pkg.getName())) {
        smallerSet.add(pkg);
View Full Code Here

        EdiConvertionTool.fromUnEdifactSpec(zipInputStream, new ZipOutputStream(new FileOutputStream(modelSetFile)), "org.milyn.edi.unedifact:d08a:1.0-SNAPSHOT", false);
    }

    public void test_MILYN_475() throws IOException, EDIConfigurationException, SAXException {
        ZipInputStream zipInputStream = new ZipInputStream(getClass().getResourceAsStream("D08A.zip"));
        UnEdifactSpecificationReader specReader = new UnEdifactSpecificationReader(zipInputStream, false, false);
        ByteArrayOutputStream serializedMap = new ByteArrayOutputStream();

        Edimap jupreq = specReader.getMappingModel("JUPREQ");
        Writer writer = new OutputStreamWriter(serializedMap);

        jupreq.write(writer);

        EDIConfigDigester.digestConfig(new ByteArrayInputStream(serializedMap.toByteArray()));
View Full Code Here

        EDIConfigDigester.digestConfig(new ByteArrayInputStream(serializedMap.toByteArray()));
    }

    public void test_MILYN_476() throws IOException, EDIConfigurationException, SAXException {
        ZipInputStream zipInputStream = new ZipInputStream(getClass().getResourceAsStream("d93a.zip"));
        UnEdifactSpecificationReader specReader = new UnEdifactSpecificationReader(zipInputStream, false, false);
        ByteArrayOutputStream serializedMap = new ByteArrayOutputStream();

        Edimap jupreq = specReader.getMappingModel("INVOIC");
        Writer writer = new OutputStreamWriter(serializedMap);

        jupreq.write(writer);

        EDIConfigDigester.digestConfig(new ByteArrayInputStream(serializedMap.toByteArray()));
View Full Code Here

  @BeforeClass
  public static void parseD08A() throws Exception {
        InputStream inputStream = UnEdifactSpecificationReaderTest.class.getResourceAsStream("D08A.zip");
        ZipInputStream zipInputStream = new ZipInputStream(inputStream);
        d08AReader_longnames = new UnEdifactSpecificationReader(zipInputStream, false, false);

        inputStream = UnEdifactSpecificationReaderTest.class.getResourceAsStream("D08A.zip");
        zipInputStream = new ZipInputStream(inputStream);
        d08AReader_shortnames = new UnEdifactSpecificationReader(zipInputStream, false, true);
  }
View Full Code Here

  public void testECoreGeneration() throws Exception {
    InputStream inputStream = getClass().getResourceAsStream("/D99A.zip");
    ZipInputStream zipInputStream = new ZipInputStream(inputStream);

    UnEdifactSpecificationReader ediSpecificationReader = new UnEdifactSpecificationReader(
        zipInputStream, false, false);
    ECoreGenerator generator = new ECoreGenerator();
    Set<EPackage> packages = generator
        .generatePackages(ediSpecificationReader.getEdiDirectory());
    for (EPackage pkg : packages) {
      validatePackage(pkg);
      if ("cuscar".equals(pkg.getName())) {
        checkCUSCAR(pkg);
      }
View Full Code Here

    @Test
    public void testRealLifeInputFilesD93ALongName() throws IOException, InstantiationException, IllegalAccessException, EDIConfigurationException, SAXException {
        InputStream inputStream = ClassUtil.getResourceAsStream("d93a.zip", this.getClass());
        ZipInputStream zipInputStream = new ZipInputStream(inputStream);

        EdiSpecificationReader ediSpecificationReader = new UnEdifactSpecificationReader(zipInputStream, false, false);

        //Test INVOIC
        String mappingModel = getEdiMessageAsString(ediSpecificationReader, "INVOIC");
        testPackage("d93a-invoic-1", mappingModel);
    }
View Full Code Here

    @Test
    public void testRealLifeInputFilesD93AShortName() throws IOException, InstantiationException, IllegalAccessException, EDIConfigurationException, SAXException {
        InputStream inputStream = ClassUtil.getResourceAsStream("d93a.zip", this.getClass());
        ZipInputStream zipInputStream = new ZipInputStream(inputStream);

        EdiSpecificationReader ediSpecificationReader = new UnEdifactSpecificationReader(zipInputStream, false, true);

        //Test INVOIC
        String mappingModel = getEdiMessageAsString(ediSpecificationReader, "INVOIC");
        testPackage("d93a-invoic-shortname", mappingModel);
    }
View Full Code Here

TOP

Related Classes of org.milyn.ect.formats.unedifact.UnEdifactSpecificationReader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.