Skip to content

Instantly share code, notes, and snippets.

View alexmoleiro's full-sized avatar
💭
OhMyDown.org

Alex Moleiro alexmoleiro

💭
OhMyDown.org
View GitHub Profile
/*
@Bean
public RouteBuilder fotocasaRoute() {
return new SoapRouteBuilder("mock:kafka", new FotocasaService("http//foto"));
}
@Bean
public RouteBuilder milAnunciosRoute() {
return new SoapRouteBuilder("mock:kafka", new FotocasaService("http//ma"));
}
public class SoapRouteBuilder extends RouteBuilder {
private final String uriFrom;
private final AlertingService alertingService;
public SoapRouteBuilder(String uriFrom, AlertingService alertingService) {
this.uriFrom = uriFrom;
this.alertingService = alertingService;
}
f(g(h(x)))
compose(f,g,h)(x)
pipe(h,g,f)(x)
//@FeignClient(value = "roger", configuration = FeignDictionaryConfiguration.class)
@FeignClient(value = "ms-common--app-dictionaries", url = "https://ms-common--app-dictionaries.global-pre.spain.schibsted.io", configuration = FeignDictionaryConfiguration.class)
annotationProcessor "org.projectlombok:lombok:$lombokVersion"
compileOnly "org.projectlombok:lombok:$lombokVersion"
// unlike testCompile, these configurations do not inherit from their compile counterparts
// so if your tests depend on lombok, make sure you have specified these:
testAnnotationProcessor "org.projectlombok:lombok:$lombokVersion"
testCompileOnly "org.projectlombok:lombok:$lombokVersion"
@alexmoleiro
alexmoleiro / AdInsertion Draft
Created January 15, 2019 14:19
Smoke tests
import requests
# given
environment = "pro"
token = ''
headers = {
'Authorization': token,
'Content-type': 'application/json; charset=utf-8'
}
url_asgard = "http://asgard.classified-ads-" + environment + ".spain.schibsted.io:8080/eu-west-1/cluster/show/ms_pta__adinsertion.json"
@alexmoleiro
alexmoleiro / gist:784a2f2c454d9dea5a849d9808286259
Created January 14, 2019 13:04
RxJava 1.x . --> List to Observable
@Override
public Single<FormResource> getDraft(GetDraftRequestDto getDraftRequestDto) {
return cochesnetRepository.getDraft(getDraftRequestDto)
.flatMapObservable(draftResponses -> Observable.from(draftResponses)
.map(DraftResponse::mapFromCochesFieldsToPtaFields)
.flatMap(values -> createFormResource(values, getDraftRequestDto.getToken()).toObservable())
.switchIfEmpty(createDraft(getDraftRequestDto.getToken()).toObservable()))
.toSingle()
.onErrorResumeNext(this::handleError);
}
@alexmoleiro
alexmoleiro / gist:94dad4bfc5bc5fe794d2034b28ae8e24
Last active January 9, 2019 15:47
Test Feign client with Pact and Spring
@RunWith(SpringRunner.class)
@ContextConfiguration(loader = AnnotationConfigContextLoader.class, classes = {ClientConfiguration.class,
CochesnetPropertiesConfiguration.class})
@TestPropertySource(properties = {"cochesnet.ConnectTimeout=1000", "cochesnet.ReadTimeout=1000",
"cochesnet.url=http://localhost:8080"})
public class CochesPactTest {
@Autowired
private FeignCochesnetDraft feignCochesnetDraft;
@Test
void return_hours_for_all_postal_codes() {
CorreosAdaptor correosAdaptor = new CorreosAdaptor();
IntStream.rangeClosed(35000, 35302).
boxed().peek(i-> System.out.println(i)).
map(i->correosAdaptor.getArrayOfOficina(String.valueOf(i))).
forEach(oficina->oficina.getItem().stream().filter(x->!x.getHorarioF().equals("SIN SERVICIO")).forEach(
o-> {
System.out.println(o.getHorarioF());
System.out.println(o.getHorarioLV());
<?php
/*
Plugin Name: Dominable.com
Description: Ejemplo de plugin para animar a hacerlos
Author: Alex Moleiro
Version: 0.1 Beta
Author URI: http://twitter.com/MoleiroAlex
License: WTFPL
License URI: http://www.wtfpl.net/