Package tests

Source Code of tests.ConteudoMigrationTest

package tests;

import java.sql.ResultSet;
import java.sql.Statement;

import junit.framework.TestCase;
import src.ConteudoMigration;
import src.Context;
import src.Migrator;

public class ConteudoMigrationTest extends TestCase {
 
  public void testGetResultSet() throws Exception {
    Migrator migration = new ConteudoMigration(Context.getSourceConnection(),Context.getDestinationConnection());
    ResultSet rs = migration.getResultSet();
   
    rs.next();
    assertEquals(7,rs.getMetaData().getColumnCount());
  }
 
  public void testExecute() throws Exception {
    Migrator migration = new ConteudoMigration(Context.getSourceConnection(),Context.getDestinationConnection());
    ResultSet rs = migration.getResultSet();
    rs.next();
   
    migration.execute(rs);
   
    Statement stm = (Statement) Context.getDestinationConnection().createStatement();
    ResultSet rs2 = (ResultSet) stm.executeQuery("SELECT id FROM CONTEUDO WHERE id = " + rs.getLong(1));
    rs2.next();
   
    assertEquals(rs2.getLong(1), rs.getLong(1));
   
    stm.executeUpdate("DELETE FROM CONTEUDO WHERE id = " + rs2.getLong(1));
  }
}
TOP

Related Classes of tests.ConteudoMigrationTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.