Skip to content

Commit

Permalink
Merge pull request #79 from UoY-RoboStar/fix-78
Browse files Browse the repository at this point in the history
Fix for issue #78
  • Loading branch information
alvarohm authored Nov 27, 2023
2 parents d7d66d0 + 333d3a0 commit c42054d
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 25 deletions.
3 changes: 2 additions & 1 deletion circus.robocalc.robochart.textual.tests/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ source.. = src/,\
src-gen/,\
xtend-gen/
bin.includes = .,\
META-INF/
META-INF/,\
junit-platform.properties
bin.excludes = **/*.xtend
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
junit.jupiter.testclass.order.default=org.junit.jupiter.api.ClassOrderer$OrderAnnotation
5 changes: 3 additions & 2 deletions circus.robocalc.robochart.textual.tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ Version Update 3.1.0 : Nov 2022
<groupId>org.eclipse.xtend</groupId>
<artifactId>xtend-maven-plugin</artifactId>
</plugin>
<!-- <plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<configuration>
<useUIHarness>false</useUIHarness>
<work>robochart-tests/</work>
<runOrder>alphabetical</runOrder>
</configuration>
</plugin>-->
</plugin>
<?ignore
<plugin>
<groupId>org.eclipse.tycho</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,31 @@ import org.junit.jupiter.api.^extension.ExtendWith
import circus.robocalc.robochart.RCPackage
import circus.robocalc.robochart.RoboChartPackage.Literals
import org.eclipse.emf.ecore.EClass
import org.junit.jupiter.api.TestMethodOrder
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation
import org.junit.jupiter.api.Order
import org.junit.jupiter.api.TestClassOrder
import org.junit.jupiter.api.ClassOrderer

@ExtendWith(InjectionExtension)
@InjectWith(RoboChartInjectorProvider)
@TestMethodOrder(OrderAnnotation)
@TestClassOrder(ClassOrderer.OrderAnnotation)
@Order(1)
class IntegrationTest {
// @Inject ParseHelper<RCPackage> parseHelper
@Inject extension SmartParserHelper<BasicPackage>
@Inject extension ValidationTestHelper

val top_dir = "robochart-tests/"

@Test
@Order(1)
def void testSimpleMachine() {
val dir = top_dir+"robochart/test-simple-machine"
TestRoboChartModel(dir)
}

@Test
def void AlphaAlgorithm() {
val dir = top_dir+"robochart/AlphaAlgorithm"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,15 @@ import org.eclipse.xtext.testing.validation.ValidationTestHelper
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.^extension.ExtendWith
import org.eclipse.core.runtime.FileLocator
import org.junit.jupiter.api.Order
import org.junit.jupiter.api.TestClassOrder
import org.junit.jupiter.api.ClassOrderer

@ExtendWith(InjectionExtension)
@InjectWith(RoboChartInjectorProvider)
@TestClassOrder(ClassOrderer.OrderAnnotation)
@Order(2)
class RoboChartParsingTest {
@Inject extension SmartParseHelper<RCPackage>
@Inject extension ValidationTestHelper
Expand Down Expand Up @@ -278,11 +284,12 @@ class SmartParseHelper<T extends EObject> extends ParseHelper<T> {
jar.close();
} else {
// treating case where the resource files are a project in the workspace
var url = classLoader.getResource(cleanPath);
var url = classLoader.getResource("lib/robochart");
if (url === null) {
val pathInLib = if (cleanPath.startsWith("lib/")) cleanPath.replaceFirst("lib/","") else cleanPath
url = classLoader.getResource(pathInLib);
url = classLoader.getResource("robochart");
}

url = FileLocator.toFileURL(url);
val path = Paths.get(url.toURI)
var Stream<Path> walk = Files.list(path);
for (var Iterator<Path> it = walk.iterator(); it.hasNext();) {
Expand All @@ -305,7 +312,7 @@ class SmartParseHelper<T extends EObject> extends ParseHelper<T> {

def createResourceSet() {
val rs = rsp.get();
addRoboChartLibrary(rs);
//addRoboChartLibrary(rs);
return rs;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,29 +51,29 @@ class SmartParserHelper<T extends EObject> extends ParseHelper<T> {
jar.close();
} else {
// treating case where the resource files are a project in the workspace
var url = classLoader.getResource("lib/robochart");
if (url === null) {
url = classLoader.getResource("robochart");
}

url = FileLocator.toFileURL(url);
val path = Paths.get(url.toURI)
var Stream<Path> walk = Files.list(path);
for (var Iterator<Path> it = walk.iterator(); it.hasNext();) {
val p = it.next()
val is = p.toUri().toURL.openStream;
val furi = URI.createFileURI(p.toUri.toURL.path)
val r = rs.createResource(furi)
r.load(is, rs.loadOptions)
}
walk.close();
// var url = classLoader.getResource("lib/robochart");
// if (url === null) {
// url = classLoader.getResource("robochart");
// }
//
// url = FileLocator.toFileURL(url);
// val path = Paths.get(url.toURI)
// var Stream<Path> walk = Files.list(path);
// for (var Iterator<Path> it = walk.iterator(); it.hasNext();) {
// val p = it.next()
// val is = p.toUri().toURL.openStream;
// val furi = URI.createFileURI(p.toUri.toURL.path)
// val r = rs.createResource(furi)
// r.load(is, rs.loadOptions)
// }
// walk.close();
}
}

def createResourceSet() {
val rs = rsp.get();
// loading robochart libraries
loadRoboChartLibrary(rs)
//loadRoboChartLibrary(rs)

return rs;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ class RoboChartScopeProvider extends AbstractRoboChartScopeProvider {
return scope
}
} else if (context instanceof Transition) {
delegateGetScope(context, reference)
val r = IScope::NULLSCOPE
if (reference === TRANSITION__SOURCE) {
if (context.eContainer instanceof NodeContainer) {
Expand Down

1 comment on commit c42054d

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.