Modified: db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/transform/model/PropertyAccessTest.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/transform/model/PropertyAccessTest.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/transform/model/PropertyAccessTest.java (original) +++ db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/transform/model/PropertyAccessTest.java Mon Aug 27 09:48:33 2018 @@ -84,7 +84,7 @@ public class PropertyAccessTest public void testSetPropertyNotExistentField() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "fieldDoesNotExist"); + = new PropertyAccess(testClass, "fieldDoesNotExist"); try { propertyAccess.setProperty(2); @@ -99,7 +99,7 @@ public class PropertyAccessTest + "_fieldDoesNotExist of class " + "org.apache.torque.generator.source.transform.model" + ".PropertyAccessTest$TestClass", - e.getMessage()); + e.getMessage()); } } @@ -107,7 +107,7 @@ public class PropertyAccessTest public void testSetPropertyPrivateField() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "privateIntField"); + = new PropertyAccess(testClass, "privateIntField"); try { propertyAccess.setProperty(2); @@ -122,7 +122,7 @@ public class PropertyAccessTest + "_privateIntField of class " + "org.apache.torque.generator.source.transform.model" + ".PropertyAccessTest$TestClass", - e.getMessage()); + e.getMessage()); } } @@ -130,7 +130,7 @@ public class PropertyAccessTest public void testSetPropertyProtectedField() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "protectedIntField"); + = new PropertyAccess(testClass, "protectedIntField"); try { propertyAccess.setProperty(2); @@ -145,7 +145,7 @@ public class PropertyAccessTest + "_protectedIntField of class " + "org.apache.torque.generator.source.transform.model" + ".PropertyAccessTest$TestClass", - e.getMessage()); + e.getMessage()); } } @@ -153,7 +153,7 @@ public class PropertyAccessTest public void testSetPropertyField() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "intField"); + = new PropertyAccess(testClass, "intField"); try { propertyAccess.setProperty(2); @@ -168,7 +168,7 @@ public class PropertyAccessTest + "_intField of class " + "org.apache.torque.generator.source.transform.model" + ".PropertyAccessTest$TestClass", - e.getMessage()); + e.getMessage()); } } @@ -176,7 +176,7 @@ public class PropertyAccessTest public void testSetPropertyPublicField() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicIntField"); + = new PropertyAccess(testClass, "publicIntField"); propertyAccess.setProperty(2); assertEquals(2, testClass.publicIntField); } @@ -191,7 +191,7 @@ public class PropertyAccessTest public void testSetPropertyPublicFieldEndingWithS() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicFieldEndingWith"); + = new PropertyAccess(testClass, "publicFieldEndingWith"); propertyAccess.setProperty(2); assertEquals(2, testClass.publicFieldEndingWiths); } @@ -217,7 +217,7 @@ public class PropertyAccessTest public void testAccessPublicFieldFromBaseClass() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicIntFieldFromBaseClass"); + = new PropertyAccess(testClass, "publicIntFieldFromBaseClass"); propertyAccess.setProperty(2); assertEquals(2, testClass.publicIntFieldFromBaseClass); } @@ -226,7 +226,7 @@ public class PropertyAccessTest public void testSetPropertyPublicFieldWrongClass() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicIntField"); + = new PropertyAccess(testClass, "publicIntField"); try { propertyAccess.setProperty("abc"); @@ -239,7 +239,7 @@ public class PropertyAccessTest + ".PropertyAccessTest$TestClass cannot be set to abc " + "because the argument has the wrong type " + "java.lang.String", - e.getMessage()); + e.getMessage()); } } @@ -247,7 +247,7 @@ public class PropertyAccessTest public void testSetPropertyIntFieldNull() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicIntField"); + = new PropertyAccess(testClass, "publicIntField"); try { propertyAccess.setProperty(null); @@ -259,7 +259,7 @@ public class PropertyAccessTest + "org.apache.torque.generator.source.transform.model" + ".PropertyAccessTest$TestClass because the value is null" + " which is not allowed", - e.getMessage()); + e.getMessage()); } } @@ -267,7 +267,7 @@ public class PropertyAccessTest public void testSetPropertyPublicStringField() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicStringField"); + = new PropertyAccess(testClass, "publicStringField"); propertyAccess.setProperty("abc"); assertEquals("abc", testClass.publicStringField); } @@ -276,7 +276,7 @@ public class PropertyAccessTest public void testSetPropertyPublicStringFieldNull() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicStringField"); + = new PropertyAccess(testClass, "publicStringField"); testClass.publicStringField = "abc"; propertyAccess.setProperty(null); assertEquals(null, testClass.publicStringField); @@ -286,7 +286,7 @@ public class PropertyAccessTest public void testSetPropertyPublicStringArrayField() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicStringArrayField"); + = new PropertyAccess(testClass, "publicStringArrayField"); propertyAccess.setProperty("abc"); assertArrayEquals(new Object[] {"abc"}, testClass.publicStringArrayField); } @@ -296,7 +296,7 @@ public class PropertyAccessTest throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicStringArrayField"); + = new PropertyAccess(testClass, "publicStringArrayField"); testClass.publicStringArrayField = new String[] {"def", "XYZ"}; propertyAccess.setProperty("abc"); assertArrayEquals( @@ -308,7 +308,7 @@ public class PropertyAccessTest public void testSetPropertyPublicStringArrayFieldNull() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicStringArrayField"); + = new PropertyAccess(testClass, "publicStringArrayField"); testClass.publicStringArrayField = new String[] {"abc"}; propertyAccess.setProperty(null); assertArrayEquals( @@ -320,7 +320,7 @@ public class PropertyAccessTest public void testSetPropertyPublicStringArrayFieldArray() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicStringArrayField"); + = new PropertyAccess(testClass, "publicStringArrayField"); testClass.publicStringArrayField = new String[] {"XYZ", "def"}; propertyAccess.setProperty(new String[] {"abc"}); assertArrayEquals(new String[] {"abc"}, testClass.publicStringArrayField); @@ -331,9 +331,9 @@ public class PropertyAccessTest public void testSetPropertyPublicStringCollectionField() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicStringCollectionField"); + = new PropertyAccess(testClass, "publicStringCollectionField"); propertyAccess.setProperty("abc"); - final List<String> expected = new ArrayList<String>(); + final List<String> expected = new ArrayList<>(); expected.add("abc"); assertEquals(expected, testClass.publicStringCollectionField); } @@ -343,13 +343,13 @@ public class PropertyAccessTest throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicStringCollectionField"); - final List<String> initial = new ArrayList<String>(); + = new PropertyAccess(testClass, "publicStringCollectionField"); + final List<String> initial = new ArrayList<>(); initial.add("def"); initial.add("XYZ"); testClass.publicStringCollectionField = initial; propertyAccess.setProperty("abc"); - final List<String> expected = new ArrayList<String>(); + final List<String> expected = new ArrayList<>(); expected.add("def"); expected.add("XYZ"); expected.add("abc"); @@ -360,10 +360,10 @@ public class PropertyAccessTest public void testSetPropertyPublicStringCollectionFieldNull() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicStringCollectionField"); + = new PropertyAccess(testClass, "publicStringCollectionField"); testClass.publicStringField = "abc"; propertyAccess.setProperty(null); - final List<String> expected = new ArrayList<String>(); + final List<String> expected = new ArrayList<>(); expected.add(null); assertEquals(expected, testClass.publicStringCollectionField); } @@ -379,15 +379,15 @@ public class PropertyAccessTest throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicStringCollectionField"); - final List<String> initial = new ArrayList<String>(); + = new PropertyAccess(testClass, "publicStringCollectionField"); + final List<String> initial = new ArrayList<>(); initial.add("def"); initial.add("XYZ"); testClass.publicStringCollectionField = initial; - final List<String> setValue = new ArrayList<String>(); + final List<String> setValue = new ArrayList<>(); setValue.add("abc"); propertyAccess.setProperty(setValue); - final List<String> expected = new ArrayList<String>(); + final List<String> expected = new ArrayList<>(); expected.add("abc"); assertEquals(expected, testClass.publicStringCollectionField); } @@ -396,9 +396,9 @@ public class PropertyAccessTest public void testSetPropertyPublicStringListField() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicStringListField"); + = new PropertyAccess(testClass, "publicStringListField"); propertyAccess.setProperty("abc"); - final List<String> expected = new ArrayList<String>(); + final List<String> expected = new ArrayList<>(); expected.add("abc"); assertEquals(expected, testClass.publicStringListField); } @@ -407,9 +407,9 @@ public class PropertyAccessTest public void testSetPropertyPublicStringSetField() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicStringSetField"); + = new PropertyAccess(testClass, "publicStringSetField"); propertyAccess.setProperty("abc"); - final Set<String> expected = new HashSet<String>(); + final Set<String> expected = new HashSet<>(); expected.add("abc"); assertEquals(expected, testClass.publicStringSetField); } @@ -418,9 +418,9 @@ public class PropertyAccessTest public void testSetPropertyPublicStringQueueField() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicStringQueueField"); + = new PropertyAccess(testClass, "publicStringQueueField"); propertyAccess.setProperty("abc"); - final LinkedList<String> expected = new LinkedList<String>(); + final LinkedList<String> expected = new LinkedList<>(); expected.add("abc"); assertEquals(expected, testClass.publicStringQueueField); } @@ -429,9 +429,9 @@ public class PropertyAccessTest public void testSetPropertyPublicStringVectorField() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicStringVectorField"); + = new PropertyAccess(testClass, "publicStringVectorField"); propertyAccess.setProperty("abc"); - final Vector<String> expected = new Vector<String>(); + final Vector<String> expected = new Vector<>(); expected.add("abc"); assertEquals(expected, testClass.publicStringVectorField); } @@ -441,7 +441,7 @@ public class PropertyAccessTest throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicBooleanField"); + = new PropertyAccess(testClass, "publicBooleanField"); propertyAccess.setProperty("true"); assertEquals(Boolean.TRUE, testClass.publicBooleanField); } @@ -450,7 +450,7 @@ public class PropertyAccessTest public void testSetPropertyOnlyGetter() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "onlyGetter"); + = new PropertyAccess(testClass, "onlyGetter"); try { propertyAccess.setProperty(2); @@ -460,7 +460,7 @@ public class PropertyAccessTest { assertEquals("The property onlyGetter of class " + testClass.getClass().getName() + " is not writeable", - e.getMessage()); + e.getMessage()); } } @@ -468,7 +468,7 @@ public class PropertyAccessTest public void testSetPropertyPrivateSetter() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "privateIntSetter"); + = new PropertyAccess(testClass, "privateIntSetter"); try { propertyAccess.setProperty(2); @@ -482,7 +482,7 @@ public class PropertyAccessTest + "and no public field exists for property " + "_privateIntSetter of class " + testClass.getClass().getName(), - e.getMessage()); + e.getMessage()); } } @@ -490,7 +490,7 @@ public class PropertyAccessTest public void testSetPropertyProtectedSetter() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "protectedIntSetter"); + = new PropertyAccess(testClass, "protectedIntSetter"); try { propertyAccess.setProperty(2); @@ -504,7 +504,7 @@ public class PropertyAccessTest + "and no public field exists for property " + "_protectedIntSetter of class " + testClass.getClass().getName(), - e.getMessage()); + e.getMessage()); } } @@ -512,7 +512,7 @@ public class PropertyAccessTest public void testSetPropertySetter() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "intSetter"); + = new PropertyAccess(testClass, "intSetter"); try { propertyAccess.setProperty(2); @@ -526,7 +526,7 @@ public class PropertyAccessTest + "and no public field exists for property " + "_intSetter of class " + testClass.getClass().getName(), - e.getMessage()); + e.getMessage()); } } @@ -534,7 +534,7 @@ public class PropertyAccessTest public void testSetPropertyPublicSetter() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicIntSetter"); + = new PropertyAccess(testClass, "publicIntSetter"); propertyAccess.setProperty(2); assertEquals(2, testClass.publicIntField); } @@ -543,7 +543,7 @@ public class PropertyAccessTest public void testSetPropertyPublicSetterEndingWithS() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicSetterEndingWith"); + = new PropertyAccess(testClass, "publicSetterEndingWith"); propertyAccess.setProperty(2); assertEquals(2, testClass.publicFieldEndingWiths); } @@ -552,7 +552,7 @@ public class PropertyAccessTest public void testSetPropertyPublicSetterFromBaseClass() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicIntSetterFromBaseClass"); + = new PropertyAccess(testClass, "publicIntSetterFromBaseClass"); propertyAccess.setProperty(2); assertEquals(2, testClass.publicIntFieldFromBaseClass); } @@ -561,7 +561,7 @@ public class PropertyAccessTest public void testSetPropertyPublicSetterWrongClass() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicIntSetter"); + = new PropertyAccess(testClass, "publicIntSetter"); try { propertyAccess.setProperty("abc"); @@ -574,7 +574,7 @@ public class PropertyAccessTest + " cannot be set to abc " + "because the argument has the wrong type " + "java.lang.String", - e.getMessage()); + e.getMessage()); } } @@ -582,7 +582,7 @@ public class PropertyAccessTest public void testSetPropertyIntSetterNull() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicIntSetter"); + = new PropertyAccess(testClass, "publicIntSetter"); try { propertyAccess.setProperty(null); @@ -594,7 +594,7 @@ public class PropertyAccessTest + testClass.getClass().getName() + " because the value is null" + " which is not allowed", - e.getMessage()); + e.getMessage()); } } @@ -602,7 +602,7 @@ public class PropertyAccessTest public void testSetPropertyPublicStringSetter() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicStringSetter"); + = new PropertyAccess(testClass, "publicStringSetter"); propertyAccess.setProperty("abc"); assertEquals("abc", testClass.publicStringField); } @@ -611,7 +611,7 @@ public class PropertyAccessTest public void testSetPropertyPublicStringSetterNull() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicStringSetter"); + = new PropertyAccess(testClass, "publicStringSetter"); testClass.publicStringField = "abc"; propertyAccess.setProperty(null); assertArrayEquals(null, testClass.publicStringArrayField); @@ -621,7 +621,7 @@ public class PropertyAccessTest public void testSetPropertyPublicStringArraySetter() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicStringArraySetter"); + = new PropertyAccess(testClass, "publicStringArraySetter"); propertyAccess.setProperty("abc"); assertArrayEquals(new Object[] {"abc"}, testClass.publicStringArrayField); } @@ -631,7 +631,7 @@ public class PropertyAccessTest throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicStringArraySetter"); + = new PropertyAccess(testClass, "publicStringArraySetter"); testClass.publicStringArrayField = new String[] {"def", "XYZ"}; propertyAccess.setProperty("abc"); assertArrayEquals( @@ -643,7 +643,7 @@ public class PropertyAccessTest public void testSetPropertyPublicStringArraySetterNull() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicStringArraySetter"); + = new PropertyAccess(testClass, "publicStringArraySetter"); testClass.publicStringArrayField = new String[] {"abc"}; propertyAccess.setProperty(null); assertArrayEquals(new Object[] {"abc", null}, testClass.publicStringArrayField); @@ -653,7 +653,7 @@ public class PropertyAccessTest public void testSetPropertyPublicStringArraySetterArray() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicStringArraySetter"); + = new PropertyAccess(testClass, "publicStringArraySetter"); propertyAccess.setProperty(new String[] {"abc"}); assertArrayEquals(new String[] {"abc"}, testClass.publicStringArrayField); } @@ -663,20 +663,20 @@ public class PropertyAccessTest throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicStringArraySetterWithoutGetter"); + = new PropertyAccess(testClass, "publicStringArraySetterWithoutGetter"); try { propertyAccess.setProperty("abc"); fail("Exception expected"); } - catch (final PropertyNotReadableException e) - { - assertEquals("The property publicStringArraySetterWithoutGetter " - + "of class " - + testClass.getClass().getName() - + " is not readable", - e.getMessage()); - } + catch (final PropertyNotReadableException e) + { + assertEquals("The property publicStringArraySetterWithoutGetter " + + "of class " + + testClass.getClass().getName() + + " is not readable", + e.getMessage()); + } } @Test @@ -684,29 +684,29 @@ public class PropertyAccessTest throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicStringArrayGetterWithoutSetter"); + = new PropertyAccess(testClass, "publicStringArrayGetterWithoutSetter"); try { propertyAccess.setProperty("abc"); fail("Exception expected"); } - catch (final PropertyNotWriteableException e) - { - assertEquals("The property publicStringArrayGetterWithoutSetter " - + "of class " - + testClass.getClass().getName() - + " is not writeable", - e.getMessage()); - } + catch (final PropertyNotWriteableException e) + { + assertEquals("The property publicStringArrayGetterWithoutSetter " + + "of class " + + testClass.getClass().getName() + + " is not writeable", + e.getMessage()); + } } @Test public void testSetPropertyPublicStringCollectionSetter() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicStringCollectionSetter"); + = new PropertyAccess(testClass, "publicStringCollectionSetter"); propertyAccess.setProperty("abc"); - final List<String> expected = new ArrayList<String>(); + final List<String> expected = new ArrayList<>(); expected.add("abc"); assertEquals(expected, testClass.publicStringCollectionField); } @@ -716,13 +716,13 @@ public class PropertyAccessTest throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicStringCollectionSetter"); - final List<String> initial = new ArrayList<String>(); + = new PropertyAccess(testClass, "publicStringCollectionSetter"); + final List<String> initial = new ArrayList<>(); initial.add("def"); initial.add("XYZ"); testClass.publicStringCollectionField = initial; propertyAccess.setProperty("abc"); - final List<String> expected = new ArrayList<String>(); + final List<String> expected = new ArrayList<>(); expected.add("def"); expected.add("XYZ"); expected.add("abc"); @@ -734,10 +734,10 @@ public class PropertyAccessTest throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicStringCollectionSetter"); + = new PropertyAccess(testClass, "publicStringCollectionSetter"); testClass.publicStringField = "abc"; propertyAccess.setProperty(null); - final List<String> expected = new ArrayList<String>(); + final List<String> expected = new ArrayList<>(); expected.add(null); assertEquals(expected, testClass.publicStringCollectionField); } @@ -753,15 +753,15 @@ public class PropertyAccessTest throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicStringCollectionSetter"); - final List<String> initial = new ArrayList<String>(); + = new PropertyAccess(testClass, "publicStringCollectionSetter"); + final List<String> initial = new ArrayList<>(); initial.add("def"); initial.add("XYZ"); testClass.publicStringCollectionField = initial; - final List<String> setValue = new ArrayList<String>(); + final List<String> setValue = new ArrayList<>(); setValue.add("abc"); propertyAccess.setProperty(setValue); - final List<String> expected = new ArrayList<String>(); + final List<String> expected = new ArrayList<>(); expected.add("abc"); assertEquals(expected, testClass.publicStringCollectionField); } @@ -770,9 +770,9 @@ public class PropertyAccessTest public void testSetPropertyPublicStringListSetter() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicStringListSetter"); + = new PropertyAccess(testClass, "publicStringListSetter"); propertyAccess.setProperty("abc"); - final List<String> expected = new ArrayList<String>(); + final List<String> expected = new ArrayList<>(); expected.add("abc"); assertEquals(expected, testClass.publicStringListField); } @@ -781,9 +781,9 @@ public class PropertyAccessTest public void testSetPropertyPublicStringSetSetter() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicStringSetSetter"); + = new PropertyAccess(testClass, "publicStringSetSetter"); propertyAccess.setProperty("abc"); - final Set<String> expected = new HashSet<String>(); + final Set<String> expected = new HashSet<>(); expected.add("abc"); assertEquals(expected, testClass.publicStringSetField); } @@ -792,9 +792,9 @@ public class PropertyAccessTest public void testSetPropertyPublicStringQueueSetter() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicStringQueueSetter"); + = new PropertyAccess(testClass, "publicStringQueueSetter"); propertyAccess.setProperty("abc"); - final LinkedList<String> expected = new LinkedList<String>(); + final LinkedList<String> expected = new LinkedList<>(); expected.add("abc"); assertEquals(expected, testClass.publicStringQueueField); } @@ -803,9 +803,9 @@ public class PropertyAccessTest public void testSetPropertyPublicStringVectorSetter() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicStringVectorSetter"); + = new PropertyAccess(testClass, "publicStringVectorSetter"); propertyAccess.setProperty("abc"); - final Vector<String> expected = new Vector<String>(); + final Vector<String> expected = new Vector<>(); expected.add("abc"); assertEquals(expected, testClass.publicStringVectorField); } @@ -821,7 +821,7 @@ public class PropertyAccessTest throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicStringCollectionGetterWithoutSetter"); + = new PropertyAccess(testClass, "publicStringCollectionGetterWithoutSetter"); try { propertyAccess.setProperty("abc"); @@ -832,7 +832,7 @@ public class PropertyAccessTest assertEquals("The property " + "publicStringCollectionGetterWithoutSetter of class " + testClass.getClass().getName() + " is not writeable", - e.getMessage()); + e.getMessage()); } } @@ -847,13 +847,13 @@ public class PropertyAccessTest throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicStringCollectionGetterWithoutSetter"); - final List<String> initial = new ArrayList<String>(); + = new PropertyAccess(testClass, "publicStringCollectionGetterWithoutSetter"); + final List<String> initial = new ArrayList<>(); initial.add("def"); initial.add("XYZ"); testClass.publicStringCollectionField = initial; propertyAccess.setProperty("abc"); - final List<String> expected = new ArrayList<String>(); + final List<String> expected = new ArrayList<>(); expected.add("def"); expected.add("XYZ"); expected.add("abc"); @@ -865,7 +865,7 @@ public class PropertyAccessTest throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicBooleanSetter"); + = new PropertyAccess(testClass, "publicBooleanSetter"); propertyAccess.setProperty("true"); assertEquals(Boolean.TRUE, testClass.publicBooleanField); } @@ -876,7 +876,7 @@ public class PropertyAccessTest public void testGetPropertyTypeNotExistentField() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "fieldDoesNotExist"); + = new PropertyAccess(testClass, "fieldDoesNotExist"); assertEquals(null, propertyAccess.getPropertyType()); } @@ -884,7 +884,7 @@ public class PropertyAccessTest public void testGetPropertyTypePrivateField() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "privateIntField"); + = new PropertyAccess(testClass, "privateIntField"); assertEquals(null, propertyAccess.getPropertyType()); } @@ -892,7 +892,7 @@ public class PropertyAccessTest public void testGetPropertyTypePublicIntField() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicIntField"); + = new PropertyAccess(testClass, "publicIntField"); assertEquals(int.class, propertyAccess.getPropertyType()); } @@ -900,7 +900,7 @@ public class PropertyAccessTest public void testGetPropertyTypePublicStringField() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicStringField"); + = new PropertyAccess(testClass, "publicStringField"); assertEquals(String.class, propertyAccess.getPropertyType()); } @@ -908,7 +908,7 @@ public class PropertyAccessTest public void testGetPropertyTypePublicIntSetter() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicIntSetter"); + = new PropertyAccess(testClass, "publicIntSetter"); assertEquals(int.class, propertyAccess.getPropertyType()); } @@ -916,7 +916,7 @@ public class PropertyAccessTest public void testGetPropertyTypePublicStringSetter() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicStringSetter"); + = new PropertyAccess(testClass, "publicStringSetter"); assertEquals(String.class, propertyAccess.getPropertyType()); } @@ -926,7 +926,7 @@ public class PropertyAccessTest public void testGetFirstGenericTypeArgumentNotExistentField() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "fieldDoesNotExist"); + = new PropertyAccess(testClass, "fieldDoesNotExist"); assertEquals(null, propertyAccess.getFirstGenericTypeArgument()); } @@ -934,7 +934,7 @@ public class PropertyAccessTest public void testGetFirstGenericTypeArgumentPrivateField() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "privateIntField"); + = new PropertyAccess(testClass, "privateIntField"); assertEquals(null, propertyAccess.getFirstGenericTypeArgument()); } @@ -942,7 +942,7 @@ public class PropertyAccessTest public void testGetFirstGenericTypeArgumentPublicIntField() throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicIntField"); + = new PropertyAccess(testClass, "publicIntField"); assertEquals(null, propertyAccess.getFirstGenericTypeArgument()); } @@ -951,7 +951,7 @@ public class PropertyAccessTest throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicStringCollectionField"); + = new PropertyAccess(testClass, "publicStringCollectionField"); assertEquals(String.class, propertyAccess.getFirstGenericTypeArgument()); } @@ -960,7 +960,7 @@ public class PropertyAccessTest throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess(testClass, "publicStringCollectionSetter"); + = new PropertyAccess(testClass, "publicStringCollectionSetter"); assertEquals(String.class, propertyAccess.getFirstGenericTypeArgument()); } @@ -969,9 +969,9 @@ public class PropertyAccessTest throws Exception { final PropertyAccess propertyAccess - = new PropertyAccess( - testClass, - "publicStringCollectionGetterWithoutSetter"); + = new PropertyAccess( + testClass, + "publicStringCollectionGetterWithoutSetter"); assertEquals(String.class, propertyAccess.getFirstGenericTypeArgument()); }
Modified: db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/template/groovy/GroovyTest.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/template/groovy/GroovyTest.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/template/groovy/GroovyTest.java (original) +++ db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/template/groovy/GroovyTest.java Mon Aug 27 09:48:33 2018 @@ -43,13 +43,13 @@ import org.junit.Test; public class GroovyTest { private static final File TARGET_DIR - = new File("target/test/groovy"); + = new File("target/test/groovy"); private static final File SCRIPT_OUTPUT_FILE - = new File(TARGET_DIR, "scriptOutput.txt"); + = new File(TARGET_DIR, "scriptOutput.txt"); private static final File TEMPLATE_OUTPUT_FILE - = new File(TARGET_DIR, "templateOutput.txt"); + = new File(TARGET_DIR, "templateOutput.txt"); @Before public void setUp() throws Exception @@ -66,7 +66,7 @@ public class GroovyTest public void testGroovy() throws Exception { final Controller controller = new Controller(); - final List<UnitDescriptor> unitDescriptors = new ArrayList<UnitDescriptor>(); + final List<UnitDescriptor> unitDescriptors = new ArrayList<>(); final CustomProjectPaths projectPaths = new CustomProjectPaths( new Maven2DirectoryProjectPaths( new File("src/test/groovyTemplates"))); Modified: db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/variable/VariableStoreTest.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/variable/VariableStoreTest.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/variable/VariableStoreTest.java (original) +++ db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/variable/VariableStoreTest.java Mon Aug 27 09:48:33 2018 @@ -37,7 +37,7 @@ public class VariableStoreTest extends B VariableStore store = new VariableStore(); store.startOutlet(); QualifiedName qualifiedName - = new QualifiedName("org.apache.torque.name"); + = new QualifiedName("org.apache.torque.name"); // fill store store.set(new Variable( @@ -123,7 +123,7 @@ public class VariableStoreTest extends B "org.apache.FILE", Variable.Scope.FILE)); QualifiedName qualifiedName - = new QualifiedName("org.apache.torque.name"); + = new QualifiedName("org.apache.torque.name"); assertEquals( "org.apache.torque.GENERATOR", store.getInHierarchy(qualifiedName).getValue()); @@ -151,17 +151,17 @@ public class VariableStoreTest extends B "org.apache.torque", Variable.Scope.OUTLET)); QualifiedName qualifiedName - = new QualifiedName("org.apache.torque.name"); + = new QualifiedName("org.apache.torque.name"); assertEquals( "org.apache.torque", store.getInHierarchy(qualifiedName).getValue()); qualifiedName - = new QualifiedName("org.apache.torque.generator.name"); + = new QualifiedName("org.apache.torque.generator.name"); assertEquals( "org.apache.torque", store.getInHierarchy(qualifiedName).getValue()); qualifiedName - = new QualifiedName("org.apache.name"); + = new QualifiedName("org.apache.name"); assertNull(store.getInHierarchy(qualifiedName)); } @@ -198,40 +198,40 @@ public class VariableStoreTest extends B { Variable variable - = storeContent.get( - new QualifiedName("org.apache.torque.generator")); + = storeContent.get( + new QualifiedName("org.apache.torque.generator")); assertEquals( "org.apache.torque.generator", variable.getValue()); } { Variable variable - = storeContent.get( - new QualifiedName("org.apache.torque.children1")); + = storeContent.get( + new QualifiedName("org.apache.torque.children1")); assertEquals( "org.apache.torque.children1", variable.getValue()); } { Variable variable - = storeContent.get( - new QualifiedName("org.apache.torque.children2")); + = storeContent.get( + new QualifiedName("org.apache.torque.children2")); assertEquals( "org.apache.torque.children2", variable.getValue()); } { Variable variable - = storeContent.get( - new QualifiedName("org.apache.torque.file")); + = storeContent.get( + new QualifiedName("org.apache.torque.file")); assertEquals( "org.apache.torque.file", variable.getValue()); } { Variable variable - = storeContent.get( - new QualifiedName("org.apache.torque.global")); + = storeContent.get( + new QualifiedName("org.apache.torque.global")); assertEquals( "org.apache.torque.global", variable.getValue()); @@ -243,7 +243,7 @@ public class VariableStoreTest extends B VariableStore store = new VariableStore(); store.startOutlet(); QualifiedName qualifiedName - = new QualifiedName("org.apache.torque.name"); + = new QualifiedName("org.apache.torque.name"); // fill store store.set(new Variable( Modified: db/torque/torque4/trunk/torque-maven-plugin/src/main/java/org/apache/torque/generator/maven/TorqueGeneratorMojo.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-maven-plugin/src/main/java/org/apache/torque/generator/maven/TorqueGeneratorMojo.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-maven-plugin/src/main/java/org/apache/torque/generator/maven/TorqueGeneratorMojo.java (original) +++ db/torque/torque4/trunk/torque-maven-plugin/src/main/java/org/apache/torque/generator/maven/TorqueGeneratorMojo.java Mon Aug 27 09:48:33 2018 @@ -115,7 +115,7 @@ public class TorqueGeneratorMojo extends } public static OutputDirUsage get(final String key) - throws MojoExecutionException + throws MojoExecutionException { for (OutputDirUsage candidate : values()) { @@ -125,9 +125,9 @@ public class TorqueGeneratorMojo extends } } StringBuilder errorMessage = new StringBuilder() - .append("targetDirUsage contains illegal value: ") - .append(key) - .append(". Possible values are :"); + .append("targetDirUsage contains illegal value: ") + .append(key) + .append(". Possible values are :"); for (OutputDirUsage targetDirUsage : values()) { errorMessage.append(" ").append(targetDirUsage.getKey()); @@ -245,7 +245,7 @@ public class TorqueGeneratorMojo extends * * @parameter */ - private Map<String, String> outputDirMap = new HashMap<String, String>(); + private Map<String, String> outputDirMap = new HashMap<>(); /** * The work directory for e.g. merge sources. @@ -328,7 +328,7 @@ public class TorqueGeneratorMojo extends * * @parameter */ - private Map<String, String> outputDirUsageMap = new HashMap<String, String>(); + private Map<String, String> outputDirUsageMap = new HashMap<>(); /** * The config directory of the project overriding the settings. @@ -416,16 +416,17 @@ public class TorqueGeneratorMojo extends /** * Configures and runs the Torque generator. */ + @Override public void execute() throws MojoExecutionException { Controller controller = new Controller(); - List<UnitDescriptor> unitDescriptors = new ArrayList<UnitDescriptor>(); + List<UnitDescriptor> unitDescriptors = new ArrayList<>(); // Do conversion here so illegal values are discovered before generation OutputDirUsage defaultOutputDirUsageConverted - = OutputDirUsage.get(defaultOutputDirUsage); + = OutputDirUsage.get(defaultOutputDirUsage); Map<String, OutputDirUsage> outputDirUsageConvertedMap - = new HashMap<String, OutputDirUsage>(); + = new HashMap<>(); for (Map.Entry<String, String> outputDirUsageEntry : outputDirUsageMap.entrySet()) { @@ -451,7 +452,7 @@ public class TorqueGeneratorMojo extends { throw new IllegalArgumentException( "Unknown packaging " + this.packaging - + ", must be jar, directory or classpath"); + + ", must be jar, directory or classpath"); } getLog().debug("Packaging is " + packaging); @@ -459,32 +460,32 @@ public class TorqueGeneratorMojo extends if (UnitDescriptor.Packaging.JAR == packaging) { defaultProjectPaths - = new Maven2JarProjectPaths(projectRootDir, jarFile); + = new Maven2JarProjectPaths(projectRootDir, jarFile); } else if (UnitDescriptor.Packaging.DIRECTORY == packaging) { defaultProjectPaths - = new Maven2DirectoryProjectPaths(projectRootDir); + = new Maven2DirectoryProjectPaths(projectRootDir); } else if (UnitDescriptor.Packaging.CLASSPATH == packaging) { defaultProjectPaths - = new Maven2DirectoryProjectPaths(projectRootDir); + = new Maven2DirectoryProjectPaths(projectRootDir); } else { - throw new IllegalStateException("Unknown packaging" + packaging); + throw new IllegalStateException("Unknown packaging" + packaging); } CustomProjectPaths projectPaths - = new CustomProjectPaths(defaultProjectPaths); + = new CustomProjectPaths(defaultProjectPaths); if (UnitDescriptor.Packaging.CLASSPATH == packaging) { if (configPackage == null) { throw new MojoExecutionException( - "configPackage must be set for packaging =\"classpath\""); + "configPackage must be set for packaging =\"classpath\""); } projectPaths.setConfigurationPackage(configPackage); projectPaths.setConfigurationDir(null); @@ -508,10 +509,10 @@ public class TorqueGeneratorMojo extends if (sourceIncludes != null || sourceExcludes != null) { Fileset sourceFileset - = new Fileset( - projectPaths.getDefaultSourcePath(), - sourceIncludes, - sourceExcludes); + = new Fileset( + projectPaths.getDefaultSourcePath(), + sourceIncludes, + sourceExcludes); getLog().debug("Setting source includes to " + sourceIncludes); getLog().debug("Setting source excludes to " @@ -541,8 +542,8 @@ public class TorqueGeneratorMojo extends outputDirMap.put( Maven2ProjectPaths.MODIFIABLE_OUTPUT_DIR_KEY, project.getBasedir() - + "/" - + Maven2ProjectPaths.MODIFIABLE_OUTPUT_DIR); + + "/" + + Maven2ProjectPaths.MODIFIABLE_OUTPUT_DIR); } for (Map.Entry<String, String> outputDirMapEntry : outputDirMap.entrySet()) @@ -569,7 +570,7 @@ public class TorqueGeneratorMojo extends { if (options == null) { - options = new HashMap<String, String>(); + options = new HashMap<>(); } if (optionsFile != null) { @@ -625,7 +626,7 @@ public class TorqueGeneratorMojo extends if (overrideConfigDir != null) { CustomProjectPaths childProjectPaths - = new CustomProjectPaths(projectPaths); + = new CustomProjectPaths(projectPaths); childProjectPaths.setConfigurationDir(overrideConfigDir); UnitDescriptor parentUnitDescriptor = new UnitDescriptor( @@ -645,7 +646,7 @@ public class TorqueGeneratorMojo extends else if (overrideConfigPackage != null) { CustomProjectPaths childProjectPaths - = new CustomProjectPaths(projectPaths); + = new CustomProjectPaths(projectPaths); childProjectPaths.setConfigurationPackage(overrideConfigPackage); UnitDescriptor parentUnitDescriptor = new UnitDescriptor( @@ -717,16 +718,16 @@ public class TorqueGeneratorMojo extends else { getLog().info("defaultOutputDirPath " - + defaultOutputDirPath.getAbsolutePath() - + " does not exist, not applying defaultOutputDirUsage"); + + defaultOutputDirPath.getAbsolutePath() + + " does not exist, not applying defaultOutputDirUsage"); } if (outputDirUsageConvertedMap.get( Maven2ProjectPaths.MODIFIABLE_OUTPUT_DIR_KEY) - == null - && outputDirMap.get( - Maven2ProjectPaths.MODIFIABLE_OUTPUT_DIR_KEY) - != null) + == null + && outputDirMap.get( + Maven2ProjectPaths.MODIFIABLE_OUTPUT_DIR_KEY) + != null) { outputDirUsageConvertedMap.put( Maven2ProjectPaths.MODIFIABLE_OUTPUT_DIR_KEY, Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/ColumnImpl.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/ColumnImpl.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/ColumnImpl.java (original) +++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/ColumnImpl.java Mon Aug 27 09:48:33 2018 @@ -38,7 +38,7 @@ public class ColumnImpl implements Colum /** Delimiters for SQL functions. */ private static final String[] FUNCTION_DELIMITERS - = {" ", ",", "(", ")", "<", ">"}; + = {" ", ",", "(", ")", "<", ">"}; /** Constant for the dot. */ private static final String DOT = "."; @@ -168,9 +168,9 @@ public class ColumnImpl implements Colum != -1) { throw new IllegalArgumentException("sqlExpression " - + sqlExpression - + " is unparseable, it does not contain a dot (.) " - + " but function delimiters."); + + sqlExpression + + " is unparseable, it does not contain a dot (.) " + + " but function delimiters."); } setColumnName(sqlExpression); return; @@ -208,13 +208,13 @@ public class ColumnImpl implements Colum setColumnName(sqlExpression.substring(dotIndex + 1, endIndex)); // if startIndex == -1 the formula is correct String fullTableName - = sqlExpression.substring(startIndex + 1, dotIndex); + = sqlExpression.substring(startIndex + 1, dotIndex); setTableName(fullTableName); if (fullTableName.contains(DOT)) { int fullTableNameDotIndex = fullTableName.lastIndexOf(DOT); String extractedSchemaName - = fullTableName.substring(0, fullTableNameDotIndex); + = fullTableName.substring(0, fullTableNameDotIndex); setSchemaName(extractedSchemaName); StringBuilder sqlExpressionBuilder = new StringBuilder(); if (startIndex != -1) @@ -223,8 +223,8 @@ public class ColumnImpl implements Colum sqlExpression.substring(0, startIndex + 1)); } sqlExpressionBuilder.append(getTableName()) - .append(DOT) - .append(post); + .append(DOT) + .append(post); setSqlExpression(sqlExpressionBuilder.toString()); } } @@ -234,6 +234,7 @@ public class ColumnImpl implements Colum * * @return the column name, may be null. */ + @Override public String getColumnName() { return columnName; @@ -265,6 +266,7 @@ public class ColumnImpl implements Colum * * @return the table name, may be null. */ + @Override public String getTableName() { return tableName; @@ -273,6 +275,7 @@ public class ColumnImpl implements Colum /** * {@inheritDoc} */ + @Override public String getFullTableName() { if (schemaName != null) @@ -314,6 +317,7 @@ public class ColumnImpl implements Colum * * @return the schema name, or null if the schema is not known. */ + @Override public String getSchemaName() { return schemaName; @@ -342,6 +346,7 @@ public class ColumnImpl implements Colum /** * {@inheritDoc} */ + @Override public String getSqlExpression() { return sqlExpression; @@ -374,11 +379,11 @@ public class ColumnImpl implements Colum public int hashCode() { return new HashCodeBuilder() - .append(sqlExpression) - .append(columnName) - .append(tableName) - .append(schemaName) - .toHashCode(); + .append(sqlExpression) + .append(columnName) + .append(tableName) + .append(schemaName) + .toHashCode(); } @Override @@ -398,11 +403,11 @@ public class ColumnImpl implements Colum } ColumnImpl other = (ColumnImpl) obj; return new EqualsBuilder() - .append(sqlExpression, other.sqlExpression) - .append(columnName, other.columnName) - .append(tableName, other.tableName) - .append(schemaName, other.schemaName) - .isEquals(); + .append(sqlExpression, other.sqlExpression) + .append(columnName, other.columnName) + .append(tableName, other.tableName) + .append(schemaName, other.schemaName) + .isEquals(); } @Override Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/Database.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/Database.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/Database.java (original) +++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/Database.java Mon Aug 27 09:48:33 2018 @@ -70,7 +70,7 @@ public class Database /** The IdGenerators, keyed by type of idMethod. */ private final Map<IDMethod, IdGenerator> idGenerators - = new HashMap<IDMethod, IdGenerator>(); + = new HashMap<>(); /** * Creates a new Database with the given name. Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/Torque.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/Torque.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/Torque.java (original) +++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/Torque.java Mon Aug 27 09:48:33 2018 @@ -66,7 +66,7 @@ public final class Torque /** default schema name for the configuration */ public static final String DEFAULT_SCHEMA_KEY - = DEFAULTS_KEY + "." + SCHEMA_KEY; + = DEFAULTS_KEY + "." + SCHEMA_KEY; /** A prefix for <code>Manager</code> properties in the configuration. */ public static final String MANAGER_PREFIX = "managed_class."; @@ -133,7 +133,7 @@ public final class Torque * rethrown wrapped into a TorqueException. */ public static void init(final String configFile) - throws TorqueException + throws TorqueException { getInstance().init(configFile); } @@ -147,7 +147,7 @@ public final class Torque * rethrown wrapped into a TorqueException. */ public static void init(final Configuration conf) - throws TorqueException + throws TorqueException { getInstance().init(conf); } @@ -324,7 +324,7 @@ public final class Torque * rethrown wrapped into a TorqueException. */ public static Connection getConnection() - throws TorqueException + throws TorqueException { return getInstance().getConnection(); } @@ -340,7 +340,7 @@ public final class Torque * rethrown wrapped into a TorqueException. */ public static Connection getConnection(final String name) - throws TorqueException + throws TorqueException { return getInstance().getConnection(name); } @@ -361,7 +361,7 @@ public final class Torque */ public static Connection getConnection(final String name, final String username, final String password) - throws TorqueException + throws TorqueException { return getInstance().getConnection(name, username, password); } @@ -425,7 +425,7 @@ public final class Torque * @throws TorqueException if Torque is not yet initialized. */ public static String getSchema(final String name) - throws TorqueException + throws TorqueException { return getInstance().getSchema(name); } Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/TorqueInstance.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/TorqueInstance.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/TorqueInstance.java (original) +++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/TorqueInstance.java Mon Aug 27 09:48:33 2018 @@ -83,18 +83,18 @@ public class TorqueInstance * in a defined state must be synchronized to this map. */ private final ConcurrentMap<String, Database> databases - = new ConcurrentHashMap<String, Database>(); + = new ConcurrentHashMap<>(); /** A repository of Manager instances. */ private final ConcurrentMap<String, AbstractBaseManager<?>> managers - = new ConcurrentHashMap<String, AbstractBaseManager<?>>(); + = new ConcurrentHashMap<>(); /** A repository of Peer instances. */ private final ConcurrentMap<Class<?>, BasePeerImpl<?>> peers - = new ConcurrentHashMap<Class<?>, BasePeerImpl<?>>(); + = new ConcurrentHashMap<>(); /** A repository of idBroker instances. */ - private final Set<IDBroker> idBrokers = new HashSet<IDBroker>(); + private final Set<IDBroker> idBrokers = new HashSet<>(); /** Torque-specific configuration. */ private Configuration conf; @@ -179,9 +179,9 @@ public class TorqueInstance { Database defaultDatabase = databases.get(defaultDBName); Database databaseInfoForKeyDefault - = getOrCreateDatabase(DEFAULT_NAME); + = getOrCreateDatabase(DEFAULT_NAME); if ((!defaultDBName.equals(DEFAULT_NAME)) - && databaseInfoForKeyDefault.getDataSourceFactory() == null) + && databaseInfoForKeyDefault.getDataSourceFactory() == null) { log.debug("Adding the DatasourceFactory and DatabaseAdapter " + "from database " @@ -226,9 +226,9 @@ public class TorqueInstance if (log.isTraceEnabled()) { log.trace("Configuration key " + Torque.TORQUE_KEY + "." - + Torque.TRANSACTION_MANAGER_KEY - + " not set, using default transaction manager " - + TransactionManagerImpl.class.getName()); + + Torque.TRANSACTION_MANAGER_KEY + + " not set, using default transaction manager " + + TransactionManagerImpl.class.getName()); } transactionManager = new TransactionManagerImpl(); } @@ -237,7 +237,7 @@ public class TorqueInstance try { Class<?> transactionManagerClass - = Class.forName(transactionManagerClassName); + = Class.forName(transactionManagerClassName); transactionManager = (TransactionManager) transactionManagerClass.newInstance(); if (log.isTraceEnabled()) @@ -347,8 +347,8 @@ public class TorqueInstance catch (SQLException e) { log.error( - "Could not get product information from JDBC", - e); + "Could not get product information from JDBC", + e); } } else @@ -389,9 +389,9 @@ public class TorqueInstance // check that at least the default database has got an adapter. Database defaultDatabase - = databases.get(getDefaultDB()); + = databases.get(getDefaultDB()); if (defaultDatabase == null - || defaultDatabase.getAdapter() == null) + || defaultDatabase.getAdapter() == null) { String error = "Invalid configuration : " + "No adapter definition found for default DB " @@ -475,9 +475,9 @@ public class TorqueInstance } Database defaultDatabase - = databases.get(defaultDBName); + = databases.get(defaultDBName); if (defaultDatabase == null - || defaultDatabase.getDataSourceFactory() == null) + || defaultDatabase.getDataSourceFactory() == null) { String error = "Invalid configuration : " + "No DataSourceFactory definition for default DB found. " @@ -582,7 +582,7 @@ public class TorqueInstance try { Configuration configuration - = new PropertiesConfiguration(configFile); + = new PropertiesConfiguration(configFile); log.debug("Config Object is " + configuration); init(configuration); @@ -687,7 +687,7 @@ public class TorqueInstance { try { - AbstractBaseManager<?> newManager = (AbstractBaseManager<?>) + AbstractBaseManager<?> newManager = (AbstractBaseManager<?>) Class.forName(className).newInstance(); managers.putIfAbsent(name, newManager); } @@ -848,7 +848,7 @@ public class TorqueInstance * exceptions are logged but ignored. */ public synchronized void shutdown() - throws TorqueException + throws TorqueException { // do not remove idbrokers because they will not be // re-registered on a new startup. @@ -877,7 +877,7 @@ public class TorqueInstance try { DataSourceFactory dataSourceFactory - = database.getDataSourceFactory(); + = database.getDataSourceFactory(); if (dataSourceFactory != null) { dataSourceFactory.close(); @@ -948,7 +948,7 @@ public class TorqueInstance { if (name == null) { - checkInit(); + checkInit(); name = getDefaultDB(); } Database database = getOrCreateDatabase(name); @@ -1003,9 +1003,9 @@ public class TorqueInstance public Connection getConnection(final String name) throws TorqueException { - checkInit(); + checkInit(); - try + try { return getDatabase(name) .getDataSourceFactory() @@ -1032,7 +1032,7 @@ public class TorqueInstance public DataSourceFactory getDataSourceFactory(final String name) throws TorqueException { - checkInit(); + checkInit(); Database database = getDatabase(name); @@ -1046,7 +1046,7 @@ public class TorqueInstance { throw new TorqueException( "There was no DataSourceFactory " - + "configured for the connection " + name); + + "configured for the connection " + name); } return dsf; @@ -1068,9 +1068,9 @@ public class TorqueInstance */ public Connection getConnection(final String name, final String username, final String password) - throws TorqueException + throws TorqueException { - checkInit(); + checkInit(); try { @@ -1095,7 +1095,7 @@ public class TorqueInstance */ public Adapter getAdapter(final String name) throws TorqueException { - checkInit(); + checkInit(); Database database = getDatabase(name); if (database == null) @@ -1163,9 +1163,9 @@ public class TorqueInstance public String getSchema(final String name) throws TorqueException { - checkInit(); + checkInit(); - Database database = getDatabase(name); + Database database = getDatabase(name); if (database == null) { return null; @@ -1186,9 +1186,9 @@ public class TorqueInstance */ public Database getDatabase(String databaseName) throws TorqueException { - checkInit(); + checkInit(); - if (databaseName == null) + if (databaseName == null) { databaseName = getDefaultDB(); } @@ -1210,7 +1210,7 @@ public class TorqueInstance */ public Map<String, Database> getDatabases() throws TorqueException { - checkInit(); + checkInit(); return Collections.unmodifiableMap(databases); } @@ -1241,7 +1241,7 @@ public class TorqueInstance result = databases.putIfAbsent(databaseName, newDatabase); if (result == null) { - result = newDatabase; + result = newDatabase; } } Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/TorqueRuntimeException.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/TorqueRuntimeException.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/TorqueRuntimeException.java (original) +++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/TorqueRuntimeException.java Mon Aug 27 09:48:33 2018 @@ -26,7 +26,7 @@ package org.apache.torque; * @version $Id$ */ public class TorqueRuntimeException - extends RuntimeException +extends RuntimeException { /** * Serial version. Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/adapter/AbstractAdapter.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/adapter/AbstractAdapter.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/adapter/AbstractAdapter.java (original) +++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/adapter/AbstractAdapter.java Mon Aug 27 09:48:33 2018 @@ -69,6 +69,7 @@ public abstract class AbstractAdapter im * @return The wrapped input string, so that the database evaluates the * returned expression to the upper case of the input. */ + @Override public abstract String toUpperCase(String in); /** @@ -78,6 +79,7 @@ public abstract class AbstractAdapter im * * @return The text delimiter. */ + @Override public char getStringDelimiter() { return '\''; @@ -90,6 +92,7 @@ public abstract class AbstractAdapter im * * @return IDMethod constant */ + @Override public abstract IDMethod getIDMethodType(); /** @@ -100,6 +103,7 @@ public abstract class AbstractAdapter im * @param obj Information used for key generation. * @return The most recently inserted database key. */ + @Override public abstract String getIDMethodSQL(Object obj); /** @@ -109,6 +113,7 @@ public abstract class AbstractAdapter im * @return the SQL clause to acquire a write lock. * This implementation returns "FOR UPDATE"; */ + @Override public String getUpdateLockClause() { return "FOR UPDATE"; @@ -122,6 +127,7 @@ public abstract class AbstractAdapter im * * @throws SQLException No Statement could be created or executed. */ + @Override public abstract void lockTable(Connection con, String table) throws SQLException; @@ -133,6 +139,7 @@ public abstract class AbstractAdapter im * * @throws SQLException No Statement could be created or executed. */ + @Override public abstract void unlockTable(Connection con, String table) throws SQLException; @@ -148,6 +155,7 @@ public abstract class AbstractAdapter im * returned expression to a case-insensitive representation * of the input. */ + @Override public abstract String ignoreCase(String in); /** @@ -160,6 +168,7 @@ public abstract class AbstractAdapter im * * @return The string in a case that can be ignored. */ + @Override public String ignoreCaseInOrderBy(final String in) { return ignoreCase(in); @@ -172,6 +181,7 @@ public abstract class AbstractAdapter im * @return true if the database natively supports limiting the * size of the resultset. */ + @Override public boolean supportsNativeLimit() { return false; @@ -184,6 +194,7 @@ public abstract class AbstractAdapter im * @return true if the database natively supports returning * results starting at an offset position other than 0. */ + @Override public boolean supportsNativeOffset() { return false; @@ -199,8 +210,9 @@ public abstract class AbstractAdapter im * * @throws TorqueException if any error occurs when building the query */ + @Override public void generateLimits(final Query query, final long offset, final int limit) - throws TorqueException + throws TorqueException { if (supportsNativeLimit()) { @@ -209,13 +221,14 @@ public abstract class AbstractAdapter im } /** - * This method is for the SqlExpression.quoteAndEscape rules. The rule is, - * any string in a SqlExpression with a BACKSLASH will either be changed to - * "\\" or left as "\". - * - * @return true if the database needs to escape text in SqlExpressions. - */ + * This method is for the SqlExpression.quoteAndEscape rules. The rule is, + * any string in a SqlExpression with a BACKSLASH will either be changed to + * "\\" or left as "\". + * + * @return true if the database needs to escape text in SqlExpressions. + */ + @Override public boolean escapeText() { return true; @@ -230,6 +243,7 @@ public abstract class AbstractAdapter im * @return true if ilike should be used for case insensitive likes, * false if ignoreCase should be applied to the compared strings. */ + @Override public boolean useIlike() { return false; @@ -245,6 +259,7 @@ public abstract class AbstractAdapter im * * @return whether the escape clause should be appended or not. */ + @Override public boolean useEscapeClauseForLike() { return false; @@ -260,6 +275,7 @@ public abstract class AbstractAdapter im * * @return whether to use the MINUS operator instead of the EXCEPT operator. */ + @Override public boolean useMinusForExcept() { return false; Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/adapter/Adapter.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/adapter/Adapter.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/adapter/Adapter.java (original) +++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/adapter/Adapter.java Mon Aug 27 09:48:33 2018 @@ -192,16 +192,16 @@ public interface Adapter extends Seriali * @throws TorqueException if any error occurs when building the query */ void generateLimits(Query query, long offset, int limit) - throws TorqueException; + throws TorqueException; /** * Determines whether backslashes (\) should be escaped in explicit SQL * strings. If true is returned, a BACKSLASH will be changed to "\\". * If false is returned, a BACKSLASH will be left as "\". - * - * @return true if the database needs to escape backslashes - * in SqlExpressions. - */ + * + * @return true if the database needs to escape backslashes + * in SqlExpressions. + */ boolean escapeText(); /** Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/adapter/AdapterFactory.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/adapter/AdapterFactory.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/adapter/AdapterFactory.java (original) +++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/adapter/AdapterFactory.java Mon Aug 27 09:48:33 2018 @@ -49,7 +49,7 @@ public final class AdapterFactory * JDBC driver to Torque Adapter map. */ private static Map<String, Class<? extends Adapter>> adapters - = new HashMap<String, Class<? extends Adapter>>(); + = new HashMap<>(); /** * Initialize the JDBC driver to Torque Adapter map. @@ -59,7 +59,7 @@ public final class AdapterFactory adapters.put("org.hsql.jdbcDriver", HsqldbAdapter.class); adapters.put("org.hsqldb.jdbcDriver", HsqldbAdapter.class); adapters.put("com.microsoft.jdbc.sqlserver.SQLServerDriver", - MssqlAdapter.class); + MssqlAdapter.class); adapters.put("com.jnetdirect.jsql.JSQLDriver", MssqlAdapter.class); adapters.put("org.gjt.mm.mysql.Driver", MysqlAdapter.class); adapters.put("com.mysql.cj.jdbc.Driver", MysqlAdapter.class); @@ -110,7 +110,7 @@ public final class AdapterFactory * @throws SQLException if there are problems getting the JDBC meta data */ public static Adapter autoDetectAdapter(Connection con) - throws InstantiationException, SQLException + throws InstantiationException, SQLException { DatabaseMetaData dmd = con.getMetaData(); String dbmsName = dmd.getDatabaseProductName(); @@ -139,7 +139,7 @@ public final class AdapterFactory * instantiated */ public static Adapter create(String key) - throws InstantiationException + throws InstantiationException { Class<? extends Adapter> adapterClass = adapters.get(key); @@ -156,9 +156,9 @@ public final class AdapterFactory catch (IllegalAccessException e) { throw new InstantiationException( - "Could not instantiate adapter for key : " - + key - + ": Assure that adapter classes are in your classpath"); + "Could not instantiate adapter for key : " + + key + + ": Assure that adapter classes are in your classpath"); } } @@ -175,7 +175,7 @@ public final class AdapterFactory */ @SuppressWarnings("unchecked") public static Adapter create(String key, String className) - throws InstantiationException + throws InstantiationException { Class<?> adapterClass; @@ -187,10 +187,10 @@ public final class AdapterFactory { throw new InstantiationException( "Could not find adapter " - + className - + " for key " - + key - + ": Check your configuration file"); + + className + + " for key " + + key + + ": Check your configuration file"); } adapters.put(key, (Class<? extends Adapter>) adapterClass); Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/adapter/DerbyAdapter.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/adapter/DerbyAdapter.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/adapter/DerbyAdapter.java (original) +++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/adapter/DerbyAdapter.java Mon Aug 27 09:48:33 2018 @@ -111,7 +111,7 @@ public class DerbyAdapter extends Abstra { StringBuilder stmt = new StringBuilder(); stmt.append("LOCK TABLE ") - .append(table).append(" IN EXCLUSIVE MODE"); + .append(table).append(" IN EXCLUSIVE MODE"); statement.executeUpdate(stmt.toString()); } } @@ -142,12 +142,12 @@ public class DerbyAdapter extends Abstra * in SqlExpressions. */ @Override - public boolean escapeText() - { - return false; - } + public boolean escapeText() + { + return false; + } - /** + /** * Whether an escape clause in like should be used. * Example : select * from AUTHOR where AUTHOR.NAME like '\_%' ESCAPE '\'; * Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/adapter/MssqlAdapter.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/adapter/MssqlAdapter.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/adapter/MssqlAdapter.java (original) +++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/adapter/MssqlAdapter.java Mon Aug 27 09:48:33 2018 @@ -101,6 +101,7 @@ public class MssqlAdapter extends Abstra * @return the SQL clause to acquire a write lock. * This implementation returns "WITH (UPDLOCK)"; */ + @Override public String getUpdateLockClause() { return "WITH (UPDLOCK)"; @@ -161,7 +162,7 @@ public class MssqlAdapter extends Abstra */ @Override public void generateLimits(Query query, long offset, int limit) - throws TorqueException + throws TorqueException { if (limit < 0 && offset >= 0) // Offset only test { Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/adapter/OracleAdapter.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/adapter/OracleAdapter.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/adapter/OracleAdapter.java (original) +++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/adapter/OracleAdapter.java Mon Aug 27 09:48:33 2018 @@ -177,8 +177,8 @@ public class OracleAdapter extends Abstr public void generateLimits(final Query query, final long offset, final int limit) { StringBuilder preLimit = new StringBuilder() - .append("SELECT B.* FROM ( ") - .append("SELECT A.*, rownum AS TORQUE$ROWNUM FROM ( "); + .append("SELECT B.* FROM ( ") + .append("SELECT A.*, rownum AS TORQUE$ROWNUM FROM ( "); StringBuilder postLimit = new StringBuilder() .append(" ) A ") @@ -187,18 +187,18 @@ public class OracleAdapter extends Abstr if (offset > 0) { postLimit.append(" B.TORQUE$ROWNUM > ") - .append(offset); + .append(offset); if (limit >= 0) { postLimit.append(" AND B.TORQUE$ROWNUM <= ") - .append(offset + limit); + .append(offset + limit); } } else { postLimit.append(" B.TORQUE$ROWNUM <= ") - .append(limit); + .append(limit); } query.setPreLimit(preLimit.toString()); @@ -210,7 +210,7 @@ public class OracleAdapter extends Abstr // TODO: does not work for functions yet UniqueList<String> selectColumns = query.getSelectClause(); int replacementSuffix = 0; - Set<String> columnNames = new HashSet<String>(); + Set<String> columnNames = new HashSet<>(); // first pass: only remember aliased columns // No replacements need to take place because double aliases // are not allowed anyway @@ -219,7 +219,7 @@ public class OracleAdapter extends Abstr { // check for sql function if ((selectColumn.indexOf('(') != -1) - || (selectColumn.indexOf(')') != -1)) + || (selectColumn.indexOf(')') != -1)) { // Sql function. Disregard. continue; @@ -245,7 +245,7 @@ public class OracleAdapter extends Abstr // check for sql function if ((selectColumn.indexOf('(') != -1) - || (selectColumn.indexOf(')') != -1)) + || (selectColumn.indexOf(')') != -1)) { // Sql function. Disregard. continue; Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/avalon/Torque.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/avalon/Torque.java?rev=1839288&r1=1839287&r2=1839288&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/avalon/Torque.java (original) +++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/avalon/Torque.java Mon Aug 27 09:48:33 2018 @@ -38,7 +38,7 @@ import org.apache.torque.om.Persistent; * @version $Id$ */ public interface Torque - extends Component +extends Component { /** * The avalon role. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
