class ConfigCapability extends CapabilitySupport implements Capability,
		ConfigEntry {

	private boolean isSnapshot(final String path) {
		return path.contains("-SNAPSHOT/");
	}

}

class TestConfigCapability {

	protected final Logger log;

	@Test
	public void testGAV() {


		final M2GavCalculator calc = new M2GavCalculator();

		{
			final String path = "/junit/junit/3.8.1/junit-3.8.1.pom";
			final Gav gav = calc.pathToGav(path);
			log(path, gav);
			assertFalse(gav.isSnapshot());
		}

		{
			final String path = "junit/junit/1.4.3-SNAPSHOT/junit-1.4.3-20120912.150156-11.pom";
			final Gav gav = calc.pathToGav(path);
			log(path, gav);
			assertTrue(gav.isSnapshot());
		}

		{
			final String path = "junit/junit/1.4.3-SNAPSHOT/junit-1.4.3-SNAPSHOT.pom";
			final Gav gav = calc.pathToGav(path);
			log(path, gav);
			assertTrue(gav.isSnapshot());
		}

		{
			final String path = "junit/junit/hello/junit-1.4.3-SNAPSHOT.pom";
			final Gav gav = calc.pathToGav(path);
			log(path, gav);
			assertNull(gav);
		}

		{
			final String path = "/.nexus/junit/junit/3.8.1/junit-3.8.1.pom";
			final Gav gav = calc.pathToGav(path);
			log(path, gav);
			assertNotNull(gav);
		}

		{
			final String path = "/junit/junit/3.8.1/junit-3.8.1.pom.sha1";
			final Gav gav = calc.pathToGav(path);
			log(path, gav);
			assertTrue(gav.isHash());
		}

		{
			final String path = "/junit/junit/3.8.1/junit-3.8.1.pom.md5";
			final Gav gav = calc.pathToGav(path);
			log(path, gav);
			assertTrue(gav.isHash());
			assertFalse(gav.isSnapshot());
		}

		{
			final String path = "/junit/junit/3.8.1-SNAPSHOT/junit-3.8.1-SNAPSHOT.pom.asc";
			final Gav gav = calc.pathToGav(path);
			log(path, gav);
			assertTrue(gav.isSignature());
			assertTrue(gav.isSnapshot());
		}

		{
			final String path = "/";
			final Gav gav = calc.pathToGav(path);
			log(path, gav);
			assertNull(gav);
		}

		{
			final String path = "jboss-releases-thirdparty/esper/esper/2.2.0-JBoss-Nightly/esper-2.2.0-JBoss-Nightly.jar";
			final Gav gav = calc.pathToGav(path);
			log(path, gav);
			assertNotNull(gav);
		}

	}

}