-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#378: Incomplete: extracted common parser code.
- Loading branch information
1 parent
a9bbf97
commit 23811d5
Showing
21 changed files
with
220 additions
and
154 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
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,20 @@ | ||
<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"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<artifactId>openfasttrace-importer-lightweightmarkup</artifactId> | ||
<name>OpenFastTrace Lightweight Markup Importer Base</name> | ||
<parent> | ||
<relativePath>../../parent/pom.xml</relativePath> | ||
<groupId>org.itsallcode.openfasttrace</groupId> | ||
<artifactId>openfasttrace-parent</artifactId> | ||
<version>${revision}</version> | ||
</parent> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.itsallcode.openfasttrace</groupId> | ||
<artifactId>openfasttrace-testutil</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
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,9 @@ | ||
/** | ||
* Base module for importers of lightweight markup formats. | ||
*/ | ||
module org.itsallcode.openfasttrace.importer.lightweightmarkup | ||
{ | ||
exports org.itsallcode.openfasttrace.importer.lightweightmarkup; | ||
|
||
requires java.logging; | ||
} |
4 changes: 2 additions & 2 deletions
4
...penfasttrace/importer/markdown/State.java → ...er/lightweightmarkup/LineParserState.java
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
package org.itsallcode.openfasttrace.importer.markdown; | ||
package org.itsallcode.openfasttrace.importer.lightweightmarkup; | ||
|
||
enum State | ||
public enum LineParserState | ||
{ | ||
START, OUTSIDE, SPEC_ITEM, DESCRIPTION, COVERS, DEPENDS, RATIONALE, COMMENT, NEEDS, EOF, TITLE, TAGS | ||
} |
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
15 changes: 15 additions & 0 deletions
15
...up/src/main/java/org/itsallcode/openfasttrace/importer/lightweightmarkup/LinePattern.java
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,15 @@ | ||
package org.itsallcode.openfasttrace.importer.lightweightmarkup; | ||
|
||
import java.util.regex.Pattern; | ||
|
||
/** | ||
* Common interface for text patterns used in line parsers. | ||
*/ | ||
public interface LinePattern { | ||
/** | ||
* Get the regular expression pattern associated with this line pattern. | ||
* | ||
* @return regular expression pattern | ||
*/ | ||
public Pattern getPattern(); | ||
} |
20 changes: 10 additions & 10 deletions
20
...sttrace/importer/markdown/Transition.java → ...mporter/lightweightmarkup/Transition.java
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
7 changes: 7 additions & 0 deletions
7
...c/main/java/org/itsallcode/openfasttrace/importer/lightweightmarkup/TransitionAction.java
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,7 @@ | ||
package org.itsallcode.openfasttrace.importer.lightweightmarkup; | ||
|
||
@FunctionalInterface | ||
public interface TransitionAction | ||
{ | ||
void transit(); | ||
} |
24 changes: 24 additions & 0 deletions
24
...src/test/java/org/itsallcode/openfasttrace/importer/lightweightmarkup/TransitionTest.java
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,24 @@ | ||
package org.itsallcode.openfasttrace.importer.lightweightmarkup; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.mockito.Mock; | ||
import org.mockito.Mockito; | ||
import org.mockito.junit.jupiter.MockitoExtension; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.equalTo; | ||
|
||
@ExtendWith(MockitoExtension.class) | ||
class TransitionTest | ||
{ | ||
@Test | ||
void testToString(@Mock final TransitionAction actionMock, @Mock final LinePattern patternMock) | ||
{ | ||
Mockito.when(patternMock.toString()).thenReturn("DUMMY_PATTERN"); | ||
final Transition transition = new Transition(LineParserState.OUTSIDE, LineParserState.TITLE, patternMock, | ||
actionMock); | ||
assertThat(transition.toString(), | ||
equalTo("Transition [from=OUTSIDE, to=TITLE, markdownPattern=DUMMY_PATTERN]")); | ||
} | ||
} |
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
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
7 changes: 0 additions & 7 deletions
7
...rkdown/src/main/java/org/itsallcode/openfasttrace/importer/markdown/TransitionAction.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.