Hi Friends,'
I have a problem with easy mocking concept in java.
I have a senerior, that i need to read one xml file which have primary and secondary connection. For these primary and secondary conenctions i have the connection details in another xml file.
First i need to read one xml file and then i need to moch that connection in the development environment. if the connection fails then i need to swift to the secondary connection.
i have written the statement of e easy mocking but i am unable to do it. can any one help on the code.
1.xml file
----
<CDG>
<enabled>true</enabled>
<failover>true</failover>
<secondaryConnection>CDG_SV</secondaryConnection>
<primaryConnection>CDG_OX</primaryConnection>
<thirdConnection>CDG_AZ</thirdConnection>
<CDG>
2.xml
-----
<connections>
<CDG_OX>
<driver>oracle</driver>
<username>test</username>
<password>test</password>
<url>YYY</url>
</CDG_OX>
<CDG_SV>
<driver>oracle</driver>
<username>test</username>
<password>test</password>
<url>ZZZ</url>
</CDG_SV>
<CDG_AZ>
<driver>oracle</driver>
<username>test</username>
<password>test</password>
<url>ZZZ</url>
</CDG_AZ>
</connections>
Could any one of you please provide me the java code for this.
the URL heere is the connection which i need assume that it connects to the database .
First i read the 1.xml and picks the CDG_OX and checks for the URL YYY (this is masked value..i dont have the actaul URL.) i this connects then well and good , if not i need to switch on to secondary connection CDG_SV and then i need to check for the connection.
Please let me know.
Thanks,
Kumar.