public void verifyNodeCache(int size, Object factory) { assertEquals(size, ((Integer) ObjectTools.get(factory, "cacheSize")).intValue()); int nodeCount = 0; for (Object node = ObjectTools.get(factory, "cacheHead"); node != null; node = ObjectTools.get(node, "next")) { nodeCount++; } assertEquals(size, nodeCount); }
public void setSpecifiedUnique(Boolean unique) { if (ObjectTools.notEquals(this.specifiedUnique, unique)) { this.getColumnAnnotation().setUnique(unique); this.removeColumnAnnotationIfUnset(); this.setSpecifiedUnique_(unique); } }
public void setSpecifiedNullable(Boolean nullable) { if (ObjectTools.notEquals(this.specifiedNullable, nullable)) { this.getColumnAnnotation().setNullable(nullable); this.removeColumnAnnotationIfUnset(); this.setSpecifiedNullable_(nullable); } }
public void setSpecifiedInsertable(Boolean insertable) { if (ObjectTools.notEquals(this.specifiedInsertable, insertable)) { this.getColumnAnnotation().setInsertable(insertable); this.removeColumnAnnotationIfUnset(); this.setSpecifiedInsertable_(insertable); } }
public void setSpecifiedUpdatable(Boolean updatable) { if (ObjectTools.notEquals(this.specifiedUpdatable, updatable)) { this.getColumnAnnotation().setUpdatable(updatable); this.removeColumnAnnotationIfUnset(); this.setSpecifiedUpdatable_(updatable); } }
public void setSpecifiedTableName(String tableName) { if (ObjectTools.notEquals(this.specifiedTableName, tableName)) { this.getColumnAnnotation().setTable(tableName); this.removeColumnAnnotationIfUnset(); this.setSpecifiedTableName_(tableName); } }
public void setSpecifiedNullable(Boolean nullable) { if (ObjectTools.notEquals(this.specifiedNullable, nullable)) { XmlOrderColumn xmlColumn = this.getXmlColumnForUpdate(); this.setSpecifiedNullable_(nullable); xmlColumn.setNullable(nullable); this.removeXmlColumnIfUnset(); } }
public void testSize() { Queue<String> queue = this.buildQueue(); String first = "first"; String second = "second"; String third = "third"; assertEquals(0, ((Integer) ObjectTools.execute(queue, "size")).intValue()); queue.enqueue(first); queue.enqueue(second); assertEquals(2, ((Integer) ObjectTools.execute(queue, "size")).intValue()); queue.enqueue(third); assertEquals(3, ((Integer) ObjectTools.execute(queue, "size")).intValue()); queue.dequeue(); assertEquals(2, ((Integer) ObjectTools.execute(queue, "size")).intValue()); queue.dequeue(); queue.dequeue(); assertEquals(0, ((Integer) ObjectTools.execute(queue, "size")).intValue()); }
public void testNodeCache_unlimited() { Queue<String> queue = new LinkedQueue<String>(-1); String first = "first"; String second = "second"; String third = "third"; String fourth = "fourth"; String fifth = "fifth"; Object factory = ObjectTools.get(queue, "nodeFactory"); this.verifyNodeCache(0, factory); queue.enqueue(first); this.verifyNodeCache(0, factory); queue.enqueue(second); queue.enqueue(third); queue.enqueue(fourth); queue.enqueue(fifth); this.verifyNodeCache(0, factory); assertNull(ObjectTools.get(factory, "cacheHead")); queue.dequeue(); this.verifyNodeCache(1, factory); queue.dequeue(); this.verifyNodeCache(2, factory); queue.dequeue(); this.verifyNodeCache(3, factory); queue.dequeue(); this.verifyNodeCache(4, factory); queue.dequeue(); this.verifyNodeCache(5, factory); queue.enqueue(first); this.verifyNodeCache(4, factory); queue.enqueue(second); this.verifyNodeCache(3, factory); queue.enqueue(third); this.verifyNodeCache(2, factory); queue.enqueue(fourth); this.verifyNodeCache(1, factory); queue.enqueue(fifth); this.verifyNodeCache(0, factory); }
public void testBuildElements() { Queue<String> queue = this.buildQueue(); String first = "first"; String second = "second"; String third = "third"; queue.enqueue(first); queue.enqueue(second); queue.enqueue(third); Object[] elements = new Object[] {first, second, third}; assertTrue(Arrays.equals(elements, ((Object[]) ObjectTools.execute(queue, "buildElements")))); }
/** test method that has more general method parameter type */ public void testSingleArgumentNamedProperty2() throws Exception { TestModel testModel = new TestModel(7); Target target = new Target(testModel, TestModel.VALUE_PROPERTY, 7, 99); Method method = ObjectTools.method(target, "propertyChangedSingleArgument2", new Class[] {Object.class}); testModel.addPropertyChangeListener( TestModel.VALUE_PROPERTY, ReflectiveChangeListener.buildPropertyChangeListener(target, method)); testModel.setValue(99); assertFalse(target.zeroArgumentFlag); assertTrue(target.singleArgumentFlag); }
public void testNodeToString() { Queue<String> queue = QueueTools.linkedQueue(); String first = "first"; String second = "second"; String third = "third"; queue.enqueue(first); queue.enqueue(second); queue.enqueue(third); Object head = ObjectTools.get(queue, "head"); assertTrue(head.toString().startsWith("LinkedQueue.Node")); assertTrue(head.toString().endsWith("(first)")); }
public void testSerialization_caching() throws Exception { Queue<String> original = QueueTools.linkedQueue(20); original.enqueue("first"); Queue<String> clone = TestTools.serialize(original); assertEquals(original.peek(), clone.peek()); assertEquals(original.dequeue(), clone.dequeue()); assertNotSame(original, clone); assertTrue(original.isEmpty()); assertEquals(original.isEmpty(), clone.isEmpty()); original.enqueue("second"); assertFalse(original.isEmpty()); // clone should still be empty assertTrue(clone.isEmpty()); Object factory = ObjectTools.get(original, "nodeFactory"); assertTrue(factory.toString().startsWith("LinkedQueue.CachingNodeFactory")); }
public void testBogusDoubleArgument2() throws Exception { TestModel testModel = new TestModel(7); Target target = new Target(testModel, TestModel.VALUE_PROPERTY, 7, 99); Method method = ObjectTools.method( target, "propertyChangedDoubleArgument", new Class[] {PropertyChangeEvent.class, Object.class}); boolean exCaught = false; try { PropertyChangeListener listener = ReflectiveChangeListener.buildPropertyChangeListener(target, method); fail("bogus listener: " + listener); } catch (RuntimeException ex) { if (ex.getMessage().equals(method.toString())) { exCaught = true; } } assertTrue(exCaught); }
@Override public String toString() { return ObjectTools.toString(this, this.transformer); }
@Override public String toString() { return ObjectTools.toString(this, this.selection); }
public void setValue(String value) { if (ObjectTools.notEquals(this.value, value)) { this.value = value; this.valueAdapter.setValue(value); } }
public void setLength(Integer length) { if (ObjectTools.notEquals(this.length, length)) { this.length = length; this.lengthAdapter.setValue(length); } }
public void setScale(Integer scale) { if (ObjectTools.notEquals(this.scale, scale)) { this.scale = scale; this.scaleAdapter.setValue(scale); } }
public void setPrecision(Integer precision) { if (ObjectTools.notEquals(this.precision, precision)) { this.precision = precision; this.precisionAdapter.setValue(precision); } }
@Override public String toString() { return ObjectTools.toString(this, this.command); }
@Override public String toString() { return ObjectTools.toString(this, this.driver); }
private boolean elementIs(Object o) { return ObjectTools.equals(o, this.getElement()); }
@Override public String toString() { return ObjectTools.toString(this, this.stack); }
public void testSimpleNodeFactoryToString() { Queue<String> queue = QueueTools.linkedQueue(); Object factory = ObjectTools.get(queue, "nodeFactory"); assertEquals("LinkedQueue.SimpleNodeFactory", factory.toString()); }
public void testCachingNodeFactoryToString() { Queue<String> queue = QueueTools.linkedQueue(20); Object factory = ObjectTools.get(queue, "nodeFactory"); assertTrue(factory.toString().startsWith("LinkedQueue.CachingNodeFactory")); assertTrue(factory.toString().endsWith("(0)")); }
@Override public String toString() { return ObjectTools.toString(this, this.valueModel); }
protected Iterable<PersistentType> buildInheritanceHierarchy(PersistentType start) { // using a chain iterable to traverse up the inheritance tree return ObjectTools.chain(start, SUPER_PERSISTENT_TYPE_TRANSFORMER); }
/** * If there is a specified table name it needs to be the same the default table name. the table * is always the collection table */ public boolean tableNameIsInvalid(String tableName) { return ObjectTools.notEquals(this.getDefaultTableName(), tableName); }
@Override public String toString() { return ObjectTools.toString(this); }