Package ru.aristar.jnuget.files

Examples of ru.aristar.jnuget.files.TempNupkgFile


     */
    @Test
    public void testPush() 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().toLowerCase());
        if (packageFolder.exists()) {
            FileUtils.deleteDirectory(packageFolder);
        }
        MavenStylePackageSource mavenStylePackageSource = new MavenStylePackageSource(testFolder);
        mavenStylePackageSource.setPushStrategy(new ModifyStrategy(true));
View Full Code Here


        File localTestFolder = new File(file.getParentFile(), "LocalTestFolder/");
        if (localTestFolder.exists()) {
            FileUtils.deleteDirectory(localTestFolder);
        }
        InputStream inputStream = this.getClass().getResourceAsStream("/NUnit.2.5.9.10348.nupkg");
        try (TempNupkgFile nupkgFile = new TempNupkgFile(inputStream)) {
            IndexedPackageSource packageSource = new IndexedPackageSource();
            ClassicPackageSource filePackageSource = new ClassicPackageSource(localTestFolder);
            packageSource.setUnderlyingSource(filePackageSource, true).join();
            packageSource.setPushStrategy(new ModifyStrategy(true));
            //WHEN
View Full Code Here

    public void testGetPackageStream() throws Exception {
        //GIVEN
        NugetClient nugetClient = new NugetClient();
        nugetClient.setUrl(TEST_PACKAGESOURCE_URL);
        //WHEN
        TempNupkgFile result = nugetClient.getPackage("NUnit", Version.parse("2.5.9.10348"));
        //THEN
        assertEquals("Идентификатор пакета", "NUnit", result.getId());
        assertEquals("Версия пакета", Version.parse("2.5.9.10348"), result.getVersion());
        assertEquals("HASH пакета", Hash.parse("kDPZtMu1BOZerHZvsbPnj7DfOdEyn/j4fanlv7BWuuVOZ0+VwuuxWzUnpD7jo7pkLjFOqIs41Vkk7abFZjPRJA=="), result.getHash());
    }
View Full Code Here

        File file = File.createTempFile("index", "index");
        file.delete();
        assertFalse(file.exists());
       
        Index index = new Index();
        TempNupkgFile tempNupkgFile = new TempNupkgFile(this.getClass().getResourceAsStream("/NUnit.2.5.9.10348.nupkg"));
        RemoteNupkg remoteNupkg = new RemoteNupkg(tempNupkgFile.getNuspecFile(), tempNupkgFile.getHash(), mockId, tempNupkgFile.getUpdated(), new URI("http://site.org"));
        ProxyNupkg proxyNupkg = new ProxyNupkg(null, remoteNupkg);
        index.put(proxyNupkg);

        //WHEN
        try (FileOutputStream fileOutputStream = new FileOutputStream(file)) {
View Full Code Here

     */
    @Test
    public void testMarshallFeed() throws Exception {
        //GIVEN
        InputStream inputStream = this.getClass().getResourceAsStream("/NUnit.2.5.9.10348.nupkg");
        TempNupkgFile nupkgFile = new TempNupkgFile(inputStream);
        PackageFeed feed = new PackageFeed();
        PackageEntry entry = new PackageEntry(nupkgFile);
        feed.getEntries().add(entry);
        //WHEN
        String resultXml = feed.getXml();
View Full Code Here

    @Test
    public void testConvertNuPkgToEntry() throws Exception {
        //GIVEN
        InputStream inputStream = this.getClass().getResourceAsStream("/NUnit.2.5.9.10348.nupkg");
        final Date date = new Date();
        TempNupkgFile nupkgFile = new TempNupkgFile(inputStream, date);
        //WHEN
        NugetContext context = new NugetContext(new URI("http://localhost:8090/"));
        PackageEntry entry = context.createPackageEntry(nupkgFile);
        //THEN
        assertEquals("Идентификатор пакета",
View Full Code Here

    public void testConvertNupkgToEntryProperties() throws IOException,
            NugetFormatException, URISyntaxException, NoSuchAlgorithmException {
        //GIVEN
        InputStream inputStream = this.getClass().getResourceAsStream("/NUnit.2.5.9.10348.nupkg");
        final Date date = new Date();
        TempNupkgFile nupkgFile = new TempNupkgFile(inputStream, date);
        //WHEN
        NugetContext context = new NugetContext(new URI("http://localhost:8090/"));
        EntryProperties properties = context.createPackageEntry(nupkgFile).getProperties();
        //THEN
        assertThat("Свойства RSS вложения созданы", properties, is(notNullValue()));
        assertThat("Дата публикации пакета", properties.getPublished(), is(equalTo(date)));
        assertThat("Хеш пакета", properties.getPackageHash(), is(equalTo(nupkgFile.getHash().toString())));
        assertThat("Размер пакета", properties.getPackageSize(), is(equalTo(nupkgFile.getSize())));
    }
View Full Code Here

     */
    @Test
    public void testWalkFileTree() throws IOException, NugetFormatException {
        //GIVEN
        InputStream inputStream = this.getClass().getResourceAsStream("/NUnit.2.5.9.10348.nupkg");
        TempNupkgFile tempNupkgFile = new TempNupkgFile(inputStream);
        final NupkgFileSystem fileSystem = new NupkgFileSystem(tempNupkgFile);
        Path path = fileSystem.getRootDirectories().iterator().next();
        @SuppressWarnings("unchecked")
        final FileVisitor<Path> fileVisitor = context.mock(FileVisitor.class);
        final NupkgPath rootPath = new NupkgPath(fileSystem, "", true);
View Full Code Here

     */
    @Test
    public void testGetRootDirectories() throws IOException, NugetFormatException {
        //GIVEN
        InputStream inputStream = this.getClass().getResourceAsStream("/NUnit.2.5.9.10348.nupkg");
        TempNupkgFile tempNupkgFile = new TempNupkgFile(inputStream);
        NupkgFileSystem fileSystem = new NupkgFileSystem(tempNupkgFile);
        final Path rootPath = new NupkgPath(fileSystem, "", true);
        //WHEN
        List<Path> result = Lists.newArrayList(fileSystem.getRootDirectories());
        //THEN
View Full Code Here

     */
    @Test
    public void testGetChild() throws IOException, NugetFormatException {
        //GIVEN
        InputStream inputStream = this.getClass().getResourceAsStream("/NUnit.2.5.9.10348.nupkg");
        TempNupkgFile tempNupkgFile = new TempNupkgFile(inputStream);
        NupkgFileSystem fileSystem = new NupkgFileSystem(tempNupkgFile);
        NupkgPath path = new NupkgPath(fileSystem, "package", true);
        //WHEN
        Set<Path> result = fileSystem.getChildren(path);
        //THEN
View Full Code Here

TOP

Related Classes of ru.aristar.jnuget.files.TempNupkgFile

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.