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 864
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 887
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 844
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 865
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 888
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 803
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 825
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 845
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 866
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 889
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 514
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 567
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 586
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 632
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 649
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 424
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 515
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 568
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 587
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 424
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 456
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 515
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 568
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 587
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 350
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 425
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 457
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 516
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 569
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 588
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 349
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 533
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 425
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 457
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 516
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 534
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 569
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 588
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 808
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 830
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 850
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 871
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 894
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 970
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 808
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 830
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 850
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 871
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 894
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 931
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 970
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 750
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 809
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 831
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 851
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 872
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 895
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 932
org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java 971
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 {