Package org.drools.lang.dsl

Examples of org.drools.lang.dsl.DSLMappingEntry$AnySection


        copy.addSelectionListener( new SelectionAdapter() {

            // Add an item, should pop up the editor
            public void widgetSelected(SelectionEvent e) {

                DSLMappingEntry curr = getCurrentSelected();
                if (curr != null) {
                    DSLMappingEntry newItem = new AntlrDSLMappingEntry( curr.getSection(),
                                                                          curr.getMetaData(),
                                                                          curr.getMappingKey(),
                                                                          curr.getMappingValue(),
                                                                          null,
                                                                          null);
View Full Code Here


        for ( final Iterator it = dsls.iterator(); it.hasNext(); ) {
            final DSLMappingFile file = (DSLMappingFile) it.next();
            final DSLMapping mapping = file.getMapping();
            for ( final Iterator entries = mapping.getEntries().iterator(); entries.hasNext(); ) {
                final DSLMappingEntry entry = (DSLMappingEntry) entries.next();
                if ( entry.getSection() == DSLMappingEntry.CONDITION ) {
                    this.builder.addDSLConditionSentence( entry.getMappingKey() );
                } else if ( entry.getSection() == DSLMappingEntry.CONSEQUENCE ) {
                    this.builder.addDSLActionSentence( entry.getMappingKey() );
                }
            }
        }

    }
View Full Code Here

        for ( final Iterator it = dsls.iterator(); it.hasNext(); ) {
            final DSLMappingFile file = (DSLMappingFile) it.next();
            final DSLMapping mapping = file.getMapping();
            for ( final Iterator entries = mapping.getEntries().iterator(); entries.hasNext(); ) {
                final DSLMappingEntry entry = (DSLMappingEntry) entries.next();
                if ( entry.getSection() == DSLMappingEntry.CONDITION ) {
                    this.builder.addDSLConditionSentence( entry.getMappingKey() );
                } else if ( entry.getSection() == DSLMappingEntry.CONSEQUENCE ) {
                    this.builder.addDSLActionSentence( entry.getMappingKey() );
                }
            }
        }

    }
View Full Code Here

    }

    @Test
    public void testAddSentenceMultipleTypes() {
        final DSLMappingEntry mapping1 = mock(DSLMappingEntry.class, "mapping1");
        final DSLMappingEntry mapping2 = mock(DSLMappingEntry.class, "mapping2");
        final DSLMappingEntry mapping3 = mock(DSLMappingEntry.class, "mapping3");
        final DSLMappingEntry mapping4 = mock(DSLMappingEntry.class, "mapping4");
       
       
        // setting expectations for entry1
        when(mapping1.getSection()).thenReturn(DSLMappingEntry.CONDITION );
        when(mapping1.getMappingKey()).thenReturn("cond");
       
        // setting expectations for entry2
        when(mapping2.getSection()).thenReturn(DSLMappingEntry.CONSEQUENCE );
        when(mapping2.getMappingKey()).thenReturn("cons");

        // setting expectations for entry3
        when(mapping3.getSection()).thenReturn(DSLMappingEntry.ANY );
        when(mapping3.getMappingKey()).thenReturn("any");
       
        // setting expectations for entry4
        when(mapping4.getSection()).thenReturn(DSLMappingEntry.KEYWORD );
        when(mapping4.getMappingKey()).thenReturn("key");
       
        this.builder.addDSLMapping(mapping1);
        this.builder.addDSLMapping(mapping2);
        this.builder.addDSLMapping(mapping3);
        this.builder.addDSLMapping(mapping4);
View Full Code Here

        assertEquals( 1, engine.conditionDSLSentences.length );

    }

    public void testAddSentenceMultipleTypes() {
        final DSLMappingEntry mapping1 = mock(DSLMappingEntry.class, "mapping1");
        final DSLMappingEntry mapping2 = mock(DSLMappingEntry.class, "mapping2");
        final DSLMappingEntry mapping3 = mock(DSLMappingEntry.class, "mapping3");
        final DSLMappingEntry mapping4 = mock(DSLMappingEntry.class, "mapping4");
       
       
        // setting expectations for entry1
        when(mapping1.getSection()).thenReturn(DSLMappingEntry.CONDITION );
        when(mapping1.getMappingKey()).thenReturn("cond");
       
        // setting expectations for entry2
        when(mapping2.getSection()).thenReturn(DSLMappingEntry.CONSEQUENCE );
        when(mapping2.getMappingKey()).thenReturn("cons");

        // setting expectations for entry3
        when(mapping3.getSection()).thenReturn(DSLMappingEntry.ANY );
        when(mapping3.getMappingKey()).thenReturn("any");
       
        // setting expectations for entry4
        when(mapping4.getSection()).thenReturn(DSLMappingEntry.KEYWORD );
        when(mapping4.getMappingKey()).thenReturn("key");
       
        this.builder.addDSLMapping(mapping1);
        this.builder.addDSLMapping(mapping2);
        this.builder.addDSLMapping(mapping3);
        this.builder.addDSLMapping(mapping4);
View Full Code Here

        ArrayList<DSLTokenizedMappingFile> dsls = new ArrayList<DSLTokenizedMappingFile>();


        DSLTokenizedMappingFile dslTokenizedMappingFile = new DSLTokenizedMappingFile();

        DSLMappingEntry dslMappingEntry = mock(DSLMappingEntry.class);
        when(dslMappingEntry.getSection()).thenReturn(DSLMappingEntry.ANY);

        dslTokenizedMappingFile.getMapping().addEntry(dslMappingEntry);
        dsls.add(dslTokenizedMappingFile);

        SuggestionCompletionEngine suggestionEngine = suggestionCompletionLoader.getSuggestionEngine("", Collections.<JarInputStream>emptyList(), dsls);
View Full Code Here

        ArrayList<DSLTokenizedMappingFile> dsls = new ArrayList<DSLTokenizedMappingFile>();


        DSLTokenizedMappingFile dslTokenizedMappingFile = new DSLTokenizedMappingFile();

        DSLMappingEntry dslMappingEntry = mock(DSLMappingEntry.class);
        when(dslMappingEntry.getSection()).thenReturn(DSLMappingEntry.ANY);

        dslTokenizedMappingFile.getMapping().addEntry(dslMappingEntry);
        dsls.add(dslTokenizedMappingFile);

        SuggestionCompletionEngine suggestionEngine = suggestionCompletionLoader.getSuggestionEngine("", Collections.<JarInputStream>emptyList(), dsls);
View Full Code Here

    }

    @Test
    public void testAddSentenceMultipleTypes() {
        final DSLMappingEntry mapping1 = mock(DSLMappingEntry.class, "mapping1");
        final DSLMappingEntry mapping2 = mock(DSLMappingEntry.class, "mapping2");
        final DSLMappingEntry mapping3 = mock(DSLMappingEntry.class, "mapping3");
        final DSLMappingEntry mapping4 = mock(DSLMappingEntry.class, "mapping4");
       
       
        // setting expectations for entry1
        when(mapping1.getSection()).thenReturn(DSLMappingEntry.CONDITION );
        when(mapping1.getMappingKey()).thenReturn("cond");
       
        // setting expectations for entry2
        when(mapping2.getSection()).thenReturn(DSLMappingEntry.CONSEQUENCE );
        when(mapping2.getMappingKey()).thenReturn("cons");

        // setting expectations for entry3
        when(mapping3.getSection()).thenReturn(DSLMappingEntry.ANY );
        when(mapping3.getMappingKey()).thenReturn("any");
       
        // setting expectations for entry4
        when(mapping4.getSection()).thenReturn(DSLMappingEntry.KEYWORD );
        when(mapping4.getMappingKey()).thenReturn("key");
       
        this.builder.addDSLMapping(mapping1);
        this.builder.addDSLMapping(mapping2);
        this.builder.addDSLMapping(mapping3);
        this.builder.addDSLMapping(mapping4);
View Full Code Here

        assertEquals( 1, engine.conditionDSLSentences.length );

    }

    public void testAddSentenceMultipleTypes() {
        final DSLMappingEntry mapping1 = context.mock(DSLMappingEntry.class, "mapping1");
        final DSLMappingEntry mapping2 = context.mock(DSLMappingEntry.class, "mapping2");
        final DSLMappingEntry mapping3 = context.mock(DSLMappingEntry.class, "mapping3");
        final DSLMappingEntry mapping4 = context.mock(DSLMappingEntry.class, "mapping4");
       
        context.checking( new Expectations() {{
            // setting expectations for entry1
            allowing(mapping1).getSection(); will(returnValue(DSLMappingEntry.CONDITION ));
            allowing(mapping1).getMappingKey(); will(returnValue("cond"));
View Full Code Here

        SuggestionCompletionLoader suggestionCompletionLoader = new SuggestionCompletionLoader();
        ArrayList<DSLTokenizedMappingFile> dsls = new ArrayList<DSLTokenizedMappingFile>();

        DSLTokenizedMappingFile dslTokenizedMappingFile = new DSLTokenizedMappingFile();

        DSLMappingEntry dslMappingEntry = mock( DSLMappingEntry.class );
        when( dslMappingEntry.getSection() ).thenReturn( DSLMappingEntry.ANY );

        dslTokenizedMappingFile.getMapping().addEntry( dslMappingEntry );
        dsls.add( dslTokenizedMappingFile );

        SuggestionCompletionEngine suggestionEngine = suggestionCompletionLoader.getSuggestionEngine( "",
View Full Code Here

TOP

Related Classes of org.drools.lang.dsl.DSLMappingEntry$AnySection

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.