MConfig.java :  » IDE-Netbeans » xtest » org » netbeans » xtest » Java Open Source

Java Open Source » IDE Netbeans » xtest 
xtest » org » netbeans » xtest » MConfig.java
/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
 *
 * The contents of this file are subject to the terms of either the GNU
 * General Public License Version 2 only ("GPL") or the Common
 * Development and Distribution License("CDDL") (collectively, the
 * "License"). You may not use this file except in compliance with the
 * License. You can obtain a copy of the License at
 * http://www.netbeans.org/cddl-gplv2.html
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
 * specific language governing permissions and limitations under the
 * License.  When distributing the software, include this License Header
 * Notice in each file and include the License file at
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
 * particular file as subject to the "Classpath" exception as provided
 * by Sun in the GPL Version 2 section of the License file that
 * accompanied this code. If applicable, add the following below the
 * License Header, with the fields enclosed by brackets [] replaced by
 * your own identifying information:
 * "Portions Copyrighted [year] [name of copyright owner]"
 *
 * Contributor(s):
 *
 * The Original Software is NetBeans. The Initial Developer of the Original
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
 * Microsystems, Inc. All Rights Reserved.
 *
 * If you wish your version of this file to be governed by only the CDDL
 * or only the GPL Version 2, indicate your decision by adding
 * "[Contributor] elects to include this software in this distribution
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
 * single choice of license, a recipient has the option to distribute
 * your version of this file under either the CDDL, the GPL Version 2 or
 * to extend the choice of license to its licensees as provided above.
 * However, if you add GPL Version 2 code and therefore, elected the GPL
 * Version 2 license, then the option applies only if the new code is
 * made subject to such option by the copyright holder.
 */
/*
 * Config.java
 *
 * Created on May 2, 2001, 9:54 PM
 */

package org.netbeans.xtest;

import java.util.Vector;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.LinkedList;
import java.util.Iterator;
import java.util.HashSet;
import java.io.File;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.taskdefs.Ant;

//import org.apache.tools.ant.types.PatternSet;

/**
 *
 * @author  mk97936
 * @version
 */
public class MConfig {

    private Vector mcfg;
    private Setup setup;

    /** Creates new Config */
    public MConfig(Vector cfg) {        
        this.mcfg = cfg;
    }

    /** Returns enumeration of TestGroup */
    public Enumeration getAllTests() {
        return mcfg.elements();
    }
    
    public void setConfigSetup(Setup setup) {
        this.setup = setup;
    }
    
    public Setup getConfigSetup() {
        return setup;
    }
    
    public static class TestGroup {
        private Vector tests = new Vector();
        private Setup  setup = null;
        private Hashtable properties = new Hashtable();
        
        public TestGroup() {
        }
        
        public void addTest(Test test) {
            tests.add(test);
        }
        
        public Enumeration getTests() {
            return tests.elements();
        }
        
        public void setSetup(Setup s) {
            setup = s;
        }
        
        public Setup getSetup() {
            return setup;
        }
        
        public void setProperties (Hashtable t) {
            properties = t;
        }
        
        public void addProperties(Hashtable t) {
            properties.putAll(t);   
        }
        
        public Hashtable getProperties () {
            return properties;
        }
    }
    
    public static class Test {
        private String [] attribs;
        private String    type;
        private String    module;
        
        public Test(String module, String type) {
            this.type = type;
            this.module = module;
        }
        
        public String [] getAttributes() {
            return attribs;
        }
        
        public String getAttributesAsString() {
            StringBuffer sb = new StringBuffer();
            for (int i = 0; i < attribs.length; i++) {
                sb.append(attribs[i]);
                sb.append(",");
            }
            if (sb.length() > 0) {
                sb.deleteCharAt(sb.length() - 1);
            }
            return sb.toString();
        }
        
        public void setAttributes(String [] attr) {
            attribs = attr;
        }
 
        public String getType() {
            return type;
        }
        
        public String getModule() {
            return module;
        }
    }
    
    public static class Setup {
        
        public static class StartStop {
            public File dir= null;
            public String antfile = null;
            public String target = null;
            public boolean onBackground = false;
            public int delay = 0;
        }

        private StartStop start = null, stop = null;
        private String name;
        
        public void setName(String n) {
            name =n;
        }
        
        public String getName() {
            return name;
        }
        
        public void setStart(StartStop start) {
            this.start = start;
        }
        
        public void setStop(StartStop stop) {
            this.stop = stop;
        }
        
        public File getStartDir() {
            return start==null?null:start.dir;
        }
        
        public File getStopDir() {
            return stop==null?null:stop.dir;
        }
        
        public String getStartAntfile() {
            return start==null?null:start.antfile;
        }
        
        public String getStopAntfile() {
            return stop==null?null:stop.antfile;
        }
        
        public String getStartTarget() {
            return start==null?null:start.target;
        }
        
        public String getStopTarget() {
            return stop==null?null:stop.target;
        }
        
        public boolean getStartOnBackground() {
            return start==null?false:start.onBackground;
        }
        
        public boolean getStopOnBackground() {
            return stop==null?false:stop.onBackground;
        }
        
        public int getStartDelay() {
            return start==null?0:start.delay;
        }
        
        public int getStopDelay() {
            return stop==null?0:stop.delay;
        }
    }
    
    
     
        
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.