Examples of AssetManagerRuntimeException


Examples of org.pau.assetmanager.utils.AssetManagerRuntimeException

    try {
      Date date = simpleDateFormat.parse(dateAsString);
      return date;
    } catch (ParseException e) {
      // throw uncatched exception --> this should crash the test
      throw new AssetManagerRuntimeException("Wrong data format 'dd/MM/yyyy' for string " + dateAsString );
    }
  }
View Full Code Here

Examples of org.pau.assetmanager.utils.AssetManagerRuntimeException

            stockExpensesAnnotation.getNumberOfStocks(),
            month, year);
        symbolToCurrentStockState.put(annotation.getConcept(),
            stockState);
      } else {
        throw new AssetManagerRuntimeException("the first transaction should be buy stocks");
        // TODO: error, the first transaction should be buy stocks
      }
    } else {
      StockState stockState = symbolToCurrentStockState.get(annotation
          .getConcept());
View Full Code Here

Examples of org.pau.assetmanager.utils.AssetManagerRuntimeException

              );
        }
      }
      return yearMonthValueTable;
    } catch (ParseException e) {
      throw new AssetManagerRuntimeException(
          "Error parsing date from CSV file for '" + symbol
              + "' between '" + startYear + "' and '" + finalYear
              + "'.", e);
    }
  }
View Full Code Here

Examples of org.pau.assetmanager.utils.AssetManagerRuntimeException

          .setRequestProperty(
              "User-Agent",
              "Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7B405");
      int responseCode = httpURLConnection.getResponseCode();
      if (responseCode != 200) {
        throw new AssetManagerRuntimeException("Error code '"
            + responseCode + "' when requesting to '" + url + "'");
      }
      try (BufferedReader bufferReader = new BufferedReader(
          new InputStreamReader(httpURLConnection.getInputStream()));) {
        String currentLine = null;
        List<Map<String, String>> csvContents = new LinkedList<Map<String, String>>();
        if ((currentLine = bufferReader.readLine()) != null) {
          String[] headers = currentLine.split(",");
          List<String> actualHeadersInCVS = new ArrayList<String>(
              Arrays.asList(headers));
          if (!actualHeadersInCVS.equals(HEADERS)) {
            throw new RuntimeException(
                String.format(
                    "CVS header %s is not consistent with the expected list of headers %s",
                    currentLine, HEADERS.toString()));
          }
        }

        while ((currentLine = bufferReader.readLine()) != null) {
          Map<String, String> fieldToValueMap = new HashMap<String, String>();
          String[] valuesInLine = currentLine.split(",");
          for (int valueIndex = 0; valueIndex < valuesInLine.length; valueIndex++) {
            fieldToValueMap.put(HEADERS.get(valueIndex),
                valuesInLine[valueIndex]);
          }
          csvContents.add(fieldToValueMap);
        }
        return csvContents;
      }
    } catch (IOException ioException) {
      throw new AssetManagerRuntimeException(
          "Error downloading stocks for '" + symbol + "' between '"
              + startYear + "' and '" + finalYear + "'.",
          ioException);
    }
  }
View Full Code Here

Examples of org.pau.assetmanager.utils.AssetManagerRuntimeException

    if (optionalClient.isPresent()) {
      setSelectedClient(optionalClient.get());
    } else {
      String message = "Client with name '" + clientName + "' not found.";
      logger.error(message);
      throw new AssetManagerRuntimeException(message);
    }
  }
View Full Code Here

Examples of org.pau.assetmanager.utils.AssetManagerRuntimeException

      List<SaNostraAnnotationImport> saNostraAnnotationImportList = sanNostraDefaultHandler.getSaNostraAnnotationImportList();
      return saNostraAnnotationImportList;
    } catch (Exception e) {
      String message = "Error importing XML file from Sa Nostra";
      logger.error("Error importing XML file from Sa Nostra", e);
      throw new AssetManagerRuntimeException(message, e);
    }
  };
View Full Code Here

Examples of org.pau.assetmanager.utils.AssetManagerRuntimeException

    this.balance = balance;
    this.numberOfPurchasedStocks = numberOfPurchasedStocks;
    this.month = month;
    this.year = year;
    if (numberOfPurchasedStocks < 0) {
      throw new AssetManagerRuntimeException(
          "There are not enought stocks to sell");
    }
  }
View Full Code Here

Examples of org.pau.assetmanager.utils.AssetManagerRuntimeException

      return optionalPredefinedConcept.get().getName();
    }
    String message = "'" + annotationClassName
        + "' annotation class name has no default predefined concept";
    logger.error(message);
    throw new AssetManagerRuntimeException(message);
  }
View Full Code Here

Examples of org.pau.assetmanager.utils.AssetManagerRuntimeException

      DaoFunction.deleteDetachedFunction().apply(client);
      return client;
    }else{
      String message = "Client '"+selectedClient.toString()+"' not found in the database";
      logger.error(message);
      throw new AssetManagerRuntimeException(message);
    }   
  }
View Full Code Here

Examples of org.pau.assetmanager.utils.AssetManagerRuntimeException

    if (timeDependentConstantValues.size() == 0) {
      // there is no value for the given type, major error
      String message = "No TimeDependentConstantValue found for type '"
          + timeDependentConstantType.name() + "'";
      logger.error(message);
      throw new AssetManagerRuntimeException(message);
    } else {
      return timeDependentConstantValues.get(0);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.