Skip to content

Commit 56b72cd

Browse files
Gradle test target now works offline by excluding tests tagged "IntegrationTest".
1 parent 8f8a459 commit 56b72cd

File tree

10 files changed

+35
-15
lines changed

10 files changed

+35
-15
lines changed

build.gradle

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,16 @@ subprojects { proj ->
2020
}
2121

2222
test {
23-
useJUnitPlatform()
23+
useJUnitPlatform {
24+
excludeTags "IntegrationTest"
25+
}
26+
}
27+
28+
tasks.register("integrationTest", Test) {
29+
useJUnitPlatform {
30+
includeTags "IntegrationTest"
31+
}
32+
mustRunAfter check
2433
}
2534

2635
compileJava.options.encoding = 'UTF-8'

structurizr-client/src/integrationTest/java/com/structurizr/api/WorkspaceApiClientIntegrationTests.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import com.structurizr.view.SystemContextView;
1111
import org.junit.jupiter.api.AfterEach;
1212
import org.junit.jupiter.api.BeforeEach;
13+
import org.junit.jupiter.api.Tag;
1314
import org.junit.jupiter.api.Test;
1415

1516
import java.io.File;
@@ -51,6 +52,7 @@ private File getArchivedWorkspace() {
5152
}
5253

5354
@Test
55+
@Tag("IntegrationTest")
5456
void putAndGetWorkspace_WithoutEncryption() throws Exception {
5557
Workspace workspace = new Workspace("Structurizr client library tests - without encryption", "A test workspace for the Structurizr client library");
5658
SoftwareSystem softwareSystem = workspace.getModel().addSoftwareSystem("Software System", "Description");
@@ -77,6 +79,7 @@ void putAndGetWorkspace_WithoutEncryption() throws Exception {
7779
}
7880

7981
@Test
82+
@Tag("IntegrationTest")
8083
void putAndGetWorkspace_WithEncryption() throws Exception {
8184
client.setEncryptionStrategy(new AesEncryptionStrategy("password"));
8285
Workspace workspace = new Workspace("Structurizr client library tests - with encryption", "A test workspace for the Structurizr client library");
@@ -104,13 +107,15 @@ void putAndGetWorkspace_WithEncryption() throws Exception {
104107
}
105108

106109
@Test
110+
@Tag("IntegrationTest")
107111
void lockWorkspace() throws Exception {
108112
client.unlockWorkspace(20081);
109113
assertTrue(client.lockWorkspace(20081));
110114
}
111115

112116

113117
@Test
118+
@Tag("IntegrationTest")
114119
void unlockWorkspace() throws Exception {
115120
client.lockWorkspace(20081);
116121
assertTrue(client.unlockWorkspace(20081));

structurizr-client/src/test/java/com/structurizr/view/ThemeUtilsTests.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.structurizr.model.Relationship;
55
import com.structurizr.model.SoftwareSystem;
66
import com.structurizr.model.Tags;
7+
import org.junit.jupiter.api.Tag;
78
import org.junit.jupiter.api.Test;
89

910
import java.util.ArrayList;
@@ -23,6 +24,7 @@ void loadThemes_DoesNothingWhenNoThemesAreDefined() throws Exception {
2324
}
2425

2526
@Test
27+
@Tag("IntegrationTest")
2628
void loadThemes_LoadsThemesWhenThemesAreDefined() throws Exception {
2729
Workspace workspace = new Workspace("Name", "Description");
2830
SoftwareSystem softwareSystem = workspace.getModel().addSoftwareSystem("Name");
@@ -137,6 +139,7 @@ void findRelationshipStyle_WithThemes() {
137139
}
138140

139141
@Test
142+
@Tag("IntegrationTest")
140143
void loadThemes_ReplacesRelativeIconReferences() throws Exception {
141144
Workspace workspace = new Workspace("Name", "Description");
142145
SoftwareSystem softwareSystem = workspace.getModel().addSoftwareSystem("Name");

structurizr-dsl/src/test/java/com/structurizr/dsl/DslTests.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import com.structurizr.model.*;
66
import com.structurizr.util.StringUtils;
77
import com.structurizr.view.*;
8+
import org.junit.jupiter.api.Tag;
89
import org.junit.jupiter.api.Test;
910
import org.junit.jupiter.params.ParameterizedTest;
1011
import org.junit.jupiter.params.provider.ValueSource;
@@ -396,6 +397,7 @@ void test_includeLocalDirectory_WhenThereAreHiddenFiles() throws Exception {
396397
}
397398

398399
@Test
400+
@Tag("IntegrationTest")
399401
void test_includeUrl() throws Exception {
400402
StructurizrDslParser parser = new StructurizrDslParser();
401403
parser.parse(new File("src/test/resources/dsl/include-url.dsl"));
@@ -434,6 +436,7 @@ void test_includeLocalFile_ThrowsAnException_WhenRunningInRestrictedMode() {
434436
}
435437

436438
@ParameterizedTest
439+
@Tag("IntegrationTest")
437440
@ValueSource(strings = { "src/test/resources/dsl/extend/extend-workspace-from-json-file.dsl", "src/test/resources/dsl/extend/extend-workspace-from-json-url.dsl" })
438441
void test_extendWorkspaceFromJson(String dslFile) throws Exception {
439442
StructurizrDslParser parser = new StructurizrDslParser();
@@ -472,6 +475,7 @@ void test_extendWorkspaceFromJsonFile_WhenRunningInRestrictedMode() throws Excep
472475
}
473476

474477
@ParameterizedTest
478+
@Tag("IntegrationTest")
475479
@ValueSource(strings = { "src/test/resources/dsl/extend/extend-workspace-from-dsl-file.dsl", "src/test/resources/dsl/extend/extend-workspace-from-dsl-url.dsl" })
476480
void test_extendWorkspaceFromDsl(String dslFile) throws Exception {
477481
StructurizrDslParser parser = new StructurizrDslParser();
@@ -1091,6 +1095,7 @@ void test_imageViews_ViaFiles() throws Exception {
10911095
}
10921096

10931097
@Test
1098+
@Tag("IntegrationTest")
10941099
void test_imageViews_ViaUrls() throws Exception {
10951100
StructurizrDslParser parser = new StructurizrDslParser();
10961101
parser.parse(new File("src/test/resources/dsl/image-views/workspace-via-url.dsl"));

structurizr-export/src/test/java/com/structurizr/export/dot/DOTDiagramExporterTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import com.structurizr.model.*;
77
import com.structurizr.util.WorkspaceUtils;
88
import com.structurizr.view.*;
9+
import org.junit.jupiter.api.Tag;
910
import org.junit.jupiter.api.Test;
1011

1112
import java.io.File;
@@ -53,6 +54,7 @@ public void test_BigBankPlcExample() throws Exception {
5354
}
5455

5556
@Test
57+
@Tag("IntegrationTest")
5658
public void test_AmazonWebServicesExample() throws Exception {
5759
Workspace workspace = WorkspaceUtils.loadWorkspaceFromJson(new File("./src/test/resources/structurizr-54915-workspace.json"));
5860
ThemeUtils.loadThemes(workspace);

structurizr-export/src/test/java/com/structurizr/export/ilograph/IlographExporterTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.structurizr.model.Model;
88
import com.structurizr.util.WorkspaceUtils;
99
import com.structurizr.view.ThemeUtils;
10+
import org.junit.jupiter.api.Tag;
1011
import org.junit.jupiter.api.Test;
1112

1213
import java.io.File;
@@ -26,6 +27,7 @@ public void test_BigBankPlcExample() throws Exception {
2627
}
2728

2829
@Test
30+
@Tag("IntegrationTest")
2931
void test_AmazonWebServicesExample() throws Exception {
3032
Workspace workspace = WorkspaceUtils.loadWorkspaceFromJson(new File("./src/test/resources/structurizr-54915-workspace.json"));
3133
workspace.getViews().getConfiguration().getStyles().addElementStyle("Amazon Web Services - Route 53").addProperty(IlographExporter.ILOGRAPH_ICON, "AWS/Networking/Route-53.svg");

structurizr-export/src/test/java/com/structurizr/export/mermaid/MermaidDiagramExporterTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import com.structurizr.model.*;
77
import com.structurizr.util.WorkspaceUtils;
88
import com.structurizr.view.*;
9+
import org.junit.jupiter.api.Tag;
910
import org.junit.jupiter.api.Test;
1011

1112
import java.io.File;
@@ -60,6 +61,7 @@ public void test_BigBankPlcExample() throws Exception {
6061
}
6162

6263
@Test
64+
@Tag("IntegrationTest")
6365
public void test_AmazonWebServicesExample() throws Exception {
6466
Workspace workspace = WorkspaceUtils.loadWorkspaceFromJson(new File("./src/test/resources/structurizr-54915-workspace.json"));
6567
ThemeUtils.loadThemes(workspace);

structurizr-export/src/test/java/com/structurizr/export/plantuml/C4PlantUMLDiagramExporterTests.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import com.structurizr.model.*;
77
import com.structurizr.util.WorkspaceUtils;
88
import com.structurizr.view.*;
9+
import org.junit.jupiter.api.Tag;
910
import org.junit.jupiter.api.Test;
1011

1112
import java.io.File;
@@ -61,6 +62,7 @@ public void test_BigBankPlcExample() throws Exception {
6162
}
6263

6364
@Test
65+
@Tag("IntegrationTest")
6466
public void test_AmazonWebServicesExampleWithoutTags() throws Exception {
6567
Workspace workspace = WorkspaceUtils.loadWorkspaceFromJson(new File("./src/test/resources/structurizr-54915-workspace.json"));
6668
ThemeUtils.loadThemes(workspace);
@@ -77,6 +79,7 @@ public void test_AmazonWebServicesExampleWithoutTags() throws Exception {
7779
}
7880

7981
@Test
82+
@Tag("IntegrationTest")
8083
public void test_AmazonWebServicesExampleWithTags() throws Exception {
8184
Workspace workspace = WorkspaceUtils.loadWorkspaceFromJson(new File("./src/test/resources/structurizr-54915-workspace.json"));
8285
ThemeUtils.loadThemes(workspace);

structurizr-export/src/test/java/com/structurizr/export/plantuml/StructurizrPlantUMLDiagramExporterTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import com.structurizr.model.*;
77
import com.structurizr.util.WorkspaceUtils;
88
import com.structurizr.view.*;
9+
import org.junit.jupiter.api.Tag;
910
import org.junit.jupiter.api.Test;
1011

1112
import java.io.File;
@@ -71,6 +72,7 @@ public void test_BigBankPlcExample() throws Exception {
7172
}
7273

7374
@Test
75+
@Tag("IntegrationTest")
7476
public void test_AmazonWebServicesExample() throws Exception {
7577
Workspace workspace = WorkspaceUtils.loadWorkspaceFromJson(new File("./src/test/resources/structurizr-54915-workspace.json"));
7678
ThemeUtils.loadThemes(workspace);

structurizr-import/build.gradle

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,4 @@ dependencies {
44

55
}
66

7-
description = 'Utilities to import diagrams and documentation into a Structurizr workspace'
8-
9-
test {
10-
useJUnitPlatform {
11-
excludeTags "IntegrationTest"
12-
}
13-
}
14-
15-
tasks.register("integrationTest", Test) {
16-
useJUnitPlatform {
17-
includeTags "IntegrationTest"
18-
}
19-
mustRunAfter check
20-
}
7+
description = 'Utilities to import diagrams and documentation into a Structurizr workspace'

0 commit comments

Comments
 (0)