Writing JUnit test app to test a method which uses AppResources
Recently I was given a requirement to write a JUnit class( with main) to test a method in a Processor class which is running in weblogic. But this method in processor class makes use of AppResources like this: AppResources appResources = new AppResources("ApplicationResources"); String ruleFileName = appResources.getResourceString("rule.file.irlfile"); But when I try to run my JUnit test (stand alone app with main class) I am getting "java.util.MissingResourceException: Can't find bundle for base name ApplicationResources" exception. The appResources is null... Any ideas how to work around this problem?
It doesn't sound like the Process class was designed for testability outside of its J2EE server container, probably. So writing a unit test for it, under its current design, may be an exercise in futility. You might want to look into "Cactus" tests (search for JUnit Cactus on the web), to test it in its container. Or, redesign the class for testability, separating its business logic better (that's a lot of work to do though) so that it can be instantiated and exercised independently of its environment.
Similar Messages
-
Process and Forms - Issue with Method which Uses Imported Form Values
We are doing a project to implement ESS and MSS. Using Adobe Process and Forms we generated a process with form and workflow.
The workflow's first step uses a version of TS17900110 task to move the form to the workflow container.
Binding:
export:
&FORM_STANDARD& @0E\QAssign Value@ @9T\QGets data for...@ &FORM&
'USER_ID' @0E\QAssign Value@ @9T\QGets data for...@ &FORM_FIELD_NAME_1&
'PERNR' @0E\QAssign Value@ @9T\QGets data for...@ &FORM_FIELD_NAME_2&
'AWART' @0E\QAssign Value@ @9T\QGets data for...@ &FORM_FIELD_NAME_3&
Binding
import:
&EMPL_USERID.OBJID& @9S\QReceives data from...@ @0D\QAssign Value@ &FORM_FIELD_VALUE_1&
&PERNR& @9S\QReceives data from...@ @0D\QAssign Value@ &FORM_FIELD_VALUE_2&
&AWART& @9S\QReceives data from...@ @0D\QAssign Value@ &FORM_FIELD_VALUE_3&
The workflow is bringing values for: EMPL_USERID, PERNR, AWART.
We need to write these field values to a table using a method. We are using a custom task to do this.
The task triggers a method which calls a FM which makes the update to the table.
The step with the custom task is a foreground step which the workflow stops for so we can test execute it.
When we execute there is a breakpoint in the ABAP code which stopps us at the point where the values are being read.
We are trying to read values: 'USER_ID', 'PERNR', and 'AWART' but the debugger is not showing any values being brought in.
The binding we currently have for the step we feel is the problem:
This is all we have in there so far - NEED suggestions/advice:
Binding export:
&ZABSREQ& @0E\QAssign Value@ @9T\QGets data for...@ &_WI_OBJECT_ID&
(&ZABSREQ& - This is a BOR)
Any information is appreciated.
alicia.morante at gmail.com
alicia.morante at us.army.mil
Edited by: Alicia Morante on Jan 23, 2012 8:43 PMWe were very anxious to solve this issue.
While I was posting my counterpart realized that we did not have target containers setup to receive the values from the workflow.
Once those were set the values were able to be read from the FM.
Here's the binding updated to:
&EMPL_NUM& @0E\QAssign Value@ @9T\QGets data for...@ &EMPL_NUM&
&SUBTYPE& @0E\QAssign Value@ @9T\QGets data for...@ &SUBTYPE&
Still gave you some points for helping - Thank you. -
Calling from javascript a method which uses accesscontroller.dopriviledged
Hello everybody!
I've a problem in accessing my pc resources from a signed applet when calling methods from Javascript.
If I try from start() or init() methods, I can do it, but as soon as I try from anoter method defined by myself, it throws this me an AccessControlException:access denied.
I googled and found that I should use this code:
KeyStore smartCardKeyStore= (KeyStore)
AccessController.doPrivileged(
new PrivilegedExceptionAction() {
public Object run() throws KeyStoreException, NoSuchProviderException, NoSuchAlgorithmException, CertificateException, IOException {
KeyStore alfa;
alfa = KeyStore.getInstance("PKCS11",pkcs11Provider.getName());
alfa.load(null,null);//this is the point where it trhew the AccessControlException
return alfa;
);The problem is that with this code, I can't get it work with Firefox (which doesn't throw any exception, just won't work!) neither with IE, which throws this:
netscape.javascript.JSException: Nome sconosciuto.
java.lang.Exception: netscape.javascript.JSException: Nome sconosciuto.
at sun.plugin.com.DispatchImpl.invokeImpl(Unknown Source)
at sun.plugin.com.DispatchImpl$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin.com.DispatchImpl.invoke(Unknown Source)Please, help me! I'm in a big trouble, since I should finish my project asap and I am not able to pass this cumbersome obstacle...
Thank you in advance! :)Hi! Don,
You cannot call methods which breach Security from Javascript. That is what SUN says.
But there is a hack, or a work around...
Declare a boolean Variable , say named buttonClicked.
Initailly keep its value false(default).
Write an inner class that extends a thread class whose RUN method will contain the following piece of Code:
public void run(){
while(buttonClicked){
KeyStore smartCardKeyStore= (KeyStore)
AccessController.doPrivileged(
new PrivilegedExceptionAction() {
public Object run() throws KeyStoreException, NoSuchProviderException, NoSuchAlgorithmException, CertificateException, IOException {
KeyStore alfa;
alfa = KeyStore.getInstance("PKCS11",pkcs11Provider.getName());
alfa.load(null,null);//this is the point where it trhew the AccessControlException
return alfa;
}You start the Thread inner class in your init method.
So, its RUN method will continuously be waiting to go into the while loop.
And in your start method you will set the +"buttonClicked"+ variable to true upon a Javascript onclick event of a button.
So, the moment you click a button, you only set the buttonClciked variable to true in your start method--------
This does, in no way breach security. So no exception is thrown.. But the code which breaches security is initiated by another thread other than that spawned the Applet; so the browser does not care anything about its privileges. It just lets the execution of the code.
I hope it works for you; be in contact, if it doesn't.
Thanks and Regards,
Samba -
Why cant i down load my free apps it says payment method decline
why cant i down load free apps it says payment method decline
iTunes uses your payment method to ensure you are who you say you are and to ensure you have a way to handle in-app purchases if necessary. If you do not have a payment method in your iTunes account, then you need to update that. If you have payment method there and it is refused, it could be the bank that is refusing the way that iTunes and other merchants will put a temporary charge on the card to ensure it is valid.
-
Getting error while writing JUnit test case for RestFul Services
Hi All,
I have written Restful services in Netbean 6.8.
It's running well...no issues.
{color:#0000ff}While writing JUnit test cases for them, I am getting following error:
{color}{color:#993300}Testcase: testGetAuthenticated(com.ct.services.LoginServicesTest): Caused an ERROR
Implementing class{color}
java.lang.IncompatibleClassChangeError: Implementing class
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:303)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:316)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:303)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:316)
at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:160)
at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:65)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34)
at com.ct.services.LoginServices.getAuthenticated(LoginServices.java:205)
at com.ct.services.LoginServicesTest.testGetAuthenticated(LoginServicesTest.java:84)
Test com.ct.services.LoginServicesTest FAILED
F:\NetbeanProjectsWorkspace\DemoProject\nbproject\build-impl.xml:972: Some tests failed; see details above.
BUILD FAILED (total time: 11 seconds)
{color:#0000ff}Strange thing is that when I am commenting below lines and its related calls:
{color}
{color:#ff0000}EntityManagerFactory mEmf = Persistence.createEntityManagerFactory("AnyName");
EntityManager mEm = mEmf.createEntityManager();
{color}
{color:#0000ff}from my code, JUnit test cases are working fine.
{color}Anybody having any idea about this ?
Thanks
Avi
Edited by: Avi007 on Aug 28, 2010 5:17 AMHi All,
[http://stackoverflow.com/questions/2778295/test-driven-development-problem]
Please refer the above link for the solution
Thanks
Avi
Edited by: Avi007 on Aug 30, 2010 12:33 AM -
Testing ActionScript classes with native methods?
Hi,
I have an ActionScript class that I'm writing and would like to test using FlexUnit.
The only issue is that the ActionScript class has a member in it that is a class with native methods.
So, I get the following error when trying to run a test of that ActionScript class:
VerifyError: Error #1079: Native methods are not allowed in loaded code.
Does anyone know of a way to get around this? FlexUnit seems not to like native methods being present.
Thanks,
MattHi casdvm,
by definition, you only own objects that you created using one of the alloc* methods, copy: or new:. All other objects (IIRC with a few noted exceptions) are autoreleased.
If you create convenience methods in your own class, you should follow the same rule. For example, if you have a class Pet and want to implement the method +petWithName, your code might look something like that:
+ petWithName: (NSString *)name
return [[[Pet alloc] initWithName: name] autorelease];
Alex -
Hii,
I wrote source code of IAP , also I added test user for sandbox environment.
But In this method:
-(void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
and response.products.count return 0 , why?
what I didnt do well ?
Please help!If I try to login from Settings->Store, it asks for my credit info which I'm sure is not necessary.
Apple had this to say about that on 8.28.09:
"Setting up Test Accounts for Testing In App Purchase
Before testing In App Purchase in your application, you need to create an In App Test User in iTunes Connect—you should not use other accounts as doing so will result in prompts to enter your credit card number and other information.
Here is how to properly set up your test user for testing In App Purchase..."
Please read all the latest info at the link and good luck w/your app. -
Internet speed test app for Asha 311
Is there any internet speed test app for Asha 311? I tried the speed test from http://bsnlspeedtest.in but the result was very high. I have Airtel 3G and it always shows 3.5G.
Solved!
Go to Solution.If you want to check the max speed of your phone internet there are two methods.
1.
Check the speed in kbps while downloading any file using UC browser. Get UC browser from Nokia store or via www.ucweb.com
2.
Connect your phone as a modem to your pc and use any pc web browser and check the speed at http://speedtest.net or any other sites.
Hope this helps.
-------------------If this post helped you, click on accept as solution.------------------
-----------------------------Appreciate by clicking on white star.---------------------------- -
Revision: 5137
Author: [email protected]
Date: 2009-03-02 10:28:59 -0800 (Mon, 02 Mar 2009)
Log Message:
Fix failing security tests on BlazeDS/trunk by using a remote object to invalidate the FlexSession at the end of each test method which should cause each test method to run with a new/clean session. It looks like some test methods were leaving some things in a bad state which was causing the next test that ran to fail. These may be legitimate bugs/issues so we should investigate further to see what sequence of events gets things into a bad state but for these tests we want all of the test methods to run in isolation.
Modified Paths:
blazeds/trunk/qa/apps/qa-manual/WEB-INF/flex/services-config.mods.xml
blazeds/trunk/qa/apps/qa-regress/WEB-INF/flex/remoting-config.mods.xml
blazeds/trunk/qa/apps/qa-regress/testsuites/mxunit/tests/messagingService/security/stream ing-amf/JMSAuthSendSubscribeConstraintTest.mxml
blazeds/trunk/qa/apps/qa-regress/testsuites/mxunit/tests/messagingService/security/stream ing-amf/MessagingAuthProSendTest.mxml
blazeds/trunk/qa/apps/qa-regress/testsuites/mxunit/tests/messagingService/security/stream ing-http/JMSAuthSendSubscribeConstraintTest.mxml
blazeds/trunk/qa/apps/qa-regress/testsuites/mxunit/tests/messagingService/security/stream ing-http/MessagingAuthProSendTest.mxml
Added Paths:
blazeds/trunk/qa/apps/qa-regress/WEB-INF/src/qa/messaging/SessionManager.javaIn general theory, one now has the Edit button for their posts, until someone/anyone Replies to it. I've had Edit available for weeks, as opposed to the old forum's ~ 30 mins.
That, however, is in theory. I've posted, and immediately seen something that needed editing, only to find NO Replies, yet the Edit button is no longer available, only seconds later. Still, in that same thread, I'd have the Edit button from older posts, to which there had also been no Replies even after several days/weeks. Found one that had to be over a month old, and Edit was still there.
Do not know the why/how of this behavior. At first, I thought that maybe there WAS a Reply, that "ate" my Edit button, but had not Refreshed on my screen. Refresh still showed no Replies, just no Edit either. In those cases, I just Reply and mention the [Edit].
Also, it seems that the buttons get very scrambled at times, and Refresh does not always clear that up. I end up clicking where I "think" the right button should be and hope for the best. Seems that when the buttons do bunch up they can appear at random around the page, often three atop one another, and maybe one way the heck out in left-field.
While I'm on a role, it would be nice to be able to switch between Flattened and Threaded Views on the fly. Each has a use, and having to go to Options and then come back down to the thread is a very slow process. Jive is probably incapable of this, but I can dream.
Hunt -
[svn] 1074: Fix test case to implement new method in IXMLEncoder
Revision: 1074
Author: [email protected]
Date: 2008-04-02 13:00:45 -0700 (Wed, 02 Apr 2008)
Log Message:
Fix test case to implement new method in IXMLEncoder
Modified Paths:
blazeds/branches/3.0.x/qa/apps/qa-regress/testsuites/flexunit/src/tests/flexunit/wscl/dec oder/SOAPEncoderTestCase.asYear Is Leab Year?
1 no
4 yes
1580 yes
1582 no
1584 yes
1600 yes
1700 no
1800 no
1900 no
1996 yes
1997 no
1999 no
2000 yes
2100 no
2200 no
2300 no
2400 yes
2800 yes
2900 no
3200 yes
3300 no
3600 yes
3800 no
4000 yes
4200 no
4400 yes
4700 no
4800 yes
5100 no
5200 yes
6400 yes
6500 no
6800 yes
6900 no
7200 yes
7400 no
7600 yes
7800 no -
My gps is not working. I cannot use turn-by-turn navigation in google maps. I downloaded a GPS test app and it showed my phone is not locking on any satellites. How can I correct this?
We certainly want to make sure you get the most out of the GPS, wplaxico! Was this tested primarily outdoors? When did this begin? Any other recent apps of updates installed when this started?
Thank you,
YaleK_VZW
Follow us on Twitter @VZWSupport
If my response answered your question please click the �Correct Answer� button under my response. This ensures others can benefit from our conversation. Thanks in advance for your help with this!! -
Testing app on device shows only black screen.
Hi,
I created hello world app, app is working fine on simulator,
But when I install this app on device, and launch it from devie it shows only black screen. I am not sure whats the possible reason for this.
Device which I am using is Intex cloud fx.
Does any here faced this problem?
ThanksHi Malkit Singh,
I'm sorry to hear that you're having problems installing a test app that you developed for your Intex Cloud Fx.
Unfortunately, I have not heard of this issue. Do you have a different Firefox OS device that you would be able to test this on?
I would also suggest contacting Intex Support for device-specific issues.
If you believe there might be something wrong with the code in the test app, you can ask developer-related questions on [http://stackoverflow.com/questions/tagged/firefox-os StackOverflow].
Please let us know if you have any other questions about your new Firefox OS device! =)
- Ralph -
Can the iOS Field Test app data be written to file with GPS coordinates of readings?
I can run the Field Test app on my iPhone5 but I cannot automatically store the data revealed by the app. Would it be possible to do this? and link the GPS coordinates to the data? or is the network data not accessible from an app?
Ask the App developer. There is no such app native on the device.
-
How to set another instance of same live app as test app sharepoint 2013 provider hosted
Hi
I have SharePoint 2013 provider hosted app published in azure now i need to deploy another instance on same app as separate app for testing purposes, i have created another site in azure and done all profile adding packaging the app with visual studio to
deploy .App file to SharePoint catalog. problem is that .app file is same name and when i going to add, it replace with same version witch deploy as live instance.
Any one can give solution how to handle this greatly appreciated ...
Kind Regards
RadikaHi Radika,
According to your description, there is already an app deployed in your site, you want to deploy another instance of it to the same site for testing purpose.
As a common practice, when developing an app, for not overriding the previous version, it is recommended to create another project for testing used only with another
name.
By doing this, we can keep the development in the testing project, when it is done, migrate the newly customization to the original project and deploy it with a new
version number.
Thanks
Patrick Liang
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support,
contact [email protected]
Patrick Liang
TechNet Community Support -
In other words jQuery mobile does not generate code with result can not test Apps in dw cs6
from the time compiled in phonegap dw c6 tools and tested from dw the App in Android sdk, for a jQuery mobile App the, code in split/Live is the same as split/Live/Live Code.... in other words jQuery mobile does not generate code with result can not test Apps in dw cs6, but design shown without jQ mobile generated code, well?
well, jQuery mobile stopped to generate code with result can not test Apps in dw cs6, but design shown without jQ mobile generated code, well (neither generated code seems nor design as seem in mobile)....????
Maybe you are looking for
-
How to do the reverse po in this report
Hi, i have a one problem in this report . i don,t know how to display the reverse po in this report. reverse po should have a po history cat. 'N' (field is bewtp) i connect type 'Q' and the type 'E' but not been able to connect the 'N'. when
-
on development client thr is a error of posting period. i set all as well as production server in t.code s_alr_87003642... bt still i m getting msg...posting period not open for 2009.... is any oher transaction for set the posting period? thanks Rekh
-
Is there any query i can use to monitor Users tried to log on to data base
is there any way to know the users tried to log on to data base is this possible if user entered user name and wrong password 4 times for example is there a table or something let me know that for example HR tried 4 times to log into data base
-
I want to export all of my photos to use them with a different program, and when I tried to export them to a folder, the export function shows "Unable to create" followed by the file extension. After I tried this several times I also discovered that
-
LabVIEW opening in Kyle, TX (south Austin)
Primary Function: The LabVIEW Development Engineer will be a key member of small team of LabVIEW developers that is responsible for developing and maintaining the company's energy storage SCADA systems. There is Core software that is common to all cu