-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor - split presentation and logic layer
- Loading branch information
Showing
20 changed files
with
5,188 additions
and
2,064 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
90 changes: 90 additions & 0 deletions
90
impl/src/main/java/org/jboss/test/audit/model/Assertion.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,90 @@ | ||
package org.jboss.test.audit.model; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* @author Tomas Remes | ||
*/ | ||
public class Assertion extends SectionElement { | ||
|
||
private String id = ""; | ||
private String note; | ||
private boolean testable; | ||
private boolean implied; | ||
private String status; | ||
private Group group; | ||
private List<Test> tests; | ||
|
||
public Assertion(String id, String text, String note, boolean testable, boolean implied, Group group, Section section) { | ||
super(text, section); | ||
this.id = id; | ||
this.note = note; | ||
this.testable = testable; | ||
this.implied = implied; | ||
this.group = group; | ||
this.tests = new ArrayList<>(); | ||
} | ||
|
||
public String getId() { | ||
return id; | ||
} | ||
|
||
public void setId(String id) { | ||
this.id = id; | ||
} | ||
|
||
public List<Test> getTests() { | ||
return tests; | ||
} | ||
|
||
public boolean isTestable() { | ||
return testable; | ||
} | ||
|
||
public void setTestable(boolean testable) { | ||
this.testable = testable; | ||
} | ||
|
||
public String getNote() { | ||
return note; | ||
} | ||
|
||
public void setNote(String note) { | ||
this.note = note; | ||
} | ||
|
||
public Group getGroup() { | ||
return group; | ||
} | ||
|
||
public void setGroup(Group group) { | ||
this.group = group; | ||
} | ||
|
||
public boolean isImplied() { | ||
return implied; | ||
} | ||
|
||
public void setImplied(boolean implied) { | ||
this.implied = implied; | ||
} | ||
|
||
public String getStatus() { | ||
return status; | ||
} | ||
|
||
public void setStatus(String status) { | ||
this.status = status; | ||
} | ||
|
||
public void addTest(Test test){ | ||
tests.add(test); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return this.getId() + " " + this.getText() + " " + this.getNote() + " " + this.getStatus() + " " + this.isImplied() + " " + this.isTestable(); | ||
} | ||
|
||
} |
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,34 @@ | ||
package org.jboss.test.audit.model; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* @author Tomas Remes | ||
*/ | ||
public class Group extends SectionElement { | ||
|
||
|
||
private List<Assertion> assertions; | ||
|
||
public Group(String text, Section section){ | ||
super(text, section); | ||
this.assertions = new ArrayList<>(); | ||
} | ||
|
||
public List<Assertion> getAssertions() { | ||
return assertions; | ||
} | ||
|
||
public void addAssertion(Assertion assertion){ | ||
assertions.add(assertion); | ||
} | ||
|
||
@Override | ||
public String toString(){ | ||
return super.getText(); | ||
} | ||
|
||
|
||
|
||
} |
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,29 @@ | ||
package org.jboss.test.audit.model; | ||
|
||
/** | ||
* @author Tomas Remes | ||
*/ | ||
public class Link { | ||
|
||
private final Provider provider; | ||
private final String url; | ||
|
||
public Link(Provider provider, String url) { | ||
this.provider = provider; | ||
this.url = url; | ||
} | ||
|
||
public Provider getProvider() { | ||
return provider; | ||
} | ||
|
||
public String getUrl() { | ||
return url; | ||
} | ||
|
||
public static enum Provider{ | ||
GITHUB, SVN, FISHEYE; | ||
|
||
} | ||
|
||
} |
66 changes: 66 additions & 0 deletions
66
impl/src/main/java/org/jboss/test/audit/model/Section.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,66 @@ | ||
package org.jboss.test.audit.model; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* @author Tomas Remes | ||
*/ | ||
public class Section { | ||
|
||
private String id; | ||
private String title; | ||
private int level; | ||
private String originalId; | ||
private List<SectionElement> sectionElements; | ||
|
||
public Section(String id, String title, int level, String originalId) { | ||
this.id = id; | ||
this.title = title; | ||
this.level = level; | ||
this.originalId = originalId; | ||
this.sectionElements = new ArrayList<>(); | ||
} | ||
|
||
public int getLevel() { | ||
return level; | ||
} | ||
|
||
public void setLevel(int level) { | ||
this.level = level; | ||
} | ||
|
||
public String getTitle() { | ||
return title; | ||
} | ||
|
||
public void setTitle(String title) { | ||
this.title = title; | ||
} | ||
|
||
public String getId() { | ||
return id; | ||
} | ||
|
||
public void setId(String id) { | ||
this.id = id; | ||
} | ||
|
||
public List<SectionElement> getSectionElements() { | ||
return sectionElements; | ||
} | ||
|
||
public String getOriginalId() { | ||
return originalId; | ||
} | ||
|
||
public void setOriginalId(String originalId) { | ||
this.originalId = originalId; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return this.getId() + " " + this.getTitle() + " " + this.getLevel(); | ||
} | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
impl/src/main/java/org/jboss/test/audit/model/SectionElement.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,32 @@ | ||
package org.jboss.test.audit.model; | ||
|
||
/** | ||
* @author Tomas Remes | ||
*/ | ||
public class SectionElement { | ||
|
||
private String text; | ||
|
||
private Section section; | ||
|
||
public SectionElement(String text, Section section){ | ||
this.text = text; | ||
this.section = section; | ||
} | ||
|
||
public String getText() { | ||
return text; | ||
} | ||
|
||
public void setText(String text) { | ||
this.text = text; | ||
} | ||
|
||
public Section getSection() { | ||
return section; | ||
} | ||
|
||
public void setSection(Section section) { | ||
this.section = section; | ||
} | ||
} |
77 changes: 77 additions & 0 deletions
77
impl/src/main/java/org/jboss/test/audit/model/TableData.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,77 @@ | ||
package org.jboss.test.audit.model; | ||
|
||
/** | ||
* @author Tomas Remes | ||
*/ | ||
public class TableData { | ||
|
||
private final Section section; | ||
private final int assertions; | ||
private final int testable; | ||
private final int tested; | ||
private final int testCount; | ||
private final int unimplemented; | ||
private final int implemented; | ||
private final double coverage; | ||
|
||
public TableData(Section section, int assertions, int testable, int tested, int unimplemented, int implemented, | ||
double coverage) { | ||
this(section, assertions, testable, tested, 0, unimplemented, implemented, coverage); | ||
} | ||
|
||
public TableData(Section section, int assertions, int testable, int tested, int testCount, int unimplemented, | ||
int implemented, double coverage) { | ||
this.section = section; | ||
this.assertions = assertions; | ||
this.testable = testable; | ||
this.tested = tested; | ||
this.testCount = testCount; | ||
this.unimplemented = unimplemented; | ||
this.implemented = implemented; | ||
this.coverage = coverage; | ||
|
||
} | ||
|
||
public double getCoverage() { | ||
return coverage; | ||
} | ||
|
||
public Section getSection() { | ||
return section; | ||
} | ||
|
||
public int getAssertions() { | ||
return assertions; | ||
} | ||
|
||
public int getTestable() { | ||
return testable; | ||
} | ||
|
||
public int getTested() { | ||
return tested; | ||
} | ||
|
||
public int getUnimplemented() { | ||
return unimplemented; | ||
} | ||
|
||
public int getImplemented() { | ||
return implemented; | ||
} | ||
|
||
public int getTestCount() { | ||
return testCount; | ||
} | ||
|
||
public String displayCoverage() { | ||
|
||
return this.assertions > 0 ? String.valueOf(((double) Math.round(this.coverage * 100) / 100)) : ""; | ||
} | ||
|
||
public String coverageForGraph() { | ||
|
||
return String.valueOf(((double) Math.round(this.coverage * 100) / 100)).replace(",", "."); | ||
} | ||
|
||
} |
Oops, something went wrong.