@Test
  public void testTranslation() {
    DateTime fixed = new DateTime(DateTimeZones.UTC).withDate(2013, 12, 13).withTime(9, 10, 20, 0);
    Application app =
        Application.application("test123")
            .withTitle("test")
            .withDescription("desc")
            .withConfiguration(ApplicationConfiguration.DEFAULT_CONFIGURATION)
            .withCredentials(new ApplicationCredentials("apiKey"))
            .withLastUpdated(fixed)
            .withDeerId(123L)
            .withRevoked(true)
            .withNumberOfUsers(27L)
            .withStripeCustomerId("Stripe1234")
            .build();

    ApplicationTranslator translator = new ApplicationTranslator();
    Application translated = translator.fromDBObject(translator.toDBObject(app));
    assertEquals(app.getSlug(), translated.getSlug());
    assertEquals(app.getDescription(), translated.getDescription());
    assertEquals(app.getLastUpdated(), translated.getLastUpdated());
    assertEquals(app.getDeerId(), translated.getDeerId());
    assertEquals(app.isRevoked(), translated.isRevoked());
    assertEquals(app.getNumberOfUsers(), translated.getNumberOfUsers());
    assertEquals(app.getStripeCustomerId().get(), translated.getStripeCustomerId().get());
  }
  @Test
  public void testChain() {

    Application app = new Application(new ApplicationTemplate()).name("ins").description("desc");
    Assert.assertEquals("ins", app.getName());
    Assert.assertEquals("desc", app.getDescription());
  }
Esempio n. 3
0
  public ApplicationPanel(final Application application) {
    super("applicationPanel");

    WebMarkupContainer webMarkupContainer = new WebMarkupContainer("appWrapper");
    webMarkupContainer.setOutputMarkupId(true);
    webMarkupContainer.add(
        new AjaxEventBehavior("onclick") {

          @Override
          protected void onEvent(AjaxRequestTarget ajaxRequestTarget) {
            PageParameters parameters = new PageParameters();
            parameters.add(APPLICATION_NAME, application.getApplicationName());
            parameters.add(GROUP_ID, application.getArtifact().getGroupId());
            parameters.add(ARTIFACT_ID, application.getArtifact().getArtifactId());
            parameters.add(PACKAGING, application.getArtifact().getPackaging());

            setResponsePage(RepoPage.class, parameters);
          }
        });

    webMarkupContainer.add(new Image("applicationImage", application.getImageUrl()));
    webMarkupContainer.add(new Label("applicationName", application.getApplicationName()));
    webMarkupContainer.add(new Label("applicationDescription", application.getDescription()));

    add(webMarkupContainer);
  }