Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(chore) Gradle: Build now runs with gradle clean jar javadocJar sourceJar test check. #88

Merged
merged 1 commit into from
May 31, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ target/
# Gradle
build/
.gradle

# Tests
screenshot*.png
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ buildscript {

apply plugin: 'base'
apply plugin: 'idea'
apply plugin: 'build-dashboard'
//apply plugin: 'build-dashboard'

subprojects { subproj ->
apply plugin: 'java'
apply plugin: 'idea'
apply from: rootProject.file('gradle/code-quality.gradle')
apply from: rootProject.file('gradle/coverage.gradle')
//apply from: rootProject.file('gradle/coverage.gradle')
apply from: rootProject.file('gradle/publish.gradle')

task sourceJar(type: Jar) {
Expand Down
4 changes: 2 additions & 2 deletions config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
<property name="option" value="stmt"/>
<property name="tokens" value="LITERAL_DO,LITERAL_ELSE,LITERAL_FINALLY,LITERAL_IF,LITERAL_FOR,LITERAL_TRY,LITERAL_WHILE,INSTANCE_INIT,STATIC_INIT"/>
</module>
<module name="EmptyBlock">
<!--<module name="EmptyBlock">
<property name="option" value="text"/>
<property name="tokens" value="LITERAL_CATCH"/>
</module>
</module>-->
<module name="AvoidNestedBlocks"/>

<!-- Braces -->
Expand Down
44 changes: 22 additions & 22 deletions gradle/code-quality.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

apply plugin: 'checkstyle'
apply plugin: 'findbugs'
//apply plugin: 'findbugs'
apply plugin: 'jdepend'
apply plugin: 'license'

Expand All @@ -38,28 +38,28 @@ checkstyle {
configProperties.checkstyleConfigDir = checkstyleConfigDir
}

findbugs {
toolVersion = '2.0.2'
sourceSets = [sourceSets.main]
ignoreFailures = true
reportsDir = file("$project.buildDir/reports/findbugs")
effort = 'max'
reportLevel = 'high'
}

findbugsMain {
reports {
xml.enabled = false
html.enabled = true
}
}
//findbugs {
// toolVersion = '2.0.2'
// sourceSets = [sourceSets.main]
// ignoreFailures = true
// reportsDir = file("$project.buildDir/reports/findbugs")
// effort = 'max'
// reportLevel = 'high'
//}

findbugsTest {
reports {
xml.enabled = false
html.enabled = true
}
}
//findbugsMain {
// reports {
// xml.enabled = false
// html.enabled = true
// }
//}
//
//findbugsTest {
// reports {
// xml.enabled = false
// html.enabled = true
// }
//}

jdepend {
toolVersion = '2.9.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,46 +22,40 @@
import static org.hamcrest.MatcherAssert.assertThat;
import static org.loadui.testfx.GuiTest.find;

public class Assertions
{
@SuppressWarnings( "unchecked" )
public static void assertNodeExists( Matcher<?> matcher )
{
find((Matcher<Object>) matcher);
}
public class Assertions {
@SuppressWarnings("unchecked")
public static void assertNodeExists(Matcher<?> matcher) {
find((Matcher<Object>) matcher);
}

public static void assertNodeExists( String query )
{
find(query);
}
public static void assertNodeExists(String query) {
find(query);
}

public static <T> void verifyThat( T value, Matcher<? super T> matcher )
{
verifyThat( "", value, matcher );
}
public static <T> void verifyThat(T value, Matcher<? super T> matcher) {
verifyThat("", value, matcher);
}

public static <T> void verifyThat( String reason, T value, Matcher<? super T> matcher )
{
try
{
assertThat( reason, value, matcher );
}
catch( AssertionError e )
{
throw new AssertionError( e.getMessage() + " Screenshot saved as " + GuiTest.captureScreenshot().getAbsolutePath() , e );
}
}
public static <T> void verifyThat(String reason, T value, Matcher<? super T> matcher) {
try {
assertThat(reason, value, matcher);
}
catch (AssertionError e) {
throw new AssertionError(e.getMessage() + " Screenshot saved as " +
GuiTest.captureScreenshot().getAbsolutePath(), e);
}
}

public static <T extends Node> void verifyThat( String query, Predicate<T> predicate )
{
T node = find( query );
if(! predicate.apply( node ) )
throw new AssertionError( "Predicate failed for query '" + query + "'. Screenshot saved as " + GuiTest.captureScreenshot().getAbsolutePath() );
public static <T extends Node> void verifyThat(String query, Predicate<T> predicate) {
T node = find(query);
if (!predicate.apply(node))
throw new AssertionError("Predicate failed for query '" + query +
"'. Screenshot saved as " + GuiTest.captureScreenshot().getAbsolutePath());
}

public static <T extends Node> void verifyThat( T node, Predicate<T> predicate )
{
if(! predicate.apply( node ) )
throw new AssertionError( "Predicate failed for '" + node + "'. Screenshot saved as " + GuiTest.captureScreenshot().getAbsolutePath() );
public static <T extends Node> void verifyThat(T node, Predicate<T> predicate) {
if (!predicate.apply(node))
throw new AssertionError("Predicate failed for '" + node + "'. Screenshot saved as " +
GuiTest.captureScreenshot().getAbsolutePath());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class Commons
/**
* Matches any Labeled Node that has the given label.
*
* @deprecated Use {@link hasText(String) instead}.
* @deprecated Use {@link #hasText(String)} instead.
*/
@Deprecated
@Factory
Expand All @@ -44,7 +44,7 @@ public static Matcher<Object> hasLabel( String label )
/**
* Matches any Labeled Node that has a label that matches the given stringMatcher.
*
* @deprecated Use {@link hasText(Matcher<String>) instead}.
* @deprecated Use {@link #hasText(Matcher)} instead.
*/
@Deprecated
@Factory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
import static org.loadui.testfx.GuiTest.find;

public class ListViews {

/**
* Get the number of rows in the list.
*
* @param list
* @return number of rows in list
*/
public static int numberOfRowsIn(ListView<?> list)
{
public static int numberOfRowsIn(ListView<?> list) {
return list.getItems().size();
}

Expand All @@ -43,25 +43,21 @@ public static int numberOfRowsIn(ListView<?> list)
* @param listQuery
* @return
*/
public static int numberOfRowsIn(String listQuery)
{
public static int numberOfRowsIn(String listQuery) {
ListView<?> table = find(listQuery);
return table.getItems().size();
}

@SuppressWarnings("unchecked")
@Factory
public static <S> org.hamcrest.Matcher<S> containsRow(Object rowValue)
{
public static <S> org.hamcrest.Matcher<S> containsRow(Object rowValue) {
return new ListContainsMatcher(rowValue);
}

static boolean containsRow(ListView<?> list, Object rowValue)
{
for(int i=0; i<list.getItems().size(); i++ )
{
static boolean containsRow(ListView<?> list, Object rowValue) {
for (int i = 0; i < list.getItems().size(); i++) {
Object rowData = list.getItems().get(i);
if( rowValue.equals( rowData ) || rowValue.equals(rowData.toString()) )
if (rowValue.equals(rowData) || rowValue.equals(rowData.toString()))
return true;
}
return false;
Expand All @@ -70,7 +66,8 @@ static boolean containsRow(ListView<?> list, Object rowValue)
static ListView<?> getListView(String listSelector) {
Node node = find(listSelector);
if (!(node instanceof ListView)) {
throw new NoNodesFoundException(listSelector + " selected " + node + " which is not a ListView!");
throw new NoNodesFoundException(listSelector + " selected " + node +
" which is not a ListView!");
}
return (ListView<?>) node;
}
Expand All @@ -79,19 +76,17 @@ static ListView<?> getListView(String listSelector) {
private static class ListContainsMatcher extends BaseMatcher {
private Object valueToMatch;

public ListContainsMatcher(Object valueToMatch)
{
public ListContainsMatcher(Object valueToMatch) {
this.valueToMatch = valueToMatch;
}

@Override
public boolean matches(Object o) {
if( o instanceof String)
{
if (o instanceof String) {
String query = (String) o;
return ListViews.containsRow(getListView(query), valueToMatch);
} else if( o instanceof ListView)
{
}
else if (o instanceof ListView) {
ListView tableView = (ListView) o;
return ListViews.containsRow(tableView, valueToMatch);
}
Expand All @@ -100,7 +95,8 @@ public boolean matches(Object o) {

@Override
public void describeTo(Description description) {
description.appendText("The list does not contain a row with value '" + valueToMatch + "'");
description.appendText("The list does not contain a row with value '" +
valueToMatch + "'");
}
}

Expand Down