Package com.tuenti.supernanny.repo.artifacts

Examples of com.tuenti.supernanny.repo.artifacts.Requirement


          // ignore empty and commented lines
          if (line.trim().startsWith(COMMENT_START_CHAR) || line.trim().length() == 0) {
            continue;
          }
          String[] lineParts = line.split("\\s");
          return new Requirement(lineParts[0], ReqType.EQ, lineParts[3],
              RepositoryType.valueOf(lineParts[1]), lineParts[2]);
        }
      } finally {
        reader.close();
      }
View Full Code Here


      }
      if (util.isSymlink(lib)) {
        rows.add(new String[] { lib.getName(), "*", "SYMLINK",
            "-> " + lib.getCanonicalPath() });
      } else {
        Requirement projectInfo = util.getProjectInfo(lib);
        if (projectInfo == null) {
          System.out.println(prefix + libName + " seems to be broken");
        } else {
          rows.add(new String[] { projectInfo.getName(),
              projectInfo.getVersion().getVersionString(),
              projectInfo.getRepoType().toString(), projectInfo.getRepo() });
        }
      }
    }
    util.printColumns(rows, prefix, "  ", 0, true);
  }
View Full Code Here

    }
  }

  @Override
  public boolean isUpdated(Artifact a, File dep) throws IOException {
    Requirement existing = util.getProjectInfo(dep);

    Requirement dummyReq = new Requirement(a.getName(), ReqType.EQ, a.getVersion().toString(),
        a.getOrigin().getRepoType(), a.getOriginUrl());
    return dummyReq.equals(existing);
  }
View Full Code Here

      // try to parse the file line
      // if cannot, die and report (error in file syntax )
      try {
        ReqVersion ptype = tryToParseType(depParts[3], defaultReqType);
        Requirement req = new Requirement(depParts[0], ptype.reqType, ptype.version,
            RepositoryType.valueOf(depParts[1]), depParts[2]);
        reqs.add(req);
      } catch (IllegalArgumentException e) {
        String message = MessageFormat.format("Wrong type: {0}; must be one of {1}",
            depParts[1], Arrays.toString(RepositoryType.values()));
View Full Code Here

    return vs;
  }

  @Override
  public boolean isUpdated(Artifact a, File dep) throws IOException {
    Requirement existing = util.getProjectInfo(dep);
    String expectedVersion = a.getVersion().toString();
    if (a instanceof DVCSArtifact) {
      DVCSArtifact da = (DVCSArtifact) a;
      expectedVersion = da.getChangeset();
    }

    Requirement dummyReq = new Requirement(a.getName(), ReqType.EQ, expectedVersion, a
        .getOrigin().getRepoType(), a.getOriginUrl());
    return dummyReq.equals(existing);
  }
View Full Code Here

    Assert.assertEquals("libphonenumber", a.getName());
    Assert.assertEquals(new Version("1.2.0"), a.getVersion());
    Assert.assertEquals("libphonenumber-1.2.0.tar.bz2", a.getFilename());

    List<Requirement> expectedRequirements = new LinkedList<Requirement>();
    expectedRequirements.add(new Requirement("tuenti-common", ReqType.LT, "7.8", RepositoryType.TARBZ2, "http://artifacts.tuenti.int/"));
    expectedRequirements.add(new Requirement("tfw-lib", ReqType.GT, "1.*", RepositoryType.TARBZ2, "http://artifacts.tuenti.int/"));
    Assert.assertEquals(expectedRequirements, a.getRequirements());

    a = artifacts.get(1);
    Assert.assertEquals("supervisor-common", a.getName());
    Assert.assertEquals(new Version("0.33"), a.getVersion());
    Assert.assertEquals("supervisor/supervisor-common-0.33.tar.bz2", a.getFilename());
    Assert.assertEquals(new LinkedList<Requirement>(), a.getRequirements());

    a = artifacts.get(2);
    Assert.assertEquals("fefw-fbi", a.getName());
    Assert.assertEquals(new Version("2.1"), a.getVersion());
    Assert.assertEquals("fefw-fbi-2.1.tar.bz2", a.getFilename());

    expectedRequirements = new LinkedList<Requirement>();
    expectedRequirements.add(new Requirement("tuenti-build", ReqType.LE, "16.8", RepositoryType.TARBZ2, "http://artifacts.tuenti.int/"));
    expectedRequirements.add(new Requirement("befw", ReqType.GE, "4.*", RepositoryType.TARBZ2, "http://artifacts.tuenti.int/"));
    expectedRequirements.add(new Requirement("otro", ReqType.SW, "5.*", RepositoryType.TARBZ2, "http://artifacts.tuenti.int/"));
    //expect the default GE
    expectedRequirements.add(new Requirement("squeeze", ReqType.GE, "6.*", RepositoryType.TARBZ2, "http://artifacts.tuenti.int/"));
    Assert.assertEquals(expectedRequirements, a.getRequirements());

    a = artifacts.get(3);
    Assert.assertEquals("supervisor-common", a.getName());
    Assert.assertEquals(new Version("1.0.1"), a.getVersion());
View Full Code Here

  public void testResolutionOk() throws Exception {
    prepareRepo();

    Resolver resolver = injector.getInstance(EagerResolver.class);
    List<Requirement> initialRequirements = new ArrayList<Requirement>();
    initialRequirements.add(new Requirement("befw", ReqType.EQ, "1.0.0", RepositoryType.TARBZ2,
        "http://localhost"));
    Set<Artifact> artifacts = resolver.resolve(initialRequirements);

    ArtifactData[] expected = { new ArtifactData("tuenti-common", "1.7.0"),
        new ArtifactData("futi", "3.0"), new ArtifactData("tuenti-build", "9.0"),
View Full Code Here

  public void testResolutionLibNotFound() throws Exception {
    prepareRepo();

    Resolver resolver = injector.getInstance(EagerResolver.class);
    List<Requirement> initialRequirements = new ArrayList<Requirement>();
    initialRequirements.add(new Requirement("something-weird", ReqType.EQ, "1.0",
        RepositoryType.TARBZ2, "http://localhost"));
    try {
      resolver.resolve(initialRequirements);
      Assert.fail();
    } catch (ResolutionException e) {
View Full Code Here

  public void testConflict() throws Exception {
    prepareRepo();

    Resolver resolver = injector.getInstance(EagerResolver.class);
    List<Requirement> initialRequirements = new ArrayList<Requirement>();
    initialRequirements.add(new Requirement("conflicting", ReqType.EQ, "1.0",
        RepositoryType.TARBZ2, "http://localhost"));
    try {
      resolver.resolve(initialRequirements);
      Assert.fail();
    } catch (ResolutionException e) {
View Full Code Here

  public void testChooseCorrectMajor() throws Exception {
    prepareRepo();

    Resolver resolver = injector.getInstance(EagerResolver.class);
    List<Requirement> initialRequirements = new ArrayList<Requirement>();
    initialRequirements.add(new Requirement("tuenti-build", ReqType.SW, "8.*",
        RepositoryType.TARBZ2, "http://localhost"));
    Set<Artifact> artifacts = resolver.resolve(initialRequirements);
    expectArtifacts(new ArtifactData[] { new ArtifactData("tuenti-build", "8.0") }, artifacts);
  }
View Full Code Here

TOP

Related Classes of com.tuenti.supernanny.repo.artifacts.Requirement

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.