Isssues with Owner Java 8

24 views
Skip to first unread message

Albert kobina Arhin

unread,
Jul 12, 2015, 6:43:07 AM7/12/15
to owne...@googlegroups.com
Hi All,
    I am trying to incorporate OWNER in my app. 
But try as I may I am only able to return only fields with defaltvalue annotations.
All others return null.
Below is the last attempt.

ServerConfig.properties File Content

serverPort=9898
dbDriverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
dbUserName=MetaDev
dbPassword=masterkey
dbURL=jdbc:sqlserver://127.0.0.1:1433;databaseName=MetaDevDB
appContext=metapaymentsgateway

Interface Class

public interface ServerConfig extends Config
{
   
    //@DefaultValue("9898")
    Integer serverPort();   
     
    //@DefaultValue("metapaymentsgateway")
    String appContext();    
    
    String dbDriverClassName();    
    
    String dbUserName();    
   
    String dbPassword();    
    
    String dbURL();
   
}

Simple Test

@Test
public void testGetServerPort() 
{
ServerConfig cfg = ConfigFactory.create(ServerConfig.class);
Assert.assertEquals(9898,(int)cfg.serverPort());
}

The Test Method above fails if I comment out the default value annotation.
Can any one tell me what is wrong ?
My preferred config file format is to use server.port , database.url etc.
Any help will be highly appreciated.

Thanks

Luigi R. Viggiano

unread,
Jul 18, 2015, 10:47:29 AM7/18/15
to owne...@googlegroups.com, a.a...@gmail.com
Hi.

I just noticed I replied to you in private since this is the default action in GMail, I include my reply here.

The case you are exposing is a basic scenario that is covered by the test suite included in the project. And they run with Java 8 and other JDKs too.

I explain the issue as a misconfiguration in the classpath of your project.

If you want me to look into your scenario, please put your files in a runnable project with ant/maven/bash script to compile and run the test case in github, so that I can try to reproduce your specific issue and try to understand what is wrong.

Regards,

L.
Reply all
Reply to author
Forward
0 new messages