use of aQute.bnd.build.Workspace in project bndtools by bndtools.
the class LocalRepositorySelectionPage method createControl.
public void createControl(Composite parent) {
setTitle("Select Local Repository");
setMessage("Bundle will be imported into the selected repository.");
Table table = new Table(parent, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
final TableViewer viewer = new TableViewer(table);
viewer.setContentProvider(new RepositoryTreeContentProvider());
viewer.setLabelProvider(new RepositoryTreeLabelProvider(false));
viewer.setFilters(new ViewerFilter[] { new ViewerFilter() {
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
return (element instanceof RepositoryPlugin) && ((RepositoryPlugin) element).canWrite();
}
} });
try {
Workspace workspace = Central.getWorkspace();
viewer.setInput(workspace);
if (selectedRepository != null)
viewer.setSelection(new StructuredSelection(selectedRepository));
validate(workspace);
} catch (Exception e) {
logger.logError("Error querying local repositories", e);
setErrorMessage("Error querying local repositories, see log for details.");
}
// LISTENERS
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
setSelectedRepository((RepositoryPlugin) selection.getFirstElement());
}
});
viewer.addOpenListener(new IOpenListener() {
public void open(OpenEvent evt) {
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
setSelectedRepository((RepositoryPlugin) selection.getFirstElement());
IWizardPage nextPage = getNextPage();
if (nextPage != null)
getContainer().showPage(nextPage);
}
});
setControl(table);
}
use of aQute.bnd.build.Workspace in project bndtools by bndtools.
the class MapValuesContentProvider method refreshBundleList.
protected void refreshBundleList() throws Exception {
Workspace workspace = Central.getWorkspace();
workspace.refresh();
availableViewer.setInput(RepositoryUtils.listRepositories(workspace, true));
}
use of aQute.bnd.build.Workspace in project bnd by bndtools.
the class IndexedReposWithComms method testIndexedRepo.
/*
* Uses workspaces/indexed Sets up a FixedIndexedRepo to the local server.
*/
public void testIndexedRepo() throws IOException, Exception {
try (HttpTestServer ht = http()) {
createSecureSocks5();
Workspace ws = Workspace.getWorkspace(aQute.lib.io.IO.getFile("workspaces/indexed"));
assertNotNull(ws);
ws.setProperty("repo", ht.getBaseURI().toASCIIString() + "/index");
FixedIndexedRepo plugin = ws.getPlugin(FixedIndexedRepo.class);
assertTrue(ws.check());
assertNotNull(plugin);
List<String> list = plugin.list(null);
assertTrue(ws.check());
assertTrue(list.size() > 0);
}
}
use of aQute.bnd.build.Workspace in project bnd by bndtools.
the class IndexedReposWithComms method testIndexedRepoWithPassword.
/*
* Uses workspaces/indexed Sets up a FixedIndexedRepo to the local server.
*/
public void testIndexedRepoWithPassword() throws IOException, Exception {
try (HttpTestServer ht = https()) {
createSecureSocks5();
Workspace ws = Workspace.getWorkspace(aQute.lib.io.IO.getFile("workspaces/indexed"));
assertNotNull(ws);
ws.setProperty("-connection-settings", "${build}/settings-withpassword.xml");
ws.setProperty("repo", ht.getBaseURI().toASCIIString() + "/index-auth/user/good");
FixedIndexedRepo plugin = ws.getPlugin(FixedIndexedRepo.class);
assertTrue(ws.check());
assertNotNull(plugin);
List<String> list = plugin.list(null);
assertTrue(ws.check());
assertTrue(list.size() > 0);
}
}
use of aQute.bnd.build.Workspace in project bnd by bndtools.
the class MavenTest method testMavenRepo.
/**
* See if we can create a maven repostory as a plugin
*
* @throws Exception
*/
public static void testMavenRepo() throws Exception {
Workspace ws = Workspace.getWorkspace(cwd.getParentFile());
Maven maven = ws.getMaven();
Processor processor = new Processor(ws);
processor.setProperty(Constants.PLUGIN, "aQute.bnd.maven.support.MavenRemoteRepository;repositories=testresources/ws/maven1/m2");
MavenRemoteRepository mr = processor.getPlugin(MavenRemoteRepository.class);
assertNotNull(mr);
assertEquals(maven, mr.getMaven());
// Cleanup the maven cache so we do not get random results
MavenEntry me = maven.getEntry("org.apache.commons", "com.springsource.org.apache.commons.beanutils", "1.6.1");
assertNotNull(me);
me.remove();
Map<String, String> map = MAP.$("groupId", "org.apache.commons");
File file = mr.get("com.springsource.org.apache.commons.beanutils", "1.6.1", Strategy.LOWEST, map);
assertNotNull(file);
assertEquals("com.springsource.org.apache.commons.beanutils-1.6.1.jar", file.getName());
assertTrue(file.isFile());
Map<String, String> map2 = MAP.$("groupId", "org.apache.commons").$("scope", "compile");
file = mr.get("com.springsource.org.apache.commons.beanutils", "1.6.1", Strategy.LOWEST, map2);
assertNotNull(file);
assertTrue(file.isFile());
assertEquals("compile.lib", file.getName());
String lib = IO.collect(file);
System.err.println(lib);
lib = lib.replaceAll("org.apache.commons\\+com.springsource.org.apache.commons.beanutils;version=\"1.6.1\"", "1");
lib = lib.replaceAll("org.apache.commons\\+com.springsource.org.apache.commons.collections;version=\"2.1.1\"", "2");
lib = lib.replaceAll("org.apache.commons\\+com.springsource.org.apache.commons.logging;version=\"1.0.4\"", "3");
assertEquals("1\n2\n3\n", lib);
}
Aggregations