Search in sources :

Example 11 with CTagManager

use of com.google.security.zynamics.binnavi.Tagging.CTagManager in project binnavi by google.

the class PostgreSQLProviderTest method testinsertTagFail2.

@Test(expected = NullPointerException.class)
public void testinsertTagFail2() throws CouldntSaveDataException, CouldntLoadDataException {
    final CTagManager tagManager = getProvider().loadTagManager(TagType.VIEW_TAG);
    getProvider().insertTag(tagManager.getRootTag(), null, "Tag Description", TagType.VIEW_TAG);
}
Also used : CTagManager(com.google.security.zynamics.binnavi.Tagging.CTagManager) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 12 with CTagManager

use of com.google.security.zynamics.binnavi.Tagging.CTagManager in project binnavi by google.

the class PostgreSQLProviderTest method testPostgreSQLTagFunctionsSetName3.

@Test(expected = NullPointerException.class)
public void testPostgreSQLTagFunctionsSetName3() throws CouldntSaveDataException, CouldntLoadDataException {
    final CTagManager tagManager = getProvider().loadTagManager(TagType.VIEW_TAG);
    tagManager.addTag(tagManager.getRootTag(), "Node Tag I");
    tagManager.addTag(tagManager.getRootTag(), "Node Tag II");
    tagManager.addTag(tagManager.getRootTag().getChildren().get(0), "Node Tag III");
    final ITreeNode<CTag> tag1 = tagManager.getRootTag().getChildren().get(0);
    PostgreSQLTagFunctions.setName((AbstractSQLProvider) getProvider(), tag1.getObject(), null);
}
Also used : CTag(com.google.security.zynamics.binnavi.Tagging.CTag) CTagManager(com.google.security.zynamics.binnavi.Tagging.CTagManager) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 13 with CTagManager

use of com.google.security.zynamics.binnavi.Tagging.CTagManager in project binnavi by google.

the class PostgreSQLProviderTest method testInsertTagFail3.

@Test(expected = NullPointerException.class)
public void testInsertTagFail3() throws CouldntLoadDataException, CouldntSaveDataException {
    final CTagManager tagManager = getProvider().loadTagManager(TagType.VIEW_TAG);
    getProvider().insertTag(tagManager.getRootTag(), "Tag Name", null, TagType.VIEW_TAG);
}
Also used : CTagManager(com.google.security.zynamics.binnavi.Tagging.CTagManager) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 14 with CTagManager

use of com.google.security.zynamics.binnavi.Tagging.CTagManager in project binnavi by google.

the class PostgreSQLProviderTest method testCTagFunctionsSetName.

@Test
public void testCTagFunctionsSetName() throws CouldntLoadDataException, CouldntSaveDataException, LoadCancelledException {
    final CTagManager tagManager = getProvider().loadTagManager(TagType.VIEW_TAG);
    tagManager.addTag(tagManager.getRootTag(), "Node Tag I");
    tagManager.addTag(tagManager.getRootTag(), "Node Tag II");
    tagManager.addTag(tagManager.getRootTag().getChildren().get(0), "Node Tag III");
    final ITreeNode<CTag> tag1 = tagManager.getRootTag().getChildren().get(0);
    final INaviModule module = getProvider().loadModules().get(0);
    module.load();
    PostgreSQLTagFunctions.setName((AbstractSQLProvider) getProvider(), tag1.getObject(), "foobar");
    module.close();
    final INaviModule module2 = getProvider().loadModules().get(0);
    module2.load();
    final CTagManager tagManager1 = getProvider().loadTagManager(TagType.VIEW_TAG);
    assertEquals("foobar", tagManager1.getRootTag().getChildren().get(0).getObject().getName());
}
Also used : INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) CTag(com.google.security.zynamics.binnavi.Tagging.CTag) CTagManager(com.google.security.zynamics.binnavi.Tagging.CTagManager) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 15 with CTagManager

use of com.google.security.zynamics.binnavi.Tagging.CTagManager in project binnavi by google.

the class PostgreSQLProviderTest method testCviewFunctionsUntagView3.

@Test
public void testCviewFunctionsUntagView3() throws CouldntLoadDataException, LoadCancelledException, CPartialLoadException, CouldntSaveDataException {
    final INaviModule module = getProvider().loadModules().get(0);
    module.load();
    final CView view = (CView) module.getContent().getViewContainer().getViews().get(224);
    view.load();
    final Set<CTag> viewTags = view.getConfiguration().getViewTags();
    if (viewTags.isEmpty()) {
        final CTagManager tagManager = getProvider().loadTagManager(TagType.VIEW_TAG);
        final CTag tag = tagManager.getRootTag().getChildren().get(0).getObject();
        getProvider().tagView(view, tag);
    } else {
        getProvider().removeTag(view, viewTags.iterator().next());
    }
}
Also used : CView(com.google.security.zynamics.binnavi.disassembly.views.CView) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) CTag(com.google.security.zynamics.binnavi.Tagging.CTag) CTagManager(com.google.security.zynamics.binnavi.Tagging.CTagManager) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Aggregations

CTagManager (com.google.security.zynamics.binnavi.Tagging.CTagManager)46 CTag (com.google.security.zynamics.binnavi.Tagging.CTag)34 Test (org.junit.Test)31 ExpensiveBaseTest (com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest)23 MockSqlProvider (com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider)17 Tree (com.google.security.zynamics.zylib.types.trees.Tree)15 MockDatabase (com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase)13 CModule (com.google.security.zynamics.binnavi.disassembly.Modules.CModule)13 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)12 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)12 Date (java.util.Date)12 TreeNode (com.google.security.zynamics.zylib.types.trees.TreeNode)10 Before (org.junit.Before)9 TagManager (com.google.security.zynamics.binnavi.API.disassembly.TagManager)8 ITreeNode (com.google.security.zynamics.zylib.types.trees.ITreeNode)8 Database (com.google.security.zynamics.binnavi.API.disassembly.Database)7 CView (com.google.security.zynamics.binnavi.disassembly.views.CView)7 Module (com.google.security.zynamics.binnavi.API.disassembly.Module)6 MockTagManager (com.google.security.zynamics.binnavi.Tagging.MockTagManager)5 MockView (com.google.security.zynamics.binnavi.disassembly.MockView)5