Examples of TempNupkgFile


Examples of ru.aristar.jnuget.files.TempNupkgFile

    public void testGetPackageStream() throws Exception {
        //GIVEN
        FileUtils.deleteDirectory(new File(testFolder, "NUnit"));
        final RemotePackageSource remotePackageSource = context.mock(RemotePackageSource.class);
        InputStream inputStream = this.getClass().getResourceAsStream("/NUnit.2.5.9.10348.nupkg");
        try (final TempNupkgFile tempNupkgFile = new TempNupkgFile(inputStream)) {
            final RemoteNupkg remoteNupkg = new RemoteNupkg(
                    tempNupkgFile.getNuspecFile(),
                    tempNupkgFile.getHash(),
                    tempNupkgFile.getSize(),
                    tempNupkgFile.getUpdated(),
                    null) {

                @Override
                public InputStream getStream() throws IOException {
                    return tempNupkgFile.getStream();
                }
            };
            context.checking(new Expectations() {

                {
View Full Code Here

Examples of ru.aristar.jnuget.files.TempNupkgFile

        tmpTestFolder.mkdirs();
        try {
            ClassicPackageSource classicPackageSource = new ClassicPackageSource(tmpTestFolder);
            ModifyStrategy simplePushStrategy = new ModifyStrategy(false);
            classicPackageSource.setPushStrategy(simplePushStrategy);
            TempNupkgFile nupkgFile = new TempNupkgFile(this.getClass().getResourceAsStream("/NUnit.2.5.9.10348.nupkg"));
            //WHEN
            boolean success = classicPackageSource.pushPackage(nupkgFile);
            //THEN
            assertThat("Пакет опубликован", success, is(equalTo(false)));
            assertThat("В тестовом каталоге не создано пакетов", tmpTestFolder.list(), is(nullValue()));
View Full Code Here

Examples of ru.aristar.jnuget.files.TempNupkgFile

     * @throws IOException ошибка чтения данных от клиента
     * @throws NugetFormatException некорректный формат пакета
     * @throws ServletException не удалось прочитать multipart сообщение
     */
    public void uploadPackage() throws IOException, NugetFormatException, ServletException {
        TempNupkgFile nupkgFile = new TempNupkgFile(uploadedFile.getInputStream());
        getStorage().pushPackage(nupkgFile);
        packages = null;
    }
View Full Code Here

Examples of ru.aristar.jnuget.files.TempNupkgFile

            return null;
        }
        URI uri = URI.create(feed.getEntries().get(0).getContent().getSrc());

        try (InputStream inputStream = get(client, uri, "", InputStream.class)) {
            TempNupkgFile nupkgFile = new TempNupkgFile(inputStream);
            return nupkgFile;
        }
    }
View Full Code Here

Examples of ru.aristar.jnuget.files.TempNupkgFile

     */
    @Test
    public void testPushAndGet() throws Exception {
        //GIVEN
        InputStream inputStream = this.getClass().getResourceAsStream("/NUnit.2.5.9.10348.nupkg");
        TempNupkgFile tempNupkgFile = new TempNupkgFile(inputStream);
        File packageFolder = new File(testFolder, tempNupkgFile.getId());
        if (packageFolder.exists()) {
            FileUtils.deleteDirectory(packageFolder);
        }
        MavenStylePackageSource mavenStylePackageSource = new MavenStylePackageSource(testFolder);
        mavenStylePackageSource.setPushStrategy(new ModifyStrategy(true));
        mavenStylePackageSource.pushPackage(tempNupkgFile);
        //WHEN
        MavenNupkg result = mavenStylePackageSource.getPackage(tempNupkgFile.getId(), tempNupkgFile.getVersion());
        //THEN
        assertEquals("Идентификатор пакета", tempNupkgFile.getId(), result.getId());
        assertEquals("Версия пакета", tempNupkgFile.getVersion(), result.getVersion());
    }
View Full Code Here

Examples of ru.aristar.jnuget.files.TempNupkgFile

                });
        createHttpServer(c1, c2, c3);
        NugetClient nugetClient = new NugetClient();
        nugetClient.setUrl("http://localhost:1234");
        //WHEN
        TempNupkgFile result = nugetClient.getPackage("NUnit", Version.parse("2.5.9.10348"));
        //THEN
        assertThat(result.getId(), is(equalTo("NUnit")));
        assertThat(result.getVersion(), is(equalTo(Version.parse("2.5.9.10348"))));
    }
View Full Code Here

Examples of ru.aristar.jnuget.files.TempNupkgFile

     * NuGet
     */
    @Test
    public void testGetPackagesWithDirectFrameWork() throws IOException, NugetFormatException {
        //GIVEN
        TempNupkgFile nupkg = new TempNupkgFile(this.getClass().getResourceAsStream("/NUnit.2.5.9.10348.nupkg"));
        @SuppressWarnings("unchecked")
        final PackageSource<Nupkg> source = context.mock(PackageSource.class);
        Expectations expectations = new Expectations();
        expectations.atLeast(0).of(source).getLastVersionPackages();
        expectations.will(returnValue(Arrays.asList(nupkg)));
View Full Code Here

Examples of ru.aristar.jnuget.files.TempNupkgFile

            logger.debug("Получен пакет ApiKey={}", new Object[]{apiKey});
            NugetContext nugetContext = new NugetContext(getCurrentStorageURI());
            nugetContext.login(apiKey);
            if (nugetContext.isUserInRole(Role.Push)) {
                ResponseBuilder response;
                try (TempNupkgFile nupkgFile = new TempNupkgFile(inputStream)) {
                    logger.debug("Помещение пакета {} версии {} в хранилище",
                            new Object[]{nupkgFile.getId(), nupkgFile.getVersion()});
                    final PackageSource<Nupkg> packageSource = getPackageSource();
                    if (packageSource == null) {
                        return Response.status(Response.Status.NOT_FOUND).build();
                    }
                    boolean pushed = packageSource.pushPackage(nupkgFile);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.