Package ru.aristar.jnuget.sources

Examples of ru.aristar.jnuget.sources.PackageSource


    @Test
    @SuppressWarnings("unchecked")
    public void testRemoveFromEmptyStorage() throws Exception {
        //GIVEN
        Nupkg nupkg = createNupkgList("Nupkg", "0.0.1").get(0);
        final PackageSource packageSource = context.mock(PackageSource.class);
        List<Version> removedVersions = new ArrayList<>();
        List<String> removedIds = new ArrayList<>();
        final RemovedPackageVersionStub addRemovedVersionToList = new RemovedPackageVersionStub(removedVersions, removedIds);
        context.checking(new Expectations() {
View Full Code Here


        Nupkg nupkg = nupkgs.get(0);
        List<Version> removedVersions = new ArrayList<>();
        List<String> removedIds = new ArrayList<>();
        final RemovedPackageVersionStub addRemovedVersionToList = new RemovedPackageVersionStub(removedVersions, removedIds);

        final PackageSource packageSource = context.mock(PackageSource.class);
        context.checking(new Expectations() {

            {
                atLeast(0).of(packageSource).getPackages("Nupkg");
                will(returnValue(nupkgs));
View Full Code Here

        //GIVEN
        IdEqIgnoreCase eqIgnoreCase = new IdEqIgnoreCase("packageId");
        VersionEq versionEq = new VersionEq(Version.parse("1.2.3"));
        AndExpression andExpression = new AndExpression(eqIgnoreCase, versionEq);

        PackageSource packageSource = context.mock(PackageSource.class);
        Nupkg nupkg = context.mock(Nupkg.class);

        Expectations expectations = new Expectations();
        expectations.oneOf(packageSource).getPackages("packageId");
        expectations.will(returnValue(Arrays.asList(nupkg)));
View Full Code Here

     * Инициализация контроллера
     *
     * @throws NugetFormatException ошибка чтения спецификации пакета
     */
    public void init() throws NugetFormatException {
        PackageSource packageSource = PackageSourceFactory.getInstance().getPublicPackageSource(storageName);
        nupkg = packageSource.getPackage(packageId, packageVersion);
        if (nupkg == null) {
            for (PackageSource<Nupkg> source : PackageSourceFactory.getInstance().getPublicPackageSources()) {
                nupkg = source.getPackage(packageId, packageVersion);
                if (nupkg != null) {
                    break;
View Full Code Here

    @Path("download/{id}/{version}")
    public Response getPackage(@PathParam("id") String id,
            @PathParam("version") String versionString) {
        try {
            Version version = Version.parse(versionString);
            PackageSource packageSource = getPackageSource();
            if (packageSource == null) {
                return Response.status(Response.Status.NOT_FOUND).build();
            }
            Nupkg nupkg = packageSource.getPackage(id, version);
            if (nupkg == null) {
                logger.warn("Пакет " + id + ":" + versionString + " не найден");
                return Response.status(Response.Status.NOT_FOUND).build();
            }
            InputStream inputStream = nupkg.getStream();
View Full Code Here

TOP

Related Classes of ru.aristar.jnuget.sources.PackageSource

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.