I do have some ADF BC components deployed in an ear . I want to access those from another ear. Is that possible ?
eg : I do have a TestAM ( application module ) defined in application ( A.ear) and I wan to access TestAM from a servlet in another application ( B.ear )
Thanks
Jijoy
if you expose the TestAM as an EJB then you can call it remotely.
Also possible to wrap it as a web service and call that way.
Look at Service Interface and EJB Session Bean tabs on the AM in JDev.
Related
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.
I have 5+ separate logic Apps that are called via HTTP Receive. Examples are:
GetUsers
GetLocations
GetCalls
etc.
I would like to expose the Logic Apps via API Management as individual operations on one API. Any samples online to show I can do that? Am I right to assume that I'll need a policy (url-rewrite, control flow)?
Any guidance appreciated.
You can add Logic Apps as operations on an existing API by:
Creating a new operation (by default http post for a Logic App)
Defining the request/response that your Logic App will expect you to pass to it
Go to the 'backend' element in the designer and select the 'forms based editor' from the designer.
In the editor, select 'Azure resource' and then browse to the Logic App you wish to use - the is should be an http request/response based Logic App.
Add other Operations and connect them up for each Logic App you want to use.
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 :).
Currently we have our Active Directory (LDAP) domain controller defined in the ConnectionStrings.config file. Is it possible to configure a second domain controller, as a fail-over option?
For example, recently Domain Controller 1 failed, and I had to manually change the connection string to point to Domain Controller 2 - but the website was generating errors in the mean-time (for several hours of down-time).
We are running Sitecore version 6.5
(Sitecore.NET 6.5.0 (rev. 120706) )
No, it's not possible to configure a fail-over partner.
You could put a loadbalancer in between the two domain controllers.
You could actually do that. There are options with the AD module that allow for connecting to multiple domains and/or using multipe providers. All pipelines in Sitecore are extendable, so there's nothing to stop you from setting this up. You could easily do some custom coding to catch exceptions during login and switch to a different provider. The trick is just doing the custom coding.
I am implementing a WPF client application in MVVM architecture using PRISM (I am new to PRISM).
The WPF application has 3 main regions :
Left Region
Right Region
Side Region
The left region has a view with a 'Fetch Button', that when pressed should connect to a 'FETCH' WCF service, fetch items, disconnect from the service and present the items in the view.
The right region has a view with no buttons. This view should connect every 10 minutes to the 'POLL' WCF service, fetch items, disconnect from the service and present the items in the view.
The side region has a view with no buttons. This view should connect to the 'NOTIFICATIONS' WCF service, and stay connected to it during the whole application life cycle. It should receive callbacks from the service, that should be presented in the Side view.
Here is an image showing what it should look like:
Questions :
What should I pass on to the constructor of the 'FETCH MODULE' that includes the 'Fetch View' ? should it be the service itself or should it be some channel factory ? I think it should be some kind of channel factory, because the connection to the 'Fetch WCF Service' needs to be initiated every time the user pressed the 'fetch' button.
Same question goes for the 'POLL MODULE'.
Regarding the 'NOTIFICATIONS MODULE' - should I pass a Singleton instance of the 'Notification Service Client' ? (since the application needs to open only one client to the service, and it should stay connected all the time)
In order to avoid the 'Notifications' client faulting because of a timeout, I need to implement some sort of 'heartbeat', that will call a stub method on the 'Notifications' WCFservice, so that it doesn't timeout. Where should I place the code for the heartbeat ? should it be in the 'NOTIFICATIONS MODULE' ? who should initiate it ? (I believe it should run in some sort of background thread)
I am currently using MEF, and I don't really know what I am doing (I decorated the views with [Export] and the [ViewModel] setter with [Import] etc, but I still don't understand how I control who gets loaded and when). In addition - I don't understand how the Dependency Injection works in MEF. What are the differences between using 'MEF Bootstrapper' and 'Unity Bootstrapper' ?
I have seen some people use MEF and just use [Import] and [Export] attributes, and some people that inherit their modules from 'IModule' and implement 'InitializeModule' with EventAggreagator, Container and RegionManager. What are the differences between these approaches, and when should you use each approach ?
Do you recommend using the 'Add Service Reference...' or to manually create an 'IChannelFactory' ? (PROs \ CONs)
Should the service clients be part of the Modules or part of the Infrastructure ?
I have searched a lot on the internet for samples of WPF+PRISM+WCF and could not find any good samples I can use, so I can understand how to inject the services into my view-models. Can anyone offer any examples \ sample links ?
Following 4 questions are a tough cookie:
All 3 WCF services I have mentioned use the same 'Username+Password' authentication method, which means I need to pop-up a 'Login' window when the application loads. What is the best practice for doing such a thing in PRISM and MVVM ? Should the 'Login' window replace the 'Shell' window ? (I don't think so, so what should it be ?)
When the user enters the username+password - Should I try to connect to just the first service, and if it succeeds - disconnect from it and close the 'Login' view (meaning, I assume that the connection will succeed with the other services).
Where could I store the username+password the user has entered, so that the application can keep on reconnecting to the services without requesting the user to provide the credentials each time ?
What do you advise should be the approach I take if for some reason - one of the modules tries to connect to one of the WCF services, and doesn't succeed because of credentials ? Should I raise an event that forces all other modules to disconnect from their services, and then pop-up the 'Login' view ?
Sorry for the long post ...