Skip to content

Commit 08f1186

Browse files
Merge pull request #135 from google/arunkumaresan-bugfix
Fixed bug with blanks tag
2 parents 8d59c09 + b36075c commit 08f1186

File tree

4 files changed

+67
-100
lines changed

4 files changed

+67
-100
lines changed

pom.xml

Lines changed: 47 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,55 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

3-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
45
<modelVersion>4.0.0</modelVersion>
56

67
<groupId>com.google.pdsl</groupId>
78
<artifactId>pdsl</artifactId>
8-
<version>1.11</version>
9+
<version>1.11.1-SNAPSHOT</version>
910

1011
<name>pdsl</name>
1112
<url>http://www.github.com/google/polymorphicDSL</url>
1213

14+
1315
<description>
14-
The Polymorphic DSL test framework was designed to solve the challenges with testing large, complex systems. Modern architecture requires software to run as distrubited systems or on multiple platforms. The conventional cost of testing these systems is quite high.
15-
PDSL allows a user to describe the system under test using a DSL of some kind: a picture,
16-
sentences in natural languages, graphs, etc. Using a common DSL allows someone to make deeply scalable tests. A simple change to the DSL could generate dozens of tests providing coverage through many layers of the test pyramid or even multiple applications.
16+
The Polymorphic DSL test framework was designed to solve the challenges with testing large, complex systems.
17+
Modern architecture requires software to run as distrubited systems or on multiple platforms. The conventional
18+
cost of testing these systems is quite high.
19+
PDSL allows a user to describe the system under test using a DSL of some kind: a picture,
20+
sentences in natural languages, graphs, etc. Using a common DSL allows someone to make deeply scalable tests. A
21+
simple change to the DSL could generate dozens of tests providing coverage through many layers of the test
22+
pyramid or even multiple applications.
1723
</description>
18-
<parent>
19-
<groupId>org.sonatype.oss</groupId>
20-
<artifactId>oss-parent</artifactId>
21-
<version>7</version>
22-
</parent>
2324

2425
<properties>
2526
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2627
<maven.compiler.source>21</maven.compiler.source>
2728
<maven.compiler.target>21</maven.compiler.target>
2829
<jacoco.version>0.8.9</jacoco.version>
2930
<shade.version>3.3.0</shade.version>
30-
<antlr.version>4.9.1</antlr.version>
31+
<antlr.version>4.13.2</antlr.version>
3132
<mvn.jar.version>3.2.2</mvn.jar.version>
3233
</properties>
3334

35+
<licenses>
36+
<license>
37+
<name>The Apache Software License, Version 2.0</name>
38+
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
39+
<distribution>repo</distribution>
40+
<comments>A business-friendly OSS license</comments>
41+
</license>
42+
</licenses>
43+
44+
<developers>
45+
<developer>
46+
<name>Nelson Boyer</name>
47+
<email>[email protected]</email>
48+
<organization>Google LLC</organization>
49+
<organizationUrl>http://www.google.com</organizationUrl>
50+
</developer>
51+
</developers>
52+
3453
<dependencies>
3554
<!-- code coverage -->
3655
<dependency>
@@ -149,22 +168,6 @@
149168
<id>test</id> <!-- needed to allow generation of ANTLR grammars used by test code -->
150169
<build>
151170
<plugins>
152-
<!-- <plugin>-->
153-
<!-- <groupId>org.apache.maven.plugins</groupId>-->
154-
<!-- <artifactId>maven-surefire-plugin</artifactId>-->
155-
<!-- <configuration>-->
156-
<!-- <argLine>-->
157-
<!-- &#45;&#45;add-opens nodatafound.mockito_jpms_usecase/nodatafound.mjpmsuc=ALL-UNNAMED-->
158-
<!-- &#45;&#45;add-opens=java.base/java.lang=ALL-UNNAMED-->
159-
<!-- &#45;&#45;add-opens=java.base/java.util=ALL-UNNAMED-->
160-
161-
<!-- </argLine>-->
162-
<!-- <includes>-->
163-
<!-- <include>**/com/pdsl/tmp/SimpleHelloTest.java</include>-->
164-
<!-- &lt;!&ndash; <include>**/myfiber/pdsl/*Test.java</include>&ndash;&gt;-->
165-
<!-- </includes>-->
166-
<!-- </configuration>-->
167-
<!-- </plugin>-->
168171
<plugin>
169172
<groupId>org.antlr</groupId>
170173
<artifactId>antlr4-maven-plugin</artifactId>
@@ -189,7 +192,7 @@
189192
<id>release</id>
190193
<build>
191194
<plugins>
192-
<plugin>
195+
<plugin>
193196
<groupId>org.apache.maven.plugins</groupId>
194197
<artifactId>maven-javadoc-plugin</artifactId>
195198
<version>3.8.0</version>
@@ -210,27 +213,12 @@
210213
</execution>
211214
</executions>
212215
</plugin>
213-
<!-- <plugin>-->
214-
<!-- <groupId>org.apache.maven.plugins</groupId>-->
215-
<!-- <artifactId>maven-surefire-plugin</artifactId>-->
216-
<!-- <configuration>-->
217-
<!-- <argLine> -->
218-
<!-- &#45;&#45;add-opens nodatafound.mockito_jpms_usecase/nodatafound.mjpmsuc=ALL-UNNAMED-->
219-
<!-- &#45;&#45;add-opens=java.base/java.lang=ALL-UNNAMED-->
220-
<!-- &#45;&#45;add-opens=java.base/java.util=ALL-UNNAMED-->
221-
222-
<!-- </argLine>-->
223-
<!-- </configuration> -->
224-
<!-- </plugin>-->
216+
225217
<plugin>
226218
<groupId>org.antlr</groupId>
227219
<artifactId>antlr4-maven-plugin</artifactId>
228220
<version>${antlr.version}</version>
229221
<configuration>
230-
<!--
231-
<sourceDirectory>${basedir}/src/test/antlr4</sourceDirectory>
232-
<libDirectory>${basedir}/src/test/antlr4/com/pdsl/grammars</libDirectory>
233-
-->
234222
<sourceDirectory>${basedir}/src/main/antlr4</sourceDirectory>
235223
<preparationGoals>antlr4</preparationGoals>
236224
</configuration>
@@ -258,37 +246,11 @@
258246
</executions>
259247
</plugin>
260248

261-
<plugin>
262-
<groupId>org.sonatype.plugins</groupId>
263-
<artifactId>nexus-staging-maven-plugin</artifactId>
264-
<version>1.7.0</version>
265-
<extensions>true</extensions>
266-
<executions>
267-
<execution>
268-
<id>antlr4_deploy</id>
269-
<phase>antlr4</phase>
270-
<goals>
271-
<goal>antlr4</goal>
272-
</goals>
273-
</execution>
274-
<execution>
275-
<id>default_deploy</id>
276-
<phase>deploy</phase>
277-
<goals>
278-
<goal>deploy</goal>
279-
</goals>
280-
</execution>
281-
</executions>
282-
<configuration>
283-
<serverId>ossrh</serverId>
284-
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
285-
<autoReleaseAfterClose>false</autoReleaseAfterClose>
286-
</configuration>
287-
</plugin>
249+
288250
<plugin>
289251
<groupId>org.apache.maven.plugins</groupId>
290252
<artifactId>maven-source-plugin</artifactId>
291-
<version>2.2.1</version>
253+
<version>3.3.1</version>
292254
<executions>
293255
<execution>
294256
<id>attach-sources</id>
@@ -313,21 +275,16 @@
313275
</profile>
314276
</profiles>
315277

316-
<distributionManagement>
317-
<snapshotRepository>
318-
<id>ossrh</id>
319-
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
320-
</snapshotRepository>
321-
<repository>
322-
<id>ossrh</id>
323-
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
324-
</repository>
325-
326-
</distributionManagement>
327-
328278
<build>
329279
<pluginManagement>
330280
<plugins>
281+
<plugin>
282+
<groupId>org.sonatype.central</groupId>
283+
<artifactId>central-publishing-maven-plugin</artifactId>
284+
<version>0.8.0</version>
285+
<extensions>true</extensions>
286+
</plugin>
287+
331288
<plugin>
332289
<groupId>org.antlr</groupId>
333290
<artifactId>antlr4-maven-plugin</artifactId>
@@ -395,7 +352,12 @@
395352
</plugin>
396353
</plugins>
397354
</pluginManagement>
355+
398356
<plugins>
357+
<plugin>
358+
<groupId>org.sonatype.central</groupId>
359+
<artifactId>central-publishing-maven-plugin</artifactId>
360+
</plugin>
399361

400362
<plugin>
401363
<groupId>org.apache.maven.plugins</groupId>
@@ -410,18 +372,12 @@
410372
<plugin>
411373
<groupId>org.apache.maven.plugins</groupId>
412374
<artifactId>maven-surefire-plugin</artifactId>
413-
<version>2.12.4</version>
375+
<version>3.5.3</version>
414376
<configuration>
415377
<argLine>
416-
<!-- &#45;&#45;add-opens nodatafound.mockito_jpms_usecase/nodatafound.mjpmsuc=ALL-UNNAMED-->
417378
--add-opens=java.base/java.lang=ALL-UNNAMED
418379
--add-opens=java.base/java.util=ALL-UNNAMED
419380
</argLine>
420-
<!-- This section for debugging only -->
421-
<!-- <includes>-->
422-
<!-- <include>**/com/pdsl/interpreter/InterpreterSuiteTest.java</include>-->
423-
<!-- <include>**/com/pdsl/component/PreorderTestCaseFactoryTest.java</include>-->
424-
<!-- </includes>-->
425381
</configuration>
426382
</plugin>
427383

src/main/java/com/pdsl/runners/SharedTestSuiteVisitor.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,16 @@ public SharedTestSuite recognizerParamsOperation(RecognizerParams recognizerPara
6565
Collection<TestSpecification> specifications = getSpecifications(parser, recognizerParams, params, testResources);
6666
// Convert the specifications into test cases
6767
List<TestCase> testCasesForSingleInterpreter = new ArrayList<>(getTestCases(recognizerParams.providers().testCaseFactoryProvider().get(), specifications));
68-
if(recognizerParams instanceof GherkinRecognizerParams)
69-
testCasesForSingleInterpreter = testCasesForSingleInterpreter.stream()
70-
.filter(t -> t instanceof TaggedTestCase)
71-
.map(t -> (TaggedTestCase)t)
72-
.filter(t -> params.tags().stream().allMatch(condition -> filter.tagExpressionMatchesPickle(new HashSet<>(t.getTags()), condition)))
73-
.map(t -> (TestCase)t)
74-
.toList();
68+
if (!params.tags().isEmpty()) {
69+
if (recognizerParams instanceof GherkinRecognizerParams) {
70+
testCasesForSingleInterpreter = testCasesForSingleInterpreter.stream()
71+
.filter(t -> t instanceof TaggedTestCase)
72+
.map(t -> (TaggedTestCase) t)
73+
.filter(t -> params.tags().stream().allMatch(condition -> filter.tagExpressionMatchesPickle(new HashSet<>(t.getTags()), condition)))
74+
.map(t -> (TestCase) t)
75+
.toList();
76+
}
77+
}
7578
testCasesPerInterpreters.add(testCasesForSingleInterpreter);
7679
interpreterObjs.add(parser.interpreterProvider().get());
7780
}

src/main/java/com/pdsl/testcases/SharedTestCase.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* and associated (Lexer/Parser; Listener/Visitor) with them.
1515
* {@link com.pdsl.executors.InterpreterObj}
1616
*/
17-
public final class SharedTestCase implements TestCase {
17+
public final class SharedTestCase implements TestCase, TaggedTestCase {
1818

1919
private final List<SharedTestCaseWithInterpreter> sharedTestCaseWithInterpreters;
2020

@@ -59,4 +59,12 @@ public List<FilteredPhrase> getFilteredPhrases() {
5959
public Map<String, Object> getMetadata() {
6060
return sharedTestCaseWithInterpreters.getFirst().getTestCase().getMetadata();
6161
}
62+
63+
@Override
64+
public Collection<String> getTags() {
65+
if (sharedTestCaseWithInterpreters.getFirst().getTestCase() instanceof TaggedTestCase tagged) {
66+
return tagged.getTags();
67+
}
68+
return Set.of();
69+
}
6270
}

src/main/java/org/junit/jupiter/engine/descriptor/PdslConfigParameter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ private static List<PdslTestParams> convert(Collection<PdslTestParameter> parame
306306
getRecognizerLexer(config, p),
307307
getRecognizerParser(config, p),
308308
getInterpreterParams(config, p),
309-
List.of(p.getTagExpression()),
309+
p.getTagExpression().isBlank() ? List.of() : List.of(p.getTagExpression()),
310310
p.getIncludesResources(),
311311
p.getExcludesResources());
312312
params.add(pdslTestParams);

0 commit comments

Comments
 (0)