@@ -0,0 +1,2408 @@
+/*%0A * Copyright (c) 2012 Mateusz Parzonka, Eric Bodden%0A * All rights reserved. This program and the accompanying materials%0A * are made available under the terms of the Eclipse Public License v1.0%0A * which accompanies this distribution, and is available at%0A * http://www.eclipse.org/legal/epl-v10.html%0A *%0A * Contributors:%0A * Mateusz Parzonka - initial API and implementation%0A */%0Apackage prm4j.indexing.realtime;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0Aimport org.junit.Test;%0A%0Aimport prm4j.AbstractTest;%0Aimport prm4j.api.fsm.FSM;%0Aimport prm4j.api.fsm.FSMSpec;%0Aimport prm4j.indexing.BaseMonitor;%0Aimport prm4j.indexing.StatefulMonitor;%0Aimport prm4j.indexing.staticdata.StaticDataConverter;%0Aimport prm4j.spec.FiniteParametricProperty;%0Aimport prm4j.spec.FiniteSpec;%0A%0Apublic class GarbageCollectionTest extends AbstractTest %7B%0A%0A    protected StaticDataConverter converter;%0A    protected DefaultBindingStore bindingStore;%0A    protected DefaultNodeStore nodeStore;%0A    protected BaseMonitor prototypeMonitor;%0A    protected DefaultParametricMonitor pm;%0A%0A    public void createDefaultParametricMonitorWithAwareComponents(FSM fsm, int cleaningInterval) %7B%0A%09FiniteSpec finiteSpec = new FSMSpec(fsm);%0A%09converter = new StaticDataConverter(new FiniteParametricProperty(finiteSpec));%0A%09bindingStore = new DefaultBindingStore(finiteSpec.getFullParameterSet(), 1);%0A%09nodeStore = new DefaultNodeStore(converter.getMetaTree());%0A%09prototypeMonitor = new StatefulMonitor(finiteSpec.getInitialState());%0A%09pm = new DefaultParametricMonitor(bindingStore, nodeStore, prototypeMonitor, converter.getEventContext());%0A    %7D%0A%0A    @Test%0A    public void aliveBinding_nodeIsPersistent() throws Exception %7B%0A%0A%09FSM_obj_obj fsm = new FSM_obj_obj();%0A%09createDefaultParametricMonitorWithAwareComponents(fsm.fsm, 1);%0A%0A%09// exercise%0A%09Object object = new Object();%0A%09LowLevelBinding%5B%5D bindings = bindingStore.getBindings(array(object));%0A%09Node node = nodeStore.getOrCreateNode(bindings);%0A%0A%09// verify%0A%09assertEquals(node, nodeStore.getNode(bindings));%0A    %7D%0A%0A    @Test%0A    public void aliveBinding_bindingIsPersistent() throws Exception %7B%0A%0A%09FSM_obj_obj fsm = new FSM_obj_obj();%0A%09createDefaultParametricMonitorWithAwareComponents(fsm.fsm, 1);%0A%0A%09// exercise%0A%09Object object = new Object();%0A%09LowLevelBinding%5B%5D bindings = bindingStore.getBindings(array(object));%0A%09nodeStore.getOrCreateNode(bindings);%0A%0A%09// verify%0A%09assertEquals(1, bindingStore.size());%0A    %7D%0A%0A%7D%0A

Add test for garbage collection