org.eclipse.emf.emfstore.internal.fuzzy.emf
Class FuzzyUtil

java.lang.Object
  extended by org.eclipse.emf.emfstore.internal.fuzzy.emf.FuzzyUtil

public final class FuzzyUtil
extends Object

Utility class for different methods used in EMFDataProvider context.

Author:
Julian Sommerfeldt

Field Summary
static String DIFF_FILE
          The path to the file containing the TestDiff.
static String FILE_SUFFIX
          The file suffix for the files.
static String FUZZY_FOLDER
          The main folder containing all files.
static String PROP_PRE
          The prefix for all fuzzy properties in the properties file.
static String PROPERTIES_FILE
          The path to the properties file.
static String ROOT_FOLDER
          The folder where to put the artifacts.
static String RUN_FOLDER
          The folder where to store the test runs.
static String TEST_CONFIG_FILE
          The file containing the TestConfigs.
static String TEST_CONFIG_PATH
          The path to the TEST_CONFIG_FILE.
 
Method Summary
static boolean containsConfig(org.eclipse.emf.ecore.resource.Resource resource, TestConfig config)
          Checks if a resource contains a TestConfig.
static org.eclipse.emf.ecore.resource.Resource createResource(String fileNameURI)
          Create a new Resource.
static String getProperty(String key, String defaultValue)
          Get a property out of the properties file.
static ESTestConfig getTestConfig(org.eclipse.emf.ecore.resource.Resource resource, org.junit.runners.model.TestClass testClass)
          Searches in the resource for a TestConfig fitting to the given TestClass.
static TestResult getValidTestResult(TestDiff diff)
          Get a valid TestResult out of a TestDiff.
static boolean resourceExists(org.eclipse.emf.ecore.resource.Resource resource)
          Checks if the resource exists.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FUZZY_FOLDER

public static final String FUZZY_FOLDER
The main folder containing all files.

See Also:
Constant Field Values

ROOT_FOLDER

public static final String ROOT_FOLDER
The folder where to put the artifacts.

See Also:
Constant Field Values

RUN_FOLDER

public static final String RUN_FOLDER
The folder where to store the test runs.

See Also:
Constant Field Values

FILE_SUFFIX

public static final String FILE_SUFFIX
The file suffix for the files.

See Also:
Constant Field Values

TEST_CONFIG_FILE

public static final String TEST_CONFIG_FILE
The file containing the TestConfigs.

See Also:
Constant Field Values

TEST_CONFIG_PATH

public static final String TEST_CONFIG_PATH
The path to the TEST_CONFIG_FILE.

See Also:
Constant Field Values

DIFF_FILE

public static final String DIFF_FILE
The path to the file containing the TestDiff.

See Also:
Constant Field Values

PROPERTIES_FILE

public static final String PROPERTIES_FILE
The path to the properties file.

See Also:
Constant Field Values

PROP_PRE

public static final String PROP_PRE
The prefix for all fuzzy properties in the properties file.

See Also:
Constant Field Values
Method Detail

getTestConfig

public static ESTestConfig getTestConfig(org.eclipse.emf.ecore.resource.Resource resource,
                                         org.junit.runners.model.TestClass testClass)
Searches in the resource for a TestConfig fitting to the given TestClass.

Parameters:
resource - The resource where to search in.
testClass - The TestClass to which the TestConfig should fit.
Returns:
The TestConfig fitting to the TestClass.

containsConfig

public static boolean containsConfig(org.eclipse.emf.ecore.resource.Resource resource,
                                     TestConfig config)
Checks if a resource contains a TestConfig.

Parameters:
resource - The resource where to search in.
config - The TestConfig to check.
Returns:
true if the resource contains the TestConfig , else false.

resourceExists

public static boolean resourceExists(org.eclipse.emf.ecore.resource.Resource resource)
Checks if the resource exists.

Parameters:
resource - The Resource to check.
Returns:
true if the resource exists, false otherwise.

createResource

public static org.eclipse.emf.ecore.resource.Resource createResource(String fileNameURI)
Create a new Resource.

Parameters:
fileNameURI - The uri of the resource.
Returns:
The newly created Resource.

getValidTestResult

public static TestResult getValidTestResult(TestDiff diff)
Get a valid TestResult out of a TestDiff. Valid means non null.

Parameters:
diff - The TestDiff containing the TestResult.
Returns:
The valid TestResult of the TestDiff.

getProperty

public static String getProperty(String key,
                                 String defaultValue)
Get a property out of the properties file.

Parameters:
key - The key of the property.
defaultValue - The value if the properties do not contain the key.
Returns:
The value if the properties contain the key or the defaultValue if not.


Copyright © 2015. All Rights Reserved.