Пример #1
0
 @Test
 public void testDefaultAdapter() {
   String veryLongVarName =
       defaultAdapter.nameTopVariable(veryLongSignatureVarName, defaultSuffix, emptyVarSet);
   assertEquals(
       veryLongVarName, defaultAdapter.sqlQuote(veryLongSignatureVarName + defaultSuffix));
 }
Пример #2
0
 @Test(expected = RuntimeException.class)
 public void testOracleTooMuchSimilarVars() {
   Set<String> assignedVars = new HashSet<>();
   int createdVarNb = (int) (Math.pow(10, OracleSQLDialectAdapter.VARIABLE_NUMBER_LENGTH) + 1);
   for (int i = 0; i < createdVarNb; i++) {
     assignedVars.add(
         oracleAdapter.nameTopVariable(veryLongSignatureVarName, defaultSuffix, assignedVars));
   }
 }
Пример #3
0
 @Test
 public void testOracleOneShot() {
   String veryLongVarName =
       oracleAdapter.nameTopVariable(veryLongSignatureVarName, defaultSuffix, emptyVarSet);
   assertTrue(veryLongVarName.length() <= OracleSQLDialectAdapter.VARIABLE_NAME_MAX_LENGTH);
   assertTrue(veryLongVarName.contains(defaultSuffix));
   assertTrue(veryLongVarName.contains("veryVery"));
   assertEquals(veryLongVarName, "\"veryVeryVeryVeryVeryV0Suffix\"");
 }
Пример #4
0
 @Test
 public void testOracleTenSimilarVars() {
   Set<String> assignedVars = new HashSet<>();
   int createdVarNb = (int) Math.pow(10, OracleSQLDialectAdapter.VARIABLE_NUMBER_LENGTH);
   for (int i = 0; i < createdVarNb; i++) {
     assignedVars.add(
         oracleAdapter.nameTopVariable(veryLongSignatureVarName, defaultSuffix, assignedVars));
   }
   assertEquals(assignedVars.size(), createdVarNb);
 }
Пример #5
0
 @Test(expected = IllegalArgumentException.class)
 public void testOracleExcessiveSuffix2() {
   oracleAdapter.nameTopVariable("short", excessiveSuffix + "More", emptyVarSet);
 }
Пример #6
0
 @Test
 public void testOracleMaxNonModifiedVarName() {
   String limitVarName =
       oracleAdapter.nameTopVariable(limitSignatureVarName, defaultSuffix, emptyVarSet);
   assertEquals(limitVarName, oracleAdapter.sqlQuote(limitSignatureVarName + defaultSuffix));
 }