JNDI datasource and ApplicationModule tester - oracle-adf

I have an ADF application module and I have it configured to use a JNDI datasource (e.g., JNDI name = jdbc/ORCL).
That all works fine, but when I try to test my Application Module through the integrated tester in JDeveloper (i.e., run the application module directly instead of running a page), it cannot find the JNDI data source, even if my integrated Weblogic Server is started.
Is this just a drawback of using JNDI: that you cannot use the integrated application module tester anymore? Or is there a way to configure JDeveloper to make this all work together (JNDI + integrated AM tester)?

You should make use of the default JDBC url, i.e. java:comp/env/jdbc/ORCL instead of using the short form jdbc/ORCL. Many features of JDeveloper rely on the full url to work. For example, even if you don't manually create the datasource on your Integrated WebLogic Server, you still can right-click and run a page to test because behind the scene, JDeveloper automatically create a temporary datasource with that name to run the application.
When you deploy your application to an actual standalone server, the application will automatically trim the java:comp/env/ portion of the full url and look for the datasource with the name jdbc/ORCL. You don't need to shorten it yourself :).

Related

How to test Spring database down?

I have this SpringBoot server app using PostgreSQL database if it's up and sending error response if it's down. So my app is running regardless the database connection.
I would very much like to test it (jUnit / mockmvc).
My question is very simple, yet I did not find the answer online:
how does one simulate a database connection loss in SpringBoot?
If anyone wants, I can supply code (project is up at https://github.com/k-wasilewski/workshop/)
Have you thought of Testcontainers? You can spin up your docker image through a Junit test and make your spring boot use that as your database.
Since you use junit, you can start/stop this container at will.
This will generate a test which creates the condition you are looking for and write code as to what to expect when the database is down.
Here are some links to get started,
Testcontainers and Junit4 with Testcontainers quickstart - https://www.testcontainers.org/quickstart/junit_4_quickstart/
Spring boot documentation - Use Testcontainers for integration testing
https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-testcontainers
Testcontainer github link example for springboot app
https://github.com/testcontainers/testcontainers-java/tree/master/examples/spring-boot
Testcontainer - Generic container javadoc. You can find methods for start/stop
container here. call from your Junit.
https://javadoc.io/static/org.testcontainers/testcontainers/1.12.4/org/testcontainers/containers/GenericContainer.html
You can implement your own Datasource based on DelegatingDataSource and then let it throw exceptions instead of delegating when ever you want to.
I've done this before by creating a Spring Boot test configuration class that created the DataSource and wrapped it in a Java proxy. The proxy simply passed method calls down to the underlying DataSource, until a certain flag was set. Once the flag was set, then any method called on the proxy would throw an exception without calling the underlying DataSource. Essentially, this allowed me to "bring the database down" or "up" simply by flipping the flag.

Getting Error while adding File System ISE Logic App Connector

I have created an ISE Logic Apps environment, and am trying to add the FileSystem ISE connector to the Managed connectors list, as it does not appear in my default list. When I click on '+Add', I can see the File System connector in the drop down that comes up, but when I select it & click on 'Create', I get the following error:
Failed to create connector 'isefilesystem'
Operation name
Set Integration Service Environment managed API
Time stamp
Mon Jan 13 2020 16:53:24 GMT+0000 (GMT Standard Time)
Event initiated by
xxxxxxxxx#xxxx.xxx
Error code
IntergrationServiceEnvironmentManagedApiDefinitionTagsNotSupported
Message
The tags are not supported in the managed API 'isefilesystem'.
The ISE File System connector is available. The ISE File System connector will not be automatically added to the ISE, you will need to manually add it yourself. Our engineers are working on getting that automatically added with new ISE deployments.
Here are steps from the document to add it manually to the ISE :
On your ISE menu, under Settings, select Managed connectors. On the toolbar, select Add.
On the Add a new managed connector pane, open the Find connector list. Select the ISE connector that you want to use but isn't yet deployed in your ISE. Select Create.
Only ISE connectors that are eligible but not yet deployed to your ISE appear available for you to select. Connectors that are already deployed in your ISE appear unavailable for selection.
Checkout this GitHub issue as well for details.
File system connectors is not yet available in ISE. You can use the shared connector (With gateway) in a Logic app in ISE till it is available.
It is on-premises data gateway. Yes there is already a work items for this and it is in progress and will be there in near future but this timeline is subject to change. As far as new features go, we are not able to disclose much at this time.
Also you could vote up this feedback to promote this feature to be achieved quickly.
I am having problems with the ISE Create File (Preview).
I have an API Connection defined with the Root Folder setting using dot notation, e.g. 192.168.1.23, because there is a DNS issue with hybrid cloud-on-prem lookup, or so I am told.
The Logic App portal editor in Designer mode behaves strangely when configuring the folder path in the Create File action. When using the pop-out folder picker I see "The use name or password is incorrect".
I have made sure that the credentials are correct and have tested successfully via other means.
Is there a work around?
Is this a known issue?

Hangfire configuration for SQL Server

I am coding a MVC 5 internet application, and am wishing to use Hangfire for recurring tasks.
How can I setup Hangfire to use SQL Server storage without specifying this in the Startup.Auth ConfigureAuth(IAppBuilder app) function.
Here is a resource link for SQL Server configuration: http://docs.hangfire.io/en/latest/configuration/using-sql-server.html
This resource states that:
If you want to use Hangfire outside of web application, where OWIN
Startup class is not applicable, create an instance of the
SqlServerStorage manually and pass it to the JobStorage.Current static
property. Parameters are the same.
The example code is as follows:
JobStorage.Current = new SqlServerStorage("connection string or its name");
I have tried the following code (with my own connection string), yet the dashboard is not available. I have called the code above from a controller function.
Is there something that I have not done correct? How can I setup Hangfire to use SQL Server storage without using the Startup.Auth class?
Thanks in advance.
I think this is your problem:
I have called the code above from a controller function.
You should be setting this up once on application startup - either in the Configuration method of an OWIN Startup class (followed by an app.UseHangFireServer();), or in the Application_Start method of your Global.asax.cs if you really don't want to use OWIN. Either way, the line you're looking for is right there in the documentation you reference:
Hangfire.GlobalConfiguration.Configuration.UseSqlServerStorage(#"connection string or connection string name");
HOWEVER, as far as I know, if you want to use the dashboard you must configure that part via OWIN along with an authorization filter. See http://docs.hangfire.io/en/latest/configuration/using-dashboard.html
So really, I don't know if any downside of using the OWIN configuration for all of this. It's the more modern platform, and since you mention this is for an MVC5 app it's unlikely that you have legacy concerns.

Error while adding project

I'm trying to create a new solution with dot net nuke.
I installed the packages and configured IIS to work with it.
Then with visual studio i created a new solution. I want to import an old module already created, so i copied/pasted the folder in "DesktopModules".
Then with VS i right click on the solution and selects add existing project.
This way i get an error:
The web application project "name" is configured to use IIS. The web server "http://dnndev.me/desktopmodules/name" is not found.
It's probably because the corresponding projet is configured to use a web server depending on the URL you've got.
I suggest you to edit the project file with notepad (csproj or vbproj) and to remove the specified URL configuration. You also have to set the UseIIS value to false.
Note that this configuration could be stored in the users project file (.vbproj.user or .csproj.user).
Then, try again to add this project to your solution.

EFCodeFirst 4.2 and Provider Manifest tokens

I have a library that I have created that depends on EF Codefirst for DB interaction. I am also using EntityMigrations Alpha 3. When I use the library in my main application (WPF) everything works fine and as expected. Another part of the system uses Excel and retrieves information using the same library via an additional COM class in between.
In the Excel scenario, as soon as it tries to connect to the database, it throws up an exception to do with "The Provider did not return a ProviderManifestToken".
I'm really not sure why I'm only getting the error when I go through Excel/COM. In both scenarios I can confirm that the same DB connection string is being used. THe method to retrieve the DB Connection string is also the same - they use a shared config file & loader class.
Any suggestions welcome.
Issue resolved.
I had also created a custom DBIntializer and part of the intialization calls upon EntityMigrations to ensure the DB is up to date. The custom migration calls the default constructor on your context. By convention this will either dynamically use it's own connection string for SQLExpress(I don't have installed) or try to look for an entry in your config file (I don't have this either for the dll - config comes from hosting apps).
This is what is causing the failure when being used from Excel(In my scenario). The Migration will be newing up an instance of the context using the default constructor. This means that a config entry for the connection string is required or it uses the default process(SQLExpress). When being used from Excel in a COM env – no config file exists.
Moving the migration out of the Initialization strategy means I no longer have a problem.

Resources