Package hu.sztaki.ilab.longneck.process

Examples of hu.sztaki.ilab.longneck.process.LongneckProcess


    @Test
    public void unmarshalTest() throws SAXException, IOException, MarshalException, ValidationException {       
        // Load document
        Document doc = documentBuilder.parse(classLoader.getResourceAsStream("unmarshal/database-source.xml"));
       
        LongneckProcess process = (LongneckProcess) unmarshaller.unmarshal(doc);      
        DatabaseSource testedDs = (DatabaseSource) process.getSource();
       
        Assert.assertEquals("connection1", testedDs.getConnectionName());
        Assert.assertEquals("select a, b from test1_source", testedDs.getQuery());
    }
View Full Code Here


    public void unmarshalTestValueEmpty() throws SAXException, IOException, Exception {
        // Load document
        Document doc = documentBuilder.parse(classLoader.getResourceAsStream("unmarshal/equals.xml"));
       
        // Unmarshal document
        LongneckProcess process = (LongneckProcess) unmarshaller.unmarshal(doc);
       
        Assert.assertTrue((((If) process.getBlocks().get(0)).getCondition().getConstraints().get(0) instanceof EqualsConstraint));       
        EqualsConstraint testedEquals = (EqualsConstraint) ((If) process.getBlocks().get(0)).getCondition().getConstraints().get(0);
       
        Assert.assertEquals("", testedEquals.getValue());
    }
View Full Code Here

    public void unmarshalTestValueText() throws SAXException, IOException, Exception {
        // Load document
        Document doc = documentBuilder.parse(classLoader.getResourceAsStream("unmarshal/equals.xml"));
       
        // Unmarshal document
        LongneckProcess process = (LongneckProcess) unmarshaller.unmarshal(doc);
       
        Assert.assertTrue((((If) process.getBlocks().get(0)).getCondition().getConstraints().get(1) instanceof EqualsConstraint));       
        EqualsConstraint testedEquals = (EqualsConstraint) ((If) process.getBlocks().get(0)).getCondition().getConstraints().get(1);
       
        Assert.assertEquals("some value", testedEquals.getValue());
    }
View Full Code Here

    public void unmarshalTestWithText() throws SAXException, IOException, Exception {
        // Load document
        Document doc = documentBuilder.parse(classLoader.getResourceAsStream("unmarshal/equals.xml"));
       
        // Unmarshal document
        LongneckProcess process = (LongneckProcess) unmarshaller.unmarshal(doc);
       
        Assert.assertTrue((((If) process.getBlocks().get(0)).getCondition().getConstraints().get(2) instanceof EqualsConstraint));       
        EqualsConstraint testedEquals = (EqualsConstraint) ((If) process.getBlocks().get(0)).getCondition().getConstraints().get(2);
       
        Assert.assertEquals("a", testedEquals.getWith());
    }   
View Full Code Here

  public void unmarshalTestValueEmpty() throws SAXException, IOException, Exception {
    // Load document
    Document doc = documentBuilder.parse(classLoader.getResourceAsStream("unmarshal/extract-timestamp.xml"));

    // Unmarshal document
    LongneckProcess process = (LongneckProcess) unmarshaller.unmarshal(doc);
    Record r = new RecordImpl();
    List<Block> blocks = process.getBlocks();
    Block setBlock = blocks.get(0);

    Assert.assertTrue("First block is not of type " + Set.class.getName(), setBlock instanceof Set);
    setBlock.apply(r, new VariableSpace());
View Full Code Here

        copy2ApplyTo.add("c");
       
        // Load document
        Document doc = documentBuilder.parse(classLoader.getResourceAsStream("unmarshal/if.xml"));
       
        LongneckProcess process = (LongneckProcess) unmarshaller.unmarshal(doc);
        If testedIf = (If) process.getBlocks().get(0);
       
        Assert.assertEquals(2, testedIf.getCondition().getConstraints().size());
        Assert.assertEquals(nncApplyTo, ((NotNullConstraint) testedIf.getCondition().getConstraints().get(0)).getApplyTo());
        Assert.assertEquals(incApplyTo, ((IsNullConstraint) testedIf.getCondition().getConstraints().get(1)).getApplyTo());
View Full Code Here

       
        // Load document
        Document doc = documentBuilder.parse(classLoader.getResourceAsStream("unmarshal/islonger.xml"));
       
        // Unmarshal document
        LongneckProcess process = (LongneckProcess) unmarshaller.unmarshal(doc);
       
        Assert.assertTrue((((If) process.getBlocks().get(0)).getCondition().getConstraints().get(0) instanceof IsNotLongerConstraint));       
        IsNotLongerConstraint testedislonger = (IsNotLongerConstraint) ((If) process.getBlocks().get(0)).getCondition().getConstraints().get(0);
       
        Assert.assertEquals(applyTo, testedislonger.getApplyTo());
        Assert.assertEquals(islonger.getValue(), testedislonger.getValue());
    }
View Full Code Here

        // Init process
        FrameAddressResolver frameAddressResolver = new FrameAddressResolver();
        Properties runtimeProperties = new Properties();
        Repository repository = new Repository();
        LongneckProcess process = new LongneckProcess();

        // Init blocks

        SetNull snBlock = new SetNull();
        List<String> fieldNames = new ArrayList<String>();
        fieldNames.add("id");
        snBlock.setApplyTo(fieldNames);
        List<Block> blocks = new ArrayList<Block>();
        blocks.add(snBlock);
        process.setBlocks(blocks);

        // Set test cases

        TestCase testCase = new TestCase();
        RecordImplForTest sourceRecord = new RecordImplForTest();
        sourceRecord.setRole("source");
        sourceRecord.add(new Field("id", "42"));
        testCase.addRecord(sourceRecord);
        RecordImplForTest targetRecord = new RecordImplForTest();
        targetRecord.setRole("target");
        targetRecord.add(new Field("id", null));
        testCase.addRecord(targetRecord);

        List<TestCase> testCases = new ArrayList<TestCase>();
        testCases.add(testCase);
        process.setTestCases(testCases);

        CompactProcess cProcess = new CompactProcess(process, repository,
            frameAddressResolver, runtimeProperties);

        ProcessTester tester = new ProcessTester(cProcess, true);
View Full Code Here

        // Init process
        FrameAddressResolver frameAddressResolver = new FrameAddressResolver();
        Properties runtimeProperties = new Properties();
        Repository repository = new Repository();
        LongneckProcess process = new LongneckProcess();

        // Init blocks

        CloneRecord clBlock = new CloneRecord();
        List<Block> blocks = new ArrayList<Block>();
        blocks.add(clBlock);
        process.setBlocks(blocks);

        // Set test cases

        TestCase testCase = new TestCase();
        RecordImplForTest sourceRecord = new RecordImplForTest();
        sourceRecord.setRole("source");
        sourceRecord.add(new Field("id", "42"));
        testCase.addRecord(sourceRecord);
        RecordImplForTest targetRecord = new RecordImplForTest();
        targetRecord.setRole("target");
        targetRecord.add(new Field("id", "42"));
        testCase.addRecord(targetRecord);
        RecordImplForTest targetRecord2 = new RecordImplForTest();
        targetRecord2.setRole("target");
        targetRecord2.add(new Field("id", "42"));
        testCase.addRecord(targetRecord2);

        List<TestCase> testCases = new ArrayList<TestCase>();
        testCases.add(testCase);
        process.setTestCases(testCases);

        CompactProcess cProcess = new CompactProcess(process, repository,
            frameAddressResolver, runtimeProperties);

        ProcessTester tester = new ProcessTester(cProcess, true);
View Full Code Here

        // Init process
        FrameAddressResolver frameAddressResolver = new FrameAddressResolver();
        Properties runtimeProperties = new Properties();
        Repository repository = new Repository();
        LongneckProcess process = new LongneckProcess();

        // Init blocks

        CloneRecord clBlock = new CloneRecord();
        List<Block> blocks = new ArrayList<Block>();
        blocks.add(clBlock);
        process.setBlocks(blocks);

        // Set test cases

        TestCase testCase = new TestCase();
        RecordImplForTest sourceRecord = new RecordImplForTest();
        sourceRecord.setRole("source");
        sourceRecord.add(new Field("id", "42"));
        testCase.addRecord(sourceRecord);
        RecordImplForTest targetRecord = new RecordImplForTest();
        targetRecord.setRole("target");
        targetRecord.add(new Field("id", "42"));
        testCase.addRecord(targetRecord);
        RecordImplForTest targetRecord2 = new RecordImplForTest();
        targetRecord2.setRole("target");
        targetRecord2.add(new Field("id", "41"));
        testCase.addRecord(targetRecord2);

        List<TestCase> testCases = new ArrayList<TestCase>();
        testCases.add(testCase);
        process.setTestCases(testCases);

        CompactProcess cProcess = new CompactProcess(process, repository,
            frameAddressResolver, runtimeProperties);

        ProcessTester tester = new ProcessTester(cProcess, true);
View Full Code Here

TOP

Related Classes of hu.sztaki.ilab.longneck.process.LongneckProcess

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.