polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paulmer...@apache.org
Subject [1/2] zest-java git commit: build: unit test ModuleReleaseSpec
Date Fri, 16 Dec 2016 22:48:25 GMT
Repository: zest-java
Updated Branches:
  refs/heads/develop c6317c08f -> 05439b735


build: unit test ModuleReleaseSpec


Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/20331cfb
Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/20331cfb
Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/20331cfb

Branch: refs/heads/develop
Commit: 20331cfb61eb35167329350e5cb9dc199eda1c89
Parents: c6317c0
Author: Paul Merlin <paulmerlin@apache.org>
Authored: Fri Dec 16 22:30:53 2016 +0100
Committer: Paul Merlin <paulmerlin@apache.org>
Committed: Fri Dec 16 22:30:53 2016 +0100

----------------------------------------------------------------------
 buildSrc/build.gradle                           |  11 +-
 .../gradle/release/ModuleReleaseSpec.groovy     |  25 ++--
 .../gradle/release/ModuleReleaseSpecTest.groovy | 118 +++++++++++++++++++
 3 files changed, 144 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-java/blob/20331cfb/buildSrc/build.gradle
----------------------------------------------------------------------
diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle
index b7d1b16..8f292ab 100644
--- a/buildSrc/build.gradle
+++ b/buildSrc/build.gradle
@@ -14,17 +14,24 @@
  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
- *
- *
  */
 
+plugins {
+  id 'groovy'
+}
+
 repositories {
   maven { url "https://plugins.gradle.org/m2/" }
   mavenCentral()
 }
 
 dependencies {
+  compile gradleApi()
+  compile localGroovy()
   compile 'gradle.plugin.org.nosphere.apache:creadur-rat-gradle:0.2.2'
   compile 'gradle.plugin.org.nosphere.honker:honker-gradle:0.2.3'
   compile 'org.hibernate.build.gradle:gradle-maven-publish-auth:2.0.1'
+
+  testCompile 'junit:junit:4.12'
+  testCompile( 'org.spockframework:spock-core:1.0-groovy-2.4' ) { exclude module: 'groovy-all'
}
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/20331cfb/buildSrc/src/main/groovy/org/apache/zest/gradle/release/ModuleReleaseSpec.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/release/ModuleReleaseSpec.groovy
b/buildSrc/src/main/groovy/org/apache/zest/gradle/release/ModuleReleaseSpec.groovy
index 0d81bac..199808a 100644
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/release/ModuleReleaseSpec.groovy
+++ b/buildSrc/src/main/groovy/org/apache/zest/gradle/release/ModuleReleaseSpec.groovy
@@ -15,13 +15,13 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package org.apache.zest.gradle.release;
+package org.apache.zest.gradle.release
 
 import org.gradle.api.Project
 
 class ModuleReleaseSpec
 {
-  def boolean satisfiedBy( Project project )
+  boolean satisfiedBy( Project project )
   {
     def devStatusFile = new File( project.projectDir, "dev-status.xml" )
     if( !devStatusFile.exists() )
@@ -29,12 +29,21 @@ class ModuleReleaseSpec
       return false
     }
     def module = new XmlSlurper().parse( devStatusFile )
-    def codebase = module.status.codebase.text()
-    def docs = module.status.documentation.text()
-    def tests = module.status.unittests.text()
-    def satisfied = ( codebase == 'none' && docs == 'complete' && tests !=
'complete' )
-    satisfied |= ( codebase == 'early' && ( docs == 'complete' || docs == 'good')
&& (tests == 'complete' || tests == 'good' ) )
-    satisfied |= ( codebase == 'beta' && (docs == 'complete' || docs == 'good' ||
docs == 'brief') && (tests == 'complete' || tests == 'good' || tests == 'some') )
+    def codebase = module.status.codebase.text() as String
+    def docs = module.status.documentation.text() as String
+    def tests = module.status.unittests.text() as String
+    return satisfiedBy( codebase, docs, tests )
+  }
+
+  boolean satisfiedBy( String codebase, String docs, String tests )
+  {
+    def satisfied = ( codebase == 'none' && docs == 'complete' )
+    satisfied |= ( codebase == 'early'
+      && ( docs == 'complete' || docs == 'good' )
+      && ( tests == 'complete' || tests == 'good' ) )
+    satisfied |= ( codebase == 'beta'
+      && ( docs == 'complete' || docs == 'good' || docs == 'brief' )
+      && ( tests == 'complete' || tests == 'good' || tests == 'some' ) )
     satisfied |= ( codebase == 'stable' )
     satisfied |= ( codebase == 'mature' )
     // TODO Add a task to report this easily

http://git-wip-us.apache.org/repos/asf/zest-java/blob/20331cfb/buildSrc/src/test/groovy/org/apache/zest/gradle/release/ModuleReleaseSpecTest.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/test/groovy/org/apache/zest/gradle/release/ModuleReleaseSpecTest.groovy
b/buildSrc/src/test/groovy/org/apache/zest/gradle/release/ModuleReleaseSpecTest.groovy
new file mode 100644
index 0000000..edd22b9
--- /dev/null
+++ b/buildSrc/src/test/groovy/org/apache/zest/gradle/release/ModuleReleaseSpecTest.groovy
@@ -0,0 +1,118 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.zest.gradle.release
+
+import spock.lang.Specification
+import spock.lang.Unroll
+
+class ModuleReleaseSpecTest extends Specification
+{
+  @Unroll
+  def "codebase(#code) docs(#docs) tests(#tests) -> #expected"()
+  {
+    expect:
+    new ModuleReleaseSpec().satisfiedBy( code, docs, tests ) == expected
+
+    where:
+    code     | docs       | tests      | expected
+    'none'   | 'none'     | 'none'     | false
+    'none'   | 'none'     | 'some'     | false
+    'none'   | 'none'     | 'good'     | false
+    'none'   | 'none'     | 'complete' | false
+    'none'   | 'brief'    | 'none'     | false
+    'none'   | 'brief'    | 'some'     | false
+    'none'   | 'brief'    | 'good'     | false
+    'none'   | 'brief'    | 'complete' | false
+    'none'   | 'good'     | 'none'     | false
+    'none'   | 'good'     | 'some'     | false
+    'none'   | 'good'     | 'good'     | false
+    'none'   | 'good'     | 'complete' | false
+    'none'   | 'complete' | 'none'     | true
+    'none'   | 'complete' | 'some'     | true
+    'none'   | 'complete' | 'good'     | true
+    'none'   | 'complete' | 'complete' | true
+
+    'early'  | 'none'     | 'none'     | false
+    'early'  | 'none'     | 'some'     | false
+    'early'  | 'none'     | 'good'     | false
+    'early'  | 'none'     | 'complete' | false
+    'early'  | 'brief'    | 'none'     | false
+    'early'  | 'brief'    | 'some'     | false
+    'early'  | 'brief'    | 'good'     | false
+    'early'  | 'brief'    | 'complete' | false
+    'early'  | 'good'     | 'none'     | false
+    'early'  | 'good'     | 'some'     | false
+    'early'  | 'good'     | 'good'     | true
+    'early'  | 'good'     | 'complete' | true
+    'early'  | 'complete' | 'none'     | false
+    'early'  | 'complete' | 'some'     | false
+    'early'  | 'complete' | 'good'     | true
+    'early'  | 'complete' | 'complete' | true
+
+    'beta'   | 'none'     | 'none'     | false
+    'beta'   | 'none'     | 'some'     | false
+    'beta'   | 'none'     | 'good'     | false
+    'beta'   | 'none'     | 'complete' | false
+    'beta'   | 'brief'    | 'none'     | false
+    'beta'   | 'brief'    | 'some'     | true
+    'beta'   | 'brief'    | 'good'     | true
+    'beta'   | 'brief'    | 'complete' | true
+    'beta'   | 'good'     | 'none'     | false
+    'beta'   | 'good'     | 'some'     | true
+    'beta'   | 'good'     | 'good'     | true
+    'beta'   | 'good'     | 'complete' | true
+    'beta'   | 'complete' | 'none'     | false
+    'beta'   | 'complete' | 'some'     | true
+    'beta'   | 'complete' | 'good'     | true
+    'beta'   | 'complete' | 'complete' | true
+
+    'stable' | 'none'     | 'none'     | true
+    'stable' | 'none'     | 'some'     | true
+    'stable' | 'none'     | 'good'     | true
+    'stable' | 'none'     | 'complete' | true
+    'stable' | 'brief'    | 'none'     | true
+    'stable' | 'brief'    | 'some'     | true
+    'stable' | 'brief'    | 'good'     | true
+    'stable' | 'brief'    | 'complete' | true
+    'stable' | 'good'     | 'none'     | true
+    'stable' | 'good'     | 'some'     | true
+    'stable' | 'good'     | 'good'     | true
+    'stable' | 'good'     | 'complete' | true
+    'stable' | 'complete' | 'none'     | true
+    'stable' | 'complete' | 'some'     | true
+    'stable' | 'complete' | 'good'     | true
+    'stable' | 'complete' | 'complete' | true
+
+    'mature' | 'none'     | 'none'     | true
+    'mature' | 'none'     | 'some'     | true
+    'mature' | 'none'     | 'good'     | true
+    'mature' | 'none'     | 'complete' | true
+    'mature' | 'brief'    | 'none'     | true
+    'mature' | 'brief'    | 'some'     | true
+    'mature' | 'brief'    | 'good'     | true
+    'mature' | 'brief'    | 'complete' | true
+    'mature' | 'good'     | 'none'     | true
+    'mature' | 'good'     | 'some'     | true
+    'mature' | 'good'     | 'good'     | true
+    'mature' | 'good'     | 'complete' | true
+    'mature' | 'complete' | 'none'     | true
+    'mature' | 'complete' | 'some'     | true
+    'mature' | 'complete' | 'good'     | true
+    'mature' | 'complete' | 'complete' | true
+  }
+}


Mime
View raw message