Package org.drools.guvnor.server.repository

Source Code of org.drools.guvnor.server.repository.EventsIntegrationTest

/*
* Copyright 2010 JBoss Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*      http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.drools.guvnor.server.repository;

import org.drools.guvnor.client.common.AssetFormats;
import org.drools.guvnor.server.test.GuvnorIntegrationTest;
import org.drools.ide.common.client.modeldriven.brl.RuleModel;
import org.drools.ide.common.client.modeldriven.dt52.GuidedDecisionTable52;
import org.drools.ide.common.server.util.BRXMLPersistence;
import org.drools.ide.common.server.util.GuidedDTXMLPersistence;
import org.drools.repository.AssetItem;
import org.drools.repository.ModuleItem;
import org.junit.Test;

public class EventsIntegrationTest extends GuvnorIntegrationTest {

    @Test
    public void testLoadSave() throws Exception {
        System.setProperty( "guvnor.saveEventListener",
                            "org.drools.guvnor.server.repository.SampleSaveEvent" );

        ModuleItem pkg = rulesRepository.createModule( "testLoadSaveEvents",
                                                                   "" );
        AssetItem asset = pkg.addAsset( "testLoadSaveEvent",
                                        "" );
        asset.updateFormat( AssetFormats.BUSINESS_RULE );

        RuleModel m = new RuleModel();
        m.name = "mrhoden";

        asset.updateContent( BRXMLPersistence.getInstance().marshal( m ) );
        asset.checkin( "" );

        asset = pkg.addAsset( "testLoadSaveEventDT",
                              "" );
        asset.updateFormat( AssetFormats.DECISION_TABLE_GUIDED );
        GuidedDecisionTable52 gt = new GuidedDecisionTable52();
        asset.updateContent( GuidedDTXMLPersistence.getInstance().marshal( gt ) );
        asset.checkin( "" );
    }

}
TOP

Related Classes of org.drools.guvnor.server.repository.EventsIntegrationTest

TOP
Copyright © 2018 www.massapi.com. 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.