CPD Results

The following document contains the results of PMD's CPD 7.0.0.

Duplications

File Line
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 833
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 856
session.setConfigProperty(ConfigurationProperties.HTTP_EXPECT_CONTINUE, false);
        httpServer.setAuthentication("testuser", "testpass");
        httpServer.setExpectSupport(HttpServer.ExpectContinue.FAIL); // if transport tries Expect/Continue explode
        auth = new AuthenticationBuilder()
                .addUsername("testuser")
                .addPassword("testpass")
                .build();
        newTransporter(httpServer.getHttpUrl());
        RecordingTransportListener listener = new RecordingTransportListener();
        PutTask task =
                new PutTask(URI.create("repo/file.txt")).setListener(listener).setDataString("upload");
        transporter.put(task);
        assertEquals(0L, listener.getDataOffset());
        assertEquals(6L, listener.getDataLength());
        assertEquals(1, listener.getStartedCount()); // w/ expectContinue enabled would have here 2
        assertTrue(listener.getProgressedCount() > 0, "Count: " + listener.getProgressedCount());
        assertEquals("upload", TestFileUtils.readString(new File(repoDir, "file.txt")));
    }

    @Test
    protected void testPut_Authenticated_ExpectContinueRejected_ExplicitlyConfiguredHeader() throws Exception {
File Line
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 813
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 834
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 857
httpServer.setAuthentication("testuser", "testpass");
        httpServer.setExpectSupport(HttpServer.ExpectContinue.FAIL);
        auth = new AuthenticationBuilder()
                .addUsername("testuser")
                .addPassword("testpass")
                .build();
        newTransporter(httpServer.getHttpUrl());
        RecordingTransportListener listener = new RecordingTransportListener();
        PutTask task =
                new PutTask(URI.create("repo/file.txt")).setListener(listener).setDataString("upload");
        transporter.put(task);
        assertEquals(0L, listener.getDataOffset());
        assertEquals(6L, listener.getDataLength());
        assertEquals(1, listener.getStartedCount());
        assertTrue(listener.getProgressedCount() > 0, "Count: " + listener.getProgressedCount());
        assertEquals("upload", TestFileUtils.readString(new File(repoDir, "file.txt")));
    }

    @Test
    protected void testPut_Authenticated_ExpectContinueDisabled() throws Exception {
File Line
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 772
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 794
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 814
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 835
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 858
httpServer.setAuthentication("testuser", "testpass");
        auth = new AuthenticationBuilder()
                .addUsername("testuser")
                .addPassword("testpass")
                .build();
        newTransporter(httpServer.getHttpUrl());
        RecordingTransportListener listener = new RecordingTransportListener();
        PutTask task =
                new PutTask(URI.create("repo/file.txt")).setListener(listener).setDataString("upload");
        transporter.put(task);
        assertEquals(0L, listener.getDataOffset());
        assertEquals(6L, listener.getDataLength());
        assertEquals(1, listener.getStartedCount());
        assertTrue(listener.getProgressedCount() > 0, "Count: " + listener.getProgressedCount());
        assertEquals("upload", TestFileUtils.readString(new File(repoDir, "file.txt")));
    }

    @Test
    protected void testPut_Authenticated_ExpectContinueBroken() throws Exception {
File Line
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 483
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 536
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 555
httpServer.addSslConnector();
        newTransporter(httpServer.getHttpsUrl());
        RecordingTransportListener listener = new RecordingTransportListener();
        GetTask task = new GetTask(URI.create("repo/file.txt")).setListener(listener);
        transporter.get(task);
        assertEquals("test", task.getDataString());
        assertEquals(0L, listener.getDataOffset());
        assertEquals(4L, listener.getDataLength());
        assertEquals(1, listener.getStartedCount());
        assertTrue(listener.getProgressedCount() > 0, "Count: " + listener.getProgressedCount());
        assertEquals(task.getDataString(), listener.getBaos().toString(StandardCharsets.UTF_8));
    }

    @Test
    protected void testGet_SSL_WithServerErrors() throws Exception {
File Line
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 601
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 618
file.setLastModified(System.currentTimeMillis() - 5 * 60 * 1000);
        RecordingTransportListener listener = new RecordingTransportListener();
        GetTask task = new GetTask(URI.create("repo/resume.txt"))
                .setDataPath(file.toPath(), true)
                .setListener(listener);
        transporter.get(task);
        assertEquals("resumable", TestFileUtils.readString(file));
        assertEquals(1L, listener.getStartedCount());
        assertEquals(0L, listener.getDataOffset());
        assertEquals(9, listener.getDataLength());
        assertTrue(listener.getProgressedCount() > 0, "Count: " + listener.getProgressedCount());
        assertEquals("resumable", listener.getBaos().toString(StandardCharsets.UTF_8));
    }

    @Test
    protected void testGet_ResumeRangesNotSupportedByServer() throws Exception {
File Line
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 423
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 484
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 537
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 556
newTransporter(httpServer.getHttpUrl());
        RecordingTransportListener listener = new RecordingTransportListener();
        GetTask task = new GetTask(URI.create("repo/file.txt")).setListener(listener);
        transporter.get(task);
        assertEquals("test", task.getDataString());
        assertEquals(0L, listener.getDataOffset());
        assertEquals(4L, listener.getDataLength());
        assertEquals(1, listener.getStartedCount());
        assertTrue(listener.getProgressedCount() > 0, "Count: " + listener.getProgressedCount());
        assertEquals(task.getDataString(), listener.getBaos().toString(StandardCharsets.UTF_8));
    }

    @Test
    protected void testGet_Unauthenticated() throws Exception {
File Line
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 423
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 455
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 484
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 537
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 556
newTransporter(httpServer.getHttpUrl());
        RecordingTransportListener listener = new RecordingTransportListener();
        GetTask task = new GetTask(URI.create("repo/file.txt")).setListener(listener);
        transporter.get(task);
        assertEquals("test", task.getDataString());
        assertEquals(0L, listener.getDataOffset());
        assertEquals(4L, listener.getDataLength());
        assertEquals(1, listener.getStartedCount());
        assertTrue(listener.getProgressedCount() > 0, "Count: " + listener.getProgressedCount());
        assertEquals(task.getDataString(), listener.getBaos().toString(StandardCharsets.UTF_8));
    }

    @Test
    protected void testGet_Unauthenticated() throws Exception {
File Line
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 349
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 424
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 456
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 485
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 538
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 557
RecordingTransportListener listener = new RecordingTransportListener();
        GetTask task = new GetTask(URI.create("repo/file.txt")).setListener(listener);
        transporter.get(task);
        assertEquals("test", task.getDataString());
        assertEquals(0L, listener.getDataOffset());
        assertEquals(4L, listener.getDataLength());
        assertEquals(1, listener.getStartedCount());
        assertTrue(listener.getProgressedCount() > 0, "Count: " + listener.getProgressedCount());
        assertEquals(task.getDataString(), listener.getBaos().toString(StandardCharsets.UTF_8));
    }

    @Test
    protected void testGet_ToFile() throws Exception {
File Line
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 348
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 502
protected void testGet_ToMemory() throws Exception {
        RecordingTransportListener listener = new RecordingTransportListener();
        GetTask task = new GetTask(URI.create("repo/file.txt")).setListener(listener);
        transporter.get(task);
        assertEquals("test", task.getDataString());
        assertEquals(0L, listener.getDataOffset());
        assertEquals(4L, listener.getDataLength());
        assertEquals(1, listener.getStartedCount());
        assertTrue(listener.getProgressedCount() > 0, "Count: " + listener.getProgressedCount());
        assertEquals(task.getDataString(), listener.getBaos().toString(StandardCharsets.UTF_8));
    }
File Line
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 424
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 456
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 485
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 503
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 538
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 557
RecordingTransportListener listener = new RecordingTransportListener();
        GetTask task = new GetTask(URI.create("repo/file.txt")).setListener(listener);
        transporter.get(task);
        assertEquals("test", task.getDataString());
        assertEquals(0L, listener.getDataOffset());
        assertEquals(4L, listener.getDataLength());
        assertEquals(1, listener.getStartedCount());
        assertTrue(listener.getProgressedCount() > 0, "Count: " + listener.getProgressedCount());
        assertEquals(task.getDataString(), listener.getBaos().toString(StandardCharsets.UTF_8));
    }
File Line
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 777
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 799
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 819
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 840
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 863
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 939
newTransporter(httpServer.getHttpUrl());
        RecordingTransportListener listener = new RecordingTransportListener();
        PutTask task =
                new PutTask(URI.create("repo/file.txt")).setListener(listener).setDataString("upload");
        transporter.put(task);
        assertEquals(0L, listener.getDataOffset());
        assertEquals(6L, listener.getDataLength());
        assertEquals(1, listener.getStartedCount());
        assertTrue(listener.getProgressedCount() > 0, "Count: " + listener.getProgressedCount());
        assertEquals("upload", TestFileUtils.readString(new File(repoDir, "file.txt")));
    }

    @Test
    protected void testPut_Authenticated_ExpectContinueBroken() throws Exception {
File Line
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 777
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 799
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 819
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 840
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 863
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 900
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 939
newTransporter(httpServer.getHttpUrl());
        RecordingTransportListener listener = new RecordingTransportListener();
        PutTask task =
                new PutTask(URI.create("repo/file.txt")).setListener(listener).setDataString("upload");
        transporter.put(task);
        assertEquals(0L, listener.getDataOffset());
        assertEquals(6L, listener.getDataLength());
        assertEquals(1, listener.getStartedCount());
        assertTrue(listener.getProgressedCount() > 0, "Count: " + listener.getProgressedCount());
        assertEquals("upload", TestFileUtils.readString(new File(repoDir, "file.txt")));
    }

    @Test
    protected void testPut_Authenticated_ExpectContinueBroken() throws Exception {
File Line
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 719
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 778
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 800
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 820
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 841
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 864
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 901
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 940
RecordingTransportListener listener = new RecordingTransportListener();
        PutTask task =
                new PutTask(URI.create("repo/file.txt")).setListener(listener).setDataString("upload");
        transporter.put(task);
        assertEquals(0L, listener.getDataOffset());
        assertEquals(6L, listener.getDataLength());
        assertEquals(1, listener.getStartedCount());
        assertTrue(listener.getProgressedCount() > 0, "Count: " + listener.getProgressedCount());
        assertEquals("upload", TestFileUtils.readString(new File(repoDir, "file.txt")));
    }

    @Test
    protected void testPut_FromFile() throws Exception {