Skip to content
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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ sudo: false
language: java

jdk:
- oraclejdk8
- oraclejdk11

branches:
#Don't build tags
Expand Down
53 changes: 32 additions & 21 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@
import org.gradle.internal.jvm.Jvm

plugins {
id 'com.github.hierynomus.license' version '0.14.0'
id 'net.researchgate.release' version '2.6.0'
id 'com.github.hierynomus.license' version '0.15.0'
id 'net.researchgate.release' version '2.8.1'
id 'org.sonarqube' version '2.6'
id 'org.unbroken-dome.test-sets' version '1.4.2'
id 'com.github.psxpaul.execfork' version '0.1.8'
id 'io.spring.dependency-management' version '1.0.3.RELEASE'
id 'com.dorongold.task-tree' version '1.3'
id 'org.unbroken-dome.test-sets' version '3.0.1'
id 'com.github.psxpaul.execfork' version '0.1.13'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'com.dorongold.task-tree' version '1.5'
id 'org.springframework.boot' version '2.4.5'
// id "com.github.spotbugs" version "4.7.1"
}

archivesBaseName = 'spring-cloud-ribbon-extensions'
group = 'com.github.enadim'
sourceCompatibility = 1.8
targetCompatibility = 1.8

tasks.bootJar {enabled = false}
tasks.jar {enabled = true}

ext {
jcenterUrl = project.hasProperty('customJcenterUrl') ? project.customJcenterUrl : 'https://jcenter.bintray.com/'
mavenUrl = project.hasProperty('customMavenUrl') ? project.customMavenUrl : 'https://repo.maven.apache.org/maven2/'
customSpringMilestoneUrl = project.hasProperty('customSpringMilestoneUrl') ? project.customSpringMilestoneUrl : 'https://repo.spring.io/libs-milestone/'
mavenPluginsUrl = project.hasProperty('customMavenPluginsUrl') ? project.customMavenPluginsUrl : 'https://plugins.gradle.org/m2/'

jvm = org.gradle.internal.jvm.Jvm.current()
jvm = Jvm.current()
javaDescription = '' + jvm
javaVersion = '' + JavaVersion.current()

Expand Down Expand Up @@ -56,9 +63,9 @@ apply from: 'gradle/signing.gradle'
apply from: 'gradle/release.gradle'
apply plugin: 'com.dorongold.task-tree'

task wrapper(type: Wrapper) {
gradleVersion = '4.7'
}
//task wrapper(type: Wrapper) {
// gradleVersion = '5.6.4'
//}

repositories {
mavenLocal()
Expand All @@ -75,42 +82,46 @@ repositories {

dependencyManagement {
imports {
mavenBom 'org.springframework.cloud:spring-cloud-dependencies:Finchley.RELEASE'
mavenBom 'org.springframework.boot:spring-boot:2.0.3.RELEASE'
mavenBom 'org.springframework.cloud:spring-cloud-dependencies:2020.0.2'
// mavenBom 'org.springframework.boot:spring-boot:2.4.5'
}
}

dependencies {
compileOnly 'org.projectlombok:lombok:1.16.20'
compileOnly 'com.google.code.findbugs:annotations:3.0.1'
compileOnly 'org.projectlombok:lombok:1.18.20'
annotationProcessor 'org.projectlombok:lombok:1.18.20'

testCompileOnly 'org.projectlombok:lombok:1.18.20'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.20'
// compileOnly 'com.google.code.findbugs:annotations:3.0.1'

compile("org.springframework.boot:spring-boot-starter-activemq") { ext.optional = true }
compile("org.apache.activemq:activemq-broker") { ext.optional = true }
compile("org.springframework.boot:spring-boot-starter-activemq:2.4.5") { ext.optional = true }
compile('com.netflix.ribbon:ribbon-eureka:2.7.18') {ext.optional = true }
compile("org.apache.activemq:activemq-broker:5.16.1") { ext.optional = true }
compile("com.fasterxml.jackson.core:jackson-databind") { ext.optional = true }
//compile('org.springframework.cloud:spring-cloud-starter-config') { ext.optional = true }
compile('org.springframework.cloud:spring-cloud-starter-netflix-ribbon') { ext.optional = true }
compile('org.springframework.cloud:spring-cloud-starter-netflix-ribbon:2.2.8.RELEASE') { ext.optional = true }
compile('org.springframework.cloud:spring-cloud-starter-openfeign') { ext.optional = true }
compile('org.springframework.cloud:spring-cloud-starter-netflix-eureka-client') { ext.optional = true }
compile('org.springframework.cloud:spring-cloud-starter-netflix-zuul') { ext.optional = true }
compile('org.springframework.cloud:spring-cloud-starter-netflix-zuul:2.2.8.RELEASE') { ext.optional = true }
compile('org.springframework.cloud:spring-cloud-starter-netflix-eureka-server') {
exclude group: 'javax.servlet', module: 'servlet-api'
ext.optional = true
}
compile('org.apache.activemq:artemis-jms-server') { ext.optional = true }
compile('org.apache.activemq:artemis-jms-server:2.17.0') { ext.optional = true }
compile("org.springframework.boot:spring-boot-starter-activemq") {
ext.optional = true
exclude group: 'org.apache.geronimo.specs', module: 'geronimo-jms_1.1_spec'
}

testCompileOnly 'org.projectlombok:lombok:1.16.20'
testCompile 'org.springframework.boot:spring-boot-starter-web'
testCompile 'org.springframework.boot:spring-boot-test'
testCompile 'org.springframework.boot:spring-boot-starter-test'
testCompile 'org.mockito:mockito-core:2.18.0'
testCompile 'net.bytebuddy:byte-buddy:1.8.5'
testCompile 'io.rest-assured:rest-assured:3.0.7'

examplesCompileOnly 'org.projectlombok:lombok:1.16.20'
examplesCompileOnly 'org.projectlombok:lombok:1.18.20'
}

compileJava {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=2.0.0
version=2.4.0
8 changes: 4 additions & 4 deletions gradle/artifacts.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ task testSourcesJar(type: Jar, dependsOn: classes) {
from sourceSets.test.allSource
}

task testJar(type: Jar, dependsOn: testClasses) {
classifier = 'tests'
from sourceSets.test.output
}
//task testJar(type: Jar, dependsOn: testClasses) {
// classifier = 'tests'
// from sourceSets.test.output
//}

assemble.dependsOn projectReport
assemble.dependsOn testJar
Expand Down
43 changes: 22 additions & 21 deletions gradle/coding.gradle
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
apply plugin: 'checkstyle'
apply plugin: 'findbugs'
apply plugin: 'pmd'
//apply plugin: 'findbugs'

findbugs {
sourceSets = [sourceSets.main]
ignoreFailures = project.hasProperty('ignoreFailures')
reportLevel = 'low'
}
//apply plugin: 'pmd'

tasks.withType(FindBugs) {
reports {
xml.enabled = true
html.enabled = false
}
}
//findbugs {
// sourceSets = [sourceSets.main]
// ignoreFailures = project.hasProperty('ignoreFailures')
// reportLevel = 'low'
//}

pmd {
sourceSets = [sourceSets.main]
ignoreFailures = project.hasProperty('ignoreFailures')
}
//tasks.withType(FindBugs) {
// reports {
// xml.enabled = true
// html.enabled = false
// }
//}

//pmd {
// sourceSets = [sourceSets.main]
// ignoreFailures = project.hasProperty('ignoreFailures')
//}

checkstyle {
sourceSets = [project.sourceSets.main]
Expand All @@ -35,7 +36,7 @@ check.dependsOn checkstyleMain

checkstyleMain.group 'coding'
checkstyleTest.group 'coding'
findbugsMain.group 'coding'
findbugsTest.group 'coding'
pmdMain.group 'coding'
pmdTest.group 'coding'
//findbugsMain.group 'coding'
//findbugsTest.group 'coding'
//pmdMain.group 'coding'
//pmdTest.group 'coding'
8 changes: 4 additions & 4 deletions gradle/tests.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,10 @@ compileIntegrationTestJava.group 'build'

checkstyleIntegrationTest.group 'coding'
checkstyleExamples.group 'coding'
findbugsExamples.group 'coding'
findbugsIntegrationTest.group 'coding'
pmdExamples.group 'coding'
pmdIntegrationTest.group 'coding'
//findbugsExamples.group 'coding'
//findbugsIntegrationTest.group 'coding'
//pmdExamples.group 'coding'
//pmdIntegrationTest.group 'coding'
licenseExamples.group 'license'
licenseFormatExamples.group 'license'
licenseFormatIntegrationTest.group 'license'
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
package com.github.enadim.spring.cloud.ribbon.it;

import io.restassured.RestAssured;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -39,7 +39,7 @@ public AbstractTest(String basePath, String applicationName) {
this.applicationName = applicationName;
}

@Before
@BeforeEach
public final void abstractBefore() {
RestAssured.baseURI = "http://localhost";
RestAssured.basePath = basePath;
Expand Down Expand Up @@ -96,11 +96,14 @@ protected void parallelRun(Runnable r) {
}
}

@Test(expected = IllegalStateException.class)
@Test()
public void parallelRunTest() {
parallelRun(Assert::fail);
if (!parrallelRunEnabled) {
throw new IllegalStateException();
}
org.assertj.core.api.Assertions.assertThatThrownBy(() -> {
parallelRun(Assertions::fail);
if (!parrallelRunEnabled) {
throw new IllegalStateException();
}
}).isInstanceOf(IllegalStateException.class);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package com.github.enadim.spring.cloud.ribbon.it;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.is;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package com.github.enadim.spring.cloud.ribbon.it;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.is;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package com.github.enadim.spring.cloud.ribbon.it;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.is;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import com.netflix.loadbalancer.PredicateKey;
import com.netflix.niws.loadbalancer.DiscoveryEnabledNIWSServerList;
import com.netflix.niws.loadbalancer.DiscoveryEnabledServer;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

/**
* Convenient class for predicates that are based on {@link DiscoveryEnabledServer} created by the {@link DiscoveryEnabledNIWSServerList}.
Expand All @@ -33,7 +32,7 @@ public abstract class DiscoveryEnabledServerPredicate extends NullSafeServerPred
* {@inheritDoc}
*/
@Override
@SuppressFBWarnings("BC_UNCONFIRMED_CAST_OF_RETURN_VALUE")
// @SuppressFBWarnings("BC_UNCONFIRMED_CAST_OF_RETURN_VALUE")
protected boolean doApply(PredicateKey input) {
return input.getServer() instanceof DiscoveryEnabledServer
&& doApply((DiscoveryEnabledServer) input.getServer());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ protected Message copyFromMessage(Message message) {
try {
ExecutionContext context = current();
List<String> eligiblePropertyNames = new ArrayList<>();
list((Enumeration<String>) message.getPropertyNames()).stream()
list((Enumeration<String>) message.getPropertyNames())
.forEach(x -> copy(context, message, x, eligiblePropertyNames));
log.trace("Message Properties copied {}", eligiblePropertyNames);
} catch (JMSException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,10 @@ public void disconnect() {
delegate.disconnect();
}

@Override
public void disconnect(StompHeaders headers) {
delegate.disconnect(headers);
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package com.github.enadim.spring.cloud.ribbon.context;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.Collections;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,14 @@
*/
package com.github.enadim.spring.cloud.ribbon.context;

import org.junit.After;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.lang.reflect.Constructor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;

import static com.github.enadim.spring.cloud.ribbon.context.ExecutionContextHolder.current;
import static com.github.enadim.spring.cloud.ribbon.context.ExecutionContextHolder.remove;
import static com.github.enadim.spring.cloud.ribbon.context.ExecutionContextHolder.switchTo;
import static com.github.enadim.spring.cloud.ribbon.context.ExecutionContextHolder.*;
import static java.util.concurrent.Executors.newFixedThreadPool;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
Expand Down Expand Up @@ -78,8 +76,8 @@ public void inheritance_do_not_work_when_executor_created_elsewhere() throws Exc
assertThat(future.get(), is(nullValue()));
}

@After
public void after() {
@BeforeEach
public void before() {
remove();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,12 @@
import com.netflix.loadbalancer.PredicateKey;
import com.netflix.loadbalancer.Server;
import com.netflix.niws.loadbalancer.DiscoveryEnabledServer;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.CALLS_REAL_METHODS;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import static org.mockito.Mockito.withSettings;
import static org.mockito.Mockito.*;

public class DiscoveryEnabledPredicateTest {

Expand Down
Loading