@Test
  public void publishIndex() throws Exception {
    File repositoryPath = new File(nexusWorkDir, "storage/nexus-test-harness-repo");
    File index = new File(repositoryPath, ".index");

    if (index.exists()) {
      // can't contain the OSS index
      MatcherAssert.assertThat(
          Arrays.asList(index.list()),
          CoreMatchers.not(
              IsCollectionContaining.hasItems(
                  "nexus-maven-repository-index.gz",
                  "nexus-maven-repository-index.gz.md5",
                  "nexus-maven-repository-index.gz.sha1",
                  "nexus-maven-repository-index.properties",
                  "nexus-maven-repository-index.properties.md5",
                  "nexus-maven-repository-index.properties.sha1",
                  "nexus-maven-repository-index.zip",
                  "nexus-maven-repository-index.zip.md5",
                  "nexus-maven-repository-index.zip.sha1")));
    }

    ScheduledServicePropertyResource prop = new ScheduledServicePropertyResource();
    prop.setKey("repositoryOrGroupId");
    prop.setValue("repo_nexus-test-harness-repo");

    TaskScheduleUtil.runTask(PublishIndexesTaskDescriptor.ID, prop);

    Assert.assertTrue(index.exists(), ".index should exists after publish index task was run.");
  }
Esempio n. 2
0
 public void not(@Nullable T value) {
   if (value == null) {
     notNull();
   } else {
     verifyUsingMatcher(CoreMatchers.not(value));
   }
 }
Esempio n. 3
0
  @Test
  public void testCatColoredCommand() throws Exception {
    Project project = projectFactory.createTempProject();
    File target = new File(project.getRoot().getFullyQualifiedName(), "test.java");
    target.createNewFile();

    FileResource<?> source = project.getRoot().getChild(target.getName()).reify(FileResource.class);
    source.setContents("public void test() {}");

    shellTest.execute("cat " + source.getFullyQualifiedName() + " --color", 5, TimeUnit.SECONDS);
    // the string should be colors, so there are color codes between the statements
    Assert.assertThat(
        shellTest.getStdOut(), CoreMatchers.not(CoreMatchers.containsString("public void")));
  }
Esempio n. 4
0
 protected void verifyUsingMatcher(Matcher<? super T> matcher) {
   if (negate) {
     matcher = CoreMatchers.not(matcher);
   }
   verifyUsingMatcher(actualValue, matcher);
 }
Esempio n. 5
0
 /**
  * Inverts the rule.
  *
  * @param matcher the matcher
  */
 public void not(Matcher<? super T> matcher) {
   verifyUsingMatcher(CoreMatchers.not(matcher));
 }
Esempio n. 6
0
  @Test
  public void test() {

    EventMapper mapper = DBRULE.getSession().getMapper(this.event.getMapper());

    assertEquals(0, this.event.getId());
    mapper.insert(this.event);
    Assert.assertThat(0, CoreMatchers.not(CoreMatchers.equalTo(this.event.getId())));
    final int eventId = this.event.getId();

    LocationMapper locMapper = DBRULE.getSession().getMapper(location.getMapper());
    locMapper.insert(location);
    locMapper.addToEvent(this.event.getId(), location.getId());

    Event readEvent = mapper.get(eventId);
    assertNotNull(readEvent);
    assertEquals(1, readEvent.getVersion());
    assertEquals(LocalDate.of(2015, 12, 6), readEvent.getEndDate());
    assertEquals(LocalDate.of(2015, 12, 5), readEvent.getStartDate());
    assertNotNull(readEvent.getFees());
    assertNotNull(readEvent.getLocalOrganizer());
    assertNotNull(readEvent.getLocations());
    assertEquals(1, readEvent.getLocations().size());
    assertEquals(info, readEvent.getInfo());
    assertNotNull(readEvent.getTournamentEdition());
    assertTrue(readEvent.getTournamentEdition() instanceof TournamentEdition);

    int updateCount = mapper.update(this.event);
    assertEquals(0, updateCount);

    readEvent.setStartDate(LocalDate.of(2015, 12, 4));
    updateCount = mapper.update(readEvent);
    assertEquals(1, updateCount);

    readEvent = mapper.get(eventId);
    assertNotNull(readEvent);
    assertEquals(2, readEvent.getVersion());
    assertEquals(LocalDate.of(2015, 12, 6), readEvent.getEndDate());
    assertEquals(LocalDate.of(2015, 12, 4), readEvent.getStartDate());
    assertNotNull(readEvent.getFees());
    assertNotNull(readEvent.getLocalOrganizer());
    assertNotNull(readEvent.getLocations());
    assertEquals(info, readEvent.getInfo());
    assertEquals(1, readEvent.getLocations().size());
    assertNotNull(readEvent.getTournamentEdition());
    assertTrue(readEvent.getTournamentEdition() instanceof TournamentEdition);

    /*
     * we need a second edition as otherwise we will insert a second event
     * for a TournamentEditionSingle
     */
    TournamentEdition secondEditino =
        DBRULE.getSession().getMapper(TournamentEditionMapper.class).get(1);
    secondEditino.setRegistrationStart(LocalDate.now());
    secondEditino.setRegistrationEnd(LocalDate.now());
    secondEditino.setSeason(season);
    secondEditino.setOrganizer(readEvent.getLocalOrganizer());

    DBRULE.getSession().getMapper(TournamentEditionMapper.class).insert(secondEditino);
    this.event.setTournamentEdition(secondEditino);

    mapper.insert(this.event);
    List<Event> allEvents = mapper.getAll();
    assertNotNull(allEvents);
    assertEquals(2, allEvents.size());

    final int deletedId = this.event.getId();
    mapper.delete(this.event);
    assertNull(mapper.get(deletedId));

    allEvents = mapper.getAll();
    assertNotNull(allEvents);
    assertEquals(1, allEvents.size());
  }