Package no.kommune.bergen.soa.svarut.domain

Examples of no.kommune.bergen.soa.svarut.domain.Forsendelse


  @Test
  @SuppressWarnings("unchecked")
  public void sendNoAttachment() {
    String email = "svarut.to@hudson.iktfou.no";
    String replyTo = "svarut.from@hudson.iktfou.no";
    Forsendelse forsendelse = ForsendelsesArkivTest.createForsendelse( 1 );
    forsendelse.setId( "sendNoAttachment" );
    forsendelse.setEmail( email );
    forsendelse.setShipmentPolicy( ShipmentPolicy.KUN_EMAIL.value() );
    forsendelse.setReplyTo( replyTo );
    expect( templateEngineMock.merge( isA( Map.class ), same( SubjectTemplate ) ) ).andReturn( SubjectTemplate );
    expect( templateEngineMock.merge( isA( Map.class ), same( BodyTemplateNoAttachment ) ) ).andReturn( BodyTemplateNoAttachment );
    mailSenderMock.sendEmail( same( email ), same( replyTo ), same( SubjectTemplate ), same( BodyTemplateNoAttachment ), (File[])EasyMock.isNull() );
    expectLastCall();
    replay( templateEngineMock );
View Full Code Here


    verify( mailSenderMock );
  }

  @Test
  public void creteAttachments() {
    Forsendelse forsendelse = ForsendelsesArkivTest.createForsendelse( 1 );
    forsendelse.setId( "MyID" );
    Map<String, String> model = this.emailFacade.modelFactory.createModel( forsendelse );
    File[] attachments = this.emailFacade.createAttachments( forsendelse, model );
    Assert.assertNull( attachments );
    File file = FilHenter.getFileAsFile(ForsendelsesArkivTest.testPdf);
    forsendelse.setFile( file );
    attachments = this.emailFacade.createAttachments( forsendelse, model );
    Assert.assertNotNull( attachments );
    Assert.assertEquals( 1, attachments.length );
  }
View Full Code Here

  }

  @Test
  public void getDispatcher() {
    int variant = 1;
    Forsendelse forsendelse = ForsendelsesArkivTest.createForsendelse( variant );
    forsendelse.setEmail( "svarut.to@qwe.com" );

    verifyDispatcherChoice(forsendelse, ShipmentPolicy.KUN_APOST);
    verifyDispatcherChoice(forsendelse, ShipmentPolicy.KUN_BPOST);
    verifyDispatcherChoice(forsendelse, ShipmentPolicy.KUN_REKOMMANDERT);
View Full Code Here

    this.dispatcher = new EmailOgPost( serviceDelegate, forsendelsesArkiv, emailFacade, printFacade, dispatchPolicy);
  }

  @Test
  public void sendEmailForsendelse() {
    Forsendelse forsendelse = newForsendelseEmailAddrIncluded();
    emailFacade.send( eq( forsendelse ) );
    forsendelsesArkiv.setSentEmail( eq( forsendelse.getId() ) );
    forsendelsesArkiv.stop( eq( forsendelse.getId() ) );
    replay( emailFacade );
    replay( forsendelsesArkiv );
    dispatcher.send( forsendelse );
    verify( emailFacade );
    verify( forsendelsesArkiv );
View Full Code Here

    verify( forsendelsesArkiv );
  }

  @Test
  public void sendPrintForsendelse() {
    Forsendelse forsendelse = newForsendelseEmailAdrOmitted();
    PrintReceipt printReceipt = newPrintReceipt( "MY-PRINT-ID" );
    expect( printFacade.print( eq( forsendelse ) ) ).andReturn( printReceipt );
    forsendelsesArkiv.setPrinted( eq( forsendelse.getId() ), eq( printReceipt ) );
    replay( printFacade );
    replay( forsendelsesArkiv );
    dispatcher.send( forsendelse );
    verify( printFacade );
    verify( forsendelsesArkiv );
View Full Code Here

    return printReceipt;
  }

  private Forsendelse newForsendelseEmailAddrIncluded() {
    int variant = 2;
    Forsendelse forsendelse = ForsendelsesArkivTest.createForsendelse( variant );
    forsendelse.setId( "" + variant );
    forsendelse.setFile( new File( "src/test/resources/test.pdf" ) );
    forsendelse.setEmail( "asd@qwe.com" );
    forsendelse.setShipmentPolicy(KUN_EMAIL.value());
    return forsendelse;
  }
View Full Code Here

    forsendelse.setShipmentPolicy(KUN_EMAIL.value());
    return forsendelse;
  }

  private Forsendelse newForsendelseEmailAdrOmitted() {
    Forsendelse forsendelse = newForsendelseEmailAddrIncluded();
    forsendelse.setEmail( null );
    return forsendelse;
  }
View Full Code Here

  }

  @Test
  public void handleUnread() {
    int variant = 2;
    Forsendelse forsendelse = ForsendelsesArkivTest.createForsendelse( 1 );
    forsendelse.setId( "" + variant );
    forsendelse.setFile( new File( "src/test/resources/test.pdf" ) );
    long now = System.currentTimeMillis();
    long sent = now - (leadTimeBeforePrint + 1);
    Date date = new Date();
    date.setTime( sent );
    forsendelse.setSendt( date );
    PrintReceipt printReceipt = newPrintReceipt( "MY-PRINT-ID" );
    expect( printFacade.print( eq( forsendelse ) ) ).andReturn( printReceipt );
    forsendelsesArkiv.setPrinted( eq( forsendelse.getId() ), eq( printReceipt ) );
    replay( printFacade );
    replay( forsendelsesArkiv );
    dispatcher.handleUnread( forsendelse );
    verify( printFacade );
    verify( forsendelsesArkiv );
View Full Code Here

    verify( forsendelsesArkiv );
  }

  @Test
  public void verifyForsendelse() {
    Forsendelse f = new Forsendelse();
    assertFalse( isOk( f ) );
    f.setNavn( "asd" );
    assertFalse( isOk( f ) );
    f.setAdresse1( "asd" );
    assertFalse( isOk( f ) );
    f.setPostnr( "asd" );
    assertFalse( isOk( f ) );
    f.setPoststed( "asd" );
    assertFalse( isOk( f ) );
    f.setEmail( "asd" );
    assertFalse( isOk( f ) );
    f.setTittel( "asd" );
    assertTrue( isOk( f ) );
  }
View Full Code Here

  }

  @Test
  public void handleUnread() {
    int variant = 3;
    Forsendelse forsendelse = ForsendelsesArkivTest.createForsendelse( 1 );
    forsendelse.setId( "" + variant );
    forsendelse.setFile( new File( "src/test/resources/test.pdf" ) );
    long now = System.currentTimeMillis();
    long sent = now - (leadTimeBeforePrint + 1);
    Date date = new Date();
    date.setTime( sent );
    forsendelse.setSendt( date );
    PrintReceipt printReceipt = newPrintReceipt( "MY-PRINT-ID" );
    expect( printFacade.print( eq( forsendelse ) ) ).andReturn( printReceipt );
    forsendelsesArkiv.setPrinted( eq( forsendelse.getId() ), eq( printReceipt ) );
    replay( printFacade );
    replay( forsendelsesArkiv );
    dispatcher.handleUnread( forsendelse );
    verify( printFacade );
    verify( forsendelsesArkiv );
View Full Code Here

TOP

Related Classes of no.kommune.bergen.soa.svarut.domain.Forsendelse

Copyright © 2018 www.massapicom. 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.