use of EmployeeDefs.AEmployeeException.ConnectionFailure in project SmartCity-Market by TechnionYP5777.
the class ManageCatalogProductDetailsTab method renameManuPressed.
void renameManuPressed() {
long id = manufacturars.get(selectedManu.iterator().next()).getId();
try {
manager.editManufacturer(new Manufacturer(id, renameManuLbl.getText()));
} catch (InvalidParameter | CriticalError | EmployeeNotConnected | ConnectionFailure | ParamIDDoesNotExist e) {
log.fatal(e);
log.debug(StackTraceUtil.getStackTrace(e));
e.showInfoToUser();
}
selectedManu.clear();
createManufacturerList();
enableButtons();
enableAddButtons();
}
use of EmployeeDefs.AEmployeeException.ConnectionFailure in project SmartCity-Market by TechnionYP5777.
the class ManageCatalogProductDetailsTab method addIngPressed.
void addIngPressed() {
try {
manager.addIngredient(new Ingredient(0, newIngr.getText()));
} catch (InvalidParameter | CriticalError | EmployeeNotConnected | ConnectionFailure | ParamIDAlreadyExists e) {
log.fatal(e);
log.debug(StackTraceUtil.getStackTrace(e));
e.showInfoToUser();
}
selectedIngr.clear();
createIngredientList();
enableButtons();
enableAddButtons();
}
use of EmployeeDefs.AEmployeeException.ConnectionFailure in project SmartCity-Market by TechnionYP5777.
the class AEmployee method sendRequestWithRespondToServer.
protected String sendRequestWithRespondToServer(String request) throws ConnectionFailure {
establishCommunication(WorkerDefs.port, WorkerDefs.host, WorkerDefs.timeout);
log.info("Sending command to server");
try {
String $ = this.clientRequestHandler.sendRequestWithRespond(request);
terminateCommunication();
return $;
} catch (IOException e) {
log.fatal("Sending logout command to server encounter sever fault : " + e.getMessage());
terminateCommunication();
throw new ConnectionFailure();
}
}
use of EmployeeDefs.AEmployeeException.ConnectionFailure in project SmartCity-Market by TechnionYP5777.
the class ViewProductFromCatalogTest method ViewProductFromCatalogSuccessfulTest.
@Test
public void ViewProductFromCatalogSuccessfulTest() {
CatalogProduct testCatalogProduct = null, catalogProduct = new CatalogProduct(1234567890, "name", null, new Manufacturer(1, "Manufacturer"), "description", 22.0, null, null);
CommandWrapper commandWrapper = new CommandWrapper(ResultDescriptor.SM_OK, Serialization.serialize(catalogProduct));
try {
Mockito.when(clientRequestHandler.sendRequestWithRespond(new CommandWrapper(WorkerDefs.loginCommandSenderId, CommandDescriptor.VIEW_PRODUCT_FROM_CATALOG, Serialization.serialize(new SmartCode(1234567890, null))).serialize())).thenReturn(commandWrapper.serialize());
} catch (IOException ¢) {
fail();
}
try {
testCatalogProduct = worker.viewProductFromCatalog(1234567890);
} catch (InvalidParameter | CriticalError | EmployeeNotConnected | ProductNotExistInCatalog | ConnectionFailure ¢) {
fail();
}
assertEquals(testCatalogProduct.getBarcode(), 1234567890);
assertEquals(testCatalogProduct.getManufacturer().getId(), 1);
assertEquals(testCatalogProduct.getManufacturer().getName(), "Manufacturer");
assertEquals(testCatalogProduct.getName(), "name");
}
use of EmployeeDefs.AEmployeeException.ConnectionFailure in project SmartCity-Market by TechnionYP5777.
the class ManageEmployeesTab method finishBtnPressed.
@FXML
void finishBtnPressed(ActionEvent __) {
try {
manager.registerNewWorker(new Login(userTxt.getText(), passTxt.getText(), new ForgotPasswordData(securityCombo.getSelectionModel().getSelectedItem(), securityAnswerTxt.getText())));
} catch (InvalidParameter | CriticalError | EmployeeNotConnected | ConnectionFailure | WorkerAlreadyExists e) {
log.fatal(e);
log.debug(StackTraceUtil.getStackTrace(e));
e.showInfoToUser();
}
createEmployeesList();
enableRemoveButton();
}
Aggregations