CloudSlang/cs-actions

View on GitHub
cs-couchbase/src/test/java/io.cloudslang.content.couchbase/execute/CouchbaseServiceTest.java

Summary

Maintainability
F
4 days
Test Coverage

File CouchbaseServiceTest.java has 359 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Copyright 2019-2024 Open Text
 * This program and the accompanying materials
 * are made available under the terms of the Apache License v2.0 which accompany this distribution.
 *

    CouchbaseServiceTest has 23 methods (exceeds 20 allowed). Consider refactoring.
    Open

    @RunWith(PowerMockRunner.class)
    @PrepareForTest({HttpClientService.class, CouchbaseService.class})
    public class CouchbaseServiceTest {
        @Rule
        public ExpectedException exception = ExpectedException.none();

      Method testCreateOrEditBucket has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          @Test
          public void testCreateOrEditBucket() throws Exception {
              httpClientInputs = getHttpClientInputs("someUser", "credentials", "", "",
                      "", "", "", "", "", "",
                      "", "", "", "", "", "", "POST");

        Similar blocks of code found in 4 locations. Consider refactoring.
        Open

            @Test
            public void testGetBucketStatistics() throws Exception {
                httpClientInputs = getHttpClientInputs("someUser", "credentials", "", "",
                        "", "", "", "", "", "",
                        "", "", "", "", "", "", "GET");
        cs-couchbase/src/test/java/io.cloudslang.content.couchbase/execute/CouchbaseServiceTest.java on lines 210..225
        cs-couchbase/src/test/java/io.cloudslang.content.couchbase/execute/CouchbaseServiceTest.java on lines 292..307
        cs-couchbase/src/test/java/io.cloudslang.content.couchbase/execute/CouchbaseServiceTest.java on lines 309..324

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 137.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 4 locations. Consider refactoring.
        Open

            @Test
            public void testGracefulFailOverNodeSuccess() throws Exception {
                httpClientInputs = getHttpClientInputs("someUser", "credentials", "", "",
                        "", "", "", "", "", "",
                        "", "", "", "", "", "", "POST");
        cs-couchbase/src/test/java/io.cloudslang.content.couchbase/execute/CouchbaseServiceTest.java on lines 210..225
        cs-couchbase/src/test/java/io.cloudslang.content.couchbase/execute/CouchbaseServiceTest.java on lines 227..242
        cs-couchbase/src/test/java/io.cloudslang.content.couchbase/execute/CouchbaseServiceTest.java on lines 292..307

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 137.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 4 locations. Consider refactoring.
        Open

            @Test
            public void testFailOverNodeSuccess() throws Exception {
                httpClientInputs = getHttpClientInputs("someUser", "credentials", "", "",
                        "", "", "", "", "", "",
                        "", "", "", "", "", "", "POST");
        cs-couchbase/src/test/java/io.cloudslang.content.couchbase/execute/CouchbaseServiceTest.java on lines 210..225
        cs-couchbase/src/test/java/io.cloudslang.content.couchbase/execute/CouchbaseServiceTest.java on lines 227..242
        cs-couchbase/src/test/java/io.cloudslang.content.couchbase/execute/CouchbaseServiceTest.java on lines 309..324

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 137.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 4 locations. Consider refactoring.
        Open

            @Test
            public void testGetBucket() throws Exception {
                httpClientInputs = getHttpClientInputs("someUser", "credentials", "", "",
                        "", "", "", "", "", "",
                        "", "", "", "", "", "", "GET");
        cs-couchbase/src/test/java/io.cloudslang.content.couchbase/execute/CouchbaseServiceTest.java on lines 227..242
        cs-couchbase/src/test/java/io.cloudslang.content.couchbase/execute/CouchbaseServiceTest.java on lines 292..307
        cs-couchbase/src/test/java/io.cloudslang.content.couchbase/execute/CouchbaseServiceTest.java on lines 309..324

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 137.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

            @Test
            public void testGetDesignDocsInfo() throws Exception {
                httpClientInputs = getHttpClientInputs("someUser", "credentials", "", "",
                        "", "", "", "", "", "",
                        "", "", "", "", "", "", "GET");
        cs-couchbase/src/test/java/io.cloudslang.content.couchbase/execute/CouchbaseServiceTest.java on lines 147..161
        cs-couchbase/src/test/java/io.cloudslang.content.couchbase/execute/CouchbaseServiceTest.java on lines 163..177

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 127.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

            @Test
            public void testDeleteBucket() throws Exception {
                httpClientInputs = getHttpClientInputs("someUser", "credentials", "", "",
                        "", "", "", "", "", "",
                        "", "", "", "", "", "", "DELETE");
        cs-couchbase/src/test/java/io.cloudslang.content.couchbase/execute/CouchbaseServiceTest.java on lines 147..161
        cs-couchbase/src/test/java/io.cloudslang.content.couchbase/execute/CouchbaseServiceTest.java on lines 276..290

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 127.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

            @Test
            public void testFlushBucket() throws Exception {
                httpClientInputs = getHttpClientInputs("someUser", "credentials", "", "",
                        "", "", "", "", "", "",
                        "", "", "", "", "", "", "POST");
        cs-couchbase/src/test/java/io.cloudslang.content.couchbase/execute/CouchbaseServiceTest.java on lines 163..177
        cs-couchbase/src/test/java/io.cloudslang.content.couchbase/execute/CouchbaseServiceTest.java on lines 276..290

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 127.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 4 locations. Consider refactoring.
        Open

            @Test
            public void testGetClusterDetails() throws Exception {
                httpClientInputs = getHttpClientInputs("someUser", "credentials", "", "",
                        "", "", "", "", "", "",
                        "", "", "", "", "", "", "GET");
        cs-couchbase/src/test/java/io.cloudslang.content.couchbase/execute/CouchbaseServiceTest.java on lines 179..193
        cs-couchbase/src/test/java/io.cloudslang.content.couchbase/execute/CouchbaseServiceTest.java on lines 260..274
        cs-couchbase/src/test/java/io.cloudslang.content.couchbase/execute/CouchbaseServiceTest.java on lines 427..440

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 121.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 4 locations. Consider refactoring.
        Open

            @Test
            public void testGetDestinationClusterReference() throws Exception {
                httpClientInputs = getHttpClientInputs("anonymous", "credentials", "", "",
                        "", "", "", "", "", "", "", "", "", "", "", "", "GET");
                CommonInputs commonInputs = getCommonInputs("GetDestinationClusterReference", "cluster", "http://somewhere.couchbase.com:8091");
        cs-couchbase/src/test/java/io.cloudslang.content.couchbase/execute/CouchbaseServiceTest.java on lines 179..193
        cs-couchbase/src/test/java/io.cloudslang.content.couchbase/execute/CouchbaseServiceTest.java on lines 244..258
        cs-couchbase/src/test/java/io.cloudslang.content.couchbase/execute/CouchbaseServiceTest.java on lines 260..274

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 121.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 4 locations. Consider refactoring.
        Open

            @Test
            public void testGetAllBuckets() throws Exception {
                httpClientInputs = getHttpClientInputs("someUser", "credentials", "", "",
                        "", "", "", "", "", "",
                        "", "", "", "", "", "", "GET");
        cs-couchbase/src/test/java/io.cloudslang.content.couchbase/execute/CouchbaseServiceTest.java on lines 244..258
        cs-couchbase/src/test/java/io.cloudslang.content.couchbase/execute/CouchbaseServiceTest.java on lines 260..274
        cs-couchbase/src/test/java/io.cloudslang.content.couchbase/execute/CouchbaseServiceTest.java on lines 427..440

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 121.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 4 locations. Consider refactoring.
        Open

            @Test
            public void testGetClusterInfo() throws Exception {
                httpClientInputs = getHttpClientInputs("someUser", "credentials", "", "",
                        "", "", "", "", "", "",
                        "", "", "", "", "", "", "GET");
        cs-couchbase/src/test/java/io.cloudslang.content.couchbase/execute/CouchbaseServiceTest.java on lines 179..193
        cs-couchbase/src/test/java/io.cloudslang.content.couchbase/execute/CouchbaseServiceTest.java on lines 244..258
        cs-couchbase/src/test/java/io.cloudslang.content.couchbase/execute/CouchbaseServiceTest.java on lines 427..440

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 121.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            @Test
            public void testFailOverNodeInvalidInternalNodeIpAddress() throws Exception {
                setExpectedExceptions(RuntimeException.class, exception, "The provided value for: " +
                        "\" anything here but not [at] symbol \" input must be a valid Couchbase internal node format.");
        
        
        cs-couchbase/src/test/java/io.cloudslang.content.couchbase/execute/CouchbaseServiceTest.java on lines 373..383

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 71.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            @Test
            public void testFailOverNodeNoIPv4Address() throws Exception {
                setExpectedExceptions(RuntimeException.class, exception, "The value of: [ blah blah blah ] input as part " +
                        "of: [ns_2@ blah blah blah ] input must be a valid IPv4 address.");
        
        
        cs-couchbase/src/test/java/io.cloudslang.content.couchbase/execute/CouchbaseServiceTest.java on lines 385..395

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 71.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                BucketInputs bucketInputs = new BucketInputs.Builder()
                        .withBucketName("toBeCreated")
                        .withAuthType("")
                        .withBucketType("")
                        .withConflictResolutionType("")
        cs-couchbase/src/test/java/io.cloudslang.content.couchbase/execute/CouchbaseServiceTest.java on lines 126..140

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 62.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                BucketInputs bucketInputs = new BucketInputs.Builder()
                        .withBucketName("toBeCreated")
                        .withAuthType("sasl")
                        .withBucketType("")
                        .withConflictResolutionType("")
        cs-couchbase/src/test/java/io.cloudslang.content.couchbase/execute/CouchbaseServiceTest.java on lines 81..95

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 62.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        There are no issues that match your filters.

        Category
        Status