Trying to upgrade from ibatis version 2 to mybatis 3.3, got stuck with below snippet - mybatis

<delete id="dProjects" parameterClass="java.util.Map">
delete from pro_tbl
where user_id = #uId#
<dynamic prepend="AND">
<iterate property="pIds" open="(" close=")" conjunction="OR">
project_id = #pIds[]#
</iterate>
</dynamic>
</delete>
Trying to upgrade from ibatis version 2 to mybatis 3.3. Since mybatis 3.3.0 doesn't support dynamic prepend anymore , need help with below snippet replacement ```

Related

How to make a custom Eclipse run launcher that launches a particular Class?

I am developing an eclipse plugin. I want to build a custom run launcher that would be executed when i use it against a specific class. So the scenario is, when i run the plugin via eclipse run time environment i want to run a particular class which is already written in this particular eclipse run time. So i will execute this class with my custom run launcher. For now, i do not need any tab or custom UI. I just need to show the output of that particular class in default java console where normally outputs are shown in eclipse. I did not find great stuff in this regard. As i am new so i am rather getting confused more. Please have a look on what i have tried so far. I am not using org.eclipse.debug.core.launchConfigurationTypes extension point. Rather i am using ILaunchShortcut in this case. So i tried to call that particular class and execute it in launch method using the below code.
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType type = manager.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION);
ILaunchConfigurationWorkingCopy wc = type.newInstance(null, "SampleConfig");
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, "Test");
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, "Test1");
ILaunchConfiguration config = wc.doSave();
config.launch(ILaunchManager.RUN_MODE, null);
But here the problem is i am not able to resolve IJavaLaunchConfigurationConstants in my code anyway. So i am fully stuck here. See my plugin.xml file also for your convenience.
<plugin>
<extension
point="org.eclipse.debug.ui.launchShortcuts">
<shortcut
class="launcher.LaunchShortcut"
id="launcher.shortcut2"
label="Launcher Test"
modes="run">
<contextualLaunch>
<contextLabel mode="run" label="Run Launcher" />
<enablement>
<with
variable="selection">
<count
value="1">
</count>
<iterate>
<adapt type="org.eclipse.core.resources.IResource">
<and>
<test property="org.eclipse.core.resources.name" value="Test1.java"/>
</and>
</adapt>
</iterate>
</with>
</enablement>
</contextualLaunch>
</shortcut>
</extension>
</plugin>
What should i do now to make this code successfully running? I need your suggestions and references. Thanks.
As per comment of greg-449 i added following the extension org.eclipse.jdt.launching.classpathProviders in the plugin.xml and the code worked perfectly.

CruiseControl.Net plugin for nunit3

It seems that the syntax for running nunit has changed between nunit 2 and 3. I would like to move my existing CruiseControl.Net configuration to use NUnit 3, but I cannot work out how to modify my existing target (see below) to use nunit3. Is there documentation anywhere? Thanks for any help.
<nunit>
<environment>
<variable name="TEST_FILES_DIRECTORY" value="C:\TestPlans\TestFiles" />
</environment>
<path>C:\nunit3\Compiled\nunit3-console.exe</path>
<assemblies>
<assembly>C:\source\TestRunner\bin\Debug\Tests.dll</assembly>
</assemblies>
<includedCategories>
<includedCategory>Data</includedCategory>
</includedCategories>
<timeout>72000</timeout>
</nunit>

Oracle ODAC 12c Release 3 32-bit beta supports EF 6.x?

I have Windows 8.1 64-bit with Visual Studio 2013. I've installed the latest Oracle ODAC 12c Release 3 32-bit beta which claims to supports EF 6. When I add the ADO.NET Entity Framework to my project and choose my Oracle data connection, it doesn't allow me to select the Entity Framework 6.0 version. It has Entity Framework 5.x selected and version 6.x is greyed out. It says 'An Entity Framework database provider compatible with the latest version of the Entity Framework could not be found for your data connection'. Why is that?
I did the following to make it work :-
First Installing ODAC 12c Release 3 which includes support for Entity Framework 6 Code First and Code First Migrations; NuGet, .NET Framework 4.5.2; and ODP.NET, Managed Driver XML DB. As per
http://www.oracle.com/technetwork/topics/dotnet/whatsnew/index.html
Adding two references , to my project references and they are :
Oracle.ManagedDataAccess.dll
Oracle.ManagedDataAccess.EntityFramework.dll
Installing EF6.1.1 using NuGet by running the following command in Package Manager Console( you can enter it by Tools->NuGet Package Manager -> Package Manager Console):
Install-Package EntityFramework -Version 6.1.1
And modify your web.config or web.config to use Oracle.ManagedDataAccess , by adding Provider and a valid connection string eg :
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<section name="Oracle.ManagedDataAccess.Client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<entityFramework>
<contexts>
<context type="App.Context.Default, App.Context">
<databaseInitializer type="MyProject.Context.Config.ContextInitializer, MyProject.Context" />
</context>
</contexts>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="Oracle.ManagedDataAccess.Client" type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices, Oracle.ManagedDataAccess.EntityFramework, Version=6.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<connectionStrings>
<add name="Default" providerName="Oracle.ManagedDataAccess.Client" connectionString="DATA SOURCE=XE;USER ID=User" />
</connectionStrings>
Rebuild your Application as x86, and start using EF6 , you can check if it works by adding a model using ADO.Net Entity Model using Code First
Did you install from this file: ODAC121010Beta2_32bit.zip and then choose to install Oracle Developer Tools?
It is the only file on that page that includes the Oracle Developer Tools for Visual Studio which must be updated for design time EF work.
set Oracle.ManagedDataAccess.EntityFramework.dll Specific version to True and rebuild your app. And then try adding ADO.NET Entity wizard again

Use of ILaunchConfigurationMigrationDelegate

I do not understand how migration of Eclipse Launch Configrations (ILaunchConfiguration) works. In my dreams, I'd love to have the following:
My plugin, version 1.0, is used to create a Launch Configuration referencing file something_1.0/foo
The plugin is upgraded to version 2.0, which also deletes the file still referenced in all old launch configurations of the plugin
The old launch configurations are automatically upgraded so that something_2.0/foo is referenced instead of the non-existing something_1.0/foo
Step 3 sadly is the one that does not work, although I wrote and connected a corresponding implementation of ILaunchConfigurationMigrationDelegate. It seems the code is never executed.
When exactly are configurations migrated? According to the code, there is a Migrate button, which I cannot find. According to the documentation configurations might be migrated automatically. How is this triggered?
Thanks,
Carsten
This implementation of this interface should be declared in extension point.
You can refer to JDT itself implementation org.eclipse.jdt.internal.launching.JavaMigrationDelegate.
Please note the launch shortcut specify the configuration type as the one defined via extension.
<extension
point="org.eclipse.debug.ui.launchShortcuts">
<shortcut
class="org.eclipse.jdt.debug.ui.launchConfigurations.JavaApplicationLaunchShortcut"
description="%JavaLaunchShortcut.description"
helpContextId="org.eclipse.jdt.debug.ui.shortcut_local_java_application"
icon="$nl$/icons/full/etool16/java_app.gif"
id="org.eclipse.jdt.debug.ui.localJavaShortcut"
label="%JavaApplicationShortcut.label"
modes="run, debug">
<contextualLaunch>
<enablement>
<with variable="selection">
<count value="1"/>
<iterate>
<and>
<adapt type="org.eclipse.jdt.core.IJavaElement">
<test property="org.eclipse.jdt.core.isInJavaProject"/>
</adapt>
<or>
<test property="org.eclipse.jdt.launching.hasMain"/>
<test property="org.eclipse.jdt.launching.isContainer"/>
<test property="org.eclipse.jdt.launching.isPackageFragment"/>
<test property="org.eclipse.jdt.launching.isPackageFragmentRoot"/>
</or>
</and>
</iterate>
</with>
</enablement>
</contextualLaunch>
<configurationType
id="org.eclipse.jdt.launching.localJavaApplication">
</configurationType>
<description
description="%RunJavaLaunchShortcut.description"
mode="run">
</description>
<description
description="%DebugJavaLaunchShortcut.description"
mode="debug">
</description>
</shortcut>

Call JUnit from other Eclipse Plugin

I am developing for Eclipse, and one feature is run JUnit tests. Now my plugin detect JUnit tests on a project in workspace and after this I want to call JUnit to run this tests.
I heard about ILaunch, ILaunchConfigurationDelegate, JUnitLaunchConfigurationDelegate but I cannot found an example of this and also I'm not sure if I have to use this!
-- Thanks in advance
Please see my answer to How does Eclipse actually run Junit tests?. You will need to create a Run Configuration and then call JUnitLaunchConfigurationDelegate#launch() with the configuration.
The easiest way to do this is to add shortcuts to the extension point org.eclipse.debug.ui.launchShortcuts. With the correct configurationType, you can create the correct type and normally, Eclipse will do the rest. In fact this is exactly what we've done in the Scala IDE.
Here is the relevant XML from scala-ide:
<extension point="org.eclipse.debug.ui.launchShortcuts">
<shortcut
label="%JUnitShortcut.label"
icon="$nl$/icons/full/obj16/julaunch.gif"
helpContextId="org.eclipse.jdt.junit.launch_shortcut"
class="org.eclipse.jdt.junit.launcher.JUnitLaunchShortcut"
modes="run, debug"
id="scala.tools.eclipse.scalatest.junitShortcut">
<contextualLaunch>
<enablement>
<with variable="selection">
<count value="1"/>
<iterate>
<adapt type="org.eclipse.jdt.core.IJavaElement">
<test property="org.eclipse.debug.ui.matchesPattern" value="*.scala"/>
<test property="org.eclipse.jdt.core.isInJavaProject"/>
<test property="org.eclipse.jdt.core.hasTypeOnClasspath" value="junit.framework.Test"/>
<or>
<test property="scala.tools.eclipse.launching.canLaunchAsJUnit" forcePluginActivation="true"/>
<test property="scala.tools.eclipse.launching.junit.canLaunchAsJUnit" forcePluginActivation="true"/>
</or>
</adapt>
</iterate>
</with>
</enablement>
</contextualLaunch>
<configurationType
id="org.eclipse.jdt.junit.launchconfig">
</configurationType>
<description
description="%DebugJUnitLaunchShortcut.description"
mode="debug">
</description>
<description
description="%RunJUnitLaunchShortcut.description"
mode="run">
</description>
</shortcut>
</extension>
The important element is the <contextualLaunch>, which defines a set of tests which need to be true in order that the option to launch as JUnit be presented to the user. Most of these are self explanatory, but we've also scala.tools.eclipse.launching.canLaunchAsJUnit, which references an extension point org.eclipse.core.expressions.propertyTesters. These property testers test whether the code can be launched as JUnit or not (for instance, the class under test extends TestCase or whatever).
If you need more details, I recommend downloading Scala IDE, and looking at the code, but it is written in Scala.
I rewrote part of launche junit services, then inform the project it calls the debug and run.
See my implementation to call the JUnitLaunch