/*******************************************************************************
 * Copyright (c) 2010 Oak Ridge National Laboratory.
 * 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
 ******************************************************************************/
package org.csstudio.opibuilder.converter;

import junit.framework.TestCase;

import org.csstudio.opibuilder.converter.model.EdmException;
/**
 * This is a convenience operation test that transforms the example files.
 * It does not perform any assertions so it will only fail if an exception is thrown
 * during conversion.
 */
public class EdmConverterTest extends TestCase {

    public static final String RESOURCES_LOCATION = "src/resources/";
    private static final String edl1 = RESOURCES_LOCATION + "ArcTest.edl";
    private static final String edl2 = RESOURCES_LOCATION + "LLRF_AUTO.edl";
    private static final String edl3 = RESOURCES_LOCATION + "navwogif.edl";
    private static final String edl4 = RESOURCES_LOCATION + "rccsWaterSkid.edl";

    public static final String COLOR_LIST_FILE = RESOURCES_LOCATION + "colors.list";

    private void setEnvironment() {
        System.setProperty("edm2xml.colorsFile", COLOR_LIST_FILE);
        /**
         * Enable fail-fast mode for stricter tests.
         * Set this to true for the partial conversion in case of exceptions.
         */
        System.setProperty("edm2xml.robustParsing", "false");
    }

    public void testExampleEDL1() throws EdmException {
        setEnvironment();

        String[] args = {edl1};
        EdmConverter.main(args);
    }

    public void testExampleEDL2() throws EdmException {
        setEnvironment();

        String[] args = {edl2};
        EdmConverter.main(args);
    }

    public void testExampleEDL3() throws EdmException {
        setEnvironment();

        String[] args = {edl3};
        EdmConverter.main(args);
    }

    public void testExampleEDL4() throws EdmException {
        setEnvironment();

        String[] args = {edl4};
        EdmConverter.main(args);
    }
}

@@ -502,42 +502,8 @@
 r;%0A%0A
-import junit.framework.TestCase;%0A%0A
 impo
@@ -559,16 +559,75 @@
 eption;%0A
+import org.junit.Before;%0A%0Aimport junit.framework.TestCase;%0A
 /**%0A * T
@@ -1320,24 +1320,36 @@
 ors.list%22;%0A%0A
+    @Before%0A
     private 
@@ -1722,34 +1722,8 @@
 on %7B
-%0A        setEnvironment();
 %0A%0A  
@@ -1851,34 +1851,8 @@
 on %7B
-%0A        setEnvironment();
 %0A%0A  
@@ -1980,34 +1980,8 @@
 on %7B
-%0A        setEnvironment();
 %0A%0A  
@@ -2109,34 +2109,8 @@
 on %7B
-%0A        setEnvironment();
 %0A%0A  

use @Before to set environment.