Search in sources :

Example 6 with InvalidParameter

use of EmployeeDefs.AEmployeeException.InvalidParameter in project SmartCity-Market by TechnionYP5777.

the class ManageCatalogProductDetailsTab method renameIngrPressed.

void renameIngrPressed() {
    long id = ingredients.get(selectedIngr.iterator().next()).getId();
    try {
        manager.editIngredient(new Ingredient(id, renameIngrLbl.getText()));
    } catch (InvalidParameter | CriticalError | EmployeeNotConnected | ConnectionFailure | ParamIDDoesNotExist e) {
        log.debug(StackTraceUtil.getStackTrace(e));
        log.fatal(e);
        e.showInfoToUser();
    }
    selectedIngr.clear();
    createIngredientList();
    enableButtons();
    enableAddButtons();
}
Also used : InvalidParameter(EmployeeDefs.AEmployeeException.InvalidParameter) CriticalError(SMExceptions.CommonExceptions.CriticalError) ConnectionFailure(EmployeeDefs.AEmployeeException.ConnectionFailure) Ingredient(BasicCommonClasses.Ingredient) ParamIDDoesNotExist(EmployeeDefs.AEmployeeException.ParamIDDoesNotExist) EmployeeNotConnected(EmployeeDefs.AEmployeeException.EmployeeNotConnected)

Example 7 with InvalidParameter

use of EmployeeDefs.AEmployeeException.InvalidParameter in project SmartCity-Market by TechnionYP5777.

the class ManageCatalogProductDetailsTab method addManuPressed.

void addManuPressed() {
    try {
        manager.addManufacturer(new Manufacturer(0, newManu.getText()));
    } catch (InvalidParameter | CriticalError | EmployeeNotConnected | ConnectionFailure | ParamIDAlreadyExists e) {
        log.fatal(e);
        log.debug(StackTraceUtil.getStackTrace(e));
        e.showInfoToUser();
    }
    selectedManu.clear();
    createManufacturerList();
    enableButtons();
    enableAddButtons();
}
Also used : InvalidParameter(EmployeeDefs.AEmployeeException.InvalidParameter) CriticalError(SMExceptions.CommonExceptions.CriticalError) ConnectionFailure(EmployeeDefs.AEmployeeException.ConnectionFailure) Manufacturer(BasicCommonClasses.Manufacturer) ParamIDAlreadyExists(EmployeeDefs.AEmployeeException.ParamIDAlreadyExists) EmployeeNotConnected(EmployeeDefs.AEmployeeException.EmployeeNotConnected)

Example 8 with InvalidParameter

use of EmployeeDefs.AEmployeeException.InvalidParameter 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");
}
Also used : SmartCode(BasicCommonClasses.SmartCode) ProductNotExistInCatalog(EmployeeDefs.AEmployeeException.ProductNotExistInCatalog) InvalidParameter(EmployeeDefs.AEmployeeException.InvalidParameter) CriticalError(SMExceptions.CommonExceptions.CriticalError) ConnectionFailure(EmployeeDefs.AEmployeeException.ConnectionFailure) Manufacturer(BasicCommonClasses.Manufacturer) CatalogProduct(BasicCommonClasses.CatalogProduct) CommandWrapper(ClientServerApi.CommandWrapper) IOException(java.io.IOException) EmployeeNotConnected(EmployeeDefs.AEmployeeException.EmployeeNotConnected) Test(org.junit.Test)

Aggregations

InvalidParameter (EmployeeDefs.AEmployeeException.InvalidParameter)8 CriticalError (SMExceptions.CommonExceptions.CriticalError)8 EmployeeNotConnected (EmployeeDefs.AEmployeeException.EmployeeNotConnected)7 ConnectionFailure (EmployeeDefs.AEmployeeException.ConnectionFailure)6 ParamIDAlreadyExists (EmployeeDefs.AEmployeeException.ParamIDAlreadyExists)4 ParamIDDoesNotExist (EmployeeDefs.AEmployeeException.ParamIDDoesNotExist)4 Manufacturer (BasicCommonClasses.Manufacturer)3 CommandWrapper (ClientServerApi.CommandWrapper)3 ProductNotExistInCatalog (EmployeeDefs.AEmployeeException.ProductNotExistInCatalog)3 WorkerAlreadyExists (EmployeeDefs.AEmployeeException.WorkerAlreadyExists)3 Ingredient (BasicCommonClasses.Ingredient)2 AmountBiggerThanAvailable (EmployeeDefs.AEmployeeException.AmountBiggerThanAvailable)2 AuthenticationError (EmployeeDefs.AEmployeeException.AuthenticationError)2 EmployeeAlreadyConnected (EmployeeDefs.AEmployeeException.EmployeeAlreadyConnected)2 IngredientStillInUse (EmployeeDefs.AEmployeeException.IngredientStillInUse)2 InvalidCommandDescriptor (EmployeeDefs.AEmployeeException.InvalidCommandDescriptor)2 ManfacturerStillInUse (EmployeeDefs.AEmployeeException.ManfacturerStillInUse)2 ProductAlreadyExistInCatalog (EmployeeDefs.AEmployeeException.ProductAlreadyExistInCatalog)2 ProductPackageDoesNotExist (EmployeeDefs.AEmployeeException.ProductPackageDoesNotExist)2 ProductStillForSale (EmployeeDefs.AEmployeeException.ProductStillForSale)2