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

com.greenpepper.maven.plugin.Repository Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 2007 Pyxis Technologies inc.
 *
 * This 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 software 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA,
 * or see the FSF site: http://www.fsf.org.
 */

package com.greenpepper.maven.plugin;

import com.greenpepper.repository.DocumentNode;
import com.greenpepper.repository.DocumentRepository;
import com.greenpepper.repository.FileSystemRepository;
import org.apache.commons.lang3.StringUtils;

import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.List;

/**
 * 

Repository class.

* * @author oaouattara * @version $Id: $Id */ public class Repository { public final List suites; public final List tests; private String type = FileSystemRepository.class.getName(); private String root; private String name; private boolean isDefault; private String projectName; private String systemUnderTest; private String runnerName; private DocumentRepository documentRepository; private String dialect; /** *

Constructor for Repository.

*/ public Repository() { suites = new ArrayList( ); tests = new ArrayList( ); } /** *

addTest.

* * @param uri a {@link java.lang.String} object. */ public void addTest(String uri) { tests.add( uri ); } /** *

addSuite.

* * @param uri a {@link java.lang.String} object. */ public void addSuite(String uri) { suites.add( uri ); } /** *

Getter for the field tests.

* * @return an array of {@link java.lang.String} objects. */ public List getTests() { return tests; } public DocumentNode retrieveDocumentHierarchy() throws Exception { DocumentRepository documentRepository = getDocumentRepository(); return documentRepository.getSpecificationsHierarchy(getProjectName(), getSystemUnderTest()); } /** *

Getter for the field suites.

* * @return an array of {@link java.lang.String} objects. */ public List getSuites() { return suites; } /** *

Setter for the field type.

* * @param type a {@link java.lang.String} object. */ public void setType(String type) { this.type = type; } /** *

Getter for the field type.

* * @return a {@link java.lang.String} object. */ public String getType() { return type; } /** *

Getter for the field root.

* * @return a {@link java.lang.String} object. */ public String getRoot() { return root; } /** *

Setter for the field root.

* * @param root a {@link java.lang.String} object. */ public void setRoot(String root) { this.root = root; } /** *

Getter for the field name.

* * @return a {@link java.lang.String} object. */ public String getName() { return name; } /** *

Setter for the field name.

* * @param name a {@link java.lang.String} object. */ public void setName(String name) { this.name = name; } /** *

newInstance.

* * @return a {@link com.greenpepper.repository.DocumentRepository} object. * @throws java.lang.Exception if any. */ public DocumentRepository newInstance() throws Exception { Class klass = Class.forName( type ); if (!DocumentRepository.class.isAssignableFrom(klass)) throw new IllegalArgumentException("Not a " + DocumentRepository.class.getName() + ": " + type ); Constructor constructor = klass.getConstructor( String[].class ); return (DocumentRepository) constructor.newInstance( new Object[]{ StringUtils.split(root,';') } ); } /** *

Getter for the field documentRepository.

* * @return a {@link com.greenpepper.repository.DocumentRepository} object. * @throws java.lang.Exception if any. */ public DocumentRepository getDocumentRepository() throws Exception { if (documentRepository == null) { documentRepository = newInstance(); } return documentRepository; } /** *

isDefault.

* * @return a boolean. */ public boolean isDefault() { return isDefault; } /** *

setDefault.

* * @param isDefault a boolean. */ public void setDefault(boolean isDefault) { this.isDefault = isDefault; } public String getProjectName() { return projectName; } public void setProjectName(String projectName) { this.projectName = projectName; } public String getSystemUnderTest() { return systemUnderTest; } public void setSystemUnderTest(String systemUnderTest) { this.systemUnderTest = systemUnderTest; } public String getRunnerName() { return runnerName; } public void setRunnerName(String runnerName) { this.runnerName = runnerName; } public String getDialect() { return dialect; } public void setDialect(String dialect) { this.dialect = dialect; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy