All Downloads are FREE. Search and download functionalities are using the official Maven repository.

at.spardat.xma.boot.test.AppDescrTest Maven / Gradle / Ivy

/*******************************************************************************
 * Copyright (c) 2003, 2007 s IT Solutions AT Spardat GmbH .
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     s IT Solutions AT Spardat GmbH - initial API and implementation
 *******************************************************************************/

package at.spardat.xma.boot.test;

import java.util.Iterator;
import java.util.Set;

import junit.framework.Assert;
import junit.framework.TestCase;
import at.spardat.xma.boot.comp.data.XMAApp;
import at.spardat.xma.boot.comp.data.XMAAppParser;
import at.spardat.xma.boot.comp.data.XMAComponent;
import at.spardat.xma.boot.logger.Logger;

/**
 * class: Tester
 *
 * @author s3595 Chris Sch?fer (CGS)
 * @version 0.1.0
 *
 */
public class AppDescrTest extends TestCase {

    /**
     * @param name
     */
    public AppDescrTest(String name) {
        super(name);
    }

    /**
     *
     * @param args
     * @return void
     */
	public static void main(String[] args) throws Exception {

        AppDescrTest ad = new AppDescrTest("main");
        ad.test_ok();

	}

	public void test_ok () throws Exception {
		System.out.println("test_ok");
		parseAppDesc("src/at/spardat/xma/boot/test/apptest.xml");
	}

	public void test_unknown () throws Exception {
		System.out.println("test_unknown");
		parseAppDesc("src/at/spardat/xma/boot/test/apptest-unknown.xml");
	}

    private void parseAppDesc (String xmlFile) throws Exception {

        String strURI = xmlFile;
        XMAAppParser parser = new XMAAppParser( Logger.getLogger( "tester"));
        Assert.assertNotNull(parser);
        XMAApp app = parser.parse(strURI);
        Assert.assertNotNull(app);

        XMAComponent comp =  app.getComponent( "demo");
        Assert.assertTrue ( comp.getName_().equals( "demo") );

        String imp = comp.getImplPackage_();
        Assert.assertTrue ( imp.equals( "at.spardat.xma") );

        Set s = app.components_.keySet();
        for (Iterator iter = s.iterator(); iter.hasNext();) {
            String element = (String)iter.next();
            XMAComponent c = (XMAComponent)app.components_.get(element);
            System.out.println( "name: " + c.getName_()) ;
        }


    }



}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy