use of SQLDatabase.SQLDatabaseException.CriticalError in project SmartCity-Market by TechnionYP5777.
the class SQLDatabaseConnectionTest method testGetWorkersList.
@Test
public void testGetWorkersList() {
SQLDatabaseConnection sqlConnection = new SQLDatabaseConnection();
String result = null;
//test add worker
try {
result = sqlConnection.getWorkersList(null);
} catch (CriticalError | ClientNotConnected e) {
fail();
}
assert result != null;
HashMap<String, Boolean> map = Serialization.deserializeWorkersHashMap(result);
assert map != null;
}
use of SQLDatabase.SQLDatabaseException.CriticalError in project SmartCity-Market by TechnionYP5777.
the class SQLDatabaseConnectionTest method testNotExistedCustomerCantLogout.
@Test
public void testNotExistedCustomerCantLogout() {
SQLDatabaseConnection sqlConnection = new SQLDatabaseConnection();
int sessionID = 34624;
try {
sqlConnection.logout(sessionID, customerName);
} catch (CriticalError e1) {
fail();
} catch (ClientNotConnected e) {
}
}
use of SQLDatabase.SQLDatabaseException.CriticalError in project SmartCity-Market by TechnionYP5777.
the class SQLDatabaseConnectionTest method testAddRemoveManufacturer.
@Test
public void testAddRemoveManufacturer() {
SQLDatabaseConnection sqlConnection = new SQLDatabaseConnection();
final String manufacturerName = "manydebug";
String result = null;
Manufacturer manufacturer = null;
//test add ingredient
try {
String tempID = sqlConnection.addManufacturer(null, manufacturerName);
manufacturer = Serialization.deserialize(tempID, Manufacturer.class);
result = sqlConnection.getManufacturersList(null);
} catch (CriticalError | ClientNotConnected e) {
fail();
}
assert result != null;
HashSet<Manufacturer> set = Serialization.deserializeManufacturersHashSet(result);
assert set != null;
assert set.contains(manufacturer);
//test remove ingredient
try {
sqlConnection.removeManufacturer(null, manufacturer);
result = sqlConnection.getManufacturersList(null);
} catch (CriticalError | ClientNotConnected | ManufacturerNotExist | ManufacturerStillUsed e) {
fail();
}
assert result != null;
set = Serialization.deserializeManufacturersHashSet(result);
assert set != null;
assert !set.contains(manufacturer);
}
use of SQLDatabase.SQLDatabaseException.CriticalError in project SmartCity-Market by TechnionYP5777.
the class SQLDatabaseConnectionTest method testCantRemoveNotExistedWorker.
@Test
public void testCantRemoveNotExistedWorker() {
SQLDatabaseConnection sqlConnection = new SQLDatabaseConnection();
try {
sqlConnection.removeWorker(null, workerName);
fail();
} catch (CriticalError | ClientNotConnected e) {
fail();
} catch (ClientNotExist e) {
}
}
use of SQLDatabase.SQLDatabaseException.CriticalError in project SmartCity-Market by TechnionYP5777.
the class SQLDatabaseConnectionTest method testNotExistedCustomerCantLogin.
@Test
public void testNotExistedCustomerCantLogin() {
SQLDatabaseConnection sqlConnection = new SQLDatabaseConnection();
try {
sqlConnection.loginCustomer(customerName, customerName);
fail();
} catch (ClientAlreadyConnected | CriticalError | NumberOfConnectionsExceeded e1) {
fail();
} catch (AuthenticationError e) {
}
}
Aggregations