Skip to content

Commit 2d997e8

Browse files
committed
GUI test
1 parent 52d8f0c commit 2d997e8

File tree

5 files changed

+57
-26
lines changed

5 files changed

+57
-26
lines changed

CHANGELOG.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Changed
1111

12-
- [Sonar cloud workflow merged in maven build](.github/workflows/deploy_maven_package.yml)
13-
- Workflow adapted for gui test (running on windows)
12+
1413

1514
### Removed
1615

1716
- Sonar cloud workflow yml removed. (after being merged with maven build)
1817

1918

20-
## [0.8.0] - 2023-09-21
19+
## [0.8.0] - 2023-09-24
2120

2221
### Added
2322

2423
- [workflow deploy on branch deploy](.github/workflows/deploy_maven_package.yml)
25-
- [workflow maven build](.github/workflows/build_maven_package.yml)
24+
- [Sonar cloud workflow merged in maven build](.github/workflows/deploy_maven_package.yml)
2625
- keep a changelog and coverage badge
27-
- fj-bom version set to 1.4.0
26+
- fj-bom version set to 1.4.2
2827

2928
### Changed
3029

31-
- [workflow sonar cloud](.github/workflows/sonarcloud-maven.yml)
32-
- fj-core version set to 8.3.7
30+
- Workflow adapted for gui test (running on windows)
31+
- fj-core version set to 8.3.8
3332

3433
### Security
3534

pom.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,18 @@
121121
<scope>test</scope>
122122
</dependency>
123123

124+
<dependency>
125+
<groupId>org.fugerit.java</groupId>
126+
<artifactId>fj-test-helper8</artifactId>
127+
<scope>test</scope>
128+
<exclusions>
129+
<exclusion>
130+
<groupId>*</groupId>
131+
<artifactId>*</artifactId>
132+
</exclusion>
133+
</exclusions>
134+
</dependency>
135+
124136
</dependencies>
125137

126138
<profiles>

src/main/java/org/fugerit/java/github/issue/export/GithubIssueExport.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@
6767
*/
6868
public class GithubIssueExport {
6969

70+
private GithubIssueExport() {}
71+
7072
protected static final Logger logger = LoggerFactory.getLogger(GithubIssueExport.class);
7173

7274
public static final String ARG_HELP = "help";

src/main/java/org/fugerit/java/github/issue/export/GithubIssueGUI.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import java.io.File;
1515
import java.io.FileInputStream;
1616
import java.io.FileOutputStream;
17-
import java.io.IOException;
1817
import java.util.Date;
1918
import java.util.Locale;
2019
import java.util.Properties;
@@ -35,6 +34,7 @@
3534
import javax.swing.JTextPane;
3635
import javax.swing.SwingConstants;
3736

37+
import org.fugerit.java.core.function.SafeFunction;
3838
import org.fugerit.java.core.lang.helpers.StringUtils;
3939
import org.slf4j.Logger;
4040
import org.slf4j.LoggerFactory;
@@ -45,22 +45,6 @@
4545
*/
4646
public class GithubIssueGUI extends JFrame implements WindowListener, ActionListener {
4747

48-
// code added to setup a basic conditional serialization - START
49-
50-
private void writeObject(java.io.ObjectOutputStream out) throws IOException {
51-
// this class is conditionally serializable, depending on contained object
52-
// special situation can be handleded using this method in future
53-
out.defaultWriteObject();
54-
}
55-
56-
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
57-
// this class is conditionally serializable, depending on contained object
58-
// special situation can be handleded using this method in future
59-
in.defaultReadObject();
60-
}
61-
62-
// code added to setup a basic conditional serialization - END
63-
6448
protected static final Logger logger = LoggerFactory.getLogger(GithubIssueGUI.class);
6549

6650
/**
@@ -330,8 +314,15 @@ public GithubIssueGUI( Properties params ) {
330314
this.initLayout();
331315
}
332316

333-
private void openInfoDialog( String title, String content ) {
317+
private JDialog openInfoDialog( String title, String content ) {
334318
final JDialog frame = new JDialog( this, title, true );
319+
Thread t = new Thread( () -> {
320+
Long timeOut = Long.valueOf( System.getProperty( "gui-default-dialog-timeout", "10000" ) );
321+
logger.info( "dialog timeout : {}", timeOut );
322+
SafeFunction.apply( () -> Thread.sleep( timeOut ) );
323+
frame.dispose();
324+
});
325+
t.start();
335326
frame.setSize( 400, 300 );
336327
frame.setLayout( new GridLayout( 1 , 1 ) );
337328
JTextPane area = new JTextPane();
@@ -340,12 +331,21 @@ private void openInfoDialog( String title, String content ) {
340331
frame.add( area );
341332
frame.pack();
342333
frame.setVisible(true);
334+
return frame;
343335
}
344336

345337
protected void pressGenerateButton() {
346338
this.performMainAction( this.buttonGenerateReport );
347339
}
348340

341+
protected void pressSaveConfigurationButton() {
342+
this.performMainAction( this.buttonSaveConfiguration );
343+
}
344+
345+
protected void pressHelpInfoMI() {
346+
this.openInfoDialog( this.helpInfoMI.getText() , this.lagelBundle.getString( "label.menu.help.dialog.info" ) );
347+
}
348+
349349
private void performMainAction( Object source ) {
350350
this.config.setProperty( GithubIssueExport.ARG_PROXY_HOST , this.inputProxyHost.getText() );
351351
this.config.setProperty( GithubIssueExport.ARG_PROXY_PORT , this.inputProxyPort.getText() );

src/test/java/test/org/fugerit/java/github/issue/export/TestGithubIssueGUI.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
import org.junit.Test;
1616

1717
import lombok.extern.slf4j.Slf4j;
18+
import test.org.fugerit.java.BasicTest;
1819

1920
@Slf4j
20-
public class TestGithubIssueGUI {
21+
public class TestGithubIssueGUI extends BasicTest {
2122

2223
@Test
2324
public void testGUI1() {
@@ -27,6 +28,7 @@ public void testGUI1() {
2728
Properties configProps = PropsIO.loadFromClassLoader( "gui/test-repo.properties" );
2829
configProps.setProperty( "xls-file" , file.getAbsolutePath() );
2930

31+
System.setProperty( "gui-default-dialog-timeout", "500" );
3032
String githubParam1 = System.getProperty( "githubParam1" );
3133
String githubParam2 = System.getProperty( "githubParam2" );
3234
if ( StringUtils.isNotEmpty( githubParam1 ) && StringUtils.isNotEmpty( githubParam2 ) ) {
@@ -42,7 +44,10 @@ public void testGUI1() {
4244
System.setProperty(GithubIssueConfig.ENV_OVERRIDE_MAIN_CONFIG , configFile.getCanonicalPath() );
4345
Properties params = new Properties();
4446
TestGUI gui = new TestGUI( params );
47+
4548
gui.pressGenerateButton();
49+
gui.pressSaveConfigurationButton();
50+
gui.pressHelpInfoMI();
4651
Awaitility.await()
4752
.atLeast( Duration.ofMillis( 50 ) )
4853
.atMost( Duration.ofMillis( 5000 ) )
@@ -66,9 +71,22 @@ public TestGUI(Properties params) {
6671
super(params);
6772
}
6873

74+
@Override
6975
public void pressGenerateButton() {
7076
super.pressGenerateButton();
7177
}
78+
79+
@Override
80+
public void pressSaveConfigurationButton() {
81+
super.pressSaveConfigurationButton();
82+
}
83+
84+
@Override
85+
public void pressHelpInfoMI() {
86+
super.pressHelpInfoMI();
87+
}
88+
89+
7290

7391
}
7492

0 commit comments

Comments
 (0)