Skip to content

Instantly share code, notes, and snippets.

View netodevel's full-sized avatar
🏠
Working from home

José Vieira Neto netodevel

🏠
Working from home
  • São Paulo, Brasil
View GitHub Profile
@Test
public void testPUTSalarioMinimoController() throws Exception {
SalarioMinimo salarioMinimo = (SalarioMinimo) salarioMinimoService.save(new SalarioMinimo("AL", "800", new SimpleDateFormat("dd/MM/yyyy").parse("01/01/2016"), new SimpleDateFormat("dd/MM/yyyy").parse("01/02/2016"), "decreto test"));
this.mockMvc.perform(MockMvcRequestBuilders.put("/salarios/" + salarioMinimo.getId() + "/editar")).andExpect(MockMvcResultMatchers.redirectedUrl("/salarios"));
}
@Autowired
private JdbcTemplate jdbcTemplate;
@After
public void tearDown() {
JdbcTestUtils.deleteFromTables(jdbcTemplate, "salarios_minimos");
}
@PutMapping("/salarios/{salario_id}/editar")
public String save(Model model, @PathVariable("salario_id") Integer id, RedirectAttributes redirectAttributes) {
try {
if (id != null) {
SalarioMinimo salarioMinimo = (SalarioMinimo) salarioMinimoService.findOne(id);
salarioMinimoService.save(salarioMinimo);
redirectAttributes.addFlashAttribute("sucesso", "Salário Editado com sucesso.");
}
} catch (Exception e) {
e.printStackTrace();
package com.example;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
package br.com.paydomestic.service;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
package br.com.paydomestic.service;
import java.io.Serializable;
import java.util.List;
public abstract class AbstractService<E, idEntity extends Serializable> implements CrudService<E, idEntity> {
@Override
public List<E> findAll() {
return getRepository().findAll();
package br.com.paydomestic.service;
import java.io.Serializable;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
public interface CrudService<E, idEntity extends Serializable> {
public List<E> findAll();
echo "setup deploy"
function setup() {
mkdir -p deploy
cd deploy
mkdir -p develop
mkdir -p production
}
if [ -d /home/{YOUR_USER}/deploy ]; then
echo "YES";
else
/*
data-req="true"
data-validation="date/cpf/email/placa"
data-eq-value=""
*/
function vform(id) {
var obj = {
status: true,
validation: {}
};
@netodevel
netodevel / tmux.md
Created May 4, 2017 12:42 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a