Skip to content

Instantly share code, notes, and snippets.

View willianantunes's full-sized avatar
🎯
Focusing

Willian Antunes willianantunes

🎯
Focusing
View GitHub Profile
@willianantunes
willianantunes / pk-limit-solution.sql
Created October 21, 2017 22:53
SQL file used for my blog post
-- 1 - Criar/copiar tabela problemática:
CREATE TABLE TABELA_NOVA SELECT * FROM TABELA_PRODUCAO;
-- 2 - Obter último valor da PK, nosso caso 65535
SELECT PK_ABUDEGA FROM TABELA_PRODUCAO ORDER BY PK_ABUDEGA DESC;
-- 3 - Adicionar constraints necessárias e obviamente da PK também
ALTER TABLE TABELA_NOVA ADD PRIMARY KEY (PK_ABUDEGA);
ALTER TABLE TABELA_NOVA CHANGE PK_ABUDEGA PK_AJUSTADA INT(11) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE TABELA_NOVA ADD FOREIGN KEY (TABELA_RELACIONADA_ID) REFERENCES TABELA_RELACIONADA(ID);
-- 4 - O valor do passo 3 mais 1
ALTER TABLE TABELA_NOVA AUTO_INCREMENT = 65536;
package br.com.willianantunes.playground;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.PropertyInject;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.twitter.search.TwitterSearchComponent;
import org.apache.camel.model.ModelCamelContext;
import java.io.IOException;
import java.util.Collection;
import org.hibernate.Hibernate;
import org.hibernate.proxy.HibernateProxy;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.TypeAdapter;
import com.google.gson.TypeAdapterFactory;
import br.com.willianantunes.serenata.JarbasAPI;
import br.com.willianantunes.support.ScenarioBuilder;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
import org.apache.camel.Producer;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.ExchangeBuilder;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.cxf.common.message.CxfConstants;
import org.apache.camel.component.cxf.jaxrs.CxfRsBinding;
class HttpService {
get(url) {
return new Promise((resolve, reject) => {
let xhr = new XMLHttpRequest();
xhr.open('GET', url);
xhr.onreadystatechange = () => {
class SampleJasmineService {
constructor(serviceUrl) {
this._http = new HttpService();
this._servicoUrl = serviceUrl;
}
consult(message) {
class SampleJasmineController {
constructor(serviceUrl) {
let $ = document.querySelector.bind(document);
this._service = new SampleJasmineService(serviceUrl);
this._message = $('p.message');
this._btnSubmit = $('form input[type=submit]');
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>Jasmine Honesto</title>
<meta charset="utf-8"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
</head>
<body>
describe("Regras para atender demandas específicas de testes honestos", () => {
var sampleJasmineController;
beforeEach(() => {
ScenarioBuilder.prepareView();
sampleJasmineController = new SampleJasmineController();
});
@Controller
public class SampleController {
private static final Logger LOGGER = LoggerFactory.getLogger(SampleController.class);
@Autowired
private SampleService sampleService;
@GetMapping(REQUEST_PATH_SAMPLE)
public ModelAndView sample(@RequestHeader(HONEST_SAMPLE_HEADER) String honestSampleHeader) {