diff --git a/drivers/jung/src/main/java/org/commonjava/maven/atlas/graph/spi/jung/JungEGraphDriver.java b/drivers/jung/src/main/java/org/commonjava/maven/atlas/graph/spi/jung/JungEGraphDriver.java
index 32a2822b..cc5c3116 100644
--- a/drivers/jung/src/main/java/org/commonjava/maven/atlas/graph/spi/jung/JungEGraphDriver.java
+++ b/drivers/jung/src/main/java/org/commonjava/maven/atlas/graph/spi/jung/JungEGraphDriver.java
@@ -54,6 +54,7 @@
import org.commonjava.maven.atlas.ident.ref.ProjectRef;
import org.commonjava.maven.atlas.ident.ref.ProjectVersionRef;
import org.commonjava.maven.atlas.ident.util.JoinString;
+import org.commonjava.maven.atlas.ident.version.InvalidVersionSpecificationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -1000,12 +1001,35 @@ public ProjectVersionRef getManagedTargetFor( final ProjectVersionRef target, fi
@Override
public GraphPath> createPath( final ProjectRelationship>... rels )
{
+ if ( rels.length > 0 )
+ {
+ try
+ {
+ rels[rels.length - 1].getTarget()
+ .getVersionSpec();
+ }
+ catch ( final InvalidVersionSpecificationException e )
+ {
+ return null;
+ }
+ }
+
return new JungGraphPath( rels );
}
@Override
public GraphPath> createPath( final GraphPath> parent, final ProjectRelationship> child )
{
+ try
+ {
+ child.getTarget()
+ .getVersionSpec();
+ }
+ catch ( final InvalidVersionSpecificationException e )
+ {
+ return null;
+ }
+
if ( parent != null && !( parent instanceof JungGraphPath ) )
{
throw new IllegalArgumentException( "Cannot get child path for: " + parent + ". This is not a JungGraphPath instance!" );
diff --git a/drivers/jung/src/test/java/org/commonjava/maven/atlas/graph/spi/jung/EGraphManagerTest.java b/drivers/jung/src/test/java/org/commonjava/maven/atlas/graph/spi/jung/EGraphManagerTest.java
new file mode 100644
index 00000000..1ff4f6af
--- /dev/null
+++ b/drivers/jung/src/test/java/org/commonjava/maven/atlas/graph/spi/jung/EGraphManagerTest.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (C) 2014 John Casey.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ ******************************************************************************/
+package org.commonjava.maven.atlas.graph.spi.jung;
+
+import org.commonjava.maven.atlas.graph.EGraphManager;
+import org.commonjava.maven.atlas.tck.graph.EGraphManagerTCK;
+
+public class EGraphManagerTest
+ extends EGraphManagerTCK
+{
+ private EGraphManager manager;
+
+ @Override
+ protected EGraphManager getManager()
+ throws Exception
+ {
+ if ( manager == null )
+ {
+ manager = new EGraphManager( new JungWorkspaceFactory() );
+ }
+
+ return manager;
+ }
+
+}
diff --git a/drivers/neo4j-embedded/src/main/java/org/commonjava/maven/atlas/graph/spi/neo4j/AbstractNeo4JEGraphDriver.java b/drivers/neo4j-embedded/src/main/java/org/commonjava/maven/atlas/graph/spi/neo4j/AbstractNeo4JEGraphDriver.java
index 2c9fdaca..7b334c95 100644
--- a/drivers/neo4j-embedded/src/main/java/org/commonjava/maven/atlas/graph/spi/neo4j/AbstractNeo4JEGraphDriver.java
+++ b/drivers/neo4j-embedded/src/main/java/org/commonjava/maven/atlas/graph/spi/neo4j/AbstractNeo4JEGraphDriver.java
@@ -1918,6 +1918,11 @@ public GraphPath> createPath( final ProjectRelationship>... rels )
for ( int i = 0; i < rels.length; i++ )
{
final Relationship r = getRelationship( rels[i] );
+ if ( r == null )
+ {
+ return null;
+ }
+
relIds[i] = r.getId();
}
@@ -1948,6 +1953,10 @@ public GraphPath> createPath( final GraphPath> parent, final ProjectRelation
}
r = getRelationship( rel );
+ if ( r == null )
+ {
+ return null;
+ }
tx.success();
}
@@ -2398,8 +2407,6 @@ private void updateCaches( final Map> newRelationsh
.isEmpty() )
{
logger.debug( "nevermind; it's the global view." );
- confIdx.remove( viewNode );
- viewNode.delete();
continue;
}
diff --git a/drivers/neo4j-embedded/src/test/java/org/commonjava/maven/atlas/graph/spi/neo4j/FileEGraphManagerTest.java b/drivers/neo4j-embedded/src/test/java/org/commonjava/maven/atlas/graph/spi/neo4j/FileEGraphManagerTest.java
new file mode 100644
index 00000000..0b47e913
--- /dev/null
+++ b/drivers/neo4j-embedded/src/test/java/org/commonjava/maven/atlas/graph/spi/neo4j/FileEGraphManagerTest.java
@@ -0,0 +1,20 @@
+package org.commonjava.maven.atlas.graph.spi.neo4j;
+
+import org.commonjava.maven.atlas.graph.EGraphManager;
+import org.commonjava.maven.atlas.graph.spi.neo4j.fixture.FileDriverFixture;
+import org.commonjava.maven.atlas.tck.graph.EGraphManagerTCK;
+import org.junit.Rule;
+
+public class FileEGraphManagerTest
+ extends EGraphManagerTCK
+{
+ @Rule
+ public FileDriverFixture fixture = new FileDriverFixture();
+
+ @Override
+ protected synchronized EGraphManager getManager()
+ throws Exception
+ {
+ return fixture.manager();
+ }
+}
diff --git a/tck/src/main/java/org/commonjava/maven/atlas/tck/graph/EGraphManagerTCK.java b/tck/src/main/java/org/commonjava/maven/atlas/tck/graph/EGraphManagerTCK.java
new file mode 100644
index 00000000..a4fb9a9d
--- /dev/null
+++ b/tck/src/main/java/org/commonjava/maven/atlas/tck/graph/EGraphManagerTCK.java
@@ -0,0 +1,36 @@
+package org.commonjava.maven.atlas.tck.graph;
+
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+import java.net.URI;
+
+import org.commonjava.maven.atlas.graph.model.GraphPath;
+import org.commonjava.maven.atlas.graph.model.GraphView;
+import org.commonjava.maven.atlas.graph.rel.DependencyRelationship;
+import org.commonjava.maven.atlas.graph.rel.ProjectRelationship;
+import org.commonjava.maven.atlas.ident.DependencyScope;
+import org.commonjava.maven.atlas.ident.ref.ProjectVersionRef;
+import org.junit.Test;
+
+public abstract class EGraphManagerTCK
+ extends AbstractSPI_TCK
+{
+
+ @Test
+ public void createPath_ReturnNullWhenTargetVersionIsAnExpression()
+ throws Exception
+ {
+ final ProjectVersionRef from = new ProjectVersionRef( "org.from", "project", "1.0" );
+ final ProjectVersionRef to = new ProjectVersionRef( "org.to", "artifact", "${version.target}" );
+
+ final URI src = new URI( "test:source-uri" );
+ final ProjectRelationship> rel = new DependencyRelationship( src, from, to.asArtifactRef( "jar", null ), DependencyScope.compile, 0, false );
+
+ final GraphView view = new GraphView( simpleWorkspace(), from );
+ final GraphPath> path = getManager().createPath( view, rel );
+
+ assertThat( path, nullValue() );
+ }
+
+}