Examples of ImportationPuces


Examples of org.xrace.model.importation.puces.ImportationPuces

  /**
   * Importation normale où on remplace les puces avec celles dans le fichier.
   */
  public void testValidateDoublonsRemplacement() throws Exception
  {
    ImportationPuces importationPuces = getImportation("importation_puces-doublons.csv");
    importationPuces.setRemplacerPuces(true);
    getImportationPucesService().load(importationPuces);
    getImportationPucesService().validate(importationPuces);

    assertEquals(6, importationPuces.getLinesByStatus(
        ImportationLineStatus.VALIDEE).size());
    assertEquals(0, importationPuces.getLinesByStatus(
        ImportationLineStatus.EN_ERREUR).size());
    assertEquals(1, importationPuces.getLinesExclus().size());
  }
View Full Code Here

Examples of org.xrace.model.importation.puces.ImportationPuces

   * d'ignorer les doublons. Aucune erreur n'est soulevée, et les lignes en double
   * sont exclues.
   */
  public void testValidateIgnoreDoublons() throws Exception
  {
    ImportationPuces importationPuces = getImportation("importation_puces-doublons.csv");
    getImportationPucesService().load(importationPuces);
    getImportationPucesService().validate(importationPuces);

    assertEquals(5, importationPuces.getLinesByStatus(
        ImportationLineStatus.VALIDEE).size());
    assertEquals(0, importationPuces.getLinesByStatus(
        ImportationLineStatus.EN_ERREUR).size());
    assertEquals(2, importationPuces.getLinesExclus().size());
  }
View Full Code Here

Examples of org.xrace.model.importation.puces.ImportationPuces

   * d'ignorer les doublons. Aucune erreur n'est soulevée, et les lignes en double
   * sont
   */
  public void testValidateDoublons() throws Exception
  {
    ImportationPuces importationPuces = getImportation("importation_puces-doublons.csv");
    importationPuces.setIgnorerDoublons(false);
    getImportationPucesService().load(importationPuces);
    getImportationPucesService().validate(importationPuces);

    assertEquals(5, importationPuces.getLinesByStatus(
        ImportationLineStatus.VALIDEE).size());
    assertEquals(2, importationPuces.getLinesByStatus(
        ImportationLineStatus.EN_ERREUR).size());
    assertEquals(0, importationPuces.getLinesExclus().size());
    assertTrue(importationPuces.getLinesByStatus(
        ImportationLineStatus.EN_ERREUR).get(0)
        .containsErreurImportation("ImportationPuces.puceEnDouble"));
  }
View Full Code Here

Examples of org.xrace.model.importation.puces.ImportationPuces

   * Cas avec des lignes invalides. Aucune ligne échoue la validation, puisque les lignes
   * sont juste mal formées.
   */
  public void testValidateLignesInvalides() throws Exception
  {
    ImportationPuces importationPuces = getImportation("importation_puces-lignes_invalides.csv");
    getImportationPucesService().load(importationPuces);
    getImportationPucesService().validate(importationPuces);

    assertEquals(3, importationPuces.getLinesByStatus(
        ImportationLineStatus.VALIDEE).size());
    assertEquals(0, importationPuces.getLinesByStatus(
        ImportationLineStatus.EN_ERREUR).size());
    assertEquals(0, importationPuces.getLinesExclus().size());
  }
View Full Code Here

Examples of org.xrace.model.importation.puces.ImportationPuces

  /**
   * Importation normale.
   */
  public void testValidateImportCasNormal() throws Exception
  {
    ImportationPuces importationPuces = getImportation("importation_puces-cas_normal.csv");
    getImportationPucesService().load(importationPuces);
    getImportationPucesService().validateAndImport(importationPuces);

    assertEquals(5, importationPuces.getLinesByStatus(
        ImportationLineStatus.IMPORTE).size());
    assertEquals(0, importationPuces.getLinesByStatus(
        ImportationLineStatus.EN_ERREUR).size());
    assertEquals(0, importationPuces.getLinesExclus().size());

    assertEquals(305, ensemblePuces.getPuces().size());
    assertNotNull(getPuceService().findByCode("Puce1", ensemblePuces));
    assertNotNull(getPuceService().findByCode("NC-02709", ensemblePuces));
  }
View Full Code Here

Examples of org.xrace.model.importation.puces.ImportationPuces

  /**
   * Importation normale où on remplace les puces avec celles dans le fichier.
   */
  public void testValidateImportDoublonsRemplacement() throws Exception
  {
    ImportationPuces importationPuces = getImportation("importation_puces-doublons.csv");
    importationPuces.setRemplacerPuces(true);
    getImportationPucesService().load(importationPuces);
    getImportationPucesService().validateAndImport(importationPuces);

    assertEquals(6, importationPuces.getLinesByStatus(
        ImportationLineStatus.IMPORTE).size());
    assertEquals(0, importationPuces.getLinesByStatus(
        ImportationLineStatus.EN_ERREUR).size());
    assertEquals(1, importationPuces.getLinesExclus().size());

    assertEquals(6, ensemblePuces.getPuces().size());
    assertNotNull(getPuceService().findByCode("Puce1", ensemblePuces));
    assertNull(getPuceService().findByCode("Puce2", ensemblePuces));
    assertNotNull(getPuceService().findByCode("NC-02709", ensemblePuces));
View Full Code Here

Examples of org.xrace.model.importation.puces.ImportationPuces

  /**
   * Importation avec des doublons, qu'on ignore.
   */
  public void testValidateImportIgnoreDoublons() throws Exception
  {
    ImportationPuces importationPuces = getImportation("importation_puces-doublons.csv");
    getImportationPucesService().load(importationPuces);
    getImportationPucesService().validateAndImport(importationPuces);

    assertEquals(5, importationPuces.getLinesByStatus(
        ImportationLineStatus.IMPORTE).size());
    assertEquals(0, importationPuces.getLinesByStatus(
        ImportationLineStatus.EN_ERREUR).size());
    assertEquals(2, importationPuces.getLinesExclus().size());

    assertEquals(305, ensemblePuces.getPuces().size());
    assertNotNull(getPuceService().findByCode("Puce1", ensemblePuces));
    assertNotNull(getPuceService().findByCode("NC-02709", ensemblePuces));
  }
View Full Code Here

Examples of org.xrace.model.importation.puces.ImportationPuces

  /**
   * Importation avec des doublons, qu'on n'importe pas.
   */
  public void testValidateImportDoublons() throws Exception
  {
    ImportationPuces importationPuces = getImportation("importation_puces-doublons.csv");
    importationPuces.setIgnorerDoublons(false);
    getImportationPucesService().load(importationPuces);
    getImportationPucesService().validateAndImport(importationPuces);

    assertEquals(5, importationPuces.getLinesByStatus(
        ImportationLineStatus.IMPORTE).size());
    assertEquals(2, importationPuces.getLinesByStatus(
        ImportationLineStatus.EN_ERREUR).size());
    assertEquals(0, importationPuces.getLinesExclus().size());

    assertEquals(305, ensemblePuces.getPuces().size());
    assertNotNull(getPuceService().findByCode("Puce1", ensemblePuces));
    assertNotNull(getPuceService().findByCode("NC-02709", ensemblePuces));
  }
View Full Code Here

Examples of org.xrace.model.importation.puces.ImportationPuces

    Resource resource = getResourceService().newResourceFromFileName(
        classPathResource.getFilename());
    getResourceService().upload(
        new FileInputStream(classPathResource.getFile()), resource);

    ImportationPuces importationPuces = getImportationPucesService()
        .newImportation(compte, ensemblePuces, new Date());
    importationPuces.setCommentaires("Test");
    importationPuces.setImportFile(resource);
    importationPuces.setIndexColonneCode(14);
    importationPuces.setIndexColonneNumero(1);
    importationPuces.setIndexPremiereLigne(2);
    importationPuces.setDelimiterChar(",");

    return importationPuces;
  }
View Full Code Here

Examples of org.xrace.model.importation.puces.ImportationPuces

    createComponents();
  }

  private void createComponents()
  {
    final ImportationPuces importationPuces = importationPucesService
        .newImportation(getXRaceSession().getCompte(), ensemblePuces,
            new Date());

    final Form form = new Form("form");
    form.add(new ImportationPucesUpdatePanel("importationUpdatePanel",
        importationPuces));

    form.add(new Button("ok")
    {
      private static final long serialVersionUID = 1L;

      @Override
      public void onSubmit()
      {
        if (importationPuces.getImportFile() == null)
        {
          error("Le fichier d'importation doit être spécifié. ");
        }
        else
        {
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.