parent
0b30e89005
commit
4333e585b3
@ -1,8 +1,8 @@ |
||||
eclipse.preferences.version=1 |
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled |
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 |
||||
org.eclipse.jdt.core.compiler.compliance=1.8 |
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 |
||||
org.eclipse.jdt.core.compiler.compliance=1.6 |
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error |
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error |
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning |
||||
org.eclipse.jdt.core.compiler.source=1.8 |
||||
org.eclipse.jdt.core.compiler.source=1.6 |
||||
|
||||
@ -1,5 +1,5 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<faceted-project> |
||||
<installed facet="jst.utility" version="1.0"/> |
||||
<installed facet="java" version="1.8"/> |
||||
<installed facet="java" version="1.6"/> |
||||
</faceted-project> |
||||
|
||||
@ -0,0 +1,42 @@ |
||||
package de.kreth.dbmanager; |
||||
|
||||
import static org.junit.Assert.assertEquals; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
import org.junit.Before; |
||||
import org.junit.Test; |
||||
|
||||
public class DbManagerAddColumnTest { |
||||
|
||||
@Before |
||||
public void setUp() throws Exception { |
||||
} |
||||
|
||||
@Test |
||||
public void testAddOneColumn() { |
||||
|
||||
TableDefinition def = new TableDefinition("testtable", new ArrayList<ColumnDefinition>()); |
||||
|
||||
List<ColumnDefinition> columns = new ArrayList<ColumnDefinition>(); |
||||
columns.add(new ColumnDefinition(DataType.DATETIME, "deleted", " DEFAULT null")); |
||||
String sql = DbManager.createSqlAddColumns(def, columns); |
||||
assertEquals("ALTER TABLE testtable\n\tADD COLUMN deleted DATETIME DEFAULT null;", sql); |
||||
} |
||||
|
||||
@Test |
||||
public void testAddTwoColumns() { |
||||
|
||||
TableDefinition def = new TableDefinition("testtable", new ArrayList<ColumnDefinition>()); |
||||
|
||||
List<ColumnDefinition> columns = new ArrayList<ColumnDefinition>(); |
||||
columns.add(new ColumnDefinition(DataType.DATETIME, "deleted", " DEFAULT null")); |
||||
columns.add(new ColumnDefinition(DataType.VARCHAR25, "theType")); |
||||
String sql = DbManager.createSqlAddColumns(def, columns); |
||||
assertEquals( |
||||
"ALTER TABLE testtable\n\tADD COLUMN deleted DATETIME DEFAULT null,\n\tADD COLUMN theType VARCHAR(25);", |
||||
sql); |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,28 @@ |
||||
package de.kreth.dbmanager; |
||||
|
||||
import static org.junit.Assert.assertEquals; |
||||
import static org.junit.Assert.assertNotNull; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
import org.junit.Before; |
||||
import org.junit.Test; |
||||
|
||||
public class DbManagerCreateTablesTest { |
||||
|
||||
@Before |
||||
public void setUp() throws Exception { |
||||
} |
||||
|
||||
@Test |
||||
public void testCreateSqlStatement() { |
||||
List<ColumnDefinition> columns = new ArrayList<ColumnDefinition>(); |
||||
TableDefinition def = new TableDefinition("testtable", columns); |
||||
String sql = DbManager.createSqlStatement(def); |
||||
assertNotNull(sql); |
||||
System.out.println(sql); |
||||
assertEquals("CREATE TABLE testtable (\n" + " _id INTEGER primary key AUTO_INCREMENT\n" + ")", sql); |
||||
} |
||||
|
||||
} |
||||
Loading…
Reference in new issue