Package hu.sztaki.ilab.longneck

Examples of hu.sztaki.ilab.longneck.RecordImpl


    /** The current file in the list. */
    private int currentFileIndex = -1;

    @Override
    public Record getRecord() throws NoMoreRecordsException {
    Record result = new RecordImpl();

        try {
            String[] values = getNextRecordValues() ;

            while(values.length != columns.length ) {
                log.warn("Skipping input line, number of columns differs: " + columns.length +
                         " (process definition) vs. " + values.length + " (CSV file line): \n" +
                         csvReader.getRawRecord() );
                values = getNextRecordValues() ;
            }
            for (int i = 0; i < values.length; ++i) {
                result.add(new Field(columns[i], values[i]));
            }

        } catch (IOException ex) {
            throw new RuntimeException(ex);
        }
View Full Code Here


        FrameAddressResolver far = new FrameAddressResolver();
       
        // Create an if sequence
        Sequence seq = createIfSequence(far);
       
        Record rec = new RecordImpl();
        rec.add(new Field("a", "aaa"));
       
        Kernel kernel = new Kernel(seq, far, null);
        kernel.process(rec);
       
        assertTrue(rec.has("b"));
        assertEquals("then", rec.get("b").getValue())
    }
View Full Code Here

        FrameAddressResolver far = new FrameAddressResolver();
       
        // Create an if sequence
        Sequence seq = createIfSequence(far);
       
        Record rec = new RecordImpl();
        rec.add(new Field("a", "bbb"));
       
        Kernel kernel = new Kernel(seq, far, null);
        kernel.process(rec);
       
        assertTrue(rec.has("b"));
        assertEquals("else", rec.get("b").getValue())
    }
View Full Code Here

    @Test
    public void testSwitchStrictCase1() throws FailException, FilterException {
        FrameAddressResolver far = new FrameAddressResolver();
        Sequence tested = createSwitchStrictSequence(far);
       
        Record rec = new RecordImpl();
        rec.add(new Field("a", "aaa"));
       
        Kernel kernel = new Kernel(tested, far, null);
        kernel.process(rec);
       
        assertTrue(rec.has("b"));
        assertEquals("case1", rec.get("b").getValue())
       
        // Only case 1 was run
        assertTrue(rec.has("c1"));
        assertEquals("case1", rec.get("c1").getValue())
        assertFalse(rec.has("c2"));
        assertFalse(rec.has("c3"));
       
        // After set was run
        assertTrue(rec.has("after"));
    }
View Full Code Here

    @Test
    public void testSwitchStrictCase2() throws FailException, FilterException {
        FrameAddressResolver far = new FrameAddressResolver();
        Sequence tested = createSwitchStrictSequence(far);
       
        Record rec = new RecordImpl();
        rec.add(new Field("a", "bbb"));
       
        Kernel kernel = new Kernel(tested, far, null);
        kernel.process(rec);
       
        assertTrue(rec.has("b"));
        assertEquals("case2", rec.get("b").getValue())
       
        // Only case 2 was run
        assertTrue(rec.has("c2"));
        assertEquals("case2", rec.get("c2").getValue())
        assertFalse(rec.has("c1"));
        assertFalse(rec.has("c3"));
       
        // After set was run
        assertTrue(rec.has("after"));
    }
View Full Code Here

    @Test   
    public void testSwitchStrictCase3() throws FailException, FilterException {
        FrameAddressResolver far = new FrameAddressResolver();
        Sequence tested = createSwitchStrictSequence(far);
       
        Record rec = new RecordImpl();
        rec.add(new Field("a", "ccc"));
       
        Kernel kernel = new Kernel(tested, far, null);
        kernel.process(rec);
       
        assertTrue(rec.has("b"));
        assertEquals("case3", rec.get("b").getValue())
       
        // Only case 3 was run
        assertTrue(rec.has("c3"));
        assertEquals("case3", rec.get("c3").getValue())
        assertFalse(rec.has("c1"));
        assertFalse(rec.has("c2"));
       
        // After set was run
        assertTrue(rec.has("after"));
    }
View Full Code Here

    @Test   
    public void testSwitchStrictAllCasesFail() throws FailException, FilterException {
        FrameAddressResolver far = new FrameAddressResolver();
        Sequence tested = createSwitchStrictSequence(far);
       
        Record rec = new RecordImpl();
        rec.add(new Field("a", "ddd"));
       
        Kernel kernel = new Kernel(tested, far, null);
        kernel.process(rec);

        assertFalse(rec.has("after"));
    }
View Full Code Here

    @Test
    public void testSwitchCase1() throws FailException, FilterException {
        FrameAddressResolver far = new FrameAddressResolver();
        Sequence tested = createSwitchSequence(far);
       
        Record rec = new RecordImpl();
        rec.add(new Field("a", "aaa"));
       
        Kernel kernel = new Kernel(tested, far, null);
        kernel.process(rec);
       
        assertTrue(rec.has("b"));
        assertEquals("case1", rec.get("b").getValue())
       
        // Only case 1 was run
        assertTrue(rec.has("c1"));
        assertEquals("case1", rec.get("c1").getValue())
        assertFalse(rec.has("c2"));
        assertFalse(rec.has("c3"));
       
        // After set was run
        assertTrue(rec.has("after"));
    }
View Full Code Here

    @Test
    public void testSwitchCase2() throws FailException, FilterException {
        FrameAddressResolver far = new FrameAddressResolver();
        Sequence tested = createSwitchSequence(far);
       
        Record rec = new RecordImpl();
        rec.add(new Field("a", "bbb"));
       
        Kernel kernel = new Kernel(tested, far, null);
        kernel.process(rec);
       
        assertTrue(rec.has("b"));
        assertEquals("case2", rec.get("b").getValue())
       
        // Only case 2 was run
        assertTrue(rec.has("c2"));
        assertEquals("case2", rec.get("c2").getValue())
        assertFalse(rec.has("c1"));
        assertFalse(rec.has("c3"));
       
        // After set was run
        assertTrue(rec.has("after"));
    }
View Full Code Here

    @Test   
    public void testSwitchCase3() throws FailException, FilterException {
        FrameAddressResolver far = new FrameAddressResolver();
        Sequence tested = createSwitchSequence(far);
       
        Record rec = new RecordImpl();
        rec.add(new Field("a", "ccc"));
       
        Kernel kernel = new Kernel(tested, far, null);
        kernel.process(rec);
       
        assertTrue(rec.has("b"));
        assertEquals("case3", rec.get("b").getValue())
       
        // Only case 3 was run
        assertTrue(rec.has("c3"));
        assertEquals("case3", rec.get("c3").getValue())
        assertFalse(rec.has("c1"));
        assertFalse(rec.has("c2"));
       
        // After set was run
        assertTrue(rec.has("after"));
    }
View Full Code Here

TOP

Related Classes of hu.sztaki.ilab.longneck.RecordImpl

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.