Package ru.aristar.jnuget.client

Examples of ru.aristar.jnuget.client.NugetClient


     */
    @Test
    public void testGetLastVersionPackageWhenPackageNotExists() throws IOException, URISyntaxException {
        //GIVEN
        RemotePackageSource packageSource = new RemotePackageSource();
        final NugetClient nugetClient = context.mock(NugetClient.class);
        Expectations expectations = new Expectations();
        expectations.atLeast(0).of(nugetClient).getPackageCount(expectations.with(false));
        expectations.will(returnValue(0));
        expectations.atLeast(0).of(nugetClient).getUrl();
        expectations.will(returnValue(""));
View Full Code Here


    @Ignore("Реализовать тест")
    public void testGetLastVersionPackageWhenExistOnePackage()
            throws IOException, URISyntaxException, NugetFormatException {
        //GIVEN
        RemotePackageSource packageSource = new RemotePackageSource();
        final NugetClient nugetClient = context.mock(NugetClient.class);
        final PackageFeed packageFeed = createPackageFeed("FirstFeed", createPackageEntry("id", "1.2.3"));
        final PackageFeed emptyFeed = createPackageFeed("SecondFeed");
        Expectations expectations = new Expectations();
        expectations.atLeast(0).of(nugetClient).getUrl();
        expectations.will(returnValue(""));
View Full Code Here

            NugetFormatException,
            IOException,
            URISyntaxException {
        //GIVEN
        RemotePackageSource packageSource = new RemotePackageSource();
        final NugetClient nugetClient = context.mock(NugetClient.class);
        final PackageFeed packageFeed = createPackageFeed("FirstFeed", createPackageEntry("id", "1.2.3"), createPackageEntry("id", "1.2.0"));
        final PackageFeed emptyFeed = createPackageFeed("SecondFeed");
        Expectations expectations = new Expectations();
        expectations.atLeast(0).of(nugetClient).getUrl();
        expectations.will(returnValue(""));
View Full Code Here

     * @throws Exception ошибка в процессе теста
     */
    @Test
    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

     * @throws Exception ошибка в процессе теста
     */
    @Test
    public void testGetAllPackages() throws Exception {
        //GIVEN
        NugetClient nugetClient = new NugetClient();
        nugetClient.setUrl(TEST_PACKAGESOURCE_URL);
        //WHEN
        PackageFeed result = nugetClient.getPackages(null, null, null, null, null);
        //THEN
        assertEquals("Количество пакетов", 1, result.getEntries().size());
        PackageEntry entry = result.getEntries().get(0);
        assertThat("Версия пакета", entry.getProperties().getVersion(), is(equalTo(Version.parse("2.5.9.10348"))));
        assertThat("HASH пакета", entry.getProperties().getPackageHash(), is(equalTo("kDPZtMu1BOZerHZvsbPnj7DfOdEyn/j4fanlv7BWuuVOZ0+VwuuxWzUnpD7jo7pkLjFOqIs41Vkk7abFZjPRJA==")));
View Full Code Here

     * @throws URISyntaxException некорректный URI ресурса
     */
    @Test
    public void testGetPackageCount() throws IOException, URISyntaxException {
        //GIVEN
        NugetClient nugetClient = new NugetClient();
        nugetClient.setUrl(TEST_PACKAGESOURCE_URL);
        //WHEN
        int result = nugetClient.getPackageCount(false);
        //THEN
        assertThat(result, is(equalTo(1)));
    }
View Full Code Here

     * @throws URISyntaxException некорректный URI ресурса
     */
    @Test
    public void testGetLastVersionPackageCount() throws IOException, URISyntaxException {
        //GIVEN
        NugetClient nugetClient = new NugetClient();
        nugetClient.setUrl(TEST_PACKAGESOURCE_URL);
        //WHEN
        int result = nugetClient.getPackageCount(true);
        //THEN
        assertThat(result, is(equalTo(1)));
    }
View Full Code Here

    @Test
    public void testCompute() throws IOException, URISyntaxException, NugetFormatException {
        //GIVEN
        List<RemoteNupkg> arrayList = new ArrayList<>();
        arrayList = Collections.synchronizedList(arrayList);
        NugetClient client = context.mock(NugetClient.class);
        ClientFactory clientFactory = context.mock(ClientFactory.class);
        Expectations expectations = new Expectations();
        expectations.atLeast(0).of(clientFactory).createClient();
        expectations.will(returnValue(client));
        expectations.atLeast(0).of(client).close();
View Full Code Here

     */
    @Test
    public void testLoadPackages() throws NugetFormatException, IOException, URISyntaxException {
        //GIVEN
        List<RemoteNupkg> nupkgs = new ArrayList<>();
        NugetClient client = context.mock(NugetClient.class);
        ClientFactory clientFactory = context.mock(ClientFactory.class);
        GetRemotePackageFeedAction action = new GetRemotePackageFeedAction(5, nupkgs, 0, 200, clientFactory);
        Expectations expectations = new Expectations();
        addExpectation(expectations, client, 5, 0, createPackageFeed("feed-1", createPackageEntry("package-1", "1.2.3"), createPackageEntry("package-2", "1.2.3")));
        addExpectation(expectations, client, 2, 2, createPackageFeed("feed-2", createPackageEntry("package-3", "1.2.3"), createPackageEntry("package-4", "1.2.3")));
View Full Code Here

     * @throws IOException ошибка чтения данных
     */
    private InputStream getStream(URI uri) throws IOException {
        getLogger().debug("Загрузка пакета из {}", new Object[]{uri});
        try {         
            NugetClient nugetClient = new NugetClient();
            return nugetClient.get(uri, InputStream.class);
        } catch (UniformInterfaceException | ClientHandlerException | URISyntaxException e) {
            throw new IOException("Ошибка получения потока пакета из удаленного ресурса", e);
        }
    }
View Full Code Here

TOP

Related Classes of ru.aristar.jnuget.client.NugetClient

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.