String tableName = "mytable"; final ISQLDatabaseMetaData md = sybase12SQLDatabaseMeta; assertEquals("Adaptive Server Enterprise", md.getDatabaseProductName()); dboInfoUnderTest = new DatabaseObjectInfo(testCatalog, testSchema, tableName, DatabaseObjectType.TABLE, md); String identifierQuoteString = md.getIdentifierQuoteString(); // Sybase 12.5 doesn't support quotation marks for identifiers, yet // reports " as the identifier quote string - go figure! assertEquals("\"", identifierQuoteString); String sep = md.getCatalogSeparator(); String expected = testCatalog + sep + testSchema + sep + tableName; String actual = dboInfoUnderTest.getQualifiedName(); assertEquals(expected, actual);
String tableName = "mytable"; final ISQLDatabaseMetaData md = sybase15SQLDatabaseMeta; assertEquals("Adaptive Server Enterprise", md.getDatabaseProductName()); dboInfoUnderTest = new DatabaseObjectInfo(testCatalog, testSchema, tableName, DatabaseObjectType.TABLE, md); String identifierQuoteString = md.getIdentifierQuoteString(); // Sybase 15 fully supports quotation marks for identifiers, and // reports " as the identifier quote string - yeah, they got it right! assertEquals("\"", identifierQuoteString); String sep = md.getCatalogSeparator(); // Since catalog, schema and table are all identifiers, they all need // to be quoted. String expected = identifierQuoteString + testCatalog + identifierQuoteString + sep + identifierQuoteString + testSchema + identifierQuoteString + sep + identifierQuoteString + tableName + identifierQuoteString; String actual = dboInfoUnderTest.getQualifiedName(); assertEquals(expected, actual);
Clone fragments detected by clone detection tool
File path: /sql12/test/src/net/sourceforge/squirrel_sql/fw/sql/DatabaseObjectInfoTest.java File path: /sql12/test/src/net/sourceforge/squirrel_sql/fw/sql/DatabaseObjectInfoTest.java
Method name: void testGetQualifiedNameSybase12() Method name: void testGetQualifiedNameSybase15()
Number of AST nodes: 10 Number of AST nodes: 10
1
String tableName = "mytable";
1
String tableName = "mytable";
2
       final ISQLDatabaseMetaData md = sybase12SQLDatabaseMeta;
2
       final ISQLDatabaseMetaData md = sybase15SQLDatabaseMeta;
3
       assertEquals("Adaptive Server Enterprise", md.getDatabaseProductName());
3
       assertEquals("Adaptive Server Enterprise", md.getDatabaseProductName());
4
       dboInfoUnderTest = 
4
       dboInfoUnderTest = 
5
          new DatabaseObjectInfo(testCatalog, testSchema, tableName, 
5
          new DatabaseObjectInfo(testCatalog, testSchema, tableName, 
6
                                 DatabaseObjectType.TABLE, md);
6
                                 DatabaseObjectType.TABLE, md);
7
       String identifierQuoteString = md.getIdentifierQuoteString();
7
       String identifierQuoteString = md.getIdentifierQuoteString();
8
       
8
       
9
       // Sybase 12.5 doesn't support quotation marks for identifiers, yet 
9
       // Sybase 15 fully supports quotation marks for identifiers, and 
10
       // reports " as the identifier quote string - go figure!
10
       // reports " as the identifier quote string - yeah, they got it right!
11
       assertEquals("\"", identifierQuoteString);
11
       assertEquals("\"", identifierQuoteString);
12
       
12
       
13
       String sep = md.getCatalogSeparator();
13
       String sep = md.getCatalogSeparator();
14
       
14
       
15
       String expected = testCatalog + sep + testSchema + sep + tableName
15
       // Since catalog, schema and table are all identifiers, they all need 
16
       // to be quoted.
17
       String expected = identifierQuoteString + testCatalog + identifierQuoteString + sep + 
18
                         identifierQuoteString + testSchema + identifierQuoteString + sep + 
16
;
19
                         identifierQuoteString + tableName + identifierQuoteString;
17
       String actual = dboInfoUnderTest.getQualifiedName();
20
       String actual = dboInfoUnderTest.getQualifiedName();
18
       assertEquals(expected, actual);
21
       assertEquals(expected, actual);
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones locationClones are declared in the same class
Number of node comparisons82
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements10
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    String tableName = "mytable";
    1
    String tableName = "mytable";
    2
    final ISQLDatabaseMetaData md = sybase12SQLDatabaseMeta;
    2
    final ISQLDatabaseMetaData md = sybase12SQLDatabaseMeta;
    2
    final ISQLDatabaseMetaData md = sybase15SQLDatabaseMeta;
    Differences
    Expression1Expression2Difference
    sybase12SQLDatabaseMetasybase15SQLDatabaseMetaVARIABLE_NAME_MISMATCH
    2
    final ISQLDatabaseMetaData md = sybase15SQLDatabaseMeta;
    3
    assertEquals("Adaptive Server Enterprise", md.getDatabaseProductName());
    3
    assertEquals("Adaptive Server Enterprise", md.getDatabaseProductName());
    4
    dboInfoUnderTest = new DatabaseObjectInfo(testCatalog, testSchema, tableName, DatabaseObjectType.TABLE, md);
    4
    dboInfoUnderTest = new DatabaseObjectInfo(testCatalog, testSchema, tableName, DatabaseObjectType.TABLE, md);
    5
    String identifierQuoteString = md.getIdentifierQuoteString();
    5
    String identifierQuoteString = md.getIdentifierQuoteString();
    6
    assertEquals("\"", identifierQuoteString);
    6
    assertEquals("\"", identifierQuoteString);
    7
    String sep = md.getCatalogSeparator();
    7
    String sep = md.getCatalogSeparator();
    8
    String expected = testCatalog + sep + testSchema + sep + tableName;
    8
    String expected = testCatalog + sep + testSchema + sep + tableName;
    8
    String expected = identifierQuoteString + testCatalog + identifierQuoteString + sep + identifierQuoteString + testSchema + identifierQuoteString + sep + identifierQuoteString + tableName + identifierQuoteString;
    Differences
    Expression1Expression2Difference
    testCatalogidentifierQuoteStringVARIABLE_NAME_MISMATCH
    septestCatalogVARIABLE_NAME_MISMATCH
    testCatalog + sep + testSchema+ sep+ tableNameidentifierQuoteString + testCatalog + identifierQuoteString+ sep+ identifierQuoteString+ testSchema+ identifierQuoteString+ sep+ identifierQuoteString+ tableName+ identifierQuoteStringINFIX_EXTENDED_OPERAND_NUMBER_MISMATCH
    Preondition Violations
    Expression identifierQuoteString cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression sep cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression testCatalog + sep + testSchema+ sep+ tableName cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression identifierQuoteString + testCatalog + identifierQuoteString+ sep+ identifierQuoteString+ testSchema+ identifierQuoteString+ sep+ identifierQuoteString+ tableName+ identifierQuoteString cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    String expected = identifierQuoteString + testCatalog + identifierQuoteString + sep + identifierQuoteString + testSchema + identifierQuoteString + sep + identifierQuoteString + tableName + identifierQuoteString;
    9
    String actual = dboInfoUnderTest.getQualifiedName();
    9
    String actual = dboInfoUnderTest.getQualifiedName();
    10
    assertEquals(expected, actual);
    10
    assertEquals(expected, actual);
    Precondition Violations (4)
    Row Violation
    1Expression identifierQuoteString cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression sep cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression testCatalog + sep + testSchema+ sep+ tableName cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression identifierQuoteString + testCatalog + identifierQuoteString+ sep+ identifierQuoteString+ testSchema+ identifierQuoteString+ sep+ identifierQuoteString+ tableName+ identifierQuoteString cannot be parameterized, because it has dependencies to/from statements that will be extracted