Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions impl/pom.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<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/maven-v4_0_0.xsd">
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jboss.test-audit</groupId>
Expand All @@ -10,6 +11,10 @@
<packaging>jar</packaging>
<name>Test Audit Utils Implementation</name>

<properties>
<freemarker.version>2.3.21</freemarker.version>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
Expand All @@ -22,6 +27,11 @@
<artifactId>jboss-test-audit-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>${freemarker.version}</version>
</dependency>
</dependencies>

<build>
Expand All @@ -30,10 +40,10 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<version>2.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<source>1.7</source>
<target>1.7</target>
<compilerArgument>-proc:none</compilerArgument>
</configuration>
</plugin>
Expand Down
90 changes: 90 additions & 0 deletions impl/src/main/java/org/jboss/test/audit/model/Assertion.java
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();
}

}
34 changes: 34 additions & 0 deletions impl/src/main/java/org/jboss/test/audit/model/Group.java
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();
}



}
29 changes: 29 additions & 0 deletions impl/src/main/java/org/jboss/test/audit/model/Link.java
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 impl/src/main/java/org/jboss/test/audit/model/Section.java
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 impl/src/main/java/org/jboss/test/audit/model/SectionElement.java
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 impl/src/main/java/org/jboss/test/audit/model/TableData.java
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(",", ".");
}

}
Loading