Package org.jostraca.test

Source Code of org.jostraca.test.ServiceTest

/*
* Name:    ServiceTest
* Authors: Richard Rodger
*
* Copyright (c) 2002-2004 Richard Rodger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/


// package
package org.jostraca.test;


// import
import junit.framework.TestCase;
import junit.framework.TestSuite;
import junit.textui.TestRunner;

import org.jostraca.Service;
import org.jostraca.VirtualTemplate;

import org.jostraca.util.PropertySet;
import org.jostraca.util.FileUtil;


/** Test cases for org.jostraca.Service
*/
public class ServiceTest extends TestCase {

  // test framework

  public ServiceTest( String pName ) {
    super( pName );
  }

  public static TestSuite suite() {
    return new TestSuite( ServiceTest.class );
  }

  public static void main( String[] pArgs ) {
    TestRunner.run( suite() );
  }


  // test methods

  public void testVersionNumber() {
    // always has to be updated manually
    // this forces a manual check of the version number
    assertEquals( "0.4.1", Service.RELEASE_NAME );
  }



  public void testVirtual() throws Exception {
    String      sc = (FileUtil.findFile("org/jostraca").getAbsolutePath())+"/../../../conf/system.conf";
    PropertySet ps = new PropertySet( sc );
    VirtualTemplate     vt01  = new VirtualTemplate( "vt01" );
    vt01.setSource( "<% @conf main.JostracaVersion = "+Service.VERSION_NUMBER+"\n"
                    +"  main.FileNameSuffix = .txt %>\n"
                    +"start\n"
                    +"[<%=\"expr\"%>]\n"
                    );

    Service s = new Service();
    s.addPropertySet( Service.CONF_system, ps );
    s.build( vt01 );
  }

}




TOP

Related Classes of org.jostraca.test.ServiceTest

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.