use of java.beans.PropertyChangeEvent in project jdk8u_jdk by JetBrains.
the class TestMethods method main.
public static void main(String[] args) throws PropertyVetoException {
Object source = new Object();
new TestMethods(source).fireVetoableChange(new PropertyChangeEvent(source, NAME, null, null));
new TestMethods(source).fireVetoableChange(NAME, null, null);
new TestMethods(source).fireVetoableChange(NAME, 0, 1);
new TestMethods(source).fireVetoableChange(NAME, true, false);
}
use of java.beans.PropertyChangeEvent in project jdk8u_jdk by JetBrains.
the class TestSynchronization method main.
public static void main(String[] args) throws PropertyVetoException {
final VetoableChangeSupport vcs = new VetoableChangeSupport(TestSynchronization.class);
vcs.addVetoableChangeListener("name", new VetoableChangeListener() {
public void vetoableChange(PropertyChangeEvent event) {
isCalled = true;
}
});
vcs.addVetoableChangeListener(new VetoableChangeListener() {
public void vetoableChange(PropertyChangeEvent event) {
for (VetoableChangeListener listener : vcs.getVetoableChangeListeners()) vcs.removeVetoableChangeListener(listener);
}
});
vcs.fireVetoableChange("name", null, null);
if (!isCalled)
throw new Error("test failed");
}
use of java.beans.PropertyChangeEvent in project geode by apache.
the class TestSessionsTomcat8Base method testSessionExpiration2.
/**
* Test setting the session expiration via a property change as would happen under normal
* deployment conditions.
*/
@Test
public void testSessionExpiration2() throws Exception {
// TestSessions only live for a minute
sessionManager.propertyChange(new PropertyChangeEvent(server.getRootContext(), "sessionTimeout", new Integer(30), new Integer(1)));
// Check that the value has been set to 60 seconds
assertEquals(60, sessionManager.getMaxInactiveInterval());
}
use of java.beans.PropertyChangeEvent in project processdash by dtuma.
the class DefaultTimeLoggingModelTest method testBoundaryConditions.
public void testBoundaryConditions() {
// stop the timer when it is already stopped. Should have no effect.
timeLoggingModel.setPaused(true);
assertTrue(eventsReceived.isEmpty());
// log some time to get the model in a common state for normal
// dashboard operation
setPath(PATH1, null, null);
startTiming();
setStopwatch(6, 0);
expectTime(PATH1, 6);
MutableTimeLogEntry tle = new MutableTimeLogEntryVO(1, PATH1, timeLoggingModel.stopwatch.getCreateTime(), 6, 0, null, ChangeFlagged.ADDED);
assertTimeLogEvent(tle);
stopTiming();
eventsReceived.clear();
// "change" the active task model to exercise listener registration
timeLoggingModel.setActiveTaskModel(activeTaskModel);
// since the active task is still the same, no changes should have been
// received
assertTrue(eventsReceived.isEmpty());
// disconnect the active task model, and make certain we no longer
// respond to its changes
timeLoggingModel.setActiveTaskModel(null);
assertNull(timeLoggingModel.getActiveTaskModel());
assertTrue(activeTaskModel.setPath(PATH2));
assertTrue(eventsReceived.isEmpty());
// check that disconnecting our listener to the timeLoggingModel
// causes us no longer to receive events
timeLoggingModel.setRecentPaths(new LinkedList());
assertPropertyChangeEvent(timeLoggingModel, TimeLoggingModel.RECENT_PATHS_PROPERTY, null, null);
timeLoggingModel.removePropertyChangeListener(this);
timeLoggingModel.setRecentPaths(Collections.singletonList("foo"));
assertTrue(eventsReceived.isEmpty());
// send a nonsense, unrelated property change event and make certain
// it gets ignored
PropertyChangeEvent pce = new PropertyChangeEvent(this, "foo", "bar", "baz");
timeLoggingModel.externalChangeListener.propertyChange(pce);
assertTrue(eventsReceived.isEmpty());
}
use of java.beans.PropertyChangeEvent in project processdash by dtuma.
the class TimeLogEntryTest method assertPropertyChange.
private void assertPropertyChange(Object source, String propName, Object oldVal, Object newVal) {
assertFalse(eventsReceived.isEmpty());
Object obj = eventsReceived.remove(0);
assertTrue(obj instanceof PropertyChangeEvent);
PropertyChangeEvent evt = (PropertyChangeEvent) obj;
assertEquals(source, evt.getSource());
assertEquals(propName, evt.getPropertyName());
assertEquals(oldVal, evt.getOldValue());
assertEquals(newVal, evt.getNewValue());
}
Aggregations