-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: issacto <[email protected]>
- Loading branch information
Showing
11 changed files
with
181 additions
and
103 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
src/main/java/org/openmainframeproject/cobolcheck/features/interpreter/Block.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,25 @@ | ||
package org.openmainframeproject.cobolcheck.features.interpreter; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class Block { | ||
|
||
private List<String> lines; | ||
|
||
public Block(){ | ||
lines = new ArrayList<>(); | ||
} | ||
|
||
void addLine(String line){ | ||
lines.add(line); | ||
} | ||
|
||
List<String> getLines(){ | ||
return lines; | ||
} | ||
|
||
void removeLines(){ | ||
lines.clear(); | ||
} | ||
} |
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
25 changes: 0 additions & 25 deletions
25
...ava/org/openmainframeproject/cobolcheck/features/interpreter/MockedSectionOrPargraph.java
This file was deleted.
Oops, something went wrong.
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
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
78 changes: 78 additions & 0 deletions
78
src/main/java/org/openmainframeproject/cobolcheck/features/testSuiteParser/WhenOther.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,78 @@ | ||
package org.openmainframeproject.cobolcheck.features.testSuiteParser; | ||
|
||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.openmainframeproject.cobolcheck.services.Config; | ||
import org.openmainframeproject.cobolcheck.services.StringHelper; | ||
|
||
public class WhenOther { | ||
|
||
private String identifier; | ||
private String type; | ||
private List<String> lines; | ||
private MockScope scope; | ||
private String testSuiteName; | ||
private String testCaseName; | ||
private int testSuiteNumber; | ||
private int testCaseNumber; | ||
private int mockNumber; | ||
|
||
|
||
public WhenOther(String testSuiteName, String testCaseName, int testSuiteNumber, int testCaseNumber, int mockNumber) { | ||
this.testSuiteName = testSuiteName; | ||
this.testCaseName = testCaseName; | ||
this.testSuiteNumber = testSuiteNumber; | ||
this.testCaseNumber = testCaseNumber; | ||
this.mockNumber = mockNumber; | ||
lines = new ArrayList<>(); | ||
} | ||
|
||
public String getGeneratedWhenOtherIdentifier(){ | ||
return Config.getTestCodePrefix() + getGeneratedWhenOtherIdentifierRoot(); | ||
} | ||
|
||
public String getGeneratedWhenOtherIdentifierRoot(){ | ||
return testSuiteNumber + "-" + testCaseNumber + "-" + mockNumber + "-WO"; | ||
} | ||
|
||
public void addLines(List<String> lines) { | ||
this.lines.addAll(lines); | ||
} | ||
|
||
public void setScope(MockScope scope) { | ||
this.scope = scope; | ||
} | ||
|
||
public void setType(String type) { | ||
this.type = type; | ||
} | ||
|
||
public String getType() { | ||
return this.type; | ||
} | ||
|
||
public List<String> getLines() { | ||
return this.lines; | ||
} | ||
|
||
public void setIdentifier(String identifier) { | ||
this.identifier = identifier; | ||
} | ||
|
||
|
||
public List<String> getCommentText(){ | ||
List<String> newLines = new ArrayList<>(); | ||
newLines.add(" *****************************************************************"); | ||
newLines.add( "When other block of: " + type + ": " + identifier); | ||
newLines.add("In testsuite: " + testSuiteName); | ||
if (scope == MockScope.Local){ | ||
newLines.add("In testcase: " + testCaseName); | ||
} | ||
newLines.add(" *****************************************************************"); | ||
return newLines; | ||
|
||
} | ||
|
||
} |
37 changes: 37 additions & 0 deletions
37
...java/org/openmainframeproject/cobolcheck/features/testSuiteParser/WhenOtherGenerator.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,37 @@ | ||
package org.openmainframeproject.cobolcheck.features.testSuiteParser; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.openmainframeproject.cobolcheck.services.StringHelper; | ||
|
||
public class WhenOtherGenerator { | ||
private final String performFormat = " PERFORM %s"; | ||
|
||
|
||
public String generateWhenOtherCall(WhenOther whenOther) { | ||
return String.format(performFormat, whenOther.getGeneratedWhenOtherIdentifier()); | ||
} | ||
|
||
List<String> generateWhenOther(WhenOther whenOther, boolean withComments){ | ||
List<String> lines = new ArrayList<>(); | ||
lines.addAll(CobolGenerator.generateCommentBlock("WhenOther block called when mocking")); | ||
lines.addAll(generateParagraphsForWhenOther(whenOther, withComments)); | ||
lines.add(""); | ||
return lines; | ||
} | ||
|
||
private List<String> generateParagraphsForWhenOther(WhenOther whenOther, boolean withComments){ | ||
List<String> comments = new ArrayList<>(); | ||
if (withComments){ | ||
for (String line : whenOther.getCommentText()){ | ||
comments.add(StringHelper.commentOutLine(line)); | ||
} | ||
} | ||
List<String> body = new ArrayList<>(); | ||
body.addAll(whenOther.getLines()); | ||
return CobolGenerator.generateWhenOtherLines(whenOther.getGeneratedWhenOtherIdentifier(), whenOther.getType(), comments, body); | ||
} | ||
|
||
|
||
} |
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