Hi Abiya,
All you need to do is a very simple arroach. As Wolf-Dieter Fink told
The datasource should only be available inside the server and your code looks like a standalone client.
You should try running only within JBoss AS 7 Environment. Which means, you cannot try connecting from a standalone Java code. You should try putting the code inside your web application and test.
What you can do is, put this block inside a test servlet and deploy and test it. This should work. Note: there is no need for you to set any property.
DataSource ds = null;
Context ctx = null;
try {
String strDSName = "java:jboss/datasources/Test";
ctx = new InitialContext();
ds = (javax.sql.DataSource) ctx.lookup(strDSName);
} catch (Exception e) {
}
Hope this works for you.
You can check in deatail on how it works in here http://kousikraj.wordpress.com/2011/11/25/datasource-configuration-setup-for-jboss-as-7-with-example-of-postgresql/