CredentialException if file is not formated as expected ErrnoException if file could not be opened. *
1 [connection_name] 2 host = 127.0.0.1 3 port = 3306 4 user = MyUser 5 pwd = MyPassword 6 db = MyDatabase
*
1 Credential[] credentials = .load("./source/test.cred"); 2 assert(credentials.length == 3); 3 4 assert(credentials.get("connection_name").connectionName == "connection_name"); 5 assert(credentials.get("connection_name").host == "127.0.0.1"); 6 assert(credentials.get("connection_name").port == 3306); 7 assert(credentials.get("connection_name").user == "MyUser"); 8 assert(credentials.get("connection_name").pwd == "MyPassword"); 9 assert(credentials.get("connection_name").db == "MyDatabase"); 10 assert(credentials.get("connection_name").connectionString == "host=127.0.0.1;port=3306;user=MyUser;pwd=MyPassword;db=MyDatabase");
Loads credentials from the given file * The file to load must have the appropriate format (see example below). One file can hold multiple credential entities, each consisting of a name and a set of variables. *