package com.rjconsultores.tests; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import org.junit.Test; public class GerarMapeamentoImpressora { @Test public void test() throws IOException { System.out.println("***"); InputStream in = this.getClass().getResourceAsStream("/com/rjconsultores/tests/impressoras.csv"); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String line = ""; while ((line = br.readLine()) != null) { String[] info = line.split(";"); String estado = info[0]; String serie = info[1]; String mapeamento = String.format("%03d", Integer.parseInt(info[2])); // System.out.println("update FISCAL_IMPRESSORA set NUMEROIDENTIFICACAO = '" + mapeamento + "' where NUMSERIE20 = '" + serie + "';"); System.out.println("update FISCAL_IMPRESSORA set NUMEROIDENTIFICACAO = '" + mapeamento + "', ESTADOLOCAL_ID = (select ESTADO_ID from ESTADO where CVEESTADO like '" + estado + "') where NUMSERIE20 = '" + serie + "';"); // System.out.println("insert into tmp_map values ('" + estado + "','" + serie + "','" + mapeamento + "');"); } if (br != null) { br.close(); } System.out.println("***"); } }