diff options
author | Eike Stepper | 2012-07-19 08:22:04 +0000 |
---|---|---|
committer | Eike Stepper | 2012-07-19 08:22:04 +0000 |
commit | 1460904fd3c193ffaf809913b2983a400fce9d94 (patch) | |
tree | 72f3a17b75fedba3ae1060df1d32c9c7889be954 /plugins/org.eclipse.net4j.db.tests/src | |
parent | 5f360965ae87478e0681899bf310a210cafc2c44 (diff) | |
download | cdo-1460904fd3c193ffaf809913b2983a400fce9d94.tar.gz cdo-1460904fd3c193ffaf809913b2983a400fce9d94.tar.xz cdo-1460904fd3c193ffaf809913b2983a400fce9d94.zip |
Fix line endings in master (dos2unix)
Diffstat (limited to 'plugins/org.eclipse.net4j.db.tests/src')
7 files changed, 512 insertions, 512 deletions
diff --git a/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/AbstractDBTest.java b/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/AbstractDBTest.java index 731f8f4fa0..a82558074d 100644 --- a/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/AbstractDBTest.java +++ b/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/AbstractDBTest.java @@ -1,128 +1,128 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.db.tests;
-
-import org.eclipse.net4j.db.DBType;
-import org.eclipse.net4j.db.DBUtil;
-import org.eclipse.net4j.db.IDBAdapter;
-import org.eclipse.net4j.db.IDBConnectionProvider;
-import org.eclipse.net4j.db.ddl.IDBField;
-import org.eclipse.net4j.db.ddl.IDBIndex;
-import org.eclipse.net4j.db.ddl.IDBSchema;
-import org.eclipse.net4j.db.ddl.IDBTable;
-import org.eclipse.net4j.util.tests.AbstractOMTest;
-
-import javax.sql.DataSource;
-
-import java.sql.Connection;
-import java.util.Set;
-
-/**
- * @author Eike Stepper
- */
-public abstract class AbstractDBTest<DATA_SOURCE extends DataSource> extends AbstractOMTest
-{
- protected IDBAdapter dbAdapter;
-
- protected IDBConnectionProvider dbConnectionProvider;
-
- @SuppressWarnings("unchecked")
- @Override
- protected void doSetUp() throws Exception
- {
- dbAdapter = createDBAdapter();
- DATA_SOURCE dataSource = (DATA_SOURCE)dbAdapter.createJDBCDataSource();
- configureDataSource(dataSource);
- dbConnectionProvider = DBUtil.createConnectionProvider(dataSource);
- }
-
- @Override
- protected void doTearDown() throws Exception
- {
- }
-
- protected abstract IDBAdapter createDBAdapter();
-
- protected abstract void configureDataSource(DATA_SOURCE dataSource);
-
- protected Connection getConnection()
- {
- return dbConnectionProvider.getConnection();
- }
-
- public void testDBTypes() throws Exception
- {
- IDBSchema schema = DBUtil.createSchema("testDBTypes"); //$NON-NLS-1$
- DBType[] dbTypes = DBType.values();
-
- int count = 0;
- int i = 0;
- for (DBType dbType : dbTypes)
- {
- IDBTable table = schema.addTable("table_" + i); //$NON-NLS-1$
- table.addField("field", dbType); //$NON-NLS-1$
- ++count;
-
- if (dbAdapter.isTypeIndexable(dbType))
- {
- IDBTable idx_table = schema.addTable("idx_table" + i); //$NON-NLS-1$
- IDBField idx_field = idx_table.addField("field", dbType); //$NON-NLS-1$
- idx_table.addIndex(IDBIndex.Type.NON_UNIQUE, idx_field);
- ++count;
-
- IDBTable uni_table = schema.addTable("uni_table" + i); //$NON-NLS-1$
- IDBField uni_field = uni_table.addField("field", dbType); //$NON-NLS-1$
- uni_table.addIndex(IDBIndex.Type.UNIQUE, uni_field);
- ++count;
-
- IDBTable pk_table = schema.addTable("pk_table" + i); //$NON-NLS-1$
- IDBField pk_field = pk_table.addField("field", dbType); //$NON-NLS-1$
- pk_table.addIndex(IDBIndex.Type.PRIMARY_KEY, pk_field);
- ++count;
- }
-
- ++i;
- }
-
- Set<IDBTable> tables = schema.create(dbAdapter, dbConnectionProvider);
- assertEquals(count, tables.size());
- }
-
- // public void testEscapeStrings() throws Exception
- // {
- // IDBSchema schema = DBUtil.createSchema("testEscapeStrings"); //$NON-NLS-1$
- // IDBTable table = schema.addTable("testtable"); //$NON-NLS-1$
- // IDBField field = table.addField("strval", DBType.VARCHAR, 255); //$NON-NLS-1$
- // schema.create(dbAdapter, dbConnectionProvider);
- //
- // insertString(field, "My name is 'nobody', not body"); //$NON-NLS-1$
- // insertString(field, "a = 'hello'"); //$NON-NLS-1$
- // insertString(field, "'hello' == a"); //$NON-NLS-1$
- // insertString(field, "'hello'"); //$NON-NLS-1$
- // }
- //
- // private void insertString(IDBField field, String val)
- // {
- // Connection connection = getConnection();
- // IDBTable table = field.getTable();
- //
- // try
- // {
- // DBUtil.insertRow(connection, dbAdapter, table, val);
- // Object[] result = DBUtil.select(connection, (String)null, field);
- // assertEquals(val, result[0]);
- // }
- // finally
- // {
- // DBUtil.update(connection, "DELETE FROM " + table); //$NON-NLS-1$
- // }
- // }
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + */ +package org.eclipse.net4j.db.tests; + +import org.eclipse.net4j.db.DBType; +import org.eclipse.net4j.db.DBUtil; +import org.eclipse.net4j.db.IDBAdapter; +import org.eclipse.net4j.db.IDBConnectionProvider; +import org.eclipse.net4j.db.ddl.IDBField; +import org.eclipse.net4j.db.ddl.IDBIndex; +import org.eclipse.net4j.db.ddl.IDBSchema; +import org.eclipse.net4j.db.ddl.IDBTable; +import org.eclipse.net4j.util.tests.AbstractOMTest; + +import javax.sql.DataSource; + +import java.sql.Connection; +import java.util.Set; + +/** + * @author Eike Stepper + */ +public abstract class AbstractDBTest<DATA_SOURCE extends DataSource> extends AbstractOMTest +{ + protected IDBAdapter dbAdapter; + + protected IDBConnectionProvider dbConnectionProvider; + + @SuppressWarnings("unchecked") + @Override + protected void doSetUp() throws Exception + { + dbAdapter = createDBAdapter(); + DATA_SOURCE dataSource = (DATA_SOURCE)dbAdapter.createJDBCDataSource(); + configureDataSource(dataSource); + dbConnectionProvider = DBUtil.createConnectionProvider(dataSource); + } + + @Override + protected void doTearDown() throws Exception + { + } + + protected abstract IDBAdapter createDBAdapter(); + + protected abstract void configureDataSource(DATA_SOURCE dataSource); + + protected Connection getConnection() + { + return dbConnectionProvider.getConnection(); + } + + public void testDBTypes() throws Exception + { + IDBSchema schema = DBUtil.createSchema("testDBTypes"); //$NON-NLS-1$ + DBType[] dbTypes = DBType.values(); + + int count = 0; + int i = 0; + for (DBType dbType : dbTypes) + { + IDBTable table = schema.addTable("table_" + i); //$NON-NLS-1$ + table.addField("field", dbType); //$NON-NLS-1$ + ++count; + + if (dbAdapter.isTypeIndexable(dbType)) + { + IDBTable idx_table = schema.addTable("idx_table" + i); //$NON-NLS-1$ + IDBField idx_field = idx_table.addField("field", dbType); //$NON-NLS-1$ + idx_table.addIndex(IDBIndex.Type.NON_UNIQUE, idx_field); + ++count; + + IDBTable uni_table = schema.addTable("uni_table" + i); //$NON-NLS-1$ + IDBField uni_field = uni_table.addField("field", dbType); //$NON-NLS-1$ + uni_table.addIndex(IDBIndex.Type.UNIQUE, uni_field); + ++count; + + IDBTable pk_table = schema.addTable("pk_table" + i); //$NON-NLS-1$ + IDBField pk_field = pk_table.addField("field", dbType); //$NON-NLS-1$ + pk_table.addIndex(IDBIndex.Type.PRIMARY_KEY, pk_field); + ++count; + } + + ++i; + } + + Set<IDBTable> tables = schema.create(dbAdapter, dbConnectionProvider); + assertEquals(count, tables.size()); + } + + // public void testEscapeStrings() throws Exception + // { + // IDBSchema schema = DBUtil.createSchema("testEscapeStrings"); //$NON-NLS-1$ + // IDBTable table = schema.addTable("testtable"); //$NON-NLS-1$ + // IDBField field = table.addField("strval", DBType.VARCHAR, 255); //$NON-NLS-1$ + // schema.create(dbAdapter, dbConnectionProvider); + // + // insertString(field, "My name is 'nobody', not body"); //$NON-NLS-1$ + // insertString(field, "a = 'hello'"); //$NON-NLS-1$ + // insertString(field, "'hello' == a"); //$NON-NLS-1$ + // insertString(field, "'hello'"); //$NON-NLS-1$ + // } + // + // private void insertString(IDBField field, String val) + // { + // Connection connection = getConnection(); + // IDBTable table = field.getTable(); + // + // try + // { + // DBUtil.insertRow(connection, dbAdapter, table, val); + // Object[] result = DBUtil.select(connection, (String)null, field); + // assertEquals(val, result[0]); + // } + // finally + // { + // DBUtil.update(connection, "DELETE FROM " + table); //$NON-NLS-1$ + // } + // } +} diff --git a/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/AllTests.java b/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/AllTests.java index 4c30b2653b..7d3a5cd3b6 100644 --- a/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/AllTests.java +++ b/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/AllTests.java @@ -1,31 +1,31 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.db.tests;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * @author Eike Stepper
- */
-public class AllTests
-{
- public static Test suite()
- {
- TestSuite suite = new TestSuite("Tests for Net4j"); //$NON-NLS-1$
-
- // $JUnit-BEGIN$
- suite.addTestSuite(DerbyTest.class);
- // $JUnit-END$
-
- return suite;
- }
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + */ +package org.eclipse.net4j.db.tests; + +import junit.framework.Test; +import junit.framework.TestSuite; + +/** + * @author Eike Stepper + */ +public class AllTests +{ + public static Test suite() + { + TestSuite suite = new TestSuite("Tests for Net4j"); //$NON-NLS-1$ + + // $JUnit-BEGIN$ + suite.addTestSuite(DerbyTest.class); + // $JUnit-END$ + + return suite; + } +} diff --git a/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/DerbyTest.java b/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/DerbyTest.java index 9f9a3bdc2c..23d4b260a9 100644 --- a/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/DerbyTest.java +++ b/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/DerbyTest.java @@ -1,56 +1,56 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.db.tests;
-
-import org.eclipse.net4j.db.IDBAdapter;
-import org.eclipse.net4j.util.io.IOUtil;
-import org.eclipse.net4j.util.io.TMPUtil;
-
-import org.apache.derby.jdbc.EmbeddedDataSource;
-
-import java.io.File;
-
-/**
- * @author Eike Stepper
- */
-public class DerbyTest extends AbstractDBTest<EmbeddedDataSource>
-{
- private File dbFolder;
-
- @Override
- protected IDBAdapter createDBAdapter()
- {
- return new org.eclipse.net4j.db.derby.EmbeddedDerbyAdapter();
- }
-
- @Override
- protected void configureDataSource(EmbeddedDataSource dataSource)
- {
- dbFolder = TMPUtil.createTempFolder("derby_"); //$NON-NLS-1$
- deleteDBFolder();
- msg("Using DB folder: " + dbFolder.getAbsolutePath()); //$NON-NLS-1$
-
- dataSource.setDatabaseName(dbFolder.getAbsolutePath());
- dataSource.setCreateDatabase("create"); //$NON-NLS-1$
- }
-
- @Override
- protected void doTearDown() throws Exception
- {
- deleteDBFolder();
- super.doTearDown();
- }
-
- private void deleteDBFolder()
- {
- IOUtil.delete(dbFolder);
- }
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + */ +package org.eclipse.net4j.db.tests; + +import org.eclipse.net4j.db.IDBAdapter; +import org.eclipse.net4j.util.io.IOUtil; +import org.eclipse.net4j.util.io.TMPUtil; + +import org.apache.derby.jdbc.EmbeddedDataSource; + +import java.io.File; + +/** + * @author Eike Stepper + */ +public class DerbyTest extends AbstractDBTest<EmbeddedDataSource> +{ + private File dbFolder; + + @Override + protected IDBAdapter createDBAdapter() + { + return new org.eclipse.net4j.db.derby.EmbeddedDerbyAdapter(); + } + + @Override + protected void configureDataSource(EmbeddedDataSource dataSource) + { + dbFolder = TMPUtil.createTempFolder("derby_"); //$NON-NLS-1$ + deleteDBFolder(); + msg("Using DB folder: " + dbFolder.getAbsolutePath()); //$NON-NLS-1$ + + dataSource.setDatabaseName(dbFolder.getAbsolutePath()); + dataSource.setCreateDatabase("create"); //$NON-NLS-1$ + } + + @Override + protected void doTearDown() throws Exception + { + deleteDBFolder(); + super.doTearDown(); + } + + private void deleteDBFolder() + { + IOUtil.delete(dbFolder); + } +} diff --git a/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/HsqldbTest.java b/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/HsqldbTest.java index 6dcc9c1d5f..66ccdbebdb 100644 --- a/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/HsqldbTest.java +++ b/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/HsqldbTest.java @@ -1,33 +1,33 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.db.tests;
-
-import org.eclipse.net4j.db.IDBAdapter;
-import org.eclipse.net4j.db.hsqldb.HSQLDBDataSource;
-
-/**
- * @author Eike Stepper
- */
-public class HsqldbTest extends AbstractDBTest<HSQLDBDataSource>
-{
- @Override
- protected IDBAdapter createDBAdapter()
- {
- return new org.eclipse.net4j.db.hsqldb.HSQLDBAdapter();
- }
-
- @Override
- protected void configureDataSource(HSQLDBDataSource dataSource)
- {
- dataSource.setDatabase("jdbc:hsqldb:mem:dbtest"); //$NON-NLS-1$
- dataSource.setUser("sa"); //$NON-NLS-1$
- }
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + */ +package org.eclipse.net4j.db.tests; + +import org.eclipse.net4j.db.IDBAdapter; +import org.eclipse.net4j.db.hsqldb.HSQLDBDataSource; + +/** + * @author Eike Stepper + */ +public class HsqldbTest extends AbstractDBTest<HSQLDBDataSource> +{ + @Override + protected IDBAdapter createDBAdapter() + { + return new org.eclipse.net4j.db.hsqldb.HSQLDBAdapter(); + } + + @Override + protected void configureDataSource(HSQLDBDataSource dataSource) + { + dataSource.setDatabase("jdbc:hsqldb:mem:dbtest"); //$NON-NLS-1$ + dataSource.setUser("sa"); //$NON-NLS-1$ + } +} diff --git a/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/MysqlTest.java b/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/MysqlTest.java index 27441cdc22..b68c1400c4 100644 --- a/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/MysqlTest.java +++ b/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/MysqlTest.java @@ -1,31 +1,31 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.db.tests;
-
-/**
- * @author Eike Stepper
- */
-public class MysqlTest // extends AbstractDBTest<MysqlDataSource>
-{
- // @Override
- // protected IDBAdapter createDBAdapter()
- // {
- // return new org.eclipse.net4j.db.mysql.MYSQLAdapter();
- // }
- //
- // @Override
- // protected void configureDataSource(MysqlDataSource dataSource)
- // {
- // dataSource.setDatabaseName("dbtest");
- // dataSource.setUser("root");
- // dataSource.setPassword("root");
- // }
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + */ +package org.eclipse.net4j.db.tests; + +/** + * @author Eike Stepper + */ +public class MysqlTest // extends AbstractDBTest<MysqlDataSource> +{ + // @Override + // protected IDBAdapter createDBAdapter() + // { + // return new org.eclipse.net4j.db.mysql.MYSQLAdapter(); + // } + // + // @Override + // protected void configureDataSource(MysqlDataSource dataSource) + // { + // dataSource.setDatabaseName("dbtest"); + // dataSource.setUser("root"); + // dataSource.setPassword("root"); + // } +} diff --git a/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/TestSchema.java b/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/TestSchema.java index 2391035295..abf56ff939 100644 --- a/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/TestSchema.java +++ b/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/TestSchema.java @@ -1,205 +1,205 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.db.tests;
-
-import org.eclipse.net4j.db.DBType;
-import org.eclipse.net4j.db.ddl.IDBField;
-import org.eclipse.net4j.db.ddl.IDBIndex;
-import org.eclipse.net4j.db.ddl.IDBTable;
-import org.eclipse.net4j.spi.db.DBSchema;
-
-/**
- * @author Eike Stepper
- */
-public class TestSchema extends DBSchema
-{
- public static final TestSchema INSTANCE = new TestSchema();
-
- /**
- * DBTable cdo_repository
- */
- public static final IDBTable REPOSITORY = INSTANCE.addTable("cdo_repository"); //$NON-NLS-1$
-
- public static final IDBField REPOSITORY_NAME = //
- REPOSITORY.addField("name", DBType.VARCHAR, 255); //$NON-NLS-1$
-
- public static final IDBField REPOSITORY_UUID = //
- REPOSITORY.addField("uuid", DBType.VARCHAR, 64); //$NON-NLS-1$
-
- public static final IDBField REPOSITORY_STARTS = //
- REPOSITORY.addField("starts", DBType.BIGINT); //$NON-NLS-1$
-
- public static final IDBField REPOSITORY_STARTED = //
- REPOSITORY.addField("started", DBType.BIGINT); //$NON-NLS-1$
-
- public static final IDBField REPOSITORY_STOPPED = //
- REPOSITORY.addField("stopped", DBType.BIGINT); //$NON-NLS-1$
-
- public static final IDBField REPOSITORY_NEXT_CDOID = //
- REPOSITORY.addField("next_cdoid", DBType.BIGINT); //$NON-NLS-1$
-
- /**
- * DBTable cdo_packages
- */
- public static final IDBTable PACKAGES = INSTANCE.addTable("cdo_packages"); //$NON-NLS-1$
-
- public static final IDBField PACKAGES_ID = //
- PACKAGES.addField("id", DBType.INTEGER); //$NON-NLS-1$
-
- public static final IDBField PACKAGES_URI = //
- PACKAGES.addField("uri", DBType.VARCHAR, 255); //$NON-NLS-1$
-
- public static final IDBField PACKAGES_NAME = //
- PACKAGES.addField("name", DBType.VARCHAR, 255); //$NON-NLS-1$
-
- public static final IDBField PACKAGES_ECORE = //
- PACKAGES.addField("ecore", DBType.CLOB); //$NON-NLS-1$
-
- public static final IDBField PACKAGES_DYNAMIC = //
- PACKAGES.addField("dynamic", DBType.BOOLEAN); //$NON-NLS-1$
-
- public static final IDBField PACKAGES_RANGE_LB = //
- PACKAGES.addField("range_lb", DBType.BIGINT); //$NON-NLS-1$
-
- public static final IDBField PACKAGES_RANGE_UB = //
- PACKAGES.addField("range_ub", DBType.BIGINT); //$NON-NLS-1$
-
- public static final IDBIndex INDEX_PACKAGES_PK = //
- PACKAGES.addIndex(IDBIndex.Type.PRIMARY_KEY, PACKAGES_ID);
-
- public static final IDBIndex INDEX_PACKAGES_URI = //
- PACKAGES.addIndex(IDBIndex.Type.UNIQUE, PACKAGES_URI);
-
- /**
- * DBTable cdo_classes
- */
- public static final IDBTable CLASSES = INSTANCE.addTable("cdo_classes"); //$NON-NLS-1$
-
- public static final IDBField CLASSES_ID = //
- CLASSES.addField("id", DBType.INTEGER); //$NON-NLS-1$
-
- public static final IDBField CLASSES_PACKAGE = //
- CLASSES.addField("package", DBType.INTEGER); //$NON-NLS-1$
-
- public static final IDBField CLASSES_CLASSIFIER = //
- CLASSES.addField("classifier", DBType.INTEGER); //$NON-NLS-1$
-
- public static final IDBField CLASSES_NAME = //
- CLASSES.addField("name", DBType.VARCHAR, 255); //$NON-NLS-1$
-
- public static final IDBField CLASSES_ABSTRACT = //
- CLASSES.addField("abstract", DBType.BOOLEAN); //$NON-NLS-1$
-
- public static final IDBIndex INDEX_CLASSES_PK = //
- CLASSES.addIndex(IDBIndex.Type.PRIMARY_KEY, CLASSES_ID);
-
- /**
- * DBTable cdo_supertypes
- */
- public static final IDBTable SUPERTYPES = INSTANCE.addTable("cdo_supertypes"); //$NON-NLS-1$
-
- public static final IDBField SUPERTYPES_TYPE = //
- SUPERTYPES.addField("type_id", DBType.INTEGER); //$NON-NLS-1$
-
- public static final IDBField SUPERTYPES_SUPERTYPE_PACKAGE = //
- SUPERTYPES.addField("supertype_package", DBType.VARCHAR, 255); //$NON-NLS-1$
-
- public static final IDBField SUPERTYPES_SUPERTYPE_CLASSIFIER = //
- SUPERTYPES.addField("supertype_classifier", DBType.INTEGER); //$NON-NLS-1$
-
- public static final IDBIndex INDEX_SUPERTYPES_PK = //
- SUPERTYPES.addIndex(IDBIndex.Type.PRIMARY_KEY, SUPERTYPES_TYPE);
-
- /**
- * DBTable cdo_features
- */
- public static final IDBTable FEATURES = INSTANCE.addTable("cdo_features"); //$NON-NLS-1$
-
- public static final IDBField FEATURES_ID = //
- FEATURES.addField("id", DBType.INTEGER); //$NON-NLS-1$
-
- public static final IDBField FEATURES_CLASS = //
- FEATURES.addField("class", DBType.INTEGER); //$NON-NLS-1$
-
- public static final IDBField FEATURES_FEATURE = //
- FEATURES.addField("feature", DBType.INTEGER); //$NON-NLS-1$
-
- public static final IDBField FEATURES_NAME = //
- FEATURES.addField("name", DBType.VARCHAR, 255); //$NON-NLS-1$
-
- public static final IDBField FEATURES_TYPE = //
- FEATURES.addField("type", DBType.INTEGER); //$NON-NLS-1$
-
- public static final IDBField FEATURES_REFERENCE_PACKAGE = //
- FEATURES.addField("reference_package", DBType.VARCHAR, 255); //$NON-NLS-1$
-
- public static final IDBField FEATURES_REFERENCE_CLASSIFIER = //
- FEATURES.addField("reference_classifier", DBType.INTEGER); //$NON-NLS-1$
-
- public static final IDBField FEATURES_MANY = //
- FEATURES.addField("many", DBType.BOOLEAN); //$NON-NLS-1$
-
- public static final IDBField FEATURES_CONTAINMENT = //
- FEATURES.addField("containment", DBType.BOOLEAN); //$NON-NLS-1$
-
- public static final IDBField FEATURES_INDEX = //
- FEATURES.addField("idx", DBType.INTEGER); //$NON-NLS-1$
-
- public static final IDBIndex INDEX_FEATURES_PK = //
- FEATURES.addIndex(IDBIndex.Type.PRIMARY_KEY, FEATURES_ID);
-
- /**
- * Name of object table
- */
- public static final String CDO_OBJECTS = "cdo_objects"; //$NON-NLS-1$
-
- /**
- * Field names of attribute tables
- */
- public static final String ATTRIBUTES_ID = "cdo_id"; //$NON-NLS-1$
-
- public static final String ATTRIBUTES_VERSION = "cdo_version"; //$NON-NLS-1$
-
- public static final String ATTRIBUTES_CLASS = "cdo_class"; //$NON-NLS-1$
-
- public static final String ATTRIBUTES_CREATED = "cdo_created"; //$NON-NLS-1$
-
- public static final String ATTRIBUTES_REVISED = "cdo_revised"; //$NON-NLS-1$
-
- public static final String ATTRIBUTES_RESOURCE = "cdo_resource"; //$NON-NLS-1$
-
- public static final String ATTRIBUTES_CONTAINER = "cdo_container"; //$NON-NLS-1$
-
- public static final String ATTRIBUTES_FEATURE = "cdo_feature"; //$NON-NLS-1$
-
- /**
- * Field names of reference tables
- */
- public static final String REFERENCES_FEATURE = "cdo_feature"; //$NON-NLS-1$
-
- public static final String REFERENCES_SOURCE = "cdo_source"; //$NON-NLS-1$
-
- public static final String REFERENCES_VERSION = "cdo_version"; //$NON-NLS-1$
-
- public static final String REFERENCES_IDX = "cdo_idx"; //$NON-NLS-1$
-
- public static final String REFERENCES_TARGET = "cdo_target"; //$NON-NLS-1$
-
- private TestSchema()
- {
- super("CDO"); //$NON-NLS-1$
- }
-
- static
- {
- INSTANCE.lock();
- }
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + */ +package org.eclipse.net4j.db.tests; + +import org.eclipse.net4j.db.DBType; +import org.eclipse.net4j.db.ddl.IDBField; +import org.eclipse.net4j.db.ddl.IDBIndex; +import org.eclipse.net4j.db.ddl.IDBTable; +import org.eclipse.net4j.spi.db.DBSchema; + +/** + * @author Eike Stepper + */ +public class TestSchema extends DBSchema +{ + public static final TestSchema INSTANCE = new TestSchema(); + + /** + * DBTable cdo_repository + */ + public static final IDBTable REPOSITORY = INSTANCE.addTable("cdo_repository"); //$NON-NLS-1$ + + public static final IDBField REPOSITORY_NAME = // + REPOSITORY.addField("name", DBType.VARCHAR, 255); //$NON-NLS-1$ + + public static final IDBField REPOSITORY_UUID = // + REPOSITORY.addField("uuid", DBType.VARCHAR, 64); //$NON-NLS-1$ + + public static final IDBField REPOSITORY_STARTS = // + REPOSITORY.addField("starts", DBType.BIGINT); //$NON-NLS-1$ + + public static final IDBField REPOSITORY_STARTED = // + REPOSITORY.addField("started", DBType.BIGINT); //$NON-NLS-1$ + + public static final IDBField REPOSITORY_STOPPED = // + REPOSITORY.addField("stopped", DBType.BIGINT); //$NON-NLS-1$ + + public static final IDBField REPOSITORY_NEXT_CDOID = // + REPOSITORY.addField("next_cdoid", DBType.BIGINT); //$NON-NLS-1$ + + /** + * DBTable cdo_packages + */ + public static final IDBTable PACKAGES = INSTANCE.addTable("cdo_packages"); //$NON-NLS-1$ + + public static final IDBField PACKAGES_ID = // + PACKAGES.addField("id", DBType.INTEGER); //$NON-NLS-1$ + + public static final IDBField PACKAGES_URI = // + PACKAGES.addField("uri", DBType.VARCHAR, 255); //$NON-NLS-1$ + + public static final IDBField PACKAGES_NAME = // + PACKAGES.addField("name", DBType.VARCHAR, 255); //$NON-NLS-1$ + + public static final IDBField PACKAGES_ECORE = // + PACKAGES.addField("ecore", DBType.CLOB); //$NON-NLS-1$ + + public static final IDBField PACKAGES_DYNAMIC = // + PACKAGES.addField("dynamic", DBType.BOOLEAN); //$NON-NLS-1$ + + public static final IDBField PACKAGES_RANGE_LB = // + PACKAGES.addField("range_lb", DBType.BIGINT); //$NON-NLS-1$ + + public static final IDBField PACKAGES_RANGE_UB = // + PACKAGES.addField("range_ub", DBType.BIGINT); //$NON-NLS-1$ + + public static final IDBIndex INDEX_PACKAGES_PK = // + PACKAGES.addIndex(IDBIndex.Type.PRIMARY_KEY, PACKAGES_ID); + + public static final IDBIndex INDEX_PACKAGES_URI = // + PACKAGES.addIndex(IDBIndex.Type.UNIQUE, PACKAGES_URI); + + /** + * DBTable cdo_classes + */ + public static final IDBTable CLASSES = INSTANCE.addTable("cdo_classes"); //$NON-NLS-1$ + + public static final IDBField CLASSES_ID = // + CLASSES.addField("id", DBType.INTEGER); //$NON-NLS-1$ + + public static final IDBField CLASSES_PACKAGE = // + CLASSES.addField("package", DBType.INTEGER); //$NON-NLS-1$ + + public static final IDBField CLASSES_CLASSIFIER = // + CLASSES.addField("classifier", DBType.INTEGER); //$NON-NLS-1$ + + public static final IDBField CLASSES_NAME = // + CLASSES.addField("name", DBType.VARCHAR, 255); //$NON-NLS-1$ + + public static final IDBField CLASSES_ABSTRACT = // + CLASSES.addField("abstract", DBType.BOOLEAN); //$NON-NLS-1$ + + public static final IDBIndex INDEX_CLASSES_PK = // + CLASSES.addIndex(IDBIndex.Type.PRIMARY_KEY, CLASSES_ID); + + /** + * DBTable cdo_supertypes + */ + public static final IDBTable SUPERTYPES = INSTANCE.addTable("cdo_supertypes"); //$NON-NLS-1$ + + public static final IDBField SUPERTYPES_TYPE = // + SUPERTYPES.addField("type_id", DBType.INTEGER); //$NON-NLS-1$ + + public static final IDBField SUPERTYPES_SUPERTYPE_PACKAGE = // + SUPERTYPES.addField("supertype_package", DBType.VARCHAR, 255); //$NON-NLS-1$ + + public static final IDBField SUPERTYPES_SUPERTYPE_CLASSIFIER = // + SUPERTYPES.addField("supertype_classifier", DBType.INTEGER); //$NON-NLS-1$ + + public static final IDBIndex INDEX_SUPERTYPES_PK = // + SUPERTYPES.addIndex(IDBIndex.Type.PRIMARY_KEY, SUPERTYPES_TYPE); + + /** + * DBTable cdo_features + */ + public static final IDBTable FEATURES = INSTANCE.addTable("cdo_features"); //$NON-NLS-1$ + + public static final IDBField FEATURES_ID = // + FEATURES.addField("id", DBType.INTEGER); //$NON-NLS-1$ + + public static final IDBField FEATURES_CLASS = // + FEATURES.addField("class", DBType.INTEGER); //$NON-NLS-1$ + + public static final IDBField FEATURES_FEATURE = // + FEATURES.addField("feature", DBType.INTEGER); //$NON-NLS-1$ + + public static final IDBField FEATURES_NAME = // + FEATURES.addField("name", DBType.VARCHAR, 255); //$NON-NLS-1$ + + public static final IDBField FEATURES_TYPE = // + FEATURES.addField("type", DBType.INTEGER); //$NON-NLS-1$ + + public static final IDBField FEATURES_REFERENCE_PACKAGE = // + FEATURES.addField("reference_package", DBType.VARCHAR, 255); //$NON-NLS-1$ + + public static final IDBField FEATURES_REFERENCE_CLASSIFIER = // + FEATURES.addField("reference_classifier", DBType.INTEGER); //$NON-NLS-1$ + + public static final IDBField FEATURES_MANY = // + FEATURES.addField("many", DBType.BOOLEAN); //$NON-NLS-1$ + + public static final IDBField FEATURES_CONTAINMENT = // + FEATURES.addField("containment", DBType.BOOLEAN); //$NON-NLS-1$ + + public static final IDBField FEATURES_INDEX = // + FEATURES.addField("idx", DBType.INTEGER); //$NON-NLS-1$ + + public static final IDBIndex INDEX_FEATURES_PK = // + FEATURES.addIndex(IDBIndex.Type.PRIMARY_KEY, FEATURES_ID); + + /** + * Name of object table + */ + public static final String CDO_OBJECTS = "cdo_objects"; //$NON-NLS-1$ + + /** + * Field names of attribute tables + */ + public static final String ATTRIBUTES_ID = "cdo_id"; //$NON-NLS-1$ + + public static final String ATTRIBUTES_VERSION = "cdo_version"; //$NON-NLS-1$ + + public static final String ATTRIBUTES_CLASS = "cdo_class"; //$NON-NLS-1$ + + public static final String ATTRIBUTES_CREATED = "cdo_created"; //$NON-NLS-1$ + + public static final String ATTRIBUTES_REVISED = "cdo_revised"; //$NON-NLS-1$ + + public static final String ATTRIBUTES_RESOURCE = "cdo_resource"; //$NON-NLS-1$ + + public static final String ATTRIBUTES_CONTAINER = "cdo_container"; //$NON-NLS-1$ + + public static final String ATTRIBUTES_FEATURE = "cdo_feature"; //$NON-NLS-1$ + + /** + * Field names of reference tables + */ + public static final String REFERENCES_FEATURE = "cdo_feature"; //$NON-NLS-1$ + + public static final String REFERENCES_SOURCE = "cdo_source"; //$NON-NLS-1$ + + public static final String REFERENCES_VERSION = "cdo_version"; //$NON-NLS-1$ + + public static final String REFERENCES_IDX = "cdo_idx"; //$NON-NLS-1$ + + public static final String REFERENCES_TARGET = "cdo_target"; //$NON-NLS-1$ + + private TestSchema() + { + super("CDO"); //$NON-NLS-1$ + } + + static + { + INSTANCE.lock(); + } +} diff --git a/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/bundle/Activator.java b/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/bundle/Activator.java index 672d548d25..d42130fbf3 100644 --- a/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/bundle/Activator.java +++ b/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/bundle/Activator.java @@ -1,28 +1,28 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.db.tests.bundle;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-/**
- * @author Eike Stepper
- */
-public class Activator implements BundleActivator
-{
- public void start(BundleContext context) throws Exception
- {
- }
-
- public void stop(BundleContext context) throws Exception
- {
- }
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + */ +package org.eclipse.net4j.db.tests.bundle; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; + +/** + * @author Eike Stepper + */ +public class Activator implements BundleActivator +{ + public void start(BundleContext context) throws Exception + { + } + + public void stop(BundleContext context) throws Exception + { + } +} |