Skip to content

Instantly share code, notes, and snippets.

View Romeh's full-sized avatar

MRomeh Romeh

View GitHub Profile
/**
* main spring boot integration test with integration test profile
*/
@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ActiveProfiles("INTEGRATION_TEST")
@ContextConfiguration
public class CucumberRoot {
@Autowired
protected TestRestTemplate template;
/**
* how the feature is executed
*/
public class GetHealthStep extends CucumberRoot {
private ResponseEntity<String> response; // output
@When("^the client calls /health$")
public void the_client_issues_GET_health() throws Throwable {
response = template.getForEntity("/health", String.class);
}
stage('Integration tests') {
// Run the maven build
steps {
script {
def mvnHome = tool 'Maven 3.3.9'
if (isUnix()) {
// to skip unit testing execution
sh "'${mvnHome}/bin/mvn' verify -Dunit-tests.skip=true"
} else {
bat(/"${mvnHome}\bin\mvn" verify -Dunit-tests.skip=true/)
pipeline {
// run on jenkins nodes tha has java 8 label
agent { label 'java8' }
// global env variables
environment {
EMAIL_RECIPIENTS = 'mahmoud.romeh@test.com'
}
stages {
stage('Build with unit testing') {
spring:
# change the application name for your project name , this name is reserved for the maven archetype code generation
application:
name: Application
---
# DO NOT FORGET TO ADD YOUR YAML CONFIG FILE IN config server as shown below
spring:
cloud:
config:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.5.6.RELEASE)
[2017-12-03 19:48:24] [main] INFO o.s.c.a.AnnotationConfigApplicationContext - Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@2c2db130: startup date [Sun Dec 03 19:48:24 CET 2017]; root of context hierarchy
[2017-12-03 19:48:24] [main] INFO o.s.c.c.s.e.NativeEnvironmentRepository - Adding property source: file:/var/folders/dl/660f5pxs0q18dmp4zh0smfgh0000gn/T/config-repo-5816360046828309118/Application.yml
/**
* the main ignite journal plugin implementation based into AsyncWriteJournal
*/
@Slf4j
public class IgniteWriteJournal extends AsyncWriteJournal {
private final Serializer serializer;
private final Store<JournalItem> storage;
private final IgniteCache<Long, JournalItem> cache;
private final IgniteCache<String, Long> sequenceNumberTrack;
/**
* the main ignite snapshot implementation based into SnapshotStore
*/
@Slf4j
public class IgniteSnapshotStore extends SnapshotStore {
private final Serializer serializer;
private final Store<SnapshotItem> storage;
private final IgniteCache<Long, SnapshotItem> cache;
private final BiFunction<Config, ActorSystem, IgniteCache<Long, SnapshotItem>> snapshotCacheProvider =
/**
* a fail fast map reducer to decide if it should keep waiting for other jobs to final reduce or it should terminate
* and fail fast with the current responses if any failed
*/
@Component
@Scope("prototype")
public class FailFastReducer implements IgniteReducer<ServiceResponse, MapReduceResponse> {
private final Map<String, ServiceResponse> responseMap = new ConcurrentHashMap<>();
/**
* generic utility class for map reduce call
*/
@Component
public class DataGridCompute {
@Autowired
private Ignite ignite;
/**