-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from ps-md2/feature/dsl-validator
Feature/dsl validator
- Loading branch information
Showing
12 changed files
with
537 additions
and
278 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ entity Complaint { | |
entity Location { | ||
myStreet: string | ||
myCity: string | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...2.framework.tests/models/de/wwu/md2/framework/tests/dsl/workflow/validator/controller.md2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package CurrentStateProject.controllers | ||
|
||
main { | ||
appVersion "1.0" | ||
modelVersion "1.0" | ||
} | ||
remoteConnection CitizenAppRemoteConnection { | ||
uri "http://localhost:8081/Backend/" | ||
} | ||
contentProvider Complaint localComplaintProvider { | ||
providerType CitizenAppRemoteConnection | ||
} | ||
|
||
WorkflowElement LocationDetection{ | ||
onInit { | ||
action CustomAction init{ | ||
|
||
} | ||
} | ||
action CustomAction next { | ||
bind action FireEvent(LocationEvent) on LocationVerifyView.Next2.onClick | ||
} | ||
processChain LocationProcessChain{ | ||
step LocationDetection: | ||
view LocationDetectionView | ||
} | ||
} | ||
|
||
WorkflowElement SubmitComplaint { | ||
onInit { | ||
action CustomAction init { | ||
} | ||
} | ||
action CustomAction next { | ||
bind action FireEvent(LocationEvent) on LocationVerifyView.Next2.onClick | ||
} | ||
processChain ComplaintProcessChain { | ||
step SubmitComplaint: | ||
view SubmitComplaintView | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...wu.md2.framework.tests/models/de/wwu/md2/framework/tests/dsl/workflow/validator/model.md2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package CurrentStateProject.models | ||
|
||
entity Complaint { | ||
loc: Location // use current MD2 location instead!--> No, current MD2 location is a content provider, not an entity! | ||
descriptions : string | ||
feedback : string | ||
status : ComplaintStatus | ||
} | ||
|
||
entity Location { | ||
myStreet: string | ||
myStreetNo: string | ||
myPostalCode: integer | ||
myCity: string | ||
myCountry: string | ||
myLatitude: float | ||
myLongitude: float | ||
} | ||
|
||
enum ComplaintStatus { | ||
"User is filling out complaint", | ||
"Complaint is sent to administration", | ||
"Complaint is in process", | ||
"Complaint has been handled by the administration" | ||
} |
73 changes: 73 additions & 0 deletions
73
de.wwu.md2.framework.tests/models/de/wwu/md2/framework/tests/dsl/workflow/validator/view.md2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package CurrentStateProject.views | ||
|
||
GridLayoutPane LocationDetectionView (columns 2, rows 9) { | ||
Label TitleLbl ("Enter your location") // better: As Title of Activity | ||
Spacer | ||
TextInput streetLbl {tooltip "street"} | ||
TextInput streetNoLbl {tooltip "no"} | ||
IntegerInput zipLbl {tooltip "zip" } | ||
TextInput cityLbl {tooltip "city"} | ||
TextInput countryLbl {tooltip "country" width 100%} | ||
Spacer {width 1%} | ||
Label latitudeLbl ("Latitude:") | ||
Label latitudeValueLbl ("") | ||
Label longitudeLbl ("Longitude:") | ||
Label longitudeValueLbl ("") | ||
Spacer {width 1%} | ||
Button DetectLocationBtn {text "My Location"} | ||
Button Cancel {text "Cancel"} | ||
Button Next {text "Next"} | ||
//NavigationBar(Cancel, next) | ||
Spacer {width 1%} | ||
} | ||
|
||
FlowLayoutPane LocationVerifyView (vertical) { | ||
Label TitleLbl ("Verify Location") // better: As Title of Activity | ||
|
||
FlowLayoutPane StreetView (horizontal) { | ||
LocationDetectionView.streetLbl -> streetLbl2 | ||
LocationDetectionView.streetNoLbl -> streetNoLbl2 | ||
} | ||
FlowLayoutPane CityView (horizontal) { | ||
LocationDetectionView.zipLbl -> zipLbl2 | ||
LocationDetectionView.cityLbl -> cityLbl2 | ||
} | ||
|
||
LocationDetectionView.countryLbl -> countryLbl2 | ||
Spacer {width 1%} | ||
LocationDetectionView.latitudeLbl -> latitudeLbl2 | ||
LocationDetectionView.longitudeLbl -> longitudeLbl2 | ||
|
||
//NavigationBar(Cancel, previous, next) | ||
LocationDetectionView.Cancel -> Cancel2 | ||
LocationDetectionView.Next -> Next2 | ||
Button Previous {text "Previous"} | ||
} | ||
|
||
FlowLayoutPane SubmitComplaintView (vertical) { | ||
Label TitleLbl ("Submit Complaint") // better: As Title of Activity | ||
Image UploadImg { | ||
src "uploadedImage.png" | ||
} | ||
FlowLayoutPane StreetView (horizontal) { | ||
LocationDetectionView.streetLbl -> streetLbl3 | ||
LocationDetectionView.streetNoLbl -> streetNoLbl3 | ||
} | ||
FlowLayoutPane CityView (horizontal) { | ||
LocationDetectionView.zipLbl -> zipLbl3 | ||
LocationDetectionView.cityLbl -> cityLbl3 | ||
} | ||
|
||
LocationDetectionView.countryLbl -> countryLbl3 | ||
Spacer {width 1%} | ||
LocationDetectionView.latitudeLbl -> latitudeLbl3 | ||
LocationDetectionView.longitudeLbl -> longitudeLbl3 | ||
|
||
TextInput DescriptionTxt { | ||
label "Additional Description" | ||
type textarea | ||
} | ||
//NavigationBar(Cancel, next "Submit complaint") | ||
LocationDetectionView.Cancel -> Cancel3 | ||
Button submitComplaint {text "Submit complaint"} | ||
} |
26 changes: 26 additions & 0 deletions
26
...md2.framework.tests/models/de/wwu/md2/framework/tests/dsl/workflow/validator/workflow.md2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package CurrentStateProject.workflows | ||
|
||
/* | ||
* Implement the workflow here | ||
*/ | ||
|
||
WorkflowElement LocationDetection | ||
fires LocationEvent { | ||
start LocationDetection | ||
} | ||
|
||
WorkflowElement SubmitComplaint | ||
fires SubmitEvent { | ||
start LocationDetection | ||
} | ||
fires anotherEvent { | ||
start LocationDetection | ||
} | ||
|
||
App Citizenapp { | ||
WorkflowElements { | ||
LocationDetection (startable: "Start Controller 1"), | ||
SubmitComplaint | ||
} | ||
appName "currentStateApp" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
...mework.tests/src/de/wwu/md2/framework/tests/dsl/workflow/functionTest/validatorTest.xtend
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package de.wwu.md2.framework.tests.dsl.workflow.functionTest | ||
|
||
import org.eclipse.xtext.junit4.InjectWith | ||
import de.wwu.md2.framework.MD2InjectorProvider | ||
import org.junit.runner.RunWith | ||
import org.eclipse.xtext.junit4.XtextRunner | ||
import javax.inject.Inject | ||
import org.eclipse.xtext.junit4.util.ParseHelper | ||
import de.wwu.md2.framework.mD2.MD2Model | ||
import org.eclipse.emf.ecore.resource.ResourceSet | ||
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl | ||
import org.junit.Before | ||
import static extension de.wwu.md2.framework.tests.utils.ModelProvider.* | ||
|
||
import org.junit.Test | ||
import org.eclipse.xtext.junit4.validation.ValidationTestHelper | ||
import de.wwu.md2.framework.validation.ControllerValidator | ||
import de.wwu.md2.framework.mD2.MD2Package | ||
|
||
@InjectWith(typeof(MD2InjectorProvider)) | ||
@RunWith(typeof(XtextRunner)) | ||
class validatorTest { | ||
|
||
@Inject extension ParseHelper<MD2Model> | ||
@Inject extension ValidationTestHelper | ||
MD2Model workflowModel; | ||
MD2Model controllerModel; | ||
MD2Model viewModel; | ||
MD2Model modelModel; | ||
ResourceSet rs; | ||
|
||
@Before | ||
def void setUp() { | ||
rs = new ResourceSetImpl(); | ||
workflowModel = WORKFLOW_VALIDATOR_W.load.parse(rs); | ||
controllerModel = WORKFLOW_VALIDATOR_C.load.parse(rs); | ||
viewModel = WORKFLOW_VALIDATOR_V.load.parse(rs); | ||
modelModel = WORKFLOW_VALIDATOR_M.load.parse(rs); | ||
} | ||
|
||
@Test | ||
def checkIfSpecifiedEventsAreFiredInControllerTest(){ | ||
workflowModel.assertNoErrors(); | ||
workflowModel.assertWarning(MD2Package::eINSTANCE.workflowEvent,ControllerValidator::FIREEVENT) | ||
} | ||
|
||
@Test | ||
def checkEventExistsInCorrectWorkflowElementTest(){ | ||
controllerModel.assertError(MD2Package::eINSTANCE.fireEventAction,ControllerValidator::EVENTREFERENCE); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.