Package test.openxml

Source Code of test.openxml.OpenXmlTestCase

// You can redistribute this software and/or modify it under the terms of
// the Ozone Library License version 1 published by ozone-db.org.
//
// The original code and portions created by SMB are
// Copyright (C) 1997-2001 by SMB GmbH. All rights reserved.
//
// $Id: OpenXmlTestCase.java,v 1.2 2002/02/09 18:46:47 per_nyfelt Exp $

package test.openxml;

import java.io.File;
import java.io.FileInputStream;
import java.util.Properties;

import junit.framework.TestCase;
import org.ozoneDB.ExternalDatabase;


/**
* This is the fixture for the openXml tests
* @author Per Nyfelt
*/
public class OpenXmlTestCase extends TestCase {

    /** the datbase used for all tests */
    protected ExternalDatabase db;
    protected String xmlTestDataFileName = OpenXmlTestSuite.xmlTestDataFileName;

    public OpenXmlTestCase(String name) {
        super(name);
    }

    public void setUp() throws Exception {
        Properties props = loadProps(OpenXmlTestSuite.propertiesFileName);
        String dbURI = props.getProperty("dbURI");
        db = ExternalDatabase.openDatabase(dbURI);
        db.reloadClasses();

    }

    public void tearDown() throws Exception {
        db.close();
    }

    /**
     *  Helper method to load the OpenXmlTestCase.properties file
     *
     *  @return the loaded properties
     */
    private Properties loadProps(String propsFileName) {
        Properties defaultProps = new Properties();

        // set default parameters
        defaultProps.put("dbURI", "ozonedb:remote://localhost:3333");
        Properties props = new Properties(defaultProps);

        // now load the props file
        try {
            props.load(new FileInputStream(new File(propsFileName)));
        } catch (Exception e) {
            System.out.println("Didn't find props file, using defaults");
            props.list(System.out);
        }
        return props;
    }
}
TOP

Related Classes of test.openxml.OpenXmlTestCase

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.