Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

did proof of concept c# implementation reusing ikvm'ed java core libr…

…ary. Does not work yet, but pieces are in place to pick up at a later date

git-svn-id: http://liquibase.jira.com/svn/CORE/trunk@1005 e6edf6fb-f266-4316-afb4-e53d95876a76
  • Loading branch information...
commit 50540eb353f38d11d80fa7cf8e94be9d6364d5fa 1 parent dd47dc3
nvoxland authored
Showing with 1,218 additions and 110 deletions.
  1. BIN  core-clr/lib-deps/IKVM.OpenJDK.Core.dll
  2. BIN  core-clr/lib-deps/IKVM.OpenJDK.Jdbc.dll
  3. BIN  core-clr/lib-deps/IKVM.OpenJDK.Security.dll
  4. BIN  core-clr/lib-deps/IKVM.OpenJDK.Text.dll
  5. BIN  core-clr/lib-deps/IKVM.OpenJDK.Util.dll
  6. BIN  core-clr/lib-deps/IKVM.OpenJDK.XML.dll
  7. BIN  core-clr/lib-deps/IKVM.Runtime.dll
  8. BIN  core-clr/lib-deps/liquibase-core.dll
  9. +25 −0 core-clr/liquibase/LiquiBase/AssemblyResourceLoader.cs
  10. +58 −0 core-clr/liquibase/LiquiBase/ClrClassPathScanner.cs
  11. +83 −0 core-clr/liquibase/LiquiBase/Database/AdoConnection.cs
  12. +46 −0 core-clr/liquibase/LiquiBase/Executor/Core/ClrWriteExecutor.cs
  13. +10 −0 core-clr/liquibase/LiquiBase/LiquiBase.cs
  14. +96 −0 core-clr/liquibase/LiquiBase/LiquiBase.csproj
  15. +36 −0 core-clr/liquibase/LiquiBase/Properties/AssemblyInfo.cs
  16. +22 −0 core-clr/liquibase/LiquiBase/Resource/ClrResourceAccessor.cs
  17. +57 −0 core-clr/liquibase/LiquiBase/Snapshot/Core/OleDatabaseSnapshotGenerator.cs
  18. +97 −0 core-clr/liquibase/LiquiBaseConsole/LiquiBaseConsole.csproj
  19. +31 −0 core-clr/liquibase/LiquiBaseConsole/Program.cs
  20. +36 −0 core-clr/liquibase/LiquiBaseConsole/Properties/AssemblyInfo.cs
  21. +136 −0 core-clr/liquibase/LiquiBaseTest/AuthoringTests.txt
  22. +122 −0 core-clr/liquibase/LiquiBaseTest/Database/AdoConnectionTest.cs
  23. +98 −0 core-clr/liquibase/LiquiBaseTest/LiquiBaseTest.csproj
  24. +72 −0 core-clr/liquibase/LiquiBaseTest/Plugin/ClassPathScannerTest.cs
  25. +35 −0 core-clr/liquibase/LiquiBaseTest/Properties/AssemblyInfo.cs
  26. +5 −0 core-clr/liquibase/LocalTestRun.testrunconfig
  27. +38 −0 core-clr/liquibase/liquibase.sln
  28. +6 −0 core-clr/liquibase/liquibase.vsmdi
  29. +1 −2  core-jvm/src/java-dbtest/liquibase/dbtest/AbstractSimpleChangeLogRunnerTest.java
  30. +1 −2  core-jvm/src/java-test/liquibase/database/core/MockDatabase.java
  31. +1 −2  core-jvm/src/java-test/liquibase/{lock → lockservice}/LockServiceExecuteTest.java
  32. +1 −1  core-jvm/src/java-test/liquibase/{lock → lockservice}/LockServiceTest.java
  33. +1 −1  core-jvm/src/java-test/liquibase/test/DatabaseTestTemplate.java
  34. +0 −51 core-jvm/src/java/liquibase/database/DatabaseFactoryJdbc.java
  35. +1 −1  core-jvm/src/java/liquibase/integration/commandline/Main.java
  36. BIN  core/lib-compile/ant-ikvmc.0.5.jar
  37. +17 −5 core/src/build.xml
  38. +2 −2 core/src/java/liquibase/Liquibase.java
  39. +0 −8 core/src/java/liquibase/database/AbstractDatabase.java
  40. +0 −2  core/src/java/liquibase/database/Database.java
  41. +32 −11 core/src/java/liquibase/database/DatabaseFactory.java
  42. +1 −1  core/src/java/liquibase/database/core/CacheDatabase.java
  43. +1 −1  core/src/java/liquibase/database/core/DB2Database.java
  44. +1 −1  core/src/java/liquibase/database/core/DerbyDatabase.java
  45. +1 −1  core/src/java/liquibase/database/core/FirebirdDatabase.java
  46. +1 −1  core/src/java/liquibase/database/core/H2Database.java
  47. +1 −1  core/src/java/liquibase/database/core/HsqlDatabase.java
  48. +1 −1  core/src/java/liquibase/database/core/InformixDatabase.java
  49. +3 −1 core/src/java/liquibase/database/core/MSSQLDatabase.java
  50. +1 −1  core/src/java/liquibase/database/core/MaxDBDatabase.java
  51. +1 −1  core/src/java/liquibase/database/core/MySQLDatabase.java
  52. +1 −1  core/src/java/liquibase/database/core/OracleDatabase.java
  53. +1 −1  core/src/java/liquibase/database/core/PostgresDatabase.java
  54. +1 −1  core/src/java/liquibase/database/core/SQLiteDatabase.java
  55. +2 −2 core/src/java/liquibase/database/core/SybaseASADatabase.java
  56. +1 −1  core/src/java/liquibase/database/core/SybaseDatabase.java
  57. +1 −1  core/src/java/liquibase/{lock → lockservice}/DatabaseChangeLogLock.java
  58. +1 −1  core/src/java/liquibase/{lock → lockservice}/LockService.java
  59. +32 −4 core/src/java/liquibase/util/plugin/ClassPathScanner.java
View
BIN  core-clr/lib-deps/IKVM.OpenJDK.Core.dll
Binary file not shown
View
BIN  core-clr/lib-deps/IKVM.OpenJDK.Jdbc.dll
Binary file not shown
View
BIN  core-clr/lib-deps/IKVM.OpenJDK.Security.dll
Binary file not shown
View
BIN  core-clr/lib-deps/IKVM.OpenJDK.Text.dll
Binary file not shown
View
BIN  core-clr/lib-deps/IKVM.OpenJDK.Util.dll
Binary file not shown
View
BIN  core-clr/lib-deps/IKVM.OpenJDK.XML.dll
Binary file not shown
View
BIN  core-clr/lib-deps/IKVM.Runtime.dll
Binary file not shown
View
BIN  core-clr/lib-deps/liquibase-core.dll
Binary file not shown
View
25 core-clr/liquibase/LiquiBase/AssemblyResourceLoader.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Liquibase.Resource {
+ class AssemblyResourceLoader : liquibase.resource.ResourceAccessor {
+
+ #region ResourceAccessor Members
+
+ public java.io.InputStream getResourceAsStream(string str) {
+ throw new NotImplementedException();
+ }
+
+ public java.util.Enumeration getResources(string str) {
+ throw new NotImplementedException();
+ }
+
+ public java.lang.ClassLoader toClassLoader() {
+ throw new NotImplementedException();
+ }
+
+ #endregion
+ }
+}
View
58 core-clr/liquibase/LiquiBase/ClrClassPathScanner.cs
@@ -0,0 +1,58 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using liquibase.util.plugin;
+using System.Reflection;
+using liquibase.resource;
+using java.lang;
+
+namespace LiquiBase {
+ public class ClrClassPathScanner : ClassPathScanner {
+
+
+ public ClrClassPathScanner() : base(null) {
+ }
+
+ public override void setResourceAccessor(liquibase.resource.ResourceAccessor resourceAccessor) {
+ }
+
+ public override java.lang.Class[] getClasses(java.lang.Class requiredInterface) {
+ //Console.WriteLine("looking up " + requiredInterface.getName());
+ List<Class> returnClasses = new List<Class>();
+
+ Type requiredType = Type.GetType(requiredInterface.getName()+", liquibase-core");
+ if (requiredType == null) {
+ Console.WriteLine("could not find required type for " + requiredInterface.getName());
+ return new java.lang.Class[0];
+ }
+
+ Assembly assembly = Assembly.GetExecutingAssembly();
+ foreach (Type type in assembly.GetTypes()) {
+ //if (type.AssemblyQualifiedName.Contains("LiquiBase")) {
+ // Console.WriteLine("type: " + type);
+ //}
+ if (!type.IsInterface && !type.IsAbstract && requiredType.IsAssignableFrom(type)) {
+ //Console.WriteLine("Adding class " + type.AssemblyQualifiedName);
+ returnClasses.Add(Class.forName(type.AssemblyQualifiedName));
+ }
+ }
+
+ foreach (AssemblyName refAsm in assembly.GetReferencedAssemblies()) {
+
+ foreach (Type type in Assembly.Load(refAsm).GetTypes()) {
+ //if (type.AssemblyQualifiedName.Contains("LiquiBase")) {
+ // Console.WriteLine("type: " + type);
+ //}
+ if (!type.IsInterface && !type.IsAbstract && requiredType.IsAssignableFrom(type)) {
+ //Console.WriteLine("Adding class " + type.AssemblyQualifiedName);
+ returnClasses.Add(Class.forName(type.AssemblyQualifiedName));
+ }
+ }
+ }
+
+ return returnClasses.ToArray();
+
+ }
+ }
+}
View
83 core-clr/liquibase/LiquiBase/Database/AdoConnection.cs
@@ -0,0 +1,83 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Data.SqlClient;
+using liquibase.database;
+using System.Data.OleDb;
+
+namespace LiquiBase.Database {
+
+ public class AdoConnection : DatabaseConnection {
+
+ OleDbConnection conn;
+ OleDbTransaction transaction;
+
+ public AdoConnection() {
+ conn = new OleDbConnection("Provider=SQLOLEDB;Data Source=localhost\\SQL2005;Initial Catalog=liquibase;User Id=liquibase;Password=liquibase;");
+ conn.Open();
+ transaction = conn.BeginTransaction();
+ }
+
+ public OleDbConnection GetUnderlyingConnection() {
+ return conn;
+
+ }
+ void DatabaseConnection.close() {
+ conn.Close();
+ }
+
+ void DatabaseConnection.commit() {
+ transaction.Commit();
+ }
+
+ bool DatabaseConnection.getAutoCommit() {
+ return transaction == null;
+ }
+
+ string DatabaseConnection.getCatalog() {
+ return null;
+ }
+
+ string DatabaseConnection.getConnectionUserName() {
+ return "liquibase"; //todo
+ }
+
+ int DatabaseConnection.getDatabaseMajorVersion() {
+ return 1; //todo
+ }
+
+ int DatabaseConnection.getDatabaseMinorVersion() {
+ return 1; //todo
+ }
+
+ string DatabaseConnection.getDatabaseProductName() {
+ return conn.Provider;
+ }
+
+ string DatabaseConnection.getDatabaseProductVersion() {
+ return conn.ServerVersion;
+ }
+
+ string DatabaseConnection.getURL() {
+ return conn.ConnectionString;
+ }
+
+ string DatabaseConnection.nativeSQL(string str) {
+ return str; //todo
+ }
+
+ void DatabaseConnection.rollback() {
+ transaction.Rollback();
+ }
+
+ void DatabaseConnection.setAutoCommit(bool b) {
+ if (b) {
+ transaction = conn.BeginTransaction();
+ } else {
+ transaction = null;
+ }
+ }
+
+ }
+}
View
46 core-clr/liquibase/LiquiBase/Executor/Core/ClrWriteExecutor.cs
@@ -0,0 +1,46 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using LiquiBase.Database;
+
+namespace LiquiBase.Executor.Core {
+ public class ClrWriteExecutor : liquibase.executor.AbstractExecutor, liquibase.executor.WriteExecutor {
+
+ public java.util.Map call(liquibase.statement.CallableSqlStatement css, java.util.List l1, java.util.List l2) {
+ throw new NotImplementedException();
+ }
+
+ public void comment(string str) {
+ throw new NotImplementedException();
+ }
+
+ public void execute(liquibase.statement.SqlStatement ss) {
+ Console.WriteLine("execute " + ss);
+ }
+
+ public void execute(liquibase.statement.SqlStatement ss, java.util.List l) {
+ Console.WriteLine("execute " + ss);
+ }
+
+ public bool executesStatements() {
+ throw new NotImplementedException();
+ }
+
+ public void setDatabase(liquibase.database.Database d) {
+ throw new NotImplementedException();
+ }
+
+ public int update(liquibase.statement.SqlStatement ss) {
+ Console.WriteLine("update " + ss);
+ return 1;
+ }
+
+ public int update(liquibase.statement.SqlStatement ss, java.util.List l) {
+ Console.WriteLine("execute " + ss);
+
+ return 1;
+ }
+
+ }
+}
View
10 core-clr/liquibase/LiquiBase/LiquiBase.cs
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace LiquiBase {
+ public class LiquiBase {
+
+ }
+}
View
96 core-clr/liquibase/LiquiBase/LiquiBase.csproj
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.30729</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{2A4C22C1-4DC9-407E-B559-758694B53BDE}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>LiquiBase</RootNamespace>
+ <AssemblyName>liquibase-clr</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="IKVM.OpenJDK.Core, Version=0.40.0.1, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib-deps\IKVM.OpenJDK.Core.dll</HintPath>
+ </Reference>
+ <Reference Include="IKVM.OpenJDK.Jdbc, Version=0.40.0.1, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib-deps\IKVM.OpenJDK.Jdbc.dll</HintPath>
+ </Reference>
+ <Reference Include="IKVM.OpenJDK.Text, Version=0.40.0.1, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib-deps\IKVM.OpenJDK.Text.dll</HintPath>
+ </Reference>
+ <Reference Include="IKVM.OpenJDK.Util, Version=0.40.0.1, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib-deps\IKVM.OpenJDK.Util.dll</HintPath>
+ </Reference>
+ <Reference Include="IKVM.OpenJDK.XML, Version=0.40.0.1, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib-deps\IKVM.OpenJDK.XML.dll</HintPath>
+ </Reference>
+ <Reference Include="IKVM.Runtime, Version=0.40.0.1, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib-deps\IKVM.Runtime.dll</HintPath>
+ </Reference>
+ <Reference Include="liquibase-core, Version=0.0.0.1, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib-deps\liquibase-core.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Core">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Xml.Linq">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Data.DataSetExtensions">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="AssemblyResourceLoader.cs" />
+ <Compile Include="ClrClassPathScanner.cs" />
+ <Compile Include="Database\AdoConnection.cs" />
+ <Compile Include="Executor\Core\ClrWriteExecutor.cs" />
+ <Compile Include="LiquiBase.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Resource\ClrResourceAccessor.cs" />
+ <Compile Include="Snapshot\Core\OleDatabaseSnapshotGenerator.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Folder Include="Plugin\" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
View
36 core-clr/liquibase/LiquiBase/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("liquibase")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("liquibase")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2009")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("0d080986-189b-4b3e-a3ca-21ba69a5284a")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
View
22 core-clr/liquibase/LiquiBase/Resource/ClrResourceAccessor.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace LiquiBase.Resource {
+ class ClrResourceAccessor : liquibase.resource.ResourceAccessor {
+
+ public java.io.InputStream getResourceAsStream(string str) {
+ throw new NotImplementedException();
+ }
+
+ public java.util.Enumeration getResources(string str) {
+ throw new NotImplementedException();
+ }
+
+ public java.lang.ClassLoader toClassLoader() {
+ throw new NotImplementedException();
+ }
+
+ }
+}
View
57 core-clr/liquibase/LiquiBase/Snapshot/Core/OleDatabaseSnapshotGenerator.cs
@@ -0,0 +1,57 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using liquibase.snapshot;
+using LiquiBase.Database;
+using System.Data.OleDb;
+using System.Data;
+using liquibase.database.structure;
+
+namespace LiquiBase.Snapshot.Core {
+ public class OleDatabaseSnapshotGenerator : DatabaseSnapshotGenerator {
+
+ public int getPriority(liquibase.database.Database d) {
+ return 5;
+ }
+
+ public bool supports(liquibase.database.Database d) {
+ return true;
+ }
+
+ public DatabaseSnapshot createSnapshot(liquibase.database.Database database, string schema, java.util.Set listeners) {
+ DatabaseSnapshot snapshot = new DatabaseSnapshot(database, schema);
+
+ OleDbConnection conn = ((AdoConnection)database.getConnection()).GetUnderlyingConnection();
+
+ string[] restrictions = new string[4];
+ restrictions[3] = "Table";
+
+ DataTable tables = conn.GetSchema("Tables", restrictions);
+
+ foreach (DataRow row in tables.Rows) {
+ Table table = new Table(row.Field<String>("TABLE_NAME"));
+ table.setSchema(row.Field<String>("TABLE_SCHEMA"));
+
+ snapshot.getTables().add(table);
+
+ DataTable tableInfo = conn.GetSchema("Columns", new string[4] { null, null, table.getName(), null });
+
+ foreach (DataRow colRow in tableInfo.Rows) {
+ Column column = new Column();
+ column.setName(colRow.Field<string>("COLUMN_NAME"));
+ column.setTable(table);
+ //column.setTypeName(colRow.Field<string>("DATA_TYPE"));
+ //column.setColumnSize(colRow.Field<int>("NUMERIC_SCALE"));
+
+ table.getColumns().add(column);
+ }
+ }
+
+ return snapshot;
+
+ }
+
+
+ }
+}
View
97 core-clr/liquibase/LiquiBaseConsole/LiquiBaseConsole.csproj
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.30729</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{F736E0FE-E0B6-46DF-B792-43BF98EB55A1}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>console</RootNamespace>
+ <AssemblyName>console</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="IKVM.OpenJDK.Core, Version=0.40.0.1, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib-deps\IKVM.OpenJDK.Core.dll</HintPath>
+ </Reference>
+ <Reference Include="IKVM.OpenJDK.Jdbc, Version=0.40.0.1, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib-deps\IKVM.OpenJDK.Jdbc.dll</HintPath>
+ </Reference>
+ <Reference Include="IKVM.OpenJDK.Security, Version=0.40.0.1, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib-deps\IKVM.OpenJDK.Security.dll</HintPath>
+ </Reference>
+ <Reference Include="IKVM.OpenJDK.Text, Version=0.40.0.1, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib-deps\IKVM.OpenJDK.Text.dll</HintPath>
+ </Reference>
+ <Reference Include="IKVM.OpenJDK.Util, Version=0.40.0.1, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib-deps\IKVM.OpenJDK.Util.dll</HintPath>
+ </Reference>
+ <Reference Include="IKVM.OpenJDK.XML, Version=0.40.0.1, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib-deps\IKVM.OpenJDK.XML.dll</HintPath>
+ </Reference>
+ <Reference Include="IKVM.Runtime, Version=0.40.0.1, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib-deps\IKVM.Runtime.dll</HintPath>
+ </Reference>
+ <Reference Include="liquibase-core, Version=0.0.0.1, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib-deps\liquibase-core.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Core">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Xml.Linq">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Data.DataSetExtensions">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\liquibase\LiquiBase.csproj">
+ <Project>{2A4C22C1-4DC9-407E-B559-758694B53BDE}</Project>
+ <Name>LiquiBase</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
View
31 core-clr/liquibase/LiquiBaseConsole/Program.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using java.lang;
+using liquibase.database;
+using liquibase.util.plugin;
+using System.Reflection;
+using liquibase;
+using liquibase.snapshot;
+using LiquiBase.Database;
+using liquibase.lockservice;
+
+namespace console {
+ class Program {
+ static void Main(string[] args) {
+ Console.WriteLine("hello");
+
+ DatabaseConnection conn = new AdoConnection();
+ Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(conn);
+
+ //Console.WriteLine("Found database " + database + " of type " + database.GetType());
+
+
+ LockService lockService = LockService.getInstance(database);
+ lockService.waitForLock();
+
+ Console.Read();
+ }
+ }
+}
View
36 core-clr/liquibase/LiquiBaseConsole/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("console")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("console")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2009")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("174b9712-17e3-4285-88e0-39f9192a5d8e")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
View
136 core-clr/liquibase/LiquiBaseTest/AuthoringTests.txt
@@ -0,0 +1,136 @@
+==========================================================================
+ Visual Studio Team System: Overview of Authoring and Running Tests
+==========================================================================
+
+This overview describes the features for authoring and running tests in
+Visual Studio Team System and Visual Studio Team Edition for Software Testers.
+
+Opening Tests
+-------------
+To open a test, open a test project or a test metadata file (a file with
+extension .vsmdi) that contains the definition of the test. You can find
+test projects and metadata files in Solution Explorer.
+
+Viewing Tests
+-------------
+To see which tests are available to you, open the Test View window. Or,
+if you have installed Team Edition for Software Testers, you can also open
+the Test List Editor window to view tests.
+
+To open the Test View window, click the Test menu, point to Windows, and
+then click Test View. To open the Test List Editor window (if you have
+installed Team Edition for Software Testers), click Test, point to Windows,
+and then click Test List Editor.
+
+Running Tests
+-------------
+You can run tests from the Test View window and the Test List Editor window.
+See Viewing Tests to learn how to open these windows. To run one or more
+tests displayed in the Test View window, first select the tests in that
+window; to select multiple tests, hold either the Shift or CTRL key while
+clicking tests. Then click the Run Tests button in the Test View window
+toolbar.
+
+If you have installed Visual Studio Team Edition for Software Testers, you can
+also use the Test List Editor window to run tests. To run tests in Test List Editor,
+select the check box next to each test that you want to run. Then click the
+Run Tests button in the Test List Editor window toolbar.
+
+Viewing Test Results
+--------------------
+When you run a test or a series of tests, the results of the test run will be
+shown in the Test Results window. Each individual test in the run is shown on
+a separate line so that you can see its status. The window contains an
+embedded status bar in the top half of the window that provides you with
+summary details of the complete test run.
+
+To see more detailed results for a particular test result, double-click it in
+the Test Results window. This opens a window that provides more information
+about the particular test result, such as any specific error messages returned
+by the test.
+
+Changing the way that tests are run
+-----------------------------------
+Each time you run one or more tests, a collection of settings is used to
+determine how those tests are run. These settings are contained in a “test
+run configuration” file.
+
+Here is a partial list of the changes you can make with a test run
+configuration file:
+
+ - Change the naming scheme for each test run.
+ - Change the test controller that the tests are run on so that you can run
+ tests remotely.
+ - Gather code coverage data for the code being tested so that you can see
+ which lines of code are covered by your tests.
+ - Enable and disable test deployment.
+ - Specify additional files to deploy before tests are run.
+ - Select a different host, ASP.NET, for running ASP.NET unit tests.
+ - Select a different host, the smart device test host, for running smart device unit tests.
+ - Set various properties for the test agents that run your tests.
+ - Run custom scripts at the start and end of each test run so that you can
+ set up the test environment exactly as required each time tests are run.
+ - Set time limits for tests and test runs.
+ - Set the browser mix and the number of times to repeat Web tests in the
+ test run.
+
+By default, a test run configuration file is created whenever you create a
+new test project. You make changes to this file by double-clicking it in
+Solution Explorer and then changing its settings. (Test run configuration
+files have the extension .testrunconfig.)
+
+A solution can contain multiple test run configuration files. Only one of
+those files, known as the “Active” test run configuration file, is used to
+determine the settings that are currently used for test runs. You select
+the active test run configuration by clicking Select Active Test Run
+Configuration on the Test menu.
+
+-------------------------------------------------------------------------------
+
+Test Types
+----------
+Using Visual Studio Team Edition for Software Testers, you can create a number
+of different test types:
+
+Unit test: Use a unit test to create a programmatic test in C++, Visual C# or
+Visual Basic that exercises source code. A unit test calls the methods of a
+class, passing suitable parameters, and verifies that the returned value is
+what you expect.
+There are three specialized variants of unit tests:
+ - Data-driven unit tests are created when you configure a unit test to be
+ called repeatedly for each row of a data source. The data from each row
+ is used by the unit test as input data.
+ - ASP.NET unit tests are unit tests that exercise code in an ASP.NET Web
+ application.
+ - Smart device unit tests are unit tests that are deployed to a smart device
+ or emulator and then executed by the smart device test host.
+
+Web Test: Web tests consist of an ordered series of HTTP requests that you
+record in a browser session using Microsoft Internet Explorer. You can have
+the test report specific details about the pages or sites it requests, such
+as whether a particular page contains a specified string.
+
+Load Test: You use a load test to encapsulate non-manual tests, such as
+unit, Web, and generic tests, and then run them simultaneously by using
+virtual users. Running these tests under load generates test results,
+including performance and other counters, in tables and in graphs.
+
+Generic test: A generic test is an existing program wrapped to function as a
+test in Visual Studio. The following are examples of tests or programs that
+you can turn into generic tests:
+ - An existing test that uses process exit codes to communicate whether the
+ test passed or failed. 0 indicates passing and any other value indicates
+ a failure.
+ - A general program to obtain specific functionality during a test scenario.
+ - A test or program that uses a special XML file (called a “summary results
+ file”), to communicate detailed results.
+
+Manual test: The manual test type is used when the test tasks are to be
+completed by a test engineer as opposed to an automated script.
+
+Ordered test: Use an ordered test to execute a set of tests in an order you
+specify.
+
+-------------------------------------------------------------------------------
+
+
View
122 core-clr/liquibase/LiquiBaseTest/Database/AdoConnectionTest.cs
@@ -0,0 +1,122 @@
+using LiquiBase;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using liquibase.database;
+using LiquiBase.Database;
+
+namespace liquibase_test.Database
+{
+
+
+ /// <summary>
+ ///This is a test class for CsConnectionTest and is intended
+ ///to contain all CsConnectionTest Unit Tests
+ ///</summary>
+ [TestClass()]
+ public class AdoConnectionTest {
+
+
+ private TestContext testContextInstance;
+
+ /// <summary>
+ ///Gets or sets the test context which provides
+ ///information about and functionality for the current test run.
+ ///</summary>
+ public TestContext TestContext {
+ get {
+ return testContextInstance;
+ }
+ set {
+ testContextInstance = value;
+ }
+ }
+
+ #region Additional test attributes
+ //
+ //You can use the following additional attributes as you write your tests:
+ //
+ //Use ClassInitialize to run code before running the first test in the class
+ //[ClassInitialize()]
+ //public static void MyClassInitialize(TestContext testContext)
+ //{
+ //}
+ //
+ //Use ClassCleanup to run code after all tests in a class have run
+ //[ClassCleanup()]
+ //public static void MyClassCleanup()
+ //{
+ //}
+ //
+ //Use TestInitialize to run code before running each test
+ //[TestInitialize()]
+ //public void MyTestInitialize()
+ //{
+ //}
+ //
+ //Use TestCleanup to run code after each test has run
+ //[TestCleanup()]
+ //public void MyTestCleanup()
+ //{
+ //}
+ //
+ #endregion
+
+
+ /// <summary>
+ ///A test for CsConnection Constructor
+ ///</summary>
+ [TestMethod()]
+ public void CsConnectionConstructorTest() {
+ AdoConnection target = new AdoConnection();
+
+ Assert.IsNotNull(target.GetUnderlyingConnection());
+ }
+
+ /// <summary>
+ ///A test for liquibase.database.DatabaseConnection.rollback
+ ///</summary>
+ [TestMethod()]
+ [DeploymentItem("liquibase.dll")]
+ public void rollbackTest() {
+ DatabaseConnection target = new AdoConnection();
+ target.rollback();
+ }
+
+ /// <summary>
+ ///A test for liquibase.database.DatabaseConnection.commit
+ ///</summary>
+ [TestMethod()]
+ [DeploymentItem("liquibase.dll")]
+ public void commitTest() {
+ DatabaseConnection target = new AdoConnection();
+ target.commit();
+ }
+
+ /// <summary>
+ ///A test for liquibase.database.DatabaseConnection.close
+ ///</summary>
+ [TestMethod()]
+ [DeploymentItem("liquibase.dll")]
+ public void closeTest() {
+ DatabaseConnection target = new AdoConnection();
+ target.close();
+ }
+
+ /// <summary>
+ ///A test for liquibase.database.DatabaseConnection.getURL
+ ///</summary>
+ [TestMethod()]
+ [DeploymentItem("liquibase.dll")]
+ public void getURLTest() {
+ DatabaseConnection target = new AdoConnection();
+ Assert.AreEqual("Provider=SQLOLEDB;Data Source=localhost\\SQL2005;Initial Catalog=liquibase;User Id=liquibase;", target.getURL());
+ }
+
+ [TestMethod()]
+ [DeploymentItem("liquibase.dll")]
+ public void getProductNameTest() {
+ DatabaseConnection target = new AdoConnection();
+ Assert.AreEqual("asdf", target.getDatabaseProductName());
+ }
+
+ }
+}
View
98 core-clr/liquibase/LiquiBaseTest/LiquiBaseTest.csproj
@@ -0,0 +1,98 @@
+<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.30729</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{30FA384E-3983-422F-BF14-1FD54A04A54E}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>LiquiBase_Test</RootNamespace>
+ <AssemblyName>liquibase-test</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="IKVM.OpenJDK.Core, Version=0.40.0.1, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib-deps\IKVM.OpenJDK.Core.dll</HintPath>
+ </Reference>
+ <Reference Include="IKVM.OpenJDK.Jdbc, Version=0.40.0.1, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib-deps\IKVM.OpenJDK.Jdbc.dll</HintPath>
+ </Reference>
+ <Reference Include="IKVM.OpenJDK.Text, Version=0.40.0.1, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib-deps\IKVM.OpenJDK.Text.dll</HintPath>
+ </Reference>
+ <Reference Include="IKVM.OpenJDK.Util, Version=0.40.0.1, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib-deps\IKVM.OpenJDK.Util.dll</HintPath>
+ </Reference>
+ <Reference Include="IKVM.OpenJDK.XML, Version=0.40.0.1, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib-deps\IKVM.OpenJDK.XML.dll</HintPath>
+ </Reference>
+ <Reference Include="IKVM.Runtime, Version=0.40.0.1, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib-deps\IKVM.Runtime.dll</HintPath>
+ </Reference>
+ <Reference Include="liquibase-core, Version=0.0.0.1, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib-deps\liquibase-core.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
+ <Reference Include="System" />
+ <Reference Include="System.Core">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Data" />
+ <Reference Include="System.Data.DataSetExtensions">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Xml" />
+ <Reference Include="System.Xml.Linq">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Database\AdoConnectionTest.cs" />
+ <Compile Include="Plugin\ClassPathScannerTest.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="AuthoringTests.txt" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\liquibase\LiquiBase.csproj">
+ <Project>{2A4C22C1-4DC9-407E-B559-758694B53BDE}</Project>
+ <Name>LiquiBase</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
View
72 core-clr/liquibase/LiquiBaseTest/Plugin/ClassPathScannerTest.cs
@@ -0,0 +1,72 @@
+using System;
+using System.Text;
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using liquibase.util.plugin;
+using LiquiBase.Database;
+using java.lang;
+using liquibase.database;
+
+namespace liquibase_test.Plugin {
+ /// <summary>
+ /// Summary description for UnitTest1
+ /// </summary>
+ [TestClass]
+ public class ClassPathScannerTest {
+ public ClassPathScannerTest() {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+
+ private TestContext testContextInstance;
+
+ /// <summary>
+ ///Gets or sets the test context which provides
+ ///information about and functionality for the current test run.
+ ///</summary>
+ public TestContext TestContext {
+ get {
+ return testContextInstance;
+ }
+ set {
+ testContextInstance = value;
+ }
+ }
+
+ #region Additional test attributes
+ //
+ // You can use the following additional attributes as you write your tests:
+ //
+ // Use ClassInitialize to run code before running the first test in the class
+ // [ClassInitialize()]
+ // public static void MyClassInitialize(TestContext testContext) { }
+ //
+ // Use ClassCleanup to run code after all tests in a class have run
+ // [ClassCleanup()]
+ // public static void MyClassCleanup() { }
+ //
+ // Use TestInitialize to run code before running each test
+ // [TestInitialize()]
+ // public void MyTestInitialize() { }
+ //
+ // Use TestCleanup to run code after each test has run
+ // [TestCleanup()]
+ // public void MyTestCleanup() { }
+ //
+ #endregion
+
+ [TestMethod]
+ public void getClasses() {
+ ClassPathScanner scanner = ClassPathScanner.getInstance();
+ Class console = Class.forName(typeof(DatabaseConnection).AssemblyQualifiedName);
+ Assert.IsNotNull(console);
+ Assert.AreEqual("liquibase.database.DatabaseConnection", console.getName());
+
+
+ Class[] classes = scanner.getClasses(console);
+ Assert.AreEqual(1, classes.Length);
+ }
+ }
+}
View
35 core-clr/liquibase/LiquiBaseTest/Properties/AssemblyInfo.cs
@@ -0,0 +1,35 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("liquibase-test")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("liquibase-test")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2009")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM componenets. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("36cd97b2-4286-4b7a-a517-a8377c4fa76e")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
View
5 core-clr/liquibase/LocalTestRun.testrunconfig
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<TestRunConfiguration name="Local Test Run" id="9f48a5d7-1d86-4399-baad-5471d876d717" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2006">
+ <Description>This is a default test run configuration for a local test run.</Description>
+ <TestTypeSpecific />
+</TestRunConfiguration>
View
38 core-clr/liquibase/liquibase.sln
@@ -0,0 +1,38 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LiquiBase", "liquibase\LiquiBase.csproj", "{2A4C22C1-4DC9-407E-B559-758694B53BDE}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D8F90C6B-AFFE-496C-B5E6-B1D919B8B693}"
+ ProjectSection(SolutionItems) = preProject
+ liquibase.vsmdi = liquibase.vsmdi
+ LocalTestRun.testrunconfig = LocalTestRun.testrunconfig
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LiquiBaseConsole", "LiquiBaseConsole\LiquiBaseConsole.csproj", "{F736E0FE-E0B6-46DF-B792-43BF98EB55A1}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LiquiBaseTest", "LiquiBaseTest\LiquiBaseTest.csproj", "{30FA384E-3983-422F-BF14-1FD54A04A54E}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {2A4C22C1-4DC9-407E-B559-758694B53BDE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2A4C22C1-4DC9-407E-B559-758694B53BDE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {2A4C22C1-4DC9-407E-B559-758694B53BDE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {2A4C22C1-4DC9-407E-B559-758694B53BDE}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F736E0FE-E0B6-46DF-B792-43BF98EB55A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F736E0FE-E0B6-46DF-B792-43BF98EB55A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F736E0FE-E0B6-46DF-B792-43BF98EB55A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F736E0FE-E0B6-46DF-B792-43BF98EB55A1}.Release|Any CPU.Build.0 = Release|Any CPU
+ {30FA384E-3983-422F-BF14-1FD54A04A54E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {30FA384E-3983-422F-BF14-1FD54A04A54E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {30FA384E-3983-422F-BF14-1FD54A04A54E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {30FA384E-3983-422F-BF14-1FD54A04A54E}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
View
6 core-clr/liquibase/liquibase.vsmdi
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<TestLists xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2006">
+ <TestList name="Lists of Tests" id="8c43106b-9dc1-4907-a29f-aa66a61bf5b6">
+ <RunConfiguration id="9f48a5d7-1d86-4399-baad-5471d876d717" name="Local Test Run" storage="localtestrun.testrunconfig" type="Microsoft.VisualStudio.TestTools.Common.TestRunConfiguration, Microsoft.VisualStudio.QualityTools.Common, PublicKeyToken=b03f5f7f11d50a3a" />
+ </TestList>
+</TestLists>
View
3  core-jvm/src/java-dbtest/liquibase/dbtest/AbstractSimpleChangeLogRunnerTest.java
@@ -3,7 +3,6 @@
import junit.framework.TestCase;
import liquibase.Liquibase;
import liquibase.snapshot.DatabaseSnapshotGeneratorFactory;
-import liquibase.snapshot.DatabaseSnapshotGenerator;
import liquibase.snapshot.DatabaseSnapshot;
import liquibase.executor.ExecutorService;
import liquibase.executor.WriteExecutor;
@@ -15,7 +14,7 @@
import liquibase.diff.DiffResult;
import liquibase.exception.DatabaseException;
import liquibase.exception.ValidationFailedException;
-import liquibase.lock.LockService;
+import liquibase.lockservice.LockService;
import liquibase.resource.ResourceAccessor;
import liquibase.resource.FileSystemResourceAccessor;
import liquibase.resource.CompositeResourceAccessor;
View
3  core-jvm/src/java-test/liquibase/database/core/MockDatabase.java
@@ -11,14 +11,13 @@
import liquibase.database.DataType;
import liquibase.diff.DiffStatusListener;
import liquibase.exception.*;
-import liquibase.lock.DatabaseChangeLogLock;
+import liquibase.lockservice.DatabaseChangeLogLock;
import liquibase.sql.visitor.SqlVisitor;
import liquibase.statement.SqlStatement;
import java.io.IOException;
import java.io.Writer;
import java.sql.Connection;
-import java.sql.SQLException;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.*;
View
3  ...a-test/liquibase/lock/LockServiceExecuteTest.java → ...liquibase/lockservice/LockServiceExecuteTest.java
@@ -1,4 +1,4 @@
-package liquibase.lock;
+package liquibase.lockservice;
import liquibase.database.Database;
import liquibase.database.DatabaseFactory;
@@ -18,7 +18,6 @@
import org.junit.Test;
import java.io.StringWriter;
-import java.sql.Connection;
import java.util.ArrayList;
public class LockServiceExecuteTest {
View
2  ...src/java-test/liquibase/lock/LockServiceTest.java → ...a-test/liquibase/lockservice/LockServiceTest.java
@@ -1,4 +1,4 @@
-package liquibase.lock;
+package liquibase.lockservice;
import liquibase.database.Database;
import liquibase.database.core.MySQLDatabase;
View
2  core-jvm/src/java-test/liquibase/test/DatabaseTestTemplate.java
@@ -5,7 +5,7 @@
import liquibase.executor.ExecutorService;
import liquibase.executor.core.jdbc.JdbcExecutor;
import liquibase.exception.MigrationFailedException;
-import liquibase.lock.LockService;
+import liquibase.lockservice.LockService;
import org.junit.ComparisonFailure;
import java.util.Set;
View
51 core-jvm/src/java/liquibase/database/DatabaseFactoryJdbc.java
@@ -1,51 +0,0 @@
-package liquibase.database;
-
-import liquibase.util.plugin.ClassPathScanner;
-import liquibase.exception.DatabaseException;
-import liquibase.database.core.UnsupportedDatabase;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-
-public class DatabaseFactoryJdbc extends DatabaseFactory {
-
- public DatabaseFactoryJdbc() {
-
- }
-
- @Override
- public Database findCorrectDatabaseImplementation(DatabaseConnection connection) throws DatabaseException {
- Database database = null;
-
- boolean foundImplementation = false;
-
- for (Database implementedDatabase : getImplementedDatabases()) {
- database = implementedDatabase;
- if (database.isCorrectDatabaseImplementation(connection)) {
- foundImplementation = true;
- break;
- }
- }
-
- if (!foundImplementation) {
- try {
- log.warning("Unknown database: " + ((JdbcConnection) connection).getUnderlyingConnection().getMetaData().getDatabaseProductName());
- } catch (SQLException e) {
- throw new DatabaseException(e);
- }
- database = new UnsupportedDatabase();
- }
-
- Database returnDatabase;
- try {
- returnDatabase = database.getClass().newInstance();
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
-
- returnDatabase.setConnection(connection);
- return returnDatabase;
- }
-
-
-}
View
2  core-jvm/src/java/liquibase/integration/commandline/Main.java
@@ -5,7 +5,7 @@
import liquibase.exception.CommandLineParsingException;
import liquibase.exception.DatabaseException;
import liquibase.exception.ValidationFailedException;
-import liquibase.lock.LockService;
+import liquibase.lockservice.LockService;
import liquibase.resource.CompositeResourceAccessor;
import liquibase.resource.FileSystemResourceAccessor;
import liquibase.util.LiquibaseUtil;
View
BIN  core/lib-compile/ant-ikvmc.0.5.jar
Binary file not shown
View
22 core/src/build.xml
@@ -172,7 +172,7 @@ The available targets at the current stage:
<!-- target: PACKAGE -->
<target name="package" depends="compile">
- <jar destfile="${release.dir}/liquibase-SNAPSHOT.jar" manifest="${src.dir}/java/META-INF/MANIFEST.MF">
+ <jar destfile="${release.dir}/liquibase-SNAPSHOT.jar" manifest="${basedir}/../../core-jvm/src/java/META-INF/MANIFEST.MF">
<zipfileset dir="${build.dir}"/>
</jar>
@@ -229,9 +229,6 @@ The available targets at the current stage:
<tarfileset dir="${package.dir}/liquibase-${build.version}-src" prefix="liquibase-${build.version}"
includes="liquibase" mode="755"/>
</tar>
-
- <zip destfile="${release.dir}/liquibase-intellij-${build.version}-src.zip" basedir="${intellij.basedir}"
- excludes="build/**,build-test/**"/>
</target>
<!-- target: SITE -->
@@ -260,7 +257,7 @@ The available targets at the current stage:
</fileset>
</copy>
<copy todir="${release.site.dir}/samples/">
- <fileset dir="${src.dir}/samples"/>
+ <fileset dir="${basedir}/../../core-jvm/src/samples"/>
</copy>
<copy todir="${release.site.dir}/api">
<fileset dir="${reports.dir}/api"/>
@@ -607,4 +604,19 @@ The available targets at the current stage:
</libClasspath>
</crap4j>
</target>
+
+ <target name="ikvmc" depends="package">
+ <taskdef name="ikvmc" classname="net.ikvm.ant.IkvmcTask" classpathref="classpath"/>
+
+ <property name="ikvm.home" location="c:/ikvm-0.40.0.1"/>
+
+ <ikvmc target="library" out="${release.dir}/liquibase-core.dll" home="${ikvm.home}" version="0.0.0.1" debug="true" verbose="true" srcpath="${src.dir}/java">
+ <fileset dir="${release.dir}">
+ <include name="liquibase-SNAPSHOT.jar"/>
+ </fileset>
+ </ikvmc>
+ <copy file="${release.dir}/liquibase-core.dll" tofile="${basedir}/../../core-clr/lib-deps/liquibase-core.dll" overwrite="true"/>
+
+
+ </target>
</project>
View
4 core/src/java/liquibase/Liquibase.java
@@ -14,8 +14,8 @@
import liquibase.executor.ExecutorService;
import liquibase.executor.LoggingExecutor;
import liquibase.executor.WriteExecutor;
-import liquibase.lock.DatabaseChangeLogLock;
-import liquibase.lock.LockService;
+import liquibase.lockservice.DatabaseChangeLogLock;
+import liquibase.lockservice.LockService;
import liquibase.parser.ChangeLogParserFactory;
import liquibase.resource.ResourceAccessor;
import liquibase.sql.visitor.SqlVisitor;
View
8 core/src/java/liquibase/database/AbstractDatabase.java
@@ -115,14 +115,6 @@ public String getDatabaseProductName() {
}
}
- public String getDatabaseProductName(DatabaseConnection conn) throws DatabaseException {
- try {
- return conn.getDatabaseProductName();
- } catch (DatabaseException e) {
- throw new DatabaseException(e);
- }
- }
-
public String getDatabaseProductVersion() throws DatabaseException {
try {
View
2  core/src/java/liquibase/database/Database.java
@@ -147,8 +147,6 @@
int getDatabaseType(int type);
- String getDatabaseProductName(DatabaseConnection conn) throws DatabaseException;
-
/**
* Returns the actual database-specific data type to use for a "char" column.
*/
View
43 core/src/java/liquibase/database/DatabaseFactory.java
@@ -1,26 +1,20 @@
package liquibase.database;
import liquibase.exception.DatabaseException;
+import liquibase.exception.UnexpectedLiquibaseException;
import liquibase.util.log.LogFactory;
import liquibase.util.plugin.ClassPathScanner;
+import liquibase.database.core.UnsupportedDatabase;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
-public abstract class DatabaseFactory {
- private static DatabaseFactory instance;
+public class DatabaseFactory {
+ private static DatabaseFactory instance = new DatabaseFactory();
protected static final Logger log = LogFactory.getLogger();
private List<Database> implementedDatabases = new ArrayList<Database>();
- static {
- try {
- instance = (DatabaseFactory) ClassPathScanner.getInstance().getClasses(DatabaseFactory.class)[0].newInstance();
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
protected DatabaseFactory() {
try {
Class[] classes = ClassPathScanner.getInstance().getClasses(Database.class);
@@ -50,7 +44,34 @@ public void register(Database database) {
implementedDatabases.add(0, database);
}
- public abstract Database findCorrectDatabaseImplementation(DatabaseConnection connection) throws DatabaseException;
+ public Database findCorrectDatabaseImplementation(DatabaseConnection connection) throws DatabaseException {
+ Database database = null;
+
+ boolean foundImplementation = false;
+
+ for (Database implementedDatabase : getImplementedDatabases()) {
+ database = implementedDatabase;
+ if (database.isCorrectDatabaseImplementation(connection)) {
+ foundImplementation = true;
+ break;
+ }
+ }
+
+ if (!foundImplementation) {
+ log.warning("Unknown database: " + connection.getDatabaseProductName());
+ database = new UnsupportedDatabase();
+ }
+
+ Database returnDatabase;
+ try {
+ returnDatabase = database.getClass().newInstance();
+ } catch (Exception e) {
+ throw new UnexpectedLiquibaseException(e);
+ }
+
+ returnDatabase.setConnection(connection);
+ return returnDatabase;
+ }
public String findDefaultDriver(String url) {
for (Database database : this.getImplementedDatabases()) {
View
2  core/src/java/liquibase/database/core/CacheDatabase.java
@@ -57,7 +57,7 @@ public String getTypeName() {
public boolean isCorrectDatabaseImplementation(DatabaseConnection conn)
throws DatabaseException {
- return PRODUCT_NAME.equalsIgnoreCase(getDatabaseProductName(conn));
+ return PRODUCT_NAME.equalsIgnoreCase(conn.getDatabaseProductName());
}
public boolean supportsInitiallyDeferrableColumns() {
View
2  core/src/java/liquibase/database/core/DB2Database.java
@@ -19,7 +19,7 @@
private static final DataType DATETIME_TYPE = new DataType("TIMESTAMP", false);
public boolean isCorrectDatabaseImplementation(DatabaseConnection conn) throws DatabaseException {
- return getDatabaseProductName(conn).startsWith("DB2");
+ return conn.getDatabaseProductName().startsWith("DB2");
}
public String getDefaultDriver(String url) {
View
2  core/src/java/liquibase/database/core/DerbyDatabase.java
@@ -17,7 +17,7 @@
private static final DataType TIMESTAMP_TYPE = new DataType("TIMESTAMP", false);
public boolean isCorrectDatabaseImplementation(DatabaseConnection conn) throws DatabaseException {
- return "Apache Derby".equalsIgnoreCase(getDatabaseProductName(conn));
+ return "Apache Derby".equalsIgnoreCase(conn.getDatabaseProductName());
}
public String getDefaultDriver(String url) {
View
2  core/src/java/liquibase/database/core/FirebirdDatabase.java
@@ -18,7 +18,7 @@
private static final DataType DATETIME_TYPE = new DataType("TIMESTAMP", false);
public boolean isCorrectDatabaseImplementation(DatabaseConnection conn) throws DatabaseException {
- return getDatabaseProductName(conn).startsWith("Firebird");
+ return conn.getDatabaseProductName().startsWith("Firebird");
}
public String getDefaultDriver(String url) {
View
2  core/src/java/liquibase/database/core/H2Database.java
@@ -29,7 +29,7 @@ public String getDefaultDriver(String url) {
@Override
public boolean isCorrectDatabaseImplementation(DatabaseConnection conn) throws DatabaseException {
- return "H2".equals(getDatabaseProductName(conn));
+ return "H2".equals(conn.getDatabaseProductName());
}
// public void dropDatabaseObjects(String schema) throws DatabaseException {
View
2  core/src/java/liquibase/database/core/HsqlDatabase.java
@@ -27,7 +27,7 @@
public boolean isCorrectDatabaseImplementation(DatabaseConnection conn) throws DatabaseException {
- return "HSQL Database Engine".equalsIgnoreCase(getDatabaseProductName(conn));
+ return "HSQL Database Engine".equalsIgnoreCase(conn.getDatabaseProductName());
}
public String getDefaultDriver(String url) {
View
2  core/src/java/liquibase/database/core/InformixDatabase.java
@@ -179,7 +179,7 @@ public DataType getUUIDType() {
public boolean isCorrectDatabaseImplementation(DatabaseConnection conn)
throws DatabaseException {
- return PRODUCT_NAME.equals(getDatabaseProductName(conn));
+ return PRODUCT_NAME.equals(conn.getDatabaseProductName());
}
public boolean supportsInitiallyDeferrableColumns() {
View
4 core/src/java/liquibase/database/core/MSSQLDatabase.java
@@ -69,7 +69,9 @@ public boolean supportsSequences() {
}
public boolean isCorrectDatabaseImplementation(DatabaseConnection conn) throws DatabaseException {
- return PRODUCT_NAME.equalsIgnoreCase(getDatabaseProductName(conn));
+ String databaseProductName = conn.getDatabaseProductName();
+ return PRODUCT_NAME.equalsIgnoreCase(databaseProductName)
+ || "SQLOLEDB".equalsIgnoreCase(databaseProductName);
}
public String getDefaultDriver(String url) {
View
2  core/src/java/liquibase/database/core/MaxDBDatabase.java
@@ -143,7 +143,7 @@ public DataType getTimeType() {
}
public boolean isCorrectDatabaseImplementation(DatabaseConnection conn) throws DatabaseException {
- return PRODUCT_NAME.equalsIgnoreCase(getDatabaseProductName(conn));
+ return PRODUCT_NAME.equalsIgnoreCase(conn.getDatabaseProductName());
}
public String getDefaultDriver(String url) {
View
2  core/src/java/liquibase/database/core/MySQLDatabase.java
@@ -28,7 +28,7 @@ public String getTypeName() {
// }
public boolean isCorrectDatabaseImplementation(DatabaseConnection conn) throws DatabaseException {
- return PRODUCT_NAME.equalsIgnoreCase(getDatabaseProductName(conn));
+ return PRODUCT_NAME.equalsIgnoreCase(conn.getDatabaseProductName());
}
public String getDefaultDriver(String url) {
View
2  core/src/java/liquibase/database/core/OracleDatabase.java
@@ -90,7 +90,7 @@ public DataType getBigIntType() {
}
public boolean isCorrectDatabaseImplementation(DatabaseConnection conn) throws DatabaseException {
- return PRODUCT_NAME.equalsIgnoreCase(getDatabaseProductName(conn));
+ return PRODUCT_NAME.equalsIgnoreCase(conn.getDatabaseProductName());
}
public String getDefaultDriver(String url) {
View
2  core/src/java/liquibase/database/core/PostgresDatabase.java
@@ -97,7 +97,7 @@ public boolean supportsInitiallyDeferrableColumns() {
}
public boolean isCorrectDatabaseImplementation(DatabaseConnection conn) throws DatabaseException {
- return PRODUCT_NAME.equalsIgnoreCase(getDatabaseProductName(conn));
+ return PRODUCT_NAME.equalsIgnoreCase(conn.getDatabaseProductName());
}
public String getDefaultDriver(String url) {
View
2  core/src/java/liquibase/database/core/SQLiteDatabase.java
@@ -75,7 +75,7 @@ public DataType getUUIDType() {
public boolean isCorrectDatabaseImplementation(DatabaseConnection conn)
throws DatabaseException {
- return "SQLite".equalsIgnoreCase(getDatabaseProductName(conn));
+ return "SQLite".equalsIgnoreCase(conn.getDatabaseProductName());
}
public boolean supportsInitiallyDeferrableColumns() {
View
4 core/src/java/liquibase/database/core/SybaseASADatabase.java
@@ -198,8 +198,8 @@ public DataType getUUIDType() {
* @see liquibase.database.Database#isCorrectDatabaseImplementation(java.sql.Connection)
*/
public boolean isCorrectDatabaseImplementation(DatabaseConnection conn) throws DatabaseException {
- return "Adaptive Server Anywhere".equalsIgnoreCase(getDatabaseProductName(conn))
- || "SQL Anywhere".equalsIgnoreCase(getDatabaseProductName(conn));
+ return "Adaptive Server Anywhere".equalsIgnoreCase(conn.getDatabaseProductName())
+ || "SQL Anywhere".equalsIgnoreCase(conn.getDatabaseProductName());
}
@Override
View
2  core/src/java/liquibase/database/core/SybaseDatabase.java
@@ -302,7 +302,7 @@ public boolean supportsDDLInTransaction() {
// }
// }
public boolean isCorrectDatabaseImplementation(DatabaseConnection conn) throws DatabaseException {
- String dbProductName = getDatabaseProductName(conn);
+ String dbProductName = conn.getDatabaseProductName();
return
"Sybase SQL Server".equals(dbProductName) ||
"sql server".equals(dbProductName);
View
2  ...rc/java/liquibase/lock/DatabaseChangeLogLock.java → .../liquibase/lockservice/DatabaseChangeLogLock.java
@@ -1,4 +1,4 @@
-package liquibase.lock;
+package liquibase.lockservice;
import java.util.Date;
View
2  core/src/java/liquibase/lock/LockService.java → core/src/java/liquibase/lockservice/LockService.java
@@ -1,4 +1,4 @@
-package liquibase.lock;
+package liquibase.lockservice;
import liquibase.database.Database;
import liquibase.exception.DatabaseException;
View
36 core/src/java/liquibase/util/plugin/ClassPathScanner.java
@@ -18,17 +18,32 @@
public class ClassPathScanner {
- private static ClassPathScanner instance = new ClassPathScanner();
+ private static ClassPathScanner instance;
+
+ static {
+ try {
+ Class<?> scanner = Class.forName("LiquiBase.ClrClassPathScanner, liquibase-clr");
+ System.out.println("Founds scanner");
+ instance = (ClassPathScanner) scanner.newInstance();
+ } catch (Exception e) {
+ System.out.println("Java scanner");
+ instance = new ClassPathScanner();
+ }
+ }
private ResourceAccessor resourceAccessor;
private Map<Class, List<Class>> classesBySuperclass;
private List<String> packagesToScan;
- private ClassPathScanner() {
+ protected ClassPathScanner() {
setResourceAccessor(new ClassLoaderResourceAccessor());
}
+ protected ClassPathScanner(ResourceAccessor accessor) {
+
+ }
+
public static ClassPathScanner getInstance() {
return instance;
}
@@ -48,7 +63,7 @@ public void setResourceAccessor(ResourceAccessor resourceAccessor) {
String attributes = StringUtils.trimToNull(manifest.getMainAttributes().getValue("LiquiBase-Package"));
if (attributes != null) {
for (Object value : attributes.split(",")) {
- packagesToScan.add(value.toString());
+ addPackageToScan(value.toString());
}
}
is.close();
@@ -58,16 +73,23 @@ public void setResourceAccessor(ResourceAccessor resourceAccessor) {
}
}
+ public void addPackageToScan(String packageName) {
+ packagesToScan.add(packageName);
+ }
+
public Class[] getClasses(Class requiredInterface) throws Exception {
- Class.forName(requiredInterface.getName());
+// Class.forName(requiredInterface.getName());
+ System.out.println("Getting classes...");
if (!classesBySuperclass.containsKey(requiredInterface)) {
classesBySuperclass.put(requiredInterface, new ArrayList<Class>());
for (String packageName : packagesToScan) {
+ System.out.println("scanning "+packageName);
String path = packageName.replace('.', '/');
Enumeration<URL> resources = resourceAccessor.getResources(path);
while (resources.hasMoreElements()) {
+ System.out.println("Found resource");
classesBySuperclass.get(requiredInterface).addAll(findClasses(resources.nextElement(), packageName, requiredInterface));
}
}
@@ -78,6 +100,7 @@ public void setResourceAccessor(ResourceAccessor resourceAccessor) {
}
private List<Class> findClasses(URL resource, String packageName, Class requiredInterface) throws Exception {
+ System.out.println("-----find "+packageName+" classes in "+resource.toExternalForm()+" matching interface "+requiredInterface.getName());
List<Class> classes = new ArrayList<Class>();
// if (directory.toURI().toString().startsWith("jar:")) {
// System.out.println("have a jar: "+directory.toString());
@@ -116,16 +139,19 @@ public void setResourceAccessor(ResourceAccessor resourceAccessor) {
}
for (String potentialClassName : potentialClassNames) {
+ System.out.println("Potential class: "+potentialClassName);
Class<?> clazz = null;
try {
clazz = Class.forName(potentialClassName, true, resourceAccessor.toClassLoader());
} catch (NoClassDefFoundError e) {
+ System.out.println("NoClassDefFoundError: "+potentialClassName);
LogFactory.getLogger().warning("Could not configure extension class "+potentialClassName+": Missing dependency "+e.getMessage());
continue;
}
if (!clazz.isInterface()
&& !Modifier.isAbstract(clazz.getModifiers())
&& isCorrectType(clazz, requiredInterface)) {
+ System.out.println(potentialClassName+" matches");
try {
clazz.getConstructor();
classes.add(clazz);
@@ -135,6 +161,8 @@ public void setResourceAccessor(ResourceAccessor resourceAccessor) {
LogFactory.getLogger().warning("Class " + clazz.getName() + " does not have a public no-arg constructor, so it can't be used as a " + requiredInterface.getName() + " plug-in");
}
}
+ } else {
+ System.out.println(potentialClassName+" does not match");
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.