diff options
author | Henrik Rentz-Reichert | 2011-02-24 08:40:40 +0000 |
---|---|---|
committer | Henrik Rentz-Reichert | 2011-02-24 08:40:40 +0000 |
commit | 48c2f0554103c61ccd2c975766f2723fa35a233c (patch) | |
tree | 05fa20113553c621824849facf55883a720e5dbe /tests/org.eclipse.etrice.ui.tests.base | |
parent | 7d299dfd7f3588483f66caa8be82f3b12b9eed9f (diff) | |
parent | 66f0406f4ad4030e8f92de20fa22d5b0f2d1ac27 (diff) | |
download | org.eclipse.etrice-48c2f0554103c61ccd2c975766f2723fa35a233c.tar.gz org.eclipse.etrice-48c2f0554103c61ccd2c975766f2723fa35a233c.tar.xz org.eclipse.etrice-48c2f0554103c61ccd2c975766f2723fa35a233c.zip |
Merge branch 'refs/heads/master' of
https://hrentzreich@git.eclipse.org/gitroot/etrice/org.eclipse.etrice.git
into HEAD
Diffstat (limited to 'tests/org.eclipse.etrice.ui.tests.base')
5 files changed, 136 insertions, 136 deletions
diff --git a/tests/org.eclipse.etrice.ui.tests.base/.classpath b/tests/org.eclipse.etrice.ui.tests.base/.classpath index ad32c83a7..8a8f1668c 100644 --- a/tests/org.eclipse.etrice.ui.tests.base/.classpath +++ b/tests/org.eclipse.etrice.ui.tests.base/.classpath @@ -1,7 +1,7 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="src" path="src"/> - <classpathentry kind="output" path="bin"/> -</classpath> +<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/tests/org.eclipse.etrice.ui.tests.base/.project b/tests/org.eclipse.etrice.ui.tests.base/.project index ebe0323d9..56bbc0f5a 100644 --- a/tests/org.eclipse.etrice.ui.tests.base/.project +++ b/tests/org.eclipse.etrice.ui.tests.base/.project @@ -1,28 +1,28 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.etrice.ui.tests.base</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> +<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.etrice.ui.tests.base</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/tests/org.eclipse.etrice.ui.tests.base/.settings/org.eclipse.jdt.core.prefs b/tests/org.eclipse.etrice.ui.tests.base/.settings/org.eclipse.jdt.core.prefs index 00cf6ec9e..a5e428cf7 100644 --- a/tests/org.eclipse.etrice.ui.tests.base/.settings/org.eclipse.jdt.core.prefs +++ b/tests/org.eclipse.etrice.ui.tests.base/.settings/org.eclipse.jdt.core.prefs @@ -1,8 +1,8 @@ -#Thu Feb 10 12:03:48 CET 2011 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 +#Thu Feb 10 12:03:48 CET 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/tests/org.eclipse.etrice.ui.tests.base/build.properties b/tests/org.eclipse.etrice.ui.tests.base/build.properties index 34d2e4d2d..41eb6ade2 100644 --- a/tests/org.eclipse.etrice.ui.tests.base/build.properties +++ b/tests/org.eclipse.etrice.ui.tests.base/build.properties @@ -1,4 +1,4 @@ -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - . +source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/tests/org.eclipse.etrice.ui.tests.base/src/org/eclipse/etrice/tests/base/TestBase.java b/tests/org.eclipse.etrice.ui.tests.base/src/org/eclipse/etrice/tests/base/TestBase.java index 73a95af74..fc80b940a 100644 --- a/tests/org.eclipse.etrice.ui.tests.base/src/org/eclipse/etrice/tests/base/TestBase.java +++ b/tests/org.eclipse.etrice.ui.tests.base/src/org/eclipse/etrice/tests/base/TestBase.java @@ -1,89 +1,89 @@ -/******************************************************************************* - * Copyright (c) 2010 protos software gmbh (http://www.protos.de). - * 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 - * - * CONTRIBUTORS: - * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution) - * - *******************************************************************************/ - -package org.eclipse.etrice.tests.base; - -import static org.junit.Assert.fail; - -import java.io.File; -import java.io.IOException; -import java.net.URL; -import java.util.LinkedList; - -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.etrice.core.room.RoomModel; -import org.eclipse.graphiti.mm.algorithms.styles.Color; -import org.eclipse.graphiti.util.IColorConstant; -import org.eclipse.xtext.resource.XtextResource; -import org.eclipse.xtext.resource.XtextResourceSet; - -public abstract class TestBase { - - private String basePath; - private LinkedList<RoomModel> models = new LinkedList<RoomModel>(); - - protected void loadModelFile() { - try { - URL modelsDir = getModelsDirectoy(); - URL fileURL = FileLocator.toFileURL(modelsDir); - basePath = fileURL.getFile(); - } catch (IOException e) { - e.printStackTrace(); - } - - loadModels(getModelFileName()); - } - - protected void removeDiagramsDirectory() { - File diagDir = new File(basePath+File.separator+"diagrams"); - if (diagDir.isDirectory()) { - File[] files = diagDir.listFiles(); - if (files!=null) - for (int i = 0; i < files.length; i++) { - files[i].delete(); - } - diagDir.delete(); - } - } - - private void loadModels(String modelName) { - XtextResourceSet rs = new XtextResourceSet(); - rs.addLoadOption(XtextResource.OPTION_RESOLVE_ALL, Boolean.TRUE); - String path = basePath + modelName; - URI uri = URI.createFileURI(path); - Resource resource = rs.getResource(uri, true); - Object root = resource.getContents().get(0); - if (root instanceof RoomModel) - models.add((RoomModel) root); - else - fail("File contains no RoomModel as root object"); - } - - public LinkedList<RoomModel> getModels() { - return models; - } - - protected abstract String getModelFileName(); - protected abstract URL getModelsDirectoy(); - - protected boolean isEqual(Color c, IColorConstant cc) { - if (c.getRed()!=cc.getRed()) - return false; - if (c.getGreen()!=cc.getGreen()) - return false; - if (c.getBlue()!=cc.getBlue()) - return false; - return true; - } -} +/*******************************************************************************
+ * Copyright (c) 2010 protos software gmbh (http://www.protos.de).
+ * 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
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.tests.base;
+
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.util.LinkedList;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.etrice.core.room.RoomModel;
+import org.eclipse.graphiti.mm.algorithms.styles.Color;
+import org.eclipse.graphiti.util.IColorConstant;
+import org.eclipse.xtext.resource.XtextResource;
+import org.eclipse.xtext.resource.XtextResourceSet;
+
+public abstract class TestBase {
+
+ private String basePath;
+ private LinkedList<RoomModel> models = new LinkedList<RoomModel>();
+
+ protected void loadModelFile() {
+ try {
+ URL modelsDir = getModelsDirectoy();
+ URL fileURL = FileLocator.toFileURL(modelsDir);
+ basePath = fileURL.getFile();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ loadModels(getModelFileName());
+ }
+
+ protected void removeDiagramsDirectory() {
+ File diagDir = new File(basePath+File.separator+"diagrams");
+ if (diagDir.isDirectory()) {
+ File[] files = diagDir.listFiles();
+ if (files!=null)
+ for (int i = 0; i < files.length; i++) {
+ files[i].delete();
+ }
+ diagDir.delete();
+ }
+ }
+
+ private void loadModels(String modelName) {
+ XtextResourceSet rs = new XtextResourceSet();
+ rs.addLoadOption(XtextResource.OPTION_RESOLVE_ALL, Boolean.TRUE);
+ String path = basePath + modelName;
+ URI uri = URI.createFileURI(path);
+ Resource resource = rs.getResource(uri, true);
+ Object root = resource.getContents().get(0);
+ if (root instanceof RoomModel)
+ models.add((RoomModel) root);
+ else
+ fail("File contains no RoomModel as root object");
+ }
+
+ public LinkedList<RoomModel> getModels() {
+ return models;
+ }
+
+ protected abstract String getModelFileName();
+ protected abstract URL getModelsDirectoy();
+
+ protected boolean isEqual(Color c, IColorConstant cc) {
+ if (c.getRed()!=cc.getRed())
+ return false;
+ if (c.getGreen()!=cc.getGreen())
+ return false;
+ if (c.getBlue()!=cc.getBlue())
+ return false;
+ return true;
+ }
+}
|