Test case: unusual locking problem or expected behaviour?

I have tried the following test case on both 9.0.1 and 10.2.0. The problem I am seeing here is that a table receives an exclusive lock that doesn't get trapped by a FOR UPDATE NOWAIT condition.
Test case setup
create table x (
f1 number not null,
f2 varchar2(100) );
create table y (
f1 number not null,
f2 number not null,
f3 number,
f4 varchar2(100) );
alter table x add constraint pk_x
primary key (f1);
alter table y add constraint pk_y
primary key (f1);
/*** This is a self-referential integrity check ****/
alter table y add constraint fk_y
foreign key (f3)
references y ( f1 );
create or replace trigger trig_y
before insert on y
for each row
begin
update x
set f2 = 'trig test ' || to_char(sysdate,'ddmmyyyy hhmiss')
where f1 = :new.f2;
end;
insert into x values (1,'test 1');
insert into x values (2,'test 2');
insert into x values (3,'test 3');
insert into y values (2,2,2,'y test 2');
insert into y values (3,3,3,'y test 3');
commit;
Test case actions
This requires 3 independent sessions to be started.
* SESSION 1 *
select * from x
where f1 = 1
for update nowait;
* SESSION 2 *
insert into y values (1,1,1,'test');
-- This session waits because of the trigger that is attempting to update the
-- same row that is locked in session 1.
* SESSION 3 *
select *
from y
where f1 = 2
for update of f1 nowait;
-- The row lock succeeds.
-- Now update the primary key column in Y.
update y
set f1 = 2
where f1 = 2;
-- This update statement waits because of a lock. Why is this as the row
-- has been successfully locked by the FOR UPDATE?
-- Remove the foreign key constraint from table Y and try again. This time
-- the update will not wait but will complete successfully.
Is this expected behaviour, or a bug in self-referential integrity checks, or in
all foreign keys? The reason this came about in our application is because FORMS attempts to update every column on a block regardless of whether all values in the block have changed. This includes the primary key columns.
We have worked around this issue for now by setting the 'update changed columns only' property on blocks in the forms.

No. All you are doing there is stating your intention of later updating the selected locked rows.
You may not even update any rows, if the program logic decides that way. Your actual update is the only case where the validation of foreign key will be applied. It cannot be done at the time of doing FOR UPDATE select, since the database does not know what new value is going to be when you do update so it is not possible to check.
Also, note that yoru statement did NOT fail. It was just rying to validate your foreign key, and in that process wants to make sure no one else makes the changes. The statement was waiting for resource to be free, it DID NOT FAIL (no error was raised).

Similar Messages

  • Problem in executing JFCunit test case

    Hi all,
    I have problem in executing a simple test case that checks for input blank fields entered.
    Below is the code for the test class that i am trying to run, but i am unable to execute it. Please can anyone try to resolve this.
    package unittest.com.erp;
    import junit.extensions.TestSetup;
    import junit.extensions.jfcunit.*;
    import junit.extensions.jfcunit.finder.*;
    import junit.extensions.jfcunit.eventdata.*;
    import junit.framework.Test;
    import junit.framework.TestSuite;
    import junit.textui.TestRunner;
    import com.erp.client.swing.ClientLoginDialog;
    import com.erp.client.swing.workspace.ClientWorkspaceFrame;
    import com.erp.client.swing.workspace.data.LoginResults;
    import javax.swing.*;
    public class LoginScreenTest
        extends JFCTestCase {
      private ClientLoginDialog loginScreen = null;
      private JButton login = null;
      private JButton cancel = null;
      private JTextField username = null;
      private JTextField password = null;
      private JFCTestHelper helper = null;
      LoginResults loginSuccess = null;
      ClientWorkspaceFrame workspaceFrame = null;
      public LoginScreenTest() {
      public LoginScreenTest(String name) {
        super(name);
      public static Test suite() {
        return new StartApp(new TestSuite(LoginScreenTest.class));
      private static class StartApp
          extends TestSetup {
         * Construct the test decorator, which starts the application     *
         * @param test
         *          Test case.
        public StartApp(final Test test) {
          super(test);
         * Start the LoginScreenTestapplication.
        public void setUp() {
          new Thread(new Runnable() {
            public void run() {
              try {
                new LoginScreenTest().setUp();
              } catch (Exception e) {
          }).start();
          try {
            Thread.currentThread().sleep(10000);
          } catch (InterruptedException ex) {
         * Tear down the LoginScreenTest application.
        public void tearDown() {
      protected void setUp()
          throws Exception {
        super.setUp(); // Choose the text Helper
        setHelper(new JFCTestHelper()); // Uses the AWT Event Queue.
        // setHelper( new RobotTestHelper( ) ); // Uses the OS Event Queue.
        ClientWorkspaceFrame workspaceFrame = ClientWorkspaceFrame.getHandle();
        // loginScreen = new ClientLoginDialog( "LoginScreenTest: " + getName());
        loginSuccess = ClientLoginDialog.login();
        loginScreen = ClientLoginDialog.login(new JFrame(), true);
        if (loginSuccess != null && loginSuccess.isSuccess()) {
          workspaceFrame.initFrame();
          workspaceFrame.loggedInUser = loginSuccess.getName();
          workspaceFrame.loggedInFullUserName = loginSuccess.getFullLoginUserName();
          workspaceFrame.loggedInUserPassword = loginSuccess.getPassword();
          workspaceFrame.setVisible(true);
          workspaceFrame.validate();
            flushAWT();
      protected void tearDown()
          throws Exception {
        login = null;
        cancel = null;
        username = null;
        password = null;
        loginScreen = null;
        flushAWT();
        // getHelper.cleanUp( this );
        super.tearDown();
      public void testInitialState() {
        NamedComponentFinder finder = new NamedComponentFinder(JButton.class, "Cancel");
        finder.setName("Cancel");
        JButton exitButton = (JButton) finder.find(loginScreen, 0);
        assertNotNull("Could not find the Exit button", exitButton);
        NamedComponentFinder finder1 = new NamedComponentFinder(JButton.class, "Login");
        finder1.setName("Login");
        JButton enterButton = (JButton) finder1.find(loginScreen, 0);
        assertNotNull("Could not find the Enter button", enterButton);
        getHelper().enterClickAndLeave(new MouseEventData(this, enterButton));
        assertEquals("", workspaceFrame.loggedInUser);
        assertEquals("", workspaceFrame.loggedInUserPassword);
      public static void main(final String[] args) {
        TestRunner.run(LoginScreenTest.suite());
    Thanks & Regards,
    VishalMessage was edited by:
    vishal_vj
    Message was edited by:
    vishal_vj
    Message was edited by:
    vishal_vj
    Message was edited by:
    vishal_vj

    hi All,
    can any one guide me how to run the test casese in JFCunit ? as when i tried to run thru command prompt its not recognising the main class at all.
    Now i m trying with eclipse problem here is that it is showing error to this line of code
    DialogFinder dFinder = new DialogFinder(loginScreen);
    error is constructor is undefined?
    So looking for some solution.
    with regards
    kin

  • JUnit - Strange Test Case running problem

    Hi Everyone,
    I am very new to J Unit testing. Here's my problem. I have a project set up in Net Beans. Inside the project, there is a folder named "tests". This folder contains the following class:
    public class Bob
        public static void main(String[] args)
            System.out.println("Hello");
    }There are other classes inside of this folder that extend TestCase and TestSuite. They are functionally working according to J Unit testing (they prompt a JUnit Test Results panel in Net Beans with Pass or Fail).
    The problem that I am having upon running/executing the class "Bob", NetBeans treats it as a JUnit test case and brings up a Pass/Fail panel. I do not want this to happen. I just want this class to print "Hello" as if it was not a Test. Do you guys have any idea what the problem is? My "Bob" class has nothing imported.
    Also, I have another question. Is there a way that I can take INPUT from a user when running a Test Case (such as using the Scanner class)? My test cases seem to skip over the Scanner.nextLine() code for some reason.
    Thanks in advance.

    Hi BigDaddy,
    Thanks for the suggestion, however I am unsure of what you mean by injecting the scanner. Here is an example of what I would like to do:
    public class BenchmarkTestSuite extends TestSuite
        public static void main(String[] args)
            try
                Scanner scan = new Scanner(System.in);
                System.out.print("Enter the number of iterations for read: ");
                readIterations = scan.nextInt();
                .... etc
            catch(Exception ex)
                ex.printStackTrace();
        .... etc
    }Here, the prompted question for the user gets ignored for some odd reason. I would like for the tests to not start until the question has been answered by the user. NetBeans is strange. I commented all of the test methods to see if the question gets printed to the console, and it does not.
    Thanks.

  • Problem at the time of Implementing Text Matching Test Case in OFT

    hi,
    I had add Text Matching Test Case on login of the application for the username and password. and If the Test Case fail on that screen,then it should not allow to go further in the application.
    As currently at the time of Playback, it is allowing to go further and in the Result Report it display the case failed.

    Actually my ques is that suppose at the time of recording i enter the username as abcd and password as 123.
    When the recording is done . I Insert a Text Matching test case for both the username and password where i put the condition for the username that select text should be present as "def" . And the Test Case failed .
    So i want to know that if the test case failed on Login. Whether it should be move forward at the time of playback?

  • Problem in test case

    Hi guys,
    we are using solution manager for testing.  We have created the test case with test case type "Test Document" in SOLAR02 transaction.  Here we are trying to attach our test script sothat it can be included in the test note generated by blue-print.
    But when we create a test case, the system is automatically taking the attribute as "Blue-print relavant" and because of this we are not able to create a test note.  WE are getting a message that test case is defined as blue-print relavant.
    Where can we change the attribute of the test case ?
    Can anybody helpme out

    Hi Sai Vineeth,
    1) Please get into SOLAR_PROJECT_ADMIN transaction
    2) Choose your project ID
    3) Toggle to Change mode
    4) Get to Project Standards Tab
    5) Go to Documentation Types sub Tab
    6) Click on 'Project Template' button at the right bottom side
    7) In the window that opens up, go through the document types that you want to take off Blueprint relevance, use the cursor to move it towards the right - you'll find a column meant for Blueprint relevance
    8) Take the checkbox away, press the button Check and then Save.
    9) Then press on 'Cancel (red X) icon.
    This should make the Blueprint relevance disappear for the given Document Type.
    Cheers,
    Srini

  • Problem in writing test cases in BI

    Hello Sir,.
    How to write a test cases in BI? and we are doing function upgrade as we are migratiing 3.x to 7.x BI.
    we have a data flow as show below at the moment after the migration has done.
    Data source->Transformation->DSO->Transformation->Info Cube.each target has individual DTP`s.
    Finally data is lieing all over the data targets.I have no routine between Data source and DSO , but we have a start routine between DSO and Info Cube.
    So i am trying to write a test cases because we want to know how the code was working in 3.x and aafter migrating the to 7.x bi how the code is working and then loaded data to targets.How do i write functional test cases? and how to proceed to write test cases here in this scenario.please reply me asap.
    Thanks much!

    No,
    I try to explain better:
    In my real application (not this simple example) I compose an image by the union of many little gifs. Then I have to save the result in a unique image. It's for this that I've overridden paintComponent(), so , after having painted all gifs, I save composite image to a png one.
    This function is activated from a main application, and I don't want to show too much to user, so I try to make this by using a popup frame that disappear quickly.
    I hope to having been as clear as possible.
    I hope to have chosen the best solution too
    Bye and thanks
    Edited by: giuseppe_italiano on Nov 21, 2007 3:35 AM

  • [svn:osmf:] 11159: Updating unit test with a check to all expected events firing properly.

    Revision: 11159
    Author:   [email protected]
    Date:     2009-10-26 12:12:10 -0700 (Mon, 26 Oct 2009)
    Log Message:
    Updating unit test with a check to all expected events firing properly.
    Modified Paths:
        osmf/trunk/framework/MediaFrameworkIntegrationTest/org/osmf/content/TestContentElementInt egration.as

    camickr wrote:
    Do you really expect us to read all that code to try and understand what you are attempting to do?
    If you need further help then you need to create a "Short, Self Contained, Compilable and Executable, Example Program (SSCCE)", that demonstrates the incorrect behaviour.
    http://homepage1.nifty.com/algafield/sscce.html
    Absolutely not, I wouldn't post such a large amount of code expecting people to read it. I indicated that I believe my error only lies within one of two classes, and that I highlighted the two methods with comments.
    I was told to create an SSCCE as you have mentioned, but I believe all of this code is necessary for the program to run properly, so I only provided it all for compilation purposes.
    I'll check the examples posted, and if I need to I'll see if I can change my methods to use the swing timer class as the first reply mentions, but I did not think this would be necessary.
    Edited by: Drew___ on Nov 29, 2007 3:28 AM
    I have just figured out what my problem was, sorry it was quite a simple mistake. When checking for user input, I was immediately resetting the eventFlag or something afterwards. This meant the object would stop moving as it couldn't remember my last keypress. Thanks for your help, those tutorials are really good.

  • Locking problem in BPS solution not getting solved  using RSPLSE. SEM_BPS_S

    Can anyone tell me exactly what "rsplse" offers to solve locking in BPS?
    We have made correct selection of characteristics (in our case "costcentre" infoobject) in tab "Lock characteristics" , but still when two people are trying to access (write) data in the same transactional cube against the different cost centres, the system is throwing an error message Cube “zIC_ccp” is locked by username.  (Or if a single person is using the two packages simultaneously using  two web sessions , he is getting the same error. )
    Our assessment is that he should not be facing this locking problem because cost centres here are acting as a “key” to different selection as configured in “rsplse”. 
    Can anyone tell me how to use parameter SEM_BPS_SAVE_UNLOCK. I want to know t. code and other t . code and other details to execute SEM_BPS_SAVE_UNLOCK.

    Hi,
    Please check the OSS note 635244.
      From the OSS note :
    <b> Notes on SET/GET parameters SEM_BPS_NO_LOCK, SEM_BPS_SAVE_UNLOCK :</b>
    These two parameters have nothing to do with the problem described above. They are only designed to facilitate the Customizing process, if users carry out Customizing in t ransaction BPS0 within a project.
    <b>SEM_BPS_NO_LOCK:</b> This parameter has the effect that transaction data is not locked at all. Never use this parameter in a production system. As of Support Package 14 for Release 3.1B, parameter SEM_BPS_NO_LOCK is released by an additional switch in table upc_dark2: For this purpose you have to maintain a record with param = ENABLE_NO_LOCK and value = X in table upc_dark2. Only then the system includes parameter SEM_BPS_NO_LOCK. The parameter can then be useful if you want to test functions or the manual planning with 'test data' in Customizing.
    <b>SEM_BPS_SAVE_UNLOCK</b>: This parameter only works in transaction BPS0; it has the effect that the system unlocks data (if possible) after it has been saved. Therefore, the system only simulates an exit and reentry in transaction BPS0 with the last active detail application. Therefore, the above parameter can be helpful if many people work on Customizing in transaction BPS0, because objects can be unlocked earlier.
    Regards,
    Siva.

  • Microsoft vista OEM Test Case-5 failing for java application

    The launcher exe for my application is built in C++ that load the jvm and then the control is passed to the java class through JNI.
    My problem is that my application exe is not passing the Microsoft Vista OEM Ready Test Case Number- 5 which specifies
    Application Verifier Checks:
    Tests for app failures from common coding errors: exceptions, handles, heaps, locks, memory, thread local storage.      
    App failures, crashes, and hangs are some of the top negative factors for customers. Eliminating such failures improves app stability and responsiveness.App verifier catches common coding errors and prevents heap corruption, the cause of more than 15% of application failures.
    Interestingly..! Even a simple Hello World program is failing this test...!

    Open [http://msdn.microsoft.com/en-us/windows/cc721647.aspx] and search for the word "Java".

  • Running test cases

    Each of my transformation needs to be tested for several types of variations in input data due to optional elements and data dependent conditional statements. Also, one of the schemas I am using is evolving as we make progress. When I make changes in xquery transformation I would like to have a script to run the test cases and make sure that output is as expected. I wondering if there is a way to script test cases for Xquery transformations?

    Karl, All,
    I dug around other websites and found a solution. The problem is caused by having [ ] characters in your project name. In my case, I was using Subclipse, which modifiies your project name as described below:
    To fix the issue, go to Window, Perferences, Team, SVN, Label Decorations. Change the value for the field "Project Format",
    From:
    {dirty_flag}{name} [{url_short}]
    To:
    {dirty_flag}{name} <{url_short}>
    Apparently, the JUnit plug-in parses the project name and looks for [ ] characters to determine if it should use a remote testing framework. Changing the project format to use different characters resolves this issue. I arbitrarily choose <> characters.
    For people not using Subclipse, it should be as easy as renaming your project.
    Eric.

  • Is anyone using testing seeing compiler lock-ups? [SOLVED]

    As the title says, is anyone using testing seeing compiler lock-ups? I've been seeing them for about two or three days. Sometimes the system will hang for a few seconds at "Starting make" with 100% CPU usage, then will continue normally. Other times it will stop in the middle of compiling and CPU usage will drop to 0. Also, I've been seeing small hang ups with patches. Maybe four or five seconds when simple patches are being applied. Bringing MAKEFLAGS down to the default 2 from 3 seems to help a tiny bit.

    fakeroot would put it in the right time frame. I linked to your bug report Anarconda as it seems like the same problem. As always if anyone has anything to add, please do:
    http://bugs.archlinux.org/task/13699

  • 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 AM

    Hi 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

  • IPv6 Test Case for LinkSys Routers - Based on Ubuntu + Radvd + DHCPv6 - E1200v2 isn't ready for IPv6

    Hello!
    Here on this guide, you'll learn how to deploy your own Linux IPv6 Router, that can be used in ANY network, to give IPv6 connectivity to ANY ethernet device, including Windows, Mac, Ubuntu Server and Desktop, RedHat and, of course, LinkSys routers like E1200v2 and E2500 for its WAN interfaces.
    I wrote this guide because I found a BUG on E1200v2, which doesn't work with IPv6 yet, already lost some money to figure this out.
    That's it, when you see a E1200v2 box at the store, you can read: "* IPv6 Enabled", but that is not entirely true, since it does not work as expected.
    Here on this post, it is a complete procedure to reproduce the problem.
    NOTE: The model E2500 v1 does not suffer from this problem!
    NOTE: This guide is very usefull if you have a LinkSys E2500 router and want to connect it directly into a Linux Router!
    Who am I?
    A.: I'm Thiago, I work in Brazil, for a company called iG (ig.com.br), I'm working here as a Network Engineer / SysAdmin and I have +10 years of experience with IPv4 networks + 5 years with IPv6.
    * Brief
    1- Install a Ubuntu 12.04.3, to act as your router, on a PC computer with two ethernet cards (eth0 will be Ubuntu's default route, eth1 will be used to connect LinkSys E1200v2);
    2- Prepare your Ubuntu Router (very important step, read it carefully)
    3- Connect E1200v2 directly into Ubuntu's eth1 ethernet card;
    4- Connect a Windows PC at E1200v2 LAN port 1 (used to configure your E1200 with Cisco Connect everytime a reset is desired);
    5- Reset (restore it from factory defaults) your E1200v2 router;
    6- Install Cisco Connect in your Windows PC (LAN port 1);
    7- Configure your E1200v2 as usual;
    8- Browse the Internet (still IPv4);
    9- Open Windows Command Prompt and type: ipconfig, ping, etc;
    10- Open Google Chrome or Firefox and go to your E1200v2 Web Admin Interface at http://192.168.1.1/
    11- Install a Ubuntu 12.04.3 Server connected at E1200v2 LAN port 2 to test IPv6 connectivity in deep, or;
    12- Boot a Ubuntu Desktop 13.04 Live CD connected at E1200v2 LAN port 3 to test IPv6 connectivity in deep;
    IMPORTANT NOTE:
    * This tests will require IPv4 connectivity to the Internet, since the IPv6 blocks used on this example, are blocks used only for documentation (or small tests) porpuses, which means that those IPv6 tests we're about to do, will not reach the Internet (in IPv6), neighter be routed out from your E1200v2. But it is enough to prove that E1200v2 drops its clients IPv6 connectivity. Feel free to replace those IPv6 address with your current / valid IPv6 blocks (if you have a IPv6 /48 block from your ISP, you know what I'm talking about).
    * Network Topology (Ubuntu Linux Router)
    IPv6:
    eth0
    2001:db8:0:1::/64 = uplink allocation
    2001:db8:0:1::1 = upstream router IP (Ubuntu's gateway IPv6)
    2001:db8:0:1::2 = customer configured IP (your WAN uplink interface to provider - Ubuntu's eth0 IPv6 address)
    eth1
    2001:db8:1::/48 = statically routed subnet pointing at 2001:db8:0:1::2 that come from you IPv6-ISP
    2001:db8:1::1 = your first IPv6 within your own infrastructure (Ubuntu's eth1 - E1200v2 directly connected here)
    eth1:0
    2001:db8:1:1::/64 = your first IPv6 /64 with Router Advertisement plus DHCPv6 running on Linux (radvd) (Ubuntu's eth1:0 - E1200v2 gets its WAN IPv6 address from this subnet)
    2001:db8:1:1::1 = IP of your first /64 subnet, Radvd + DHCPv6 running here, Ubuntu as IPv6 router
    IPv4:
    eth0
    192.168.10.0/24 = uplink allocation
    192.168.10.1 = upstream router IP (Ubuntu's gateway IPv4)
    192.168.10.2 = customer configured IP (your WAN uplink interface to provider - Ubuntu's eth0 IPv4 address)
    eth1
    192.168.20.1 = your E1200 will gets its WAN IPv4 address from this subnet - most common scenario for IPv4 wifi routers running inside enterprise environments today
    * Complete procedure
    1- Install a Ubuntu 12.04.3, to act as your router, on a PC computer with two ethernet cards
    Install the following packages in your Ubuntu Router:
    sudo apt-get install radvd isc-dhcp-server
    2- Prepare your Ubuntu Router (very important step, read it carefully)
    2.1- Ubuntu's file /etc/network/interfaces contents:
    # This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5).
    # The loopback network interface
    auto lo
    iface lo inet loopback
    # The primary network interface
    auto eth0
    # IPv6
    iface eth0 inet6 static
       address 2001:db8:0:1::2
       netmask 64
       gateway 2001:db8:0:1::1
       # dns-* options are implemented by the resolvconf package, if installed
       dns-nameservers 2001:4860:4860::8888
       dns-search linksys.com
    # IPv4
    iface eth0 inet static
       address 192.168.10.2
       netmask 24
       gateway 192.168.10.1
       # dns-* options are implemented by the resolvconf package, if installed
       dns-nameservers 8.8.8.8 8.8.4.4
       dns-search linksys.com
    # The secondary network interface, E1200 LinkSys wifi-router is connected here (WAN port)
    auto eth1
    # IPv6
    iface eth1 inet6 static
       address 2001:db8:1::1
       netmask 48
    auto eth1:0
    iface eth1:0 inet6 manual
       up ip -6 address add 2001:db8:1:1::1/64 dev $IFACE
       down ip -6 address del 2001:db8:1:1::1/64 dev $IFACE
       # IPv6 /56 block routed to LinkSys E1200v2, it is delegated to it through Prefix Delegation using DHCPv6
       # Uncomment it later when your E1200v2 gets its own IPv6 Internet IP Address, keep reading this guide
       #up ip -6 route add 2001:db8:1:f00::/56 via 2001:db8:1:1::2000
    # IPv4
    iface eth1 inet static
       address 192.168.20.1
       netmask 24
    2.2- Configure Ubuntu /etc/sysctl.conf file
    Uncomment the following two lines on it:
    net.ipv4.ip_forward=1
    net.ipv6.conf.all.forwarding=1
    After writting, run "sudo sysctl -p" to apply the changes.
    2.3- Configuring Linux Router Advertisement daemon (radvd)
    Your Linux Router Advertisement daemon running on Ubuntu, must have the following content:
    # Ubuntu eth1
    interface eth1
        # Enable RA
        AdvSendAdvert on;
        # Enable clients getting their IPs from DHCPv6
        AdvManagedFlag on;
        AdvOtherConfigFlag on;
        # Enable RA to the following subnet
        prefix 2001:db8:1:1::/64
           AdvOnLink on;
           # When not allowing clients to auto-generate their IPv6 address (SLAAC), DHCPv6 will be used instead
           AdvAutonomous off;
    2.4- Configuring DHCPv6
    Your isc-dhcp-server6 configuration file (/etc/dhcp/dhcpd6.conf) for IPv6 must have the following content:
    ddns-update-style none;
    default-lease-time 600;
    max-lease-time 7200;
    authoritative;
    log-facility local7;
    # Ubuntu eth1
    # This is a very basic subnet declaration with Prefix Delegation enabled.
    subnet6 2001:db8:1:1::/64 {
            # Range for clients
            range6 2001:db8:1:1::2 2001:db8:1:1::2000;
            # Extra DHCP options
            option dhcp6.name-servers 2001:4860:4860::8888, 2001:4860:4860::8844;
            option dhcp6.domain-search "linksys.com";
            # The following line will delegate a subnet to LinkSys E1200v2,
            # using Prefix Delagation standards.
            # You'll be able to see this "Prefix Address" under "Status -> Local Network" E1200v2 menu.
            prefix6 2001:db8:1:100:: 2001:db8:1:f00:: /56;
    # No service will be given on this subnet, but declaring it helps the 
    # DHCP server to understand the network topology.
    # Ubuntu eth0 - no DHCPv6 running but doesn't hurt to declare it here
    subnet6 2001:db8:0:1::/64 {
    Reference: http://www.tldp.org/HOWTO/Linux+IPv6-HOWTO/hints-daemons-isc-dhcp.html
    2.5- Configuring DHCPv4
    Your isc-dhcp-server configuration file (/etc/dhcp/dhcpd.conf) for IPv4 must have the following content:
    ddns-update-style none;
    default-lease-time 600;
    max-lease-time 7200;
    authoritative;
    log-facility local7;
    # Ubuntu eth1
    # This is a very basic subnet declaration.
    subnet 192.168.20.0 netmask 255.255.255.0 {
       range 192.168.20.2 192.168.20.200;
       option routers 192.168.20.1;
       option domain-name "linksys.com";
       option domain-name-servers 8.8.8.8, 8.8.4.4;
    # No service will be given on this subnet, but declaring it helps the 
    # DHCP server to understand the network topology.
    # Ubuntu eth0 - no DHCPv4 running but doesn't hurt to declare it here
    subnet 192.168.10.0 netmask 255.255.255.0 {
    * Reboot your Ubuntu Router to apply all the changes
    After rebooting it, try to "ping 8.8.8.8" to make sure your Ubuntu Router have at least, IPv4 Internet connectivity.
    NOTE: From this point, you'll be able to start testing IPv6 from behind your Ubuntu Router (i.e. from its eth1), if you connect a Ubuntu Desktop, a Mac or a Windows on Ubuntu's eth1, it will provide IPv4 and IPv6 address to that devices, including your E1200v2 WAN port...
    3- Connect E1200v2 directly into Ubuntu's eth1 ethernet card;
    Plug a RJ45 cable between Ubuntu eth1 ethernet card and E1200v2 WAN port.
    4- Connect a Windows PC at E1200v2 LAN port 1
    This Windows computer will be used to (re)configure your E1200v2 with Cisco Connect everytime a reset is desired.
    5- Reset (restore it from factory defaults) your E1200v2 router;
    Press and hold the reset button for about 10 seconds.
    6- Install Cisco Connect in your Windows PC (LAN port 1);
    Boot(reboot) Windows and install Cisco Connect on it.
    7- Configure your E1200v2 as usual (by finishing Cisco Connect installation procedure);
    After concluding this step, your Windows PC will have both IPv4 and IPv6 address, that come from E1200v2.
    Windows gets its IPv4 from DHCP and IPv6 from SLAAC (main point of the problem), both provided by E1200v2.
    NOTE: From this point, you'll be able to see the problem with E1200v2 internal RA daemon, you'll lose your IPv6 connectivity that come from E1200v2. But, lets keep testing it...
    8- Browse the Internet (still IPv4);
    That's it, try to browse google.com from your Windows PC, if Ubuntu Router can "ping google.com", Windows PC should be able to do it so.
    9- Open Windows Command Prompt and type: ipconfig, ping, etc;
    Run "ipconfig" to see your IPv4 and IPv6 address...
    Run "ping 8.8.8.8" to see if you can reach the Internet...
    10- Open Google Chrome or Firefox and open your E1200v2 Web Admin Interface at http://192.168.1.1/
    Access your E1200v2 Web Admin and go to the "Status -> Router" menu.
    Write down its Internet IPv6 address, it will be something like this:
    IPv6 - Internet IP Address: 2001:db8:1:1::2000
    NOTE: You can get this address at the Ubuntu Router itself, by reading the file /var/log/syslog (`grep pool' might help), for example:
    # grep pool /var/log/syslog
    Sep 24 00:47:13 ubuntu-router-1 dhcpd: Picking pool address 2001:db8:1:1::2000
    Sep 24 00:47:13 ubuntu-router-1 dhcpd: Picking pool prefix 2001:db8:1:1::/56
    You'll see the above message on your Ubuntu Router, right after turning on your E1200v2. Pool address is the IPv6 Internet IP Address of your E1200v2's WAN port, pool prefix is the delegated subnet to your E1200v2 router. After thatn, it will start to advertiser that block on its LAN ports and WiFi (which doesn't work as expected, there is a problem there, whithin E1200v2 itself.
    11- Install a Ubuntu 12.04.3 Server connected at E1200v2 LAN port 2, to test IPv6 connectivity in deep;
    Here is the most important test:
    * Testing the IPv6 connectivity from E1200v2 LAN ports.
    This test is very simple, we just need to try ping E1200v2's IPv6 Internet IP Address.
    This Ubuntu Server will have the following content on its /etc/network/interfaces file:
    # This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5).
    # The loopback network interface
    auto lo
    iface lo inet loopback
    # The primary network interface
    auto eth0
    # IPv6 - SLAAC - No DHCPv6 client required - E1200v2 will kicks off this IPv6, and I don't know why...
    iface eth0 inet6 auto
    # IPv4 - Requires DHCPv4
    iface eth0 inet dhcp
    After this, your Ubuntu Server will be able to "ping 8.8.8.8" and "ping6 2001:db8:1:1::2000" (E1200v2 WAN IPv6 Address noted before).
    To prove that E1200v2 have a problem with IPv6, try to ping it, just run:
    mtr -n 2001:db8:1:1::2000
    ...And after a few minutes, Ubuntu Server will lose its IPv6 address, because E1200v2 is kicking it off.
    You'll be able to see a lots of package loss going on "mtr -n 2001:db8:1:1::2000".
    If you connect a Mac OSX on E1200v2 LAN por 3, for example, it will also lose its IPv6 from time to time.
    Wireless clients connected at E1200v2, like Android, iPad, Windows, Mac and Ubuntu laptops, also loses its IPv6 (that come from E1200v2) from time to time.
    You guys must note that the E1200v2 itself, ramdomly becomes unreacheable from its own LAN ports (via IPv6)!! Which is unnaceptable.
    12- Boot a Ubuntu Desktop 13.04 Live CD connected at E1200v2 LAN port 3 to test IPv6 connectivity in deep;
    Boot a Ubuntu Desktop connected at your LinkSys E1200v2 router, and open 2 Terminals, on each of it, you should run:
    Terminal 1:
    mtr -n 2001:db8:1:1::2000
    Terminal 2:
    sudo tail -f /var/log/syslog
    You'll be able to see a lots of package loss going on "mtr -n 2001:db8:1:1::2000" after a few minutes AND at the syslog, you'll be able to see when you lose your IPv6, that come from E1200v2.
    Conclusion
    E1200v2 doesn't have a working IPv6 Router Advertisement service. Please Cisco, fix it!
    The IPv4 from behind E1200v2 is fine, I'm using LinkSys products for about +10 years now... First time with problems like this but, IPv6 is more or like new and, problems are expected... Lets work on it?!
    Best Regards,
    Thiago

    Try to use dhclient perhaps?  Might I also suggest letting systemd deal with the dhcp issue and not NM.  That may seem incongruous but it is possible NM is mis-handling the dhcp hand-off to the network card.  I'm no guru but I got thinking about this when I saw this in your output:
    aug 26 19:15:39 arch_daboka NetworkManager[527]: <info> (enp1s0): device state change: ip-check -> secondaries (reason 'none') [80 90 0]
    aug 26 19:15:39 arch_daboka NetworkManager[527]: <info> (enp1s0): device state change: secondaries -> activated (reason 'none') [90 100 0]
    aug 26 19:15:40 arch_daboka NetworkManager[527]: <info> NetworkManager state is now CONNECTED_LOCAL
    It is very possible that I'm mis-interpreting this information so please take it with a boulder of salt. 

  • Exception Handling in bounded taskflows - expected behaviour

    Hi,
    I'm currently reviewing exception handling in bounded task flows and some things does not seems to be very clear for me.
    (q1) Does it make sense that a bounded task flow calls a method (via a method activity) defined on the page definition of another page (outside of the BTF) by using a #{data.xxxmyPageDef.myMethodName.execute} EL expression?
    (q2) Is is correct to expect the application to execute the method marked as ExceptionHandler in the taskflow, whenever an exception occurs?
    (q3) I created 5 different scenarios where I call a service method which throws an exception, from within a page fragment of the BTF.
    (q3 – sc1) Call a service method through the binding layer of the current page (by using #{bindings.xxx.execute})
    Result: A dialog containing the exception message appears.
    This is what I expected. Althought, the exception handler method does not seems to be invoked.(q3 – sc2) Call a service method through a task flow method activity using #{bindings.xxx.execute}
    Result: A dialog containing the exception message appears.
    This is what I expected. Althought, the exception handler method does not seems to be invoked.(q3 – sc3) Call a service method through a task flow method activity using #{data.myPageFragementPagedef.xxx.execute} (accessing the pageDef of the page fragment)
    Result: Nothing happens.
    This is not what I expected. Although, the exception handler method does nog seems to be invoked, I expect the ADF Error Handler to create a FacesMessage.(q3 – sc4) Call a service method through a task flow method activity using #{data.myPageContainingThePageFragmentPageDef.xxx.execute} (accessing the page containing the BTF region)
    Result: Nothing happens.
    This is not what I expected. Although, the exception handler method does nog seems to be invoked, I expect the ADF Error Handler to create a FacesMessage. (q3 – sc5) Call a service method through a task flow method activity using #{data.aPageOutsideTheBTFPageDef.xxx.execute} (accessing a page outside the BTW)
    Result: Nothing happens.
    This is not what I expected. Although, the exception handler method does nog seems to be invoked, I expect the ADF Error Handler to create a FacesMessage. (q4) How can it be possible that – without an exception handler – exceptions occur when calling method activities, without the exceptions being translated to FacesMessages?
    Thanks in advance,
    Koen Verhulst
    JDeveloper 11.1.1.4

    Koen,
    +(q1) Does it make sense that a bounded task flow calls a method (via a method activity) defined on the page definition of another page (outside of the BTF) by using a #{data.xxxmyPageDef.myMethodName.execute} EL expression?+
    No. Exceptions should be handled locally.
    +(q2) Is is correct to expect the application to execute the method marked as ExceptionHandler in the taskflow, whenever an exception occurs?+
    Only for exceptions that are before Render Response. The Render Response Phase is not handled in ADFc. So exceptions that occur in managed beans may fall through
    +(q3) I created 5 different scenarios where I call a service method which throws an exception, from within a page fragment of the BTF.+
    +(q3 – sc1) Call a service method through the binding layer of the current page (by using #{bindings.xxx.execute}) Result: A dialog containing the exception message appears.+
    This is what I expected. Althought, the exception handler method does not seems to be invoked.
    The binding layer has an error handler you can override in the DataBinings.cpx file
    +(q3 – sc2) Call a service method through a task flow method activity using #{bindings.xxx.execute}+
    Result: A dialog containing the exception message appears.
    This is what I expected. Althought, the exception handler method does not seems to be invoked.
    Again, you use the binding layer to invoke the service
    +(q3 – sc3) Call a service method through a task flow method activity using #{data.myPageFragementPagedef.xxx.execute} (accessing the pageDef of the page fragment)+
    Result: Nothing happens.
    This is not what I expected. Although, the exception handler method does nog seems to be invoked, I expect the ADF Error Handler to create a FacesMessage.
    Never use such a call. Its bad practice as there is no guarantee the container you reference is active. Always have the method call activity have its own binding defined when accessing a method call activity. I know there are lots of example floating aroundthat you #{data ...} and many are from 10.1.3. This should be avoided alltogether though
    +(q3 – sc4) Call a service method through a task flow method activity using #{data.myPageContainingThePageFragmentPageDef.xxx.execute} (accessing the page containing the BTF region)+
    Result: Nothing happens.
    This is not what I expected. Although, the exception handler method does not seems to be invoked, I expect the ADF Error Handler to create a FacesMessage.
    Again, this is not a proper use of the ADF framework.
    +(q3 – sc5) Call a service method through a task flow method activity using #{data.aPageOutsideTheBTFPageDef.xxx.execute} (accessing a page outside the BTW)+
    Result: Nothing happens. This is not what I expected. Although, the exception handler method does nog seems to be invoked, I expect the ADF Error Handler to create a FacesMessage.
    accessing a page outside the BTW (!!!) This should ring a worst practices alarm on your laptop (obviously doesn't do it either)
    +(q4) How can it be possible that – without an exception handler – exceptions occur when calling method activities, without the exceptions being translated to FacesMessages?+
    Exceptions are not handled in a single place but stacked. The business service raises an exception and passes it to the binding layer if not handled. The binding layer handles the exception and if it can't passes it to ADFc. ADFc can handle this exception if it is not during Render Response.
    Bottom line: There is no single point of exception handling. So as a recommendation for best practices
    - Catch and handle exceptions as close as possible to their origins
    - If things can go wrong, thy will - use try/catch blocks in managed beans
    - Use an exception handling activity in all bounded task flows. In the case of task flow call activities being used exceptions can bubble up to the caller. However, this would take users out of their current application context
    - Exceptions not handled in ADFc can be intercepted by overriding the application task flow exception handler (used by the exception handler activities). This would give you a chance e.g. to handle issues during Render Response
    - Never fight the framework, never bend the framework: Don't use out of scope access to page definitions and resources. Exception handling is not a replacement for bad code practices (sorry for saying this, its not meant to be rude) :-)
    Though I don't have a qualified numbers of bugs open for exception handling in ADF between 11.1.1.4 and now (and some that are open), but there are issues reported in this area. If there is something that really feels wrong, please go ahead and file a bug and provide a test case for development to have a look. The Render Response issue, for example is something we are aware of and that is in discussion (afaik knows, there is a change in exception handling in JSF 2 that may have an impact to what we can do in ADFc).
    thanks
    Frank

  • Help with writing a static method in my test case class inside blue j

    I have this method that I have to test. below is the method I need to test and what I have to create inside my test case file to test it Im having big time problems getting going. Any help is appreciated.
    public String introduceSurprise ( String first, String last ) {
    int d1 = dieOne.getFace();
    Die.roll();
    if (d1 %4 == 2){
    return Emcee.introduce(first);
    else {
    return this.introduceSpy (first,last);
    So how do write tests to verify that every fourth call really does give a randomized answer? Write a static method showTests which
    creates an EmCee,
    calls introduceSurprise three times (doing nothing with the result (!)),
    and then calls it a fourth time, printing the result to the console window.
    Write this code inside your test class TestEmCee, not inside EmCee!

    hammer wrote:
    So how do write tests to verify that every fourth call really does give a randomized answer? Write a static method showTests which
    creates an EmCee,
    calls introduceSurprise three times (doing nothing with the result (!)),
    and then calls it a fourth time, printing the result to the console window.
    Write this code inside your test class TestEmCee, not inside EmCee!Those instructions couldn't be anymore straightforward. Make a class called TestEmCee. Have it create an EmCee object. Call introduceSurprise on that object 3 times. Then print the results of calling it a 4th time.

Maybe you are looking for