Problem creating unit testing repository (and workaround)

I tried to create the unit testing repository with a user that had all the required system privileges granted through a different role other than RESOURCE and CONNECT roles, and who wasn't explicitely granted CREATE VIEW, but inherited it through the custom role. However the check in SQL Developer is explicitely for the RESOURCE and CONNECT roles (regardless of what privileges they have granted to them in whichever database version past, present or future) and for CREATE VIEW privilege granted direct to the user:
SELECT DECODE (roles.required_role_count + privs.required_priv_count,
               3, 1,
               0)
          AS basic_privs_granted
  FROM (SELECT COUNT (*) AS required_role_count
          FROM user_role_privs
         WHERE granted_role IN ('CONNECT', 'RESOURCE')) roles,
       (SELECT COUNT (*) AS required_priv_count
          FROM USER_SYS_PRIVS
         WHERE privilege IN ('CREATE VIEW')) privsI found this SQL contained within the sqldeveloper/extensions/oracle.sqldeveloper.unit_test.jar in an XML file: oracle/dbtools/unit_test/manage_user/UserSql.xml and replaced the SQL with one that actually checks for the specific system privileges:
SELECT DECODE (required_sys_priv_count,
               10, 1,
               0)
          AS basic_privs_granted
  FROM
       (SELECT COUNT(*) AS required_sys_priv_count FROM
         (SELECT privilege
            FROM role_sys_privs
           WHERE privilege IN ('CREATE CLUSTER','CREATE INDEXTYPE','CREATE OPERATOR','CREATE PROCEDURE','CREATE SEQUENCE','CREATE SESSION','CREATE TABLE','CREATE TRIGGER','CREATE TYPE','CREATE VIEW')
          UNION
          SELECT privilege
            FROM user_sys_privs
           WHERE privilege IN ('CREATE CLUSTER','CREATE INDEXTYPE','CREATE OPERATOR','CREATE PROCEDURE','CREATE SEQUENCE','CREATE SESSION','CREATE TABLE','CREATE TRIGGER','CREATE TYPE','CREATE VIEW')))This enabled me to bypass that check when creating the respository. I don't know if all these privileges are actually required by the unit testing repository or not, so maybe the above list can be reduced...
Edited by: RDB on Mar 1, 2013 2:24 PM

Hi Sai Vineeth,
First of all, I appreciate your elaborate way of framing the question. That itself helps others to comment.
On the first two questions, I am sure you'll be able to follow the answers provided and take care of your concerns.
On your question 3), an additional piece of information that should bring smile to you
Whether the Test is to happen in DEV or QAS or whatever 'System Role' is dependent on the Test Plan.
So, if you have two distinct Test Plans, one for Unit Tests and the other for Integration Tests, which should be the case, as usual, you can certainly point the System Role to DEV or QAS as required.
Feel free to pose any other query as well.
Best regards,
Srini

Similar Messages

  • Create Unit Test wizard does not populate parameters

    If I right click a standalone function or procedure and select "Create Unit Test", the parameters window is populated and I am able to enter input and expected output values for the test.
    However, when I attempt the same with a function that is within a package, the parameters window is blank.
    I am using version 3.2.20.09

    Looks like someone has already reported this bug (and a workaround) in this thread:
    unit testing packages in sql developer
    Edited by: AJMiller on Dec 11, 2012 9:24 AM

  • Unit testing, integration and functional testing

    Hello all,
    I would like to know the difference between Unit testing, integration and functional testing. And also what are the testing tools that are more commonly used?
    Thanks,
    Maxx

    Hi,
        Unit testing :
                    A complete cycle of each  module will be tested
                    ie for PP Right from requirements to planned orders /production orders
                    confirmation .
        Integration testing:
                    Here cross module testing will be carried out.
                     ie PP and MM integration
                        After confirming production order a GR is made /billing is carried out
                        and delivered.
          Functional testing:
                    This testing is carried out to see whether the system can with stand l the loads during processing by users.
                    Stress test and volume test.
                Regards,
                nandha

  • Unit Test Repository Problems

    Ciao,
    This is related to SQL Developer 3.0 Unit Test feature. Is it possible to have many shared repository in a single DB instance? How to prevent the users to delete the testcases written by another user in a shared repository?
    Regards,
    Bala

    Hi, it is possible:
    create the two roles
    UT_REPO_USER
    UT_REPO_ADMINISTRATOR
    Extract the file dbtools\unit_test\repository\create10.sql from the jar oracle.sqldeveloper.unit_test.jar
    Run the create10.sql script
    HTH
    Oliver

  • LABVIEW.LIB was not called from a LabVIEW process when creating unit tests

    We are developing a DLL to be integrated in LabVIEW using CLFs. So far we have the system working, but we wanted to create some unit tests in C as part of our release process. The problem is that when I link labview.lib in VS C++ and then call the EXE generated I get an error saying: "LABVIEW.LIB was not called from a LabVIEW process". As mentioned in http://zone.ni.com/reference/en-XX/help/371361J-01/lvexcodeconcepts/debug_dlls_and_dll_calls/:
    "Calling the shared library from another C program is also another way to debug the shared library. By calling the shared library from another C program, you have a means of testing the shared library independent of LabVIEW, thus helping you to identify any problems, sooner."
    Some of our functions, however, use LabVIEW specific instructions and we would like to test them in a realistic environment (i.e., calling to the actual functions instead of creating stubs).
    Is there any workaround to this problem?
    Thanks!!

    Hello SaraGr,
    Welcome to the NI Discussion Forums! I have a couple of questions to better determine the issue here:
    1. What is the LabVIEW version that you are using?
    2. Does your DLL uses Serial Compatibility VIs? If so, try using your development on NI-VISA instead of Serial.
    3. Are you using a Code Interface Node (CIN)? If you do, I see that from the help file you would need to compile the code for the new platform. Also, please remember that functions specifc to CINs (such as SetCINArraySize) will not work in a DLL.
    4. Be sure to include the header files in your program, like extcode.h. Please follow this white paper to link labview.lib to your program, or follow the Alternate Method.
    Regards,
    Daniel REDS
    RF Systems Engineer
    Help us grow.
    If a post solves your question, mark it as The Solution.
    If a post helps, give Kudos to it.

  • Suggestions requested for Unit Testing process and build processes.

    Hi All,
    We are using WebLogic WorkShop 8.1 SP2 to build our WebApp. One thing I am trying
    to get together is a "Best Practises" list for aspects of WorkShop developement,
    particularly Unit Testing, Continous Build methodology, source control management
    etc.I have been through the "Best Practises Guide" that comes in WorkShop help,
    but it doesnt address these issues.This could help us all for future projects.
    1)Could anyone give pointers on how to perform Unit Testing using either JUnit/JUnitEE
    in the WorkShop realm, given that Controls cannot be accessed directly from PO
    Test classes.
    2)For a project of size say 5 developers ,does it make sense to have a nightly
    build using tools like CruiseControl?We use CVS for our source control and its
    working out pretty well, but given that we currently have no Unit Tests that can
    be run after the build and that can provide some reports on what broke/what didnt?
    I am sure we all would appreciate any suggestions and more questions on this topic.
    Thanks,
    Vik.

    Hi, Chris,
    can you perhaps explain your solution in greater detail. I am really curious to
    find a way to test controls.
    "Chris Pyrke" <[email protected]> wrote:
    >
    I have written (well it's a bit of a dirty hack really) something that
    lends itself
    to the name ControlTest (it unit tests controls). Its a blend of Junit
    and Cactus
    with some of the source of each brutalised a bit to get things to work
    (not much
    - it was a couple of hours work, when I was supposed to be doing something
    else).
    To write a control test you code something like...
    package com.liffe;
    import com.liffe.controlunit.ControlTestCase;
    import controls.Example;
    public class TestExample extends ControlTestCase
    private Example example = null;
    public void setUp() {
    example = (Example)getControl("example");
    public void testExample() {
    this.assertNotNull(example);
    String result = example.getData();
    assertEquals(result, "Happy as Larry");
    Other tasks required to set up a test are creating a web project with
    a jpf which
    needs some cut and paste code (14 lines) in its begin method and a jsp
    which is
    also cut and paste (5 lines). (ie create a standard web project and paste
    in 2
    pieces of code)
    In the web project you need to create a control (A) with an instance
    name of controlContainer.
    (if it's called something else the pasted in code will need changing
    to reflect)
    In this control you need to put an instance of TestContainerImpl and
    any controls
    that need testing.
    You then need to add a method to the control (A) that looks like…
    * @common:operation
    public String controlTestRun(String theSuiteClassName, boolean xsl)
    container.setControl("example", example);
    return container.controlTestRun(theSuiteClassName, xsl);
    You need to call container.setControl for each control being tested and
    the object
    'container' is the instance name of the TestContainerImpl that was put
    in.
    There are 4 jars (junit, cactus etc) that go in the library. You will
    also need
    the ControlUnitBase project (or maybe just it's jar).
    To use you call a URL like:
    http://localhost:7001/TestWeb/Controller.jpf?test=com.liffe.TestExample
    TestWeb is the name I gave to my web project - this will be different
    for each
    test project
    com.liffe.Example is the class above and will therefore be different
    for each
    test case.
    You can also call
    http://localhost:7001/TestWeb/Controller.jpf?test=com.liffe.TestExample&xsl=true
    (Note the extra &xsl=true) and the browser will (if it can) render it
    more prettily.
    This seems to do the job quite nicely, but there are several caveats
    I would hope
    someone from bea would be able to address before I start using it widely.
    1) To access the control you need to create it (eg as a subcontrol in
    the control
    (A) above.
    To get it into the test case you need to pass it round as an Object (can't
    return
    Control from a control operation). As it's being passed around among
    Java (POJO)
    classes I'm assuming that control remains in the control container context
    so
    this is OK. It seems to work and the Object is some form of proxy as
    any control
    seems to be reproxied before the control is invoked from the test case.
    2) If I'm testing controls called from a JPD then they either need to
    be in a
    control project (and my test cases called from a Web Project) which makes
    for
    a large increase in project numbers (we already have this and are trying
    to resist
    it) To avoid this - as a process project is a brain damaged web project
    I simply
    perform some brain surgery and augment the process project with some
    standard
    files found in any old web project. this means I can call the test JPF
    from a
    browser. This seems nasty, is there a better way?
    3) I would like to be able to deliver without the test code. At the worst
    the
    code can be in place but must be inacessible in a production environment.
    I don't
    know how best to do this - any suggestions (without creating lots of
    projects,
    or lots of manual effort)
    If anyone has read this far I would ask the question does this seem like
    the kind
    of thing that would be useful?
    Hopefully a future version of workshop will have something to enable
    unit testing
    and this hacking will be unnecessary.
    Could someone from BEA tell me if this is a dangerous way to do things?
    Chris
    "vik" <[email protected]> wrote:
    Hi All,
    We are using WebLogic WorkShop 8.1 SP2 to build our WebApp. One thing
    I am trying
    to get together is a "Best Practises" list for aspects of WorkShop developement,
    particularly Unit Testing, Continous Build methodology, source control
    management
    etc.I have been through the "Best Practises Guide" that comes in WorkShop
    help,
    but it doesnt address these issues.This could help us all for future
    projects.
    1)Could anyone give pointers on how to perform Unit Testing using either
    JUnit/JUnitEE
    in the WorkShop realm, given that Controls cannot be accessed directly
    from PO
    Test classes.
    2)For a project of size say 5 developers ,does it make sense to have
    a nightly
    build using tools like CruiseControl?We use CVS for our source control
    and its
    working out pretty well, but given that we currently have no Unit Tests
    that can
    be run after the build and that can provide some reports on what broke/what
    didnt?
    I am sure we all would appreciate any suggestions and more questions
    on this topic.
    Thanks,
    Vik.

  • Create Unit Test Vectors From The Unit Test Configuration Window

    I have recently been using more test vectors in the unit test framework.
    The principle works well but if you are in a unit test and decide you need a test vector you must:
    Close the unit test configuration
    Create a test vector
    Set up your vector (entering values and data types, which is much easier if you could see the actual unit test case)
    Close the vector configuration window
    Open the unit test configuration
    Assign the new vector file to the unit test
    Now you can assign vectors to test inputs
    This seems convoluted and forces unnecessary context switchs.
    I propose that at a minimum, you should be able to create a new vector file and launch it's configuration without leaving the unit test configuration window. I suspect that the whole process could be streamlined even further though.
    James Mc
    ========
    CLA and cRIO Fanatic
    wiresmithtech.com/blog

    Oops supposed to be ideas exchange, sorry!
    James Mc
    ========
    CLA and cRIO Fanatic
    wiresmithtech.com/blog

  • Unit Testing, Null, and Warnings

    I have a Unit Test that includes the following lines:
    Dim nullarray As Integer()()
    Assert.AreEqual(nullarray.ToString(False), "Nothing")
    The variable "nullarray" will obviously be null when ToString is called (ToString is an extension method, which is the one I am testing). This is by design, because the purpose of this specific unit test is to make sure that my ToString extension
    method handles null values the way I expect. The test runs fine, but Visual Studio 2013 gives includes the following warning:
    Variable 'nullarray' is used before it has been assigned a value. A null reference exception could result at runtime.
    This warning is to be expected, and I don't want to stop Visual Studio 2013 from showing this warning or any other warnings, just this specific case (and several others that involve similar scenarios). Is there any way to mark a line or segment
    of code so that it is not checked for warnings? Otherwise, I will end up with lots of warnings for things that I am perfectly aware of and don't plan on changing.
    Nathan Sokalski [email protected] http://www.nathansokalski.com/

    Hi Nathan Sokalski,
    Variable 'nullarray' is used before it has been assigned a value. A null reference exception could result at runtime.
    Whether the warning above was thrown when you built the test project but the test run successfully? I assume Yes.
    Is there any way to mark a line or segment of code so that it is not checked for warnings?
    There is no built-in way to make some code snippet or a code line not be checked during compiling, but we can configure some specific warnings not to be warned during compiling in Visual Basic through project Properties->Compile
    tab->warning configurations box.
    For detailed information, please see: Configuring Warnings in Visual Basic
    Another way is to correct your code logic and make sure the code will not generate warning at runtime.
    If I misunderstood you, please tell us what code you want it not to be checked for warnings with a sample so that we can further look at your issue.
    Thanks,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Guidence regarding creating  a test data and running any function module

    hi pals,
       can you plz tell me how to create a test data, commit and run any function module, in details(step wise) ??

    Hi yawmark,
    I appologise for including a poor code example ealier on, i had to come up with something quick. I will however, visit the sugeted sites you mentioned, thank you.
    I did however, create a simple class that compiles and can be used to set, return, reset and print a few details about a person. I hope that is of better use than my previous example. here it is:
    public class SimplePerson {
        int age = 0;
        String firstName = "";
        String lastName = "";
        /** Creates a new instance of SimplePerson */
        public SimplePerson() {
        /** Sets the age of this person */
        private void setAge(int takeAge){
            age = takeAge;
        /** Returns the age of this person */
        private int getAge(){
            return age;
        /** Sets the First Name of this person */
        private void setFirstName(String takeName){
            firstName = takeName;
        /** Returns the First Name of this person */
        private String getFirstName(){
            return firstName;
        /** Sets the Last Name of this person */
        private void setLastName(String takeName){
            firstName = takeName;
        /** Returns the Last Name of this person */
        private String getLastName(){
            return firstName;
        /** Resets the details of this person back to back to
         *  the default form.
        private void resetAll(){
            age = 0;
            firstName = "";
            lastName = "";
        /** Prints all the details this person has */
        private void printAll(){
            System.out.println("Age: " +Integer.toString(age)
                    + "\n First Name: " + firstName
                    + "\n Last Name: " + lastName );
    }Cheers mate

  • Problems creating the Master Repository with MS SQL Server 2000

    Hello guys!
    I can't create the Master Repository with MS SQL Server 2000 database.
    Wath is the correct adress in the URL?
    I select the Driver: com.microsoft.jdbc.sqlserver.SQLServerDriver and the URL: *jdbc:microsoft:sqlserver://<host>:<port>;SelectMethod=cursor[;<property>=<value>...]*
    Thanks
    Maurício
    Edited by: user857262 on 03/10/2008 10:05

    Hi Maurício,
    For MS SQL Server the following drivers should avaliable in /drivers folder (http://www.inetsoftware.de/),
    * msutil.jar
    * mssqlserver.jar
    * msbase.jar
    JDBC Driver is:
    com.microsoft.jdbc.sqlserver.SQLServerDriver
    JDBC URL is:
    jdbc:sqlserver://serverName\instance:port;property=value[;property=value]
    Example,
    jdbc:sqlserver://myHost:1433;selectMethod=cursor;databaseName=myDB
    Thanks,
    G

  • K8N Neo2 boot problems, freezes at testing base and extended memory

    I recently bought a motherboard/cpu combo and been having problems.   I'll start with my system specs:
    MSI K8N Neo 2
    AMD 64 3000+ Rev E
    XFX Geforce 6600GT
    Corsair Valueselect 184-Pin DDR SDRAM Unbuffered DDR 400 , 4 512MB sticks
    400W Powersupply
    I ordered a mother/cpu combo along with other parts to build a new computer.  Finally everything arrived a couple days ago and I started building.  First I installed the mb, cpu, ram and vid card to make sure everything was working.  When I started it up I got nothing.  So I started messing around and dropped the ram down to only one stick and used the D-Bracket.  I figured out the cpu had been dislodged during shipping, got it installed again and was able to boot up could get into the bios etc.  I put back in my other three sticks of ram everything seems to be working.  Next I hooked up the hd, cd/dvd etc.  Tried to boot up and it freezes after listing the total memory.  Looking at the D-Bracket it shows it freezes at Testing Base and Extended Memory.  So I unplug everything back down to just cpu, ram and vid card to see if it still works.  It freezes again at testing base and extended memory.
    At this point I drop the ram back down to one stick.  It boots up and I can get into the bios again.  So I shut everything off and put back in the rest of the ram.  Turn it on and it freezes at the same point.  Hmm, drop it back down to one stick and I can make it through to the bios.  Now I'm just frustrated and want to see if I can get my other components working and maybe windows installed then I'll come back to figuring this out.  So I save and exit the bios, while it's rebooting again it freezes at the Testing base and extended memory.
    After playing around with it some more over the past day here is what I've come to see.  If I move one stick of ram around I can get past the testing extended memory to get into the bios or up to the point of needing a boot disk etc.  If I reset or reboot it from this point it will freeze.  If I just leave my computer alone and off for around 30 minutes I can start it up once then it will freeze.  Now I'm just confused why it will intially start up as everything is ok but freeze if it resets.  Everytime it freezes it will be at the Testing Base and Extended Memory.
    Some things I have tried while talking to a friend about the problem is clearing the cmos and also putting in the ram settings in the bios.  Neither seems to work.  I've done a lot of searching on google and in this forum and haven't seen anyone talk about a problem like this so hopefully I'm not missing anything.
    If there's anything else you guys need to know about my setup let me know.  I also hope I wrote this all clearly because at this point I'm pretty frustrated.
    Thanks!

    Ok, newest update.
    After clearing the cmos I put in a stick of ram.  Everything loaded up ok and I went into the bios and entered the values (2.5-3-3-8) and 2.75V.  To my amazement it didnt' lock up after saving and exiting and it made it through to the Disk Boot Failure etc.  So I hit the reset button to see if it would go all the way through again and it froze again with D-Bracket LEDs showing the Testing base and extended.  I turned off the case with the on off switch in the back and powered up again.  It went right through in the past I'd have to wait.  So it seemed like things were a little better.
    So I put in a second stick of ram and it booted all the way through, tried to reset to see what would happen and it froze.  Turned power on and off and it froze not making it anywhere.  Tried that a few more times and it would always freeze right away making no progress.
    Back down to one stick of ram and it works again where I can go into the bios, save and exit and it'll make it through a full boot up to Disk Boot Failure.  Weird thing was once after just hitting the reset button it actually made it all the way through.  So it seems to act differently almost everytime.
    To me at least there doesn't seem to be a logical way I can think of what the problem could be.

  • Create a new repository and import metadata...

    Hi all,
    I'm trying to initiate the exercise in link http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/bi/bi11115/biadmin11g_02/biadmin11g.htm
    I installed the OBIEE 11.1.1.5.0 and 11.1.1.6.0, created the ODBCs connections, but when I try to connect to the repository, using both ODBC 3.5 and OCI 10g/11g the Administration Tool returns 'Connection Failed'
    The Middleware installation is hosted in an Oracle Linux environment, a VMBox SampleApp_V107 I downloaded from OTN site.
    In the Middleware installation, in the network/admin folder I created the tnsnames.ora file to try to correct this problem. But it did not worked.
    Anyone can help me?
    Sorry about my english.
    Regards,
    Gustavo.

    Try this
    Choose OCI 10g/11g
    Data Source Name: give tns entry like
    (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = <hostname>)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XE)))
    Pls mark if helps

  • Can you create a test online and get the results filter in the report tab?

    Im brand new to this software and i had a big concern about it.
    This is a great tool to create surveys and forms to fill out but i was wondering if you can create a quiz.
    By a quiz i mean that instead of sending me back the data the user click in the multiple choice is it
    possible for me to get instead if they got it right or wrong.
    I want to retun if they got it right a boolean variable (true or false)
         logic ex)
         if (answer == true)
             return "correct"
         else
              return" "incorrect"

    Hi;
    You can certainly create a Quiz using FormsCentral but there is nothing built in to "grade" the quiz and no integration with any grading systems like flubaroo.
    You might be able to use "Formulas" on the "View Response" tab to identify correct/incorrect answers. 
    This describes a bit about how to use Formulas (they can be done in a column as well as a row): http://acrobatusers.com/tutorials/how-to-work-with-formulas-in-formscentral
    This is a list of the forumulas available in FormsCentral: http://helpx.adobe.com/acrobat-com/formscentral/help/formula-syntax-built-in-functions.htm l
    Thanks,
    Josh

  • T420s & Windows 8: startup problems in legacy bios mode (and workaround​)

    a heads up for anyone looking to install windows 8 on a t420s. after my inplace-upgrade from windows 7 to windows 8, the os would only boot every 10-15 tries. most of the time it was stuck on the blue windows bootloader logo.
    after being annoyed too much by this, i went ahead and manually converted the MBR to GPT with the help of gparted/gdisk . then i switched to UEFI-only mode in the bios and used a UEFI-enabled windows 8 boot stick to use the win 8 recovery tool to make the disk bootable again.
    since then, no more boot problems.
    TL;DR: if you plan a fresh installation of windows 8 x64, make sure to switch to UEFI only mode in bios before running setup.

    Hi,
    i got my new T420 in may this year. As I am a student i get the new Windows 8 out of Dreamspark one month ago. Before I installed Windows 8 x64 I made all bios and firmware updates i can get. 
    After the successfull installation I got some startup hangs, not regular, but most of the boots. A few days ago a new bios was available, so I hope this one will get me rid of the problem. But the same thing happens, well I think it is the powermanagement, because the hang always happens at this point, when the display is going to dim. If I have the power plugged in, I don't get this problem. 
    Hope this will be fixed in later versions of bios / powermanagement.
    Best Regards

  • Unit testing in J2EE environment

    Hi All:
    We have been trying to use Junit for creating unit test scripts, and have been bit successful in unit testing DAOs and Value objects - but problem is testing of components like EJBs and Servlets or even classes like Actions or Commands. Since these components run under application server environment, I am not sure how to unit test them without either deploying them on the actual server or simulating app server and rest of the system.
    I was wondering if people could share their experience in writing unit test scripts especially for J2EE components - like Servlets, JSPs and EJBs. On the similar note, is there any similar tool or API for creating integration test scripts?
    Thanks,

    Well - we already have couple of other servers but that's for beta, QA and Integration testing. Problem is with the unit testing. In unit testing, some piece of code is tested by itself. And I am not sure how I can unit test some of the classes like Servlets, EJBs, JSPs or even dependent classes like Commands or Actions. For example, consider following Action class from Java Pet Store:
    public final class CartHTMLAction extends HTMLActionSupport {
    public Event perform(HttpServletRequest request)
    throws HTMLActionException {
    // Extract attributes we will need
    String actionType= (String)request.getParameter("action");
    HttpSession session = request.getSession();
    // get the shopping cart helper
    CartEvent event = null;
    if (actionType == null) return null;
    if (actionType.equals("purchase")) {
    String itemId = request.getParameter("itemId");
    event = new CartEvent(CartEvent.ADD_ITEM, itemId);
    else if (actionType.equals("remove")) {
    String itemId = request.getParameter("itemId");
    event = new CartEvent(CartEvent.DELETE_ITEM, itemId);
    else if (actionType.equals("update")) {
    Map quantities = new HashMap();
    Map parameters = request.getParameterMap();
    for (Iterator it = parameters.keySet().iterator();
    it.hasNext(); ) {
    String name = (String) it.next();
    String value = ((String[]) parameters.get(name))[0];
    final String ITEM_QTY = "itemQuantity_";
    if (name.startsWith(ITEM_QTY)) {
    String itemID = name.substring(ITEM_QTY.length());
    Integer quantity = null;
    try {
    quantity = new Integer(value);
    catch (NumberFormatException nfe) {
    quantity = new Integer(0);
    quantities.put(itemID, quantity);
    event = CartEvent.createUpdateItemEvent(quantities);
    return event;
    In order to unit test above class from say, JUnit test script class, I will have to pass HttpServletRequest object to its method - I will also have to store corresponding command params and store them in the request object - how will you write unit test script for the above class?

Maybe you are looking for

  • How can i make something in dreamweaver stay in fixed position?

    Hey guys, I'm having a really hard time getting the css right on this one, perhaps someone can see what I'm missing. If you go to my website http://www.vickybonline.com and scroll down to the bottom of the page, you can see I have set up a few rss fe

  • Help! I can no longer choose Adobe Media Encoder when trying to Render a Video.

    When I try to Render a Video, only the JPG option is available, but I need to render a Quicktime. Most likely related is a new error I receive when launching Photoshop CS6 Extended: "Could not complete your request because of a program error." This d

  • How to force check right value of a JTable cell?

    Hi, I have a JTable with a column that must have a value no empty and between 0 and 100. I made a sample with only one column for simplicity. The code works fine when the user types some value. However, when the user press ENTER to go to next column,

  • Crash in data transfer process, exception cx_rs_step_failed_callstack

    Hi, I am having problems with a data transfer process, i am getting the message: Extraction datasource Z_WMS_VRM    Prepare for extraction    Exceptions in Substep: Extraction Completed    Processing terminated When I click the button behind "Excepti

  • Iphone 5 plug in but don't recharge

    Hello everybody ! I plug my iphone 5 in but it doesn't recharge ! He's off and the screen is black, with battery with 3 sticks .. When i plug off, i see the battery and the cable sync. I already try the button up + home .. nothing again ! I change th