use of SQLDatabase.SQLDatabaseException.NumberOfConnectionsExceeded in project SmartCity-Market by TechnionYP5777.
the class SQLDatabaseConnectionTest method testCartClientType.
@Test
public void testCartClientType() {
SQLDatabaseConnection sqlConnection = new SQLDatabaseConnection();
int session = 0;
try {
session = sqlConnection.loginCustomer(ClientServerDefs.anonymousCustomerUsername, ClientServerDefs.anonymousCustomerPassword);
assert sqlConnection.isClientLoggedIn(session);
assertEquals(new Gson().toJson(CLIENT_TYPE.CART), sqlConnection.getClientType(session));
} catch (AuthenticationError | CriticalError | ClientAlreadyConnected | NumberOfConnectionsExceeded | ClientNotConnected e) {
fail();
}
try {
sqlConnection.logout(session, ClientServerDefs.anonymousCustomerUsername);
assert !sqlConnection.isClientLoggedIn(session);
} catch (CriticalError | ClientNotConnected e) {
fail();
}
try {
sqlConnection.getClientType(session);
fail();
} catch (ClientNotConnected e) {
} catch (CriticalError e) {
fail();
}
}
use of SQLDatabase.SQLDatabaseException.NumberOfConnectionsExceeded in project SmartCity-Market by TechnionYP5777.
the class SQLDatabaseConnectionTest method testCartConnection.
@Test
public void testCartConnection() {
SQLDatabaseConnection sqlConnection = new SQLDatabaseConnection();
int session = 0;
try {
session = sqlConnection.loginCustomer(ClientServerDefs.anonymousCustomerUsername, ClientServerDefs.anonymousCustomerPassword);
assert sqlConnection.isClientLoggedIn(session);
} catch (AuthenticationError | CriticalError | ClientAlreadyConnected | NumberOfConnectionsExceeded e) {
fail();
}
try {
sqlConnection.logout(session, ClientServerDefs.anonymousCustomerUsername);
assert !sqlConnection.isClientLoggedIn(session);
} catch (CriticalError | ClientNotConnected e) {
fail();
}
}
Aggregations