From c6b0c6825e9db15737a94d980bfe11d4ef5f5552 Mon Sep 17 00:00:00 2001 From: tkohegyi2 Date: Wed, 24 Jun 2015 21:07:30 +0200 Subject: [PATCH] #46, make wilma-mock releasable (jar, src, pom) and fix func test that does not work except on official test env --- .../localhost/BlockLocalhostUsageTest.java | 6 ++++ wilma-mock/build.gradle | 28 ++++++++++++++++--- wilma-mock/gradle.properties | 5 ++-- 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/wilma-functionaltest/src/main/java/com/epam/wilma/gepard/test/localhost/BlockLocalhostUsageTest.java b/wilma-functionaltest/src/main/java/com/epam/wilma/gepard/test/localhost/BlockLocalhostUsageTest.java index a5ad433a..1e0486b6 100644 --- a/wilma-functionaltest/src/main/java/com/epam/wilma/gepard/test/localhost/BlockLocalhostUsageTest.java +++ b/wilma-functionaltest/src/main/java/com/epam/wilma/gepard/test/localhost/BlockLocalhostUsageTest.java @@ -25,6 +25,7 @@ import java.io.FileInputStream; import java.io.FileNotFoundException; +import java.net.Inet4Address; /** * Tests the localhost request blocking functionality. @@ -49,6 +50,11 @@ public class BlockLocalhostUsageTest extends WilmaTestCase { public void testLocalhostBlocking() throws Exception { //given + String actualHost = Inet4Address.getLocalHost().getHostAddress(); + if (!tcTargetUrl.contains(actualHost) && !tcTargetUrl.contains("127.0.0.1")) { + //in case we are in foreign test environment, or not testing the localhost, this TC should be N/A + naTestCase("Running on unknown test environment, marking this Test as N/A."); + } setOperationModeTo(tcStubOperationState); setLocalhostBlockingTo(tcState); RequestParameters requestParameters = createRequestParameters(); diff --git a/wilma-mock/build.gradle b/wilma-mock/build.gradle index 398af0fb..df351be1 100644 --- a/wilma-mock/build.gradle +++ b/wilma-mock/build.gradle @@ -19,14 +19,12 @@ along with Wilma. If not, see . description = "wilma-mock" -apply plugin: 'java' -apply plugin: 'maven' apply plugin: 'application' apply plugin: 'checkstyle' apply plugin: 'jacoco' group = 'com.epam.wilma.mock' -version = "$wilmaVersion" +version = "$wilmaVersion.$buildNumber" sourceCompatibility = 1.7 targetCompatibility = 1.7 @@ -36,7 +34,8 @@ mainClassName = 'com.epam.wilma.mock.client.WilmaMock' jar { manifest.attributes( 'provider': 'gradle') manifest.attributes( 'Main-Class': mainClassName) - manifest.attributes( 'Implementation-Title': "$componentName-v$version"+'.'+"$buildNumber") + manifest.attributes( 'Implementation-Title': "$componentName-v$version") + archiveName = "$componentName-$version"+'.jar' } repositories { @@ -58,6 +57,7 @@ checkstyle.configFile = file("$rootProject.rootDir/config/checkstyle/checkstyle. checkstyle.configProperties = ['samedir' : "$rootProject.rootDir/config/checkstyle"] checkstyle.toolVersion = '5.6' checkstyle.ignoreFailures = true + test.useTestNG() configurations { @@ -90,3 +90,23 @@ task jacocoReport(type: JacocoReport) { }) } } + +task copyJarToDistributions (type: Copy) { + dependsOn(sourceZip) + from(rootProject.rootDir.absolutePath + '/wilma-mock/build/libs/') + into(rootProject.rootDir.absolutePath + '/wilma-mock/build/distributions') +} + +task createPom << { + pom { + }.writeTo("$buildDir/distributions/wlima-mock-$version"+'.pom') +} +createPom.dependsOn(copyJarToDistributions) + +uploadArchives { + repositories { + mavenDeployer { + repository(url: "${myLocalRepository}") + } + } +} \ No newline at end of file diff --git a/wilma-mock/gradle.properties b/wilma-mock/gradle.properties index 6cf5ec64..4ee3add1 100644 --- a/wilma-mock/gradle.properties +++ b/wilma-mock/gradle.properties @@ -1,3 +1,2 @@ -componentName=Wilma-Mock -buildNumber=DEV -org.gradle.daemon=true \ No newline at end of file +componentName=wilma-mock +buildNumber=DEV \ No newline at end of file