Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mbe-tools
TTool
Commits
dd05ae21
Commit
dd05ae21
authored
Mar 20, 2019
by
Minh Hiep Pham
💬
Browse files
Updated test for cloning component
parent
30e7d012
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
modeling/DIPLODOCUS/CloneCompositeComponentTest.xml
View file @
dd05ae21
This diff is collapsed.
Click to expand it.
src/main/java/ui/TDiagramPanel.java
View file @
dd05ae21
...
...
@@ -2404,7 +2404,7 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree {
public
void
cloneComponent
(
TGComponent
_tgc
)
{
cloneComponent
(
_tgc
,
fals
e
);
cloneComponent
(
_tgc
,
tru
e
);
}
/*
...
...
@@ -2435,6 +2435,7 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree {
}
clone
=
mgui
.
gtm
.
makeXMLFromSelectedComponentOfADiagram
(
this
,
getMaxIdSelected
(),
_tgc
.
getX
(),
_tgc
.
getY
(),
cloneEvenIfNonNullFather
);
//TraceManager.addDev(clone);
_tgc
.
select
(
false
);
for
(
int
i
=
0
;
i
<
connectorList
.
size
();
i
++){
...
...
ttool/src/test/java/ui/TDiagramPanelCloneTest.java
View file @
dd05ae21
...
...
@@ -15,8 +15,12 @@ import static org.junit.Assert.*;
public
class
TDiagramPanelCloneTest
extends
AbstractUITest
{
static
TDiagramPanel
diagramPanel
;
static
TGComponent
tgComponent
;
final
static
String
EXPECTED_FILE
=
getBaseResourcesDir
()
+
"tmltranslator/expected/expected_spec.tml"
;
static
TGComponent
tgComponent1
;
static
TGComponent
tgComponent2
;
static
TGComponent
tgComponent3
;
final
static
String
EXPECTED_FILE1
=
getBaseResourcesDir
()
+
"tmltranslator/expected/expected_spec1.tml"
;
final
static
String
EXPECTED_FILE2
=
getBaseResourcesDir
()
+
"tmltranslator/expected/expected_spec2.tml"
;
final
static
String
EXPECTED_FILE3
=
getBaseResourcesDir
()
+
"tmltranslator/expected/expected_spec3.tml"
;
@BeforeClass
...
...
@@ -45,23 +49,58 @@ public class TDiagramPanelCloneTest extends AbstractUITest {
}
}
//tgComponent = findDiagComponent(238, diagramPanel);
for
(
TGComponent
tgc
:
diagramPanel
.
getComponentList
())
{
if
(
tgc
instanceof
TMLCCompositeComponent
)
{
tgComponent
=
tgc
;
for
(
TGComponent
tgc
:
diagramPanel
.
getAllComponent
())
{
if
(
tgc
.
getValue
().
equals
(
"CompositeComp1"
))
{
tgComponent1
=
tgc
;
}
if
(
tgc
.
getValue
().
equals
(
"CompositeComp2"
))
{
tgComponent2
=
tgc
;
}
if
(
tgc
.
getValue
().
equals
(
"PrimitiveComp5"
))
{
tgComponent3
=
tgc
;
}
}
}
@Test
public
void
testCloneCompo
nent
()
throws
Exception
{
@Test
public
void
testCloneCompo
siteComponentWithNullFather
()
throws
Exception
{
CompareTML
compTML
=
new
CompareTML
();
diagramPanel
.
cloneComponent
(
tgComponent
);
diagramPanel
.
cloneComponent
(
tgComponent
1
);
// mainGUI.modelChecking();
mainGUI
.
checkModelingSyntax
(
true
);
mainGUI
.
generateTMLTxt
();
File
f1
=
new
File
(
EXPECTED_FILE
);
File
f1
=
new
File
(
EXPECTED_FILE1
);
File
f2
=
new
File
(
"spec.tml"
);
// Generated file after executing "TML generation"
assertTrue
(
compTML
.
compareTML
(
f1
,
f2
));
}
@Test
public
void
testCloneCompositeComponentWithNonNullFather
()
throws
Exception
{
CompareTML
compTML
=
new
CompareTML
();
diagramPanel
.
cloneComponent
(
tgComponent2
);
// mainGUI.modelChecking();
mainGUI
.
checkModelingSyntax
(
true
);
mainGUI
.
generateTMLTxt
();
File
f1
=
new
File
(
EXPECTED_FILE2
);
File
f2
=
new
File
(
"spec.tml"
);
// Generated file after executing "TML generation"
assertTrue
(
compTML
.
compareTML
(
f1
,
f2
));
}
@Test
public
void
testClonePrimitiveComponent
()
throws
Exception
{
CompareTML
compTML
=
new
CompareTML
();
diagramPanel
.
cloneComponent
(
tgComponent3
);
// mainGUI.modelChecking();
mainGUI
.
checkModelingSyntax
(
true
);
mainGUI
.
generateTMLTxt
();
File
f1
=
new
File
(
EXPECTED_FILE3
);
File
f2
=
new
File
(
"spec.tml"
);
// Generated file after executing "TML generation"
assertTrue
(
compTML
.
compareTML
(
f1
,
f2
));
}
}
\ No newline at end of file
ttool/src/test/resources/tmltranslator/expected/expected_spec1.tml
0 → 100644
View file @
dd05ae21
// TML Application - FORMAT 0.1
// Application: /home/pham/Documents/TToolHelp/TTool/modeling/DIPLODOCUS/CloneCompositeComponentTest.xml
// Generated: Wed Mar 20 17:19:43 CET 2019
// Channels
CHANNEL DIPLODOCUS_C_Design__channel BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp1 IN DIPLODOCUS_C_Design__PrimitiveComp2
CHANNEL DIPLODOCUS_C_Design__channel2 BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp3 IN DIPLODOCUS_C_Design__PrimitiveComp4
CHANNEL DIPLODOCUS_C_Design__channel2_0 BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp3_0 IN DIPLODOCUS_C_Design__PrimitiveComp4_0
CHANNEL DIPLODOCUS_C_Design__channel3 BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp5 IN DIPLODOCUS_C_Design__PrimitiveComp5
CHANNEL DIPLODOCUS_C_Design__channel3_0 BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp5_0 IN DIPLODOCUS_C_Design__PrimitiveComp5_0
CHANNEL DIPLODOCUS_C_Design__channel_0 BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp1_0 IN DIPLODOCUS_C_Design__PrimitiveComp2_0
// Events
EVENT DIPLODOCUS_C_Design__event_0__DIPLODOCUS_C_Design__event_0() NIB 8 DIPLODOCUS_C_Design__PrimitiveComp1_0 DIPLODOCUS_C_Design__PrimitiveComp2_0
EVENT DIPLODOCUS_C_Design__event__DIPLODOCUS_C_Design__event() NIB 8 DIPLODOCUS_C_Design__PrimitiveComp1 DIPLODOCUS_C_Design__PrimitiveComp2
// Requests
TASK DIPLODOCUS_C_Design__PrimitiveComp1
TASKOP
//Local variables
//Behavior
RAND
CASERAND 50
NOTIFY DIPLODOCUS_C_Design__event__DIPLODOCUS_C_Design__event
ENDCASERAND
CASERAND 50
WRITE DIPLODOCUS_C_Design__channel 1
ENDCASERAND
ENDRAND
ENDTASK
TASK DIPLODOCUS_C_Design__PrimitiveComp1_0
TASKOP
//Local variables
//Behavior
RAND
CASERAND 50
NOTIFY DIPLODOCUS_C_Design__event_0__DIPLODOCUS_C_Design__event_0
ENDCASERAND
CASERAND 50
WRITE DIPLODOCUS_C_Design__channel_0 1
ENDCASERAND
ENDRAND
ENDTASK
TASK DIPLODOCUS_C_Design__PrimitiveComp2
TASKOP
//Local variables
//Behavior
RAND
CASERAND 50
WAIT DIPLODOCUS_C_Design__event__DIPLODOCUS_C_Design__event
ENDCASERAND
CASERAND 50
READ DIPLODOCUS_C_Design__channel 1
ENDCASERAND
ENDRAND
ENDTASK
TASK DIPLODOCUS_C_Design__PrimitiveComp2_0
TASKOP
//Local variables
//Behavior
RAND
CASERAND 50
WAIT DIPLODOCUS_C_Design__event_0__DIPLODOCUS_C_Design__event_0
ENDCASERAND
CASERAND 50
READ DIPLODOCUS_C_Design__channel_0 1
ENDCASERAND
ENDRAND
ENDTASK
TASK DIPLODOCUS_C_Design__PrimitiveComp3
TASKOP
//Local variables
//Behavior
WRITE DIPLODOCUS_C_Design__channel2 1
ENDTASK
TASK DIPLODOCUS_C_Design__PrimitiveComp3_0
TASKOP
//Local variables
//Behavior
WRITE DIPLODOCUS_C_Design__channel2_0 1
ENDTASK
TASK DIPLODOCUS_C_Design__PrimitiveComp4
TASKOP
//Local variables
//Behavior
READ DIPLODOCUS_C_Design__channel2 1
ENDTASK
TASK DIPLODOCUS_C_Design__PrimitiveComp4_0
TASKOP
//Local variables
//Behavior
READ DIPLODOCUS_C_Design__channel2_0 1
ENDTASK
TASK DIPLODOCUS_C_Design__PrimitiveComp5
TASKOP
//Local variables
//Behavior
WRITE DIPLODOCUS_C_Design__channel3 1
ENDTASK
TASK DIPLODOCUS_C_Design__PrimitiveComp5_0
TASKOP
//Local variables
//Behavior
WRITE DIPLODOCUS_C_Design__channel3_0 1
ENDTASK
ttool/src/test/resources/tmltranslator/expected/expected_spec2.tml
0 → 100644
View file @
dd05ae21
// TML Application - FORMAT 0.1
// Application: /home/pham/Documents/TToolHelp/TTool/modeling/DIPLODOCUS/CloneCompositeComponentTest.xml
// Generated: Wed Mar 20 17:20:10 CET 2019
// Channels
CHANNEL DIPLODOCUS_C_Design__channel BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp1 IN DIPLODOCUS_C_Design__PrimitiveComp2
CHANNEL DIPLODOCUS_C_Design__channel2 BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp3 IN DIPLODOCUS_C_Design__PrimitiveComp4
CHANNEL DIPLODOCUS_C_Design__channel2_0 BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp3_0 IN DIPLODOCUS_C_Design__PrimitiveComp4_0
CHANNEL DIPLODOCUS_C_Design__channel3 BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp5 IN DIPLODOCUS_C_Design__PrimitiveComp5
CHANNEL DIPLODOCUS_C_Design__channel3_0 BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp5_0 IN DIPLODOCUS_C_Design__PrimitiveComp5_0
// Events
EVENT DIPLODOCUS_C_Design__event__DIPLODOCUS_C_Design__event() NIB 8 DIPLODOCUS_C_Design__PrimitiveComp1 DIPLODOCUS_C_Design__PrimitiveComp2
// Requests
TASK DIPLODOCUS_C_Design__PrimitiveComp1
TASKOP
//Local variables
//Behavior
RAND
CASERAND 50
NOTIFY DIPLODOCUS_C_Design__event__DIPLODOCUS_C_Design__event
ENDCASERAND
CASERAND 50
WRITE DIPLODOCUS_C_Design__channel 1
ENDCASERAND
ENDRAND
ENDTASK
TASK DIPLODOCUS_C_Design__PrimitiveComp2
TASKOP
//Local variables
//Behavior
RAND
CASERAND 50
WAIT DIPLODOCUS_C_Design__event__DIPLODOCUS_C_Design__event
ENDCASERAND
CASERAND 50
READ DIPLODOCUS_C_Design__channel 1
ENDCASERAND
ENDRAND
ENDTASK
TASK DIPLODOCUS_C_Design__PrimitiveComp3
TASKOP
//Local variables
//Behavior
WRITE DIPLODOCUS_C_Design__channel2 1
ENDTASK
TASK DIPLODOCUS_C_Design__PrimitiveComp3_0
TASKOP
//Local variables
//Behavior
WRITE DIPLODOCUS_C_Design__channel2_0 1
ENDTASK
TASK DIPLODOCUS_C_Design__PrimitiveComp4
TASKOP
//Local variables
//Behavior
READ DIPLODOCUS_C_Design__channel2 1
ENDTASK
TASK DIPLODOCUS_C_Design__PrimitiveComp4_0
TASKOP
//Local variables
//Behavior
READ DIPLODOCUS_C_Design__channel2_0 1
ENDTASK
TASK DIPLODOCUS_C_Design__PrimitiveComp5
TASKOP
//Local variables
//Behavior
WRITE DIPLODOCUS_C_Design__channel3 1
ENDTASK
TASK DIPLODOCUS_C_Design__PrimitiveComp5_0
TASKOP
//Local variables
//Behavior
WRITE DIPLODOCUS_C_Design__channel3_0 1
ENDTASK
ttool/src/test/resources/tmltranslator/expected/expected_spec3.tml
0 → 100644
View file @
dd05ae21
// TML Application - FORMAT 0.1
// Application: /home/pham/Documents/TToolHelp/TTool/modeling/DIPLODOCUS/CloneCompositeComponentTest.xml
// Generated: Wed Mar 20 17:20:50 CET 2019
// Channels
CHANNEL DIPLODOCUS_C_Design__channel BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp1 IN DIPLODOCUS_C_Design__PrimitiveComp2
CHANNEL DIPLODOCUS_C_Design__channel2 BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp3 IN DIPLODOCUS_C_Design__PrimitiveComp4
CHANNEL DIPLODOCUS_C_Design__channel3 BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp5 IN DIPLODOCUS_C_Design__PrimitiveComp5
CHANNEL DIPLODOCUS_C_Design__channel3_0 BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp5_0 IN DIPLODOCUS_C_Design__PrimitiveComp5_0
// Events
EVENT DIPLODOCUS_C_Design__event__DIPLODOCUS_C_Design__event() NIB 8 DIPLODOCUS_C_Design__PrimitiveComp1 DIPLODOCUS_C_Design__PrimitiveComp2
// Requests
TASK DIPLODOCUS_C_Design__PrimitiveComp1
TASKOP
//Local variables
//Behavior
RAND
CASERAND 50
NOTIFY DIPLODOCUS_C_Design__event__DIPLODOCUS_C_Design__event
ENDCASERAND
CASERAND 50
WRITE DIPLODOCUS_C_Design__channel 1
ENDCASERAND
ENDRAND
ENDTASK
TASK DIPLODOCUS_C_Design__PrimitiveComp2
TASKOP
//Local variables
//Behavior
RAND
CASERAND 50
WAIT DIPLODOCUS_C_Design__event__DIPLODOCUS_C_Design__event
ENDCASERAND
CASERAND 50
READ DIPLODOCUS_C_Design__channel 1
ENDCASERAND
ENDRAND
ENDTASK
TASK DIPLODOCUS_C_Design__PrimitiveComp3
TASKOP
//Local variables
//Behavior
WRITE DIPLODOCUS_C_Design__channel2 1
ENDTASK
TASK DIPLODOCUS_C_Design__PrimitiveComp4
TASKOP
//Local variables
//Behavior
READ DIPLODOCUS_C_Design__channel2 1
ENDTASK
TASK DIPLODOCUS_C_Design__PrimitiveComp5
TASKOP
//Local variables
//Behavior
WRITE DIPLODOCUS_C_Design__channel3 1
ENDTASK
TASK DIPLODOCUS_C_Design__PrimitiveComp5_0
TASKOP
//Local variables
//Behavior
WRITE DIPLODOCUS_C_Design__channel3_0 1
ENDTASK
ttool/src/test/resources/ui/diagram2tml/input/CloneCompositeComponentTest.xml
View file @
dd05ae21
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment