How to check whether a user session is null or not

Hi
I am using Jdeveloper 11.1.2.2
I have a use case of running some Junit test case, this is the problem I have :
There are some Junit tests which are written for some VO's. While testing insert and update operation in Junit there is two mandatory columns Created by and Updated by to be entered for committing into the database.
These values are taken from the UserName of the current UserSession .
So for getting the these values for each user I thought of displaying a JPanel before the test is run, where the user enters the Username and password which is validated and the user is verified.
First, I need to check whether there is a session present or not. For checking this, I wrote a createUserSession() and did like this inside it :
if(fixture.getApplicationModule().getSession().getUserData().isEmpty())If so to show the Jpanel and get the user details and verify the user.
But while running the test itself I found that the session is already present, now I just have to input the values based on who is the user.
But Junit doesn't run the tests in the order in which the test are written. So I have to call this in all the test cases.
The Question is :
How can I check whether the session is already present or not, so that I don't have to ask the user every time while every test is running to enter the Username and Password ?
Thanks,
Nigel.
Edited by: Nigel Thomas on Jul 30, 2012 10:26 AM

Hi,
wondering why don't you create test users and then automatically log them in as Jan Vervecken did on the threads I pointed you to. This way your test cases run without user interaction. To test if a session exists for a user, I would put a custom property into user data. If this property exists, the user session is an existing one. However, make sure the information you save into the user data survives passivation as otherwise the information you get out of this is not accurate. See: http://tompeez.wordpress.com/2011/07/08/jdev-always-test-your-app-with-applicationmodule-pooling-turned-off/
Frank

Similar Messages

  • How to check whether the user has a certificate or not?

    Hi everyone.
    We're currently finishing a web project and the last step is to check whether users accessing the application have a valid certificate or not.
    Users with a valid certificate can access all the data. Users without any certificate installed on their browsers may still proceed, but they won't be able to see all data. Please note that the lack of a certificate doesn't mean an error - it's just another use case.
    Is there any way to check whether users have a certificate installed on their browsers?
    Thanks in advance.
    Edit: sorry, I forgot to post some tech details. We're using Struts 1.2 on a Tomcat 5 app server.
    Message was edited by:
    advaca

    I am not sure how Tomcat handles this, but you need to use two-way (mutual authentication) request but not enforce SSL between Tomcat and the client browser. This will make the browser prompt the user for the cert they want to send. Then you'll need to tackle the other part of your problem, getting the correct content displayed depending on whether the user sent a cert or not. I'm even less help there than I was on the first part of your question.
    So, yeah - good luck with that
    Lee

  • What's the best way to check whether a user is logged in or not?

    I have a question about basic session handling.
    I'm running Tomcat 5.0.30 and have a web application where users can register with a username and password, and then log into a "member site".
    What is the best way of making sure that a user actually has logged in or not?
    What I've done in previous applications I've made is that I've just put a simple variable into the users session after he has successfully entered his password (i.e. Boolean loggedIn=true). Then I just test if this flag is true to grant him access to the member site. Is that a smart way of doing it?
    Are there any libraries I can use which handles sessions for me in a secure way?
    All comments and suggestions are appreciated!

    Maintain a flag using session attributes it to one when the user is logs in set it to value.... and change set it zero or invalidate that session... when the user is logged out...
    use something like this while user had logged in
    session.setAttribute("flag",<unique_number>);
    for checking whether the user had logged in or not...
    if(Integer.parseInt(session.getAttribute("flag").toString())=!<unique_number>){
    out.println("The session had expired");
    out.close();
    }

  • How to check if a user session is active in Java application server

    Hi Experts,
          We have a online scenario with a third party system by which a portal user will launch the third party application in a new window from portal. The SSO will work at the third party web application with the dynamic key that is generated by calling a webservice for that user. Now, as the user works on the launched screen, they will have to check whether the user (logged in portal) session is still active. ie., they will be periodically calling a service hosted by SAP java application server to find out whether the corresponding user who launched the session is still logged in or logged out.
    So, my question is, how can i find out programatically whether a user/user's session is still logged in/active in SAP Netweaver Java AS? We are in version 7.3.
    Kindly help me in this regard.
    Regards
    Vijay.K

    Hi Vijay,
    Could you check below links
    Tracing Single User Sessions - Administration - SAP Library
    Display and Manage User Sessions (SAP Library - Tools for Monitoring the System)
    Hope this helps.
    Regards,
    Deepak Kori

  • How to check whether portal user exists or not using UM API.

    Hi Experts,
    Let us say i need to create an user account "PortalUser",i know how to create an user,setting first name,lastname,password for that.
    but here before creating the portal user, i need to check whether that user exists or not.If user already exists ,then i  need to skip the below for creating the user.
    IUserFactory userFact = UMFactory.getUserFactory();
    IGroupFactory groupFact = UMFactory.getGroupFactory();
    IRoleFactory roleFact = UMFactory.getRoleFactory();
    IUser tuser = userFact.getUserByLogonID("PortalUser");
    IUserMaint newUser = userFact.newUser("PortalUser");
    newUser.setFirstName("PortalUser");
    newUser.setLastName("Test");
    newUser.setEmail("PortalUser.Testatgmaildotcom");
    //Locale PortalLanguage = new Locale(Lang.toLowerCase(), "");
    Locale PortalLang=new Locale("en");
    newUser.setLocale(PortalLang);
    newUser.save();
    newUser.commit();
    IUserAccount userAcc = UMFactory.getUserAccountFactory().newUserAccount("PortalUser", newUser.getUniqueID());
    userAcc.setPassword("test1test$");
    userAcc.save();
    userAcc.commit();     
    Thanks in advance.
    Thanks
    Sony.

    Hi,
    Try this code,
    IUserFactory factory = UMFactory.getUserFactory();
    IUser user = factory.getUserByLogonID(userId);
    lastName = user.getLastName();
    firstName = user.getFirstName();
    refer this pdf,its very helpful
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/events/webinars-nw-rig/using%20the%20user%20management%20api%20with%20ep%20applications%20-%20webinar%20powerpoint.pdf
    Regards,
    Sunaina Reddy T

  • How to check whether a user has permission to create term in Taxonomy Term Store using CSOM ?

    I want to check programmatically whether the current user is a Term Store Administrator or not.

    I am not sure how Tomcat handles this, but you need to use two-way (mutual authentication) request but not enforce SSL between Tomcat and the client browser. This will make the browser prompt the user for the cert they want to send. Then you'll need to tackle the other part of your problem, getting the correct content displayed depending on whether the user sent a cert or not. I'm even less help there than I was on the first part of your question.
    So, yeah - good luck with that
    Lee

  • How to check whether the Application Server directory exits or not

    Hi,
    I have a selection screen in which I give the Application server file name(UNIX file) as input. Here, I would like to check whether the Server directory exists or not.
    Let us say, the path I gave in the selection screen is /usr/sap/tmp/testfile.txt . Here, the file name is testfile.txt and the server directory is /usr/sap/tmp . I would like to check whether this directory /usr/sap/tmp exists in the server or not. I am not bothered about the file name as I am going to write data into the file. I am mainly concerned about whether the directory exists in the server or not. and one more thing... this is the Application Server path not the Local path.
    Can anyone help me on the same how to check whether the server directory exists or not.
    Thanks in advance.
    Best Regards,
    Pradeep.

    Also you can use the FM EPS_GET_DIRECTORY_LISTING for this purpose.
      Store the directory name
        l_dpath = p_file+0(l_no).
      Validate the directory of the application server
        CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
          EXPORTING
            dir_name               = l_dpath
          TABLES
            dir_list               = l_i_dlist
          EXCEPTIONS
            invalid_eps_subdir     = 1
            sapgparam_failed       = 2
            build_directory_failed = 3
            no_authorization       = 4
            read_directory_failed  = 5
            too_many_read_errors   = 6
            empty_directory_list   = 7
            OTHERS                 = 8.
      If any problem occurs with the directory then display proper
      error message
        IF sy-subrc <> 0.
        Display error message
          MESSAGE e018 WITH 'Problem with directory entered'(008).
        ENDIF. " sy-subrc <> 0
    Regards,
    Joy.

  • How to check whether a Oracle server is installed or not ?

    Hi,
    How cani check whether a Machine has oracle server installed or not ?
    I have a machine where i have the client tools installed but not server. In that case how can i check whether this machine has oracle server is installed or not?
    Thanks in Advance..

    user11000236 wrote:
    Hi,
    How cani check whether a Machine has oracle server installed or not ?
    I have a machine where i have the client tools installed but not server. In that case how can i check whether this machine has oracle server is installed or not?
    Thanks in Advance..http://tinyurl.com/ngunhv
    Kamran Agayev A. (10g OCP)
    http://kamranagayev.wordpress.com
    [Step by Step install Oracle on Linux and Automate the installation using Shell Script |http://kamranagayev.wordpress.com/2009/05/01/step-by-step-installing-oracle-database-10g-release-2-on-linux-centos-and-automate-the-installation-using-linux-shell-script/]

  • How to check whether set up tables are filled or not

    Hi Gurus,
    How to check whehter set up tables are filled or not?
    Cheers,
    Reddy.

    Hi Reddy.......
    And another point I want to make u clear............LBWQ is not the Delta Queue.............Delta queue is RSA7...............it comes into play in delta loading.......LBWQ is Extraction Queue.........While delta loading....if we use the Update mode Queued Delta........then any Changes will not directly get updated in the Delta queue.....For the Delta set up.........
    1) First u hav to run init with data transfer(After filling the set up table)
    2) After that any Changed ........will be recorded in the Extraction Queue(LBWQ)........
    3) After a certain number of records get accumulated in LBWQ........We hav to run V3 jobs to bring the data in the Delta queue(RSA7)...
    Check this.....
    Re: question on LBWQ and RSA7
    Regards,
    Debjani.....

  • How to check whether an invoice has been paid or not?

    Hi,
        In FI, how should I check whether an invoice is paid fully and also whether it has any residual item?
    And how should I pay an invoice with some residue? Which transaction I should use and what are the steps to do that?
    Since I'm new to FI, any guidance will help me a lot...
    Thanks,
    Priya.

    Hi Priya,
    you create a posting with residual items as follows:
    <b>Incoming payment</b>
    1. Start transaction F-28
    2. Enter all required information and click on <i>Process open items</i>
    3. On the next screen click on the tab <i>Res. items</i>
    4. Make sure that only the items that you want to pay are highlighted ((Net amount appears in blue)
    5. For each line item enter the residual amount that is still to be paid (Example: you have one invoice over 100 USD and 80 USD are paid, you enter 20 USD, since this is your residual that still needs to be paid)
    6. Save
    <b>Outgoing payment</b>
    1. Start transaction F-53
    2-6. is identical to incoming payment
    Regards,
    Claus

  • How to check whether the report is being called or not

    Iam using srw.run_report.for calling another report. I have registered both the report in oracle apps11.0.3. When i run the master report in oracle apps I want to see whether the second report is called or not. How to check this.
    Thanks.

    try to check it in C:\Reports6i\Bin
    C:\Reports6i\Bin <-- this may varry depending on the location of your reports.
    btw, are you generating a pdf file?

  • How to check whether an asset is fully retired or not ?

    Hi All,
    Where can I see whether an asset is fully depreciated or not from the backend?
    Whats the table and the field?
    Thanks and Regards,
    MPH

    You should log into EBS front-end them go to Assets responsibility, from there you go to Asset Workbench, query your asset, and you will be able to check if the asset is fully retired or not.

  • How to check whether INSO Filer is being used or not?

    Hi,
    We have created full text search indexes using the default syntax -
    CREATE INDEX FTI ON DOCUMENTS(DOC_FILE) INDEXTYPE IS CTXSYS.CONTEXT;
    How can I find out whether the INSO filter is used or not. Also a basic question, INSO filter helps in reading and "crawling" some 100+ document formats and creating an index against which search could be executed.... right?
    Please do let me know.
    Thanks & Regards,
    Dhwanil

    you can specify the inso filter in index code creation.
    create index TEST_IDX
    on TEST_TABLE (TEXT)
    indextype is ctxsys.context
    parameters('filter     ctxsys.inso_filter');

  • How to check whether gather stats job is running or not in OEM

    Hi,
    People in our team are saying that there is an automatic job is running in OEM to gather the statistics of the tables. Also it decides which table needs to be gather stats.
    I have not much idea in OEM (Oracle 10g), please let me know how to check the job which is gathering the statistics of tables and where to check that job.
    Thanks in advance,
    Mahi

    You may query dba_scheduler_job_log like
    SQL> select JOB_NAME,LOG_DATE,STATUS from dba_scheduler_job_log;There you should see the GATHER_STATS_JOB and its runnings.

  • How to check whether a list item is highlighted or not

    I have delete button.Have to alert the user if user does not select any itemin list
    Below is the code I have written in When Button Pressed Trigger:
    Begin
    v_currValue := NULL;
    v_currValue := Name_In('CONTROL.ENTITY_LIST');
    If (v_currValue is null) then
         v_alert_button := MSGBOX ('Select the entity type to be deleted.', 'STOP', 'Delete');
                   if v_alert_button = alert_button1 then
                        raise      v_exception ;
                             go_item('CONTROL.ENTITY_TYPE');
                   end if;
              End if;
    v_curlist_index     := Get_List_Index ('CONTROL.ENTITY_LIST');
    Delete_List_Element('CONTROL.ENTITY_LIST',v_curlist_index);
    End
    Above code works fine means alerts the user when there are no elements in the list.
    And if there are 4 elemnts
    emp
    dept
    sal
    loc
    when clicks delete button it alerts the user to select the item
    now v_currvalue = emp;
    after deleting list contains 3 values
    but v_currvalue still remains 'emp'
    even i keep vcurrvalue = null or ''
    it is still emp.
    Is there any way to solve this or there is any bug inmy code.
    Could anyone helpme in this?
    Thanks,

    b]/** First approach which didnt worked **/     
    Begin
    v_currValue := to_char(' ');
    v_currValue := Name_In('CONTROL.ENTITY_LIST');
    If (v_currValue is null) then
    v_alert_button := MSGBOX ('Select the entity type to be deleted.', 'STOP', 'Delete');
    if v_alert_button = alert_button1 then
    raise v_exception ;
    go_item('CONTROL.ENTITY_TYPE');
    end if;
    End if;
    v_curlist_index := Get_List_Index ('CONTROL.ENTITY_LIST');
    Delete_List_Element('CONTROL.ENTITY_LIST',v_curlist_index);
    End
    Above is my previous code
    I want to alert the user by using v_currvalue
    /** Second type of approachwhich worked **/     
         /* Retrieves the index of the current item in the list */
         v_curlist_index     := Get_List_Index ('CONTROL.ENTITY_LIST');
              /* Alert the user if list item is not selected */
         If( (     v_curlist_index = 0     ))then
         v_alert_button := MSGBOX ('Select the entity list item to be deleted.', 'STOP', 'Delete');
                   if v_alert_button = alert_button1 then
                             go_item('CONTROL.ENTITY_LIST');
                   end if;
         Else
                   /* Deletes the list item */
    Delete_List_Element('CONTROL.ENTITY_LIST',v_curlist_index);
         End if;
    Want to know why my first approach not working
    Thanks,

Maybe you are looking for

  • Set parameters input automatically in my report and connection to my base

    Hello this my programmes , it work it's ok ( see bottom of the page ) Now i have a rapport rpt with a input edit (example number customer ) I want by my file jsp that the number customer display automatically in my rapport rpt ( variable string or in

  • Cannot connect to Repository

    Hi! I am facing with the following problem by Configuration Wizard of Integration Builder --> Configuration Integraiton Directory     Cannot connect to Repository STACKTRACE: com.sap.aii.utilxi.misc.api.BaseRuntimeException: Cannot connect to Reposit

  • Auto rotate photos

    Hi, please can any of you, tell me if the phots stored on my Nokia 625 phone, should they auto-rotate as mine don't seem too.

  • Director 11 transitions

    Does anyone know of any transition xtras that will work with Dir 11 and higher?  All the ones I can find top out at MX2004.  It would be a shame if none of those were never upgraded.  Unfortunately the default transitions with Director are rudimenatr

  • Dead DV4-1313dx

    Our ~2yr old DV4 died the other day.  HP DV4-1313dx AMD RM-72? 4GB RAM 250 HDD When I boot up, the screen is blank/off with it giving me a single blink by the caps lock key indicating a problem with the CPU. I tried to do the BIOS reset with no luck.