FramesExtension extends AbstractRexsterExtension { @Override public boolean isConfigurationValid(ExtensionConfiguration extensionConfiguration) { boolean valid = false; if (extensionConfiguration != null) { Map<String, String> mapFrames = extensionConfiguration.tryGetMapFromConfiguration(); valid = mapFrames != null && !mapFrames.isEmpty() && mapFrames.size() > 0; } return valid; }  @ExtensionDefinition(extensionPoint = ExtensionPoint.EDGE) @ExtensionDescriptor(description = "Frames extension for an edge.") ExtensionResponse doFramesWorkOnEdge(@RexsterContext RexsterResourceContext rexsterResourceContext,
                                                @RexsterContext Graph graph,
                                                @RexsterContext Edge edge,

                                                @ExtensionRequestParameter(name = "direction", description = "the direction of the edge (must be \"" + TOKEN_BOTH + "\", \"" + TOKEN_IN + "\", or \"" + TOKEN_OUT + "\" with the default being \"" + TOKEN_BOTH + "\"") String directionString); @ExtensionDefinition(extensionPoint = ExtensionPoint.VERTEX) @ExtensionDescriptor(description = "Frames extension for a vertex.") ExtensionResponse doFramesWorkOnVertex(@RexsterContext RexsterResourceContext rexsterResourceContext,
                                                  @RexsterContext Graph graph,
                                                  @RexsterContext Vertex vertex); @Override boolean isConfigurationValid(ExtensionConfiguration extensionConfiguration); static final String EXTENSION_NAME; static final String EXTENSION_NAMESPACE; static final String TOKEN_BOTH; static final String TOKEN_IN; static final String TOKEN_OUT; }
@Test public void isConfigurationValidNullConfiguration() { Assert.assertFalse(this.framesExtension.isConfigurationValid(null)); }
@Test public void isConfigurationValidEmptyConfiguration() { HierarchicalConfiguration xmlConfig = new HierarchicalConfiguration(); ExtensionConfiguration configuration = new ExtensionConfiguration("ns", "name", xmlConfig); Assert.assertFalse(this.framesExtension.isConfigurationValid(configuration)); }
@Test public void isConfigurationValidNiceConfiguration() { HierarchicalConfiguration hc = new HierarchicalConfiguration(); hc.addProperty("key1", "value1"); hc.addProperty("key2", "value2"); ExtensionConfiguration configuration = new ExtensionConfiguration("ns", "name", hc); Assert.assertTrue(this.framesExtension.isConfigurationValid(configuration)); }