Search in sources :

Example 6 with CCachedExpressionTree

use of com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCachedExpressionTree in project binnavi by google.

the class JCriteriumTreeModelTest method setUp.

@Before
public void setUp() throws FileReadException, CouldntLoadDataException, LoadCancelledException, CouldntSaveDataException {
    m_graph = ZyGraphFactory.generateTestGraph();
    m_tree = new CCachedExpressionTree();
    try {
        PluginInterface.instance("", new MockDatabaseManager(), new PluginRegistry());
    } catch (final IllegalStateException e) {
    }
}
Also used : MockDatabaseManager(com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabaseManager) PluginRegistry(com.google.security.zynamics.binnavi.Plugins.PluginRegistry) CCachedExpressionTree(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCachedExpressionTree) Before(org.junit.Before)

Example 7 with CCachedExpressionTree

use of com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCachedExpressionTree in project binnavi by google.

the class CCriteriumCacheTest method testAdd.

@Test
public void testAdd() {
    final CCachedExpressionTree cachedTree = new CCachedExpressionTree();
    final CCachedExpressionTree cachedTree2 = new CCachedExpressionTree();
    final CCachedAndCriterium criterium = new CCachedAndCriterium();
    final CCachedExpressionTreeNode node = new CCachedExpressionTreeNode(criterium);
    CCachedExpressionTreeNode.append(cachedTree.getRoot(), node);
    final CCachedExpressionTreeNode node_a = new CCachedExpressionTreeNode(new CCachedColorCriterium(Color.red));
    CCachedExpressionTreeNode.append(node, node_a);
    final CCachedExpressionTreeNode node_b = new CCachedExpressionTreeNode(new CCachedColorCriterium(Color.blue));
    CCachedExpressionTreeNode.append(node, node_b);
    final CCachedExpressionTreeNode node2 = new CCachedExpressionTreeNode(new CCachedTextCriterium("foo", false, false));
    CCachedExpressionTreeNode.append(cachedTree2.getRoot(), node2);
    final CCriteriumCache criteriumCache = new CCriteriumCache();
    criteriumCache.addListener(m_listener);
    assertEquals(0, criteriumCache.getTrees().size());
    criteriumCache.add(cachedTree);
    assertEquals(1, criteriumCache.getTrees().size());
    criteriumCache.add(cachedTree2);
    assertEquals(2, criteriumCache.getTrees().size());
}
Also used : CCachedAndCriterium(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.And.CCachedAndCriterium) CCachedExpressionTree(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCachedExpressionTree) CCachedTextCriterium(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.Text.CCachedTextCriterium) CCachedColorCriterium(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.NodeColor.CCachedColorCriterium) CCachedExpressionTreeNode(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCachedExpressionTreeNode) CCriteriumCache(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Cache.CCriteriumCache) Test(org.junit.Test)

Example 8 with CCachedExpressionTree

use of com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCachedExpressionTree in project binnavi by google.

the class CCriteriumCacheTest method testRemoveListener.

@Test
public void testRemoveListener() {
    final CCachedExpressionTree cachedTree = new CCachedExpressionTree();
    final CCachedExpressionTreeNode node = new CCachedExpressionTreeNode(new CCachedTextCriterium("foo", false, false));
    CCachedExpressionTreeNode.append(cachedTree.getRoot(), node);
    final CCriteriumCache criteriumCache = new CCriteriumCache();
    criteriumCache.addListener(m_listener);
    assertEquals(0, criteriumCache.getTrees().size());
    criteriumCache.add(cachedTree);
    assertEquals(1, criteriumCache.getTrees().size());
    criteriumCache.removeListener(m_listener);
}
Also used : CCachedExpressionTree(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCachedExpressionTree) CCachedTextCriterium(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.Text.CCachedTextCriterium) CCachedExpressionTreeNode(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCachedExpressionTreeNode) CCriteriumCache(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Cache.CCriteriumCache) Test(org.junit.Test)

Aggregations

CCachedExpressionTree (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCachedExpressionTree)8 CCriteriumCache (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Cache.CCriteriumCache)4 CCachedTextCriterium (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.Text.CCachedTextCriterium)4 CCachedExpressionTreeNode (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCachedExpressionTreeNode)4 Test (org.junit.Test)4 Before (org.junit.Before)3 MockDatabaseManager (com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabaseManager)1 CCachedAndCriterium (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.And.CCachedAndCriterium)1 CCachedColorCriterium (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.NodeColor.CCachedColorCriterium)1 CExecuteCachedCriterium (com.google.security.zynamics.binnavi.Gui.GraphWindows.Actions.CExecuteCachedCriterium)1 PluginRegistry (com.google.security.zynamics.binnavi.Plugins.PluginRegistry)1 JMenuItem (javax.swing.JMenuItem)1