func ExampleNexus2x_Artifacts() {
	n := nexus.New("http://maven.java.net", credentials.None)

	// using a simple search
	n.Artifacts(search.ByClassname("javax.servlet.Servlet"))

	// using a composite search
	n.Artifacts(
		search.InRepository{
			RepositoryID: "releases",
			Criteria:     search.ByKeyword("javax.enterprise")})

	// searching for every artifact in Nexus (WARNING: this can take a LOOONG
	// time - and memory!)
	n.Artifacts(search.All)
}
Exemple #2
0
func TestByClassnameSetsTheProperFields(t *testing.T) {
	actual := search.ByClassname("cn").Parameters()
	expected := map[string]string{"cn": "cn"}

	diff, onlyExpected, onlyActual := util.MapDiff(expected, actual)

	for _, key := range diff {
		t.Errorf("Mismatch on key %q: expected value %q, got %q", key, expected[key], actual[key])
	}

	for _, key := range onlyExpected {
		t.Errorf("Missing key %q", key)
	}

	for _, key := range onlyActual {
		t.Errorf("Unexpected key %q", key)
	}
}
Exemple #3
0
func TestByClassnameImplementsCriteria(t *testing.T) {
	if _, ok := interface{}(search.ByClassname("")).(search.Criteria); !ok {
		t.Errorf("search.ByClassname does not implement Criteria!")
	}
}