Gephi: Unit Tests (JUnit)


When I created a JUnit unit test for a Gephi’s module (NetBeans) there seemed to be no way to execute it; since the “Test”, “Test File”, “Run File” were all greyed out (disabled).


Right click on the module and select “Create NBM”; then restart gephi so that the module is re-initialized; this seems to fix it (may need to also execute Clean and Build and then Run).



This is an old and somewhat more detailed description of the problem


I tried to get unit tests set up for my gephi’s module (module’s zip).  It does not seem to work well; there are quite a few NullpointerExcpetions caused by Lookup and ImportController etc. It does look like that it is a problem caused by NetBeans rather than Gephi itself.

Even the most basic task does not seem to work:

        //Init a project - and therefore a workspace
        ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);
        Workspace workspace = pc.getCurrentWorkspace();

        //Get controllers and models
        ImportController importController = Lookup.getDefault().lookup(ImportController.class);
        GraphModel graphModel = Lookup.getDefault().lookup(GraphController.class).getModel();

        File file = new File(getClass().getResource("/org/activeintel/gephi/les-miserables.gexf").toURI());

        //Import file
        Container container = importController.importFile(file);

        //Append imported data to GraphAPI
        importController.process(container, new DefaultProcessor(), workspace);

The following error is thrown:

GraphModel graphModel = Lookup.getDefault().lookup(GraphController.class).getModel();


Testcase: testDoTheDew(org.activeintel.gephi.DriverTest):	Caused an ERROR
	at org.activeintel.gephi.DriverTest.testDoTheDew




The work around was to create a regular netbeans project and then to included the toolkit.jar (which could be built by using ant).

Suggested approach is: (thanks Mathieu for pointing it out)

I have not tried it yet; will update the post as soon as I do.


For more information see comments at the very end of the post.



Keywords & References


Searched for test-roots netbeans 3:38pm

Bug 69390 – No tests root folder was found – 3:39pm

Netbeans and creating JUnit tests – Stack… – 3:39pm

Netbeans IDE Users – Junit and NB – 3:39pm

Searched for netbeans run module junit run file greyed out 2:49pm

Gephi: Unit Tests (JUnit) | Active Intelligence – 2:50pm

Netbeans IDE Users – Junit tests from… – 2:55pm

Creating, Importing, and Configuring… – 2:56pm

Bug 159256 – Groovy Unit tests cannot be run – 


Yesterday (cont.)


Searched for netbeans run module junit 2:42pm

Build Gephi – Gephi:Wiki – 2:45pm

java – How do I run JUnit from NetBeans?… – 2:46pm




Searched for netbeans add lookup library 10:35am
AboutLookup – NetBeans Wiki – 10:35am
Searched for netbeans add lookup 10:34am
NetBeans Lookups Explained! | NetBeans Zone – 10:35am
DevFaqLookup – NetBeans Wiki – 10:35am
Searched for gephi NullPointerException graphmodel lookup toolkit 10:12am
Gephi Toolkit Tutorial – – Viewed 6 times 10:12am
Searched for gephi NullPointerException graphmodel lookup 10:12am
Searched for gephi plugin developer 9:53am
Plugin Quick Start (5 minutes) – Gephi:Wiki – – Viewed 2 times 9:53am
Searched for netbeans run file greyed out 9:52am
How to compile & run a project-less file… – 9:52am
java – NetBeans Tips and Tricks – Stack Overflow – 9:52am
Searched for jung file 9:43am
JUNG – Java Universal Network/Graph Framework – 9:43am
Searched for gephi junit nullpointerexception 9:29am
Searched for gephi junit null 9:29am
Searched for gephi junit 9:29am
Build Gephi – Gephi:Wiki – 9:29am… 9:29am
Question #106928 : Questions : Gephi – – Viewed 2 times


Searched for gephi unit test 9:28am
Searched for gephi Lookup.getDefault().lookup(GraphController.class).getModel() 9:25am
Gephi forums • View topic – Resize… – 9:26am
Getting Graph Model for the Panel in… – – Viewed 2 times 9:26am
Searched for file input stream 9:09am
FileInputStream (Java 2 Platform SE v1.4.2) – 9:09am
Searched for athome 9431921301 8:06am 8:07am
Searched for Alan Turing to be pardoned 7:28am
No posthumous pardon for Alan Turing – – Feb 6, 2012
Searched for russia 7:24am


Searched for jgrapht open file 11:43pm
Welcome to JGraphT – a free Java Graph Library – 11:43pm
Searched for jgrapht import 11:43pm
Searched for gephi importController 11:40pm
Gephi API Index – 11:40pm
Searched for gephi getMatchingImporter 11:35pm 11:35pm 11:35pm
Searched for masterfs netbeans The module is not a friend of 11:25pm… 11:25pm… 11:25pm… 11:26pm
NetBeans Forums – toFileObject returns null. –

Yesterday (cont.)


Searched for FileUtil.toFileObject 11:21pm
Searched for gephi toFileObject 11:13pm… – 11:13pm
Gephi forums • View topic – [SOLVED]… – 11:14pm
ProjectAPI/src/org/gephi/project/io/LoadTask…. – 11:16pm
File (Java Platform SE 6) – 11:09pm
Searched for java file 11:09pm
File (Java Platform SE 6) – 11:09pm
Searched for gephi import nullpointerexception 11:06pm
Searched for gephi graphmodel panel 10:38pm
Getting Graph Model for the Panel in… – – Viewed 2 times 10:38pm
Searched for gephi graphmodel 10:37pm
org.gephi.graph.api (Gephi API Index) – 10:37pm
Searched for gephi ImportHelper java.lang.NullPointerException 10:31pm
Question #157823 : Questions : Gephi – 10:31pm
Searched for gephi toolkit 10:18pm
Gephi Toolkit | Gephi, open source graph… – – Viewed 7 times 10:18pm
Searched for gephi File file = new File(getClass().getResource 10:18pm
Toolkit – Import Dynamic Network from… – 10:18pm
Searched for netbeans junit 9:53pm
Writing JUnit Tests in NetBeans IDE – 9:54pm
java – How do I run JUnit from NetBeans?… – 9:54pm
Searched for netbeans 9:51pm
Welcome to NetBeans – 9:51pm
Searched for gephi netbeans “7.1”

Yesterday (cont.)


Searched for gephi netbeans 7.1 9:46pm
Searched for gephi unit test 9:42pm
NetBeans Tips – Gephi:Wiki – 9:42pm
Question #106928 : Questions : Gephi – – Viewed 2 times 9:44pm
Searched for git multiple projects 9:26pm
Multiple projects in a single git repository…. – 9:26pm
GIT repository layout for server with… – 9:26pm
organizing – How do you organise multiple… – 9:26pm
version control – What is the best way… – 9:26pm
Searched for data science 9:23pm
What is data science? – Quora – 9:23pm
Searched for netbeans lacks a unit test dependency on org.netbeans.libs.junit4; using default dependencies for compatibility 5:55pm
NetBeans Forums – Warning: firstmodule… – 5:56pm
Searched for netbeans java.lang.IllegalStateException: Cannot find myself as 5:45pm
NetBeans Forums – Strange sudden error… – 5:45pm
Searched for netbeans add library 5:20pm
jGuru: How can I add third party libraries… – 5:20pm
Searched for gephi plugin developer 4:58pm
Plugin Quick Start (5 minutes) – Gephi:Wiki – – Viewed 2 times 4:58pm
Searched for org.gephi.project.api.ProjectController 4:52pm
ProjectController (Gephi API Index) – 4:52pm
Searched for responsiveness 3:57pm
Searched for responsivness 3:57pm
java – How to Find Which classes implements… – 3:47pm
Program to find classes implementing… –

About Neil Rubens

This entry was posted in Uncategorized. Bookmark the permalink.

3 Responses to Gephi: Unit Tests (JUnit)

Leave a Reply

Your email address will not be published. Required fields are marked *