Search in sources :

Example 1 with DefaultMarketplaceService

use of org.eclipse.epp.internal.mpc.core.service.DefaultMarketplaceService in project epp.mpc by eclipse.

the class DefaultMarketplaceServiceTest method setUp.

@Before
public void setUp() throws Exception {
    marketplaceService = new DefaultMarketplaceService();
    // configure client id (bug 397004), as well as eclipse and marketplace versions (bug 418865)
    Map<String, String> requestMetaParameters = ServiceLocator.computeDefaultRequestMetaParameters();
    marketplaceService.setRequestMetaParameters(requestMetaParameters);
}
Also used : DefaultMarketplaceService(org.eclipse.epp.internal.mpc.core.service.DefaultMarketplaceService) Before(org.junit.Before)

Example 2 with DefaultMarketplaceService

use of org.eclipse.epp.internal.mpc.core.service.DefaultMarketplaceService in project epp.mpc by eclipse.

the class SolutionCompatibilityFilterTest method setupMarketplaceService.

@Before
public void setupMarketplaceService() throws Exception {
    marketplaceService = new DefaultMarketplaceService(new URL(BASE_URL));
    marketplaceService.setRequestMetaParameters(computeRequestMetaParameters(system, eclipseRelease));
}
Also used : DefaultMarketplaceService(org.eclipse.epp.internal.mpc.core.service.DefaultMarketplaceService) URL(java.net.URL) Before(org.junit.Before)

Example 3 with DefaultMarketplaceService

use of org.eclipse.epp.internal.mpc.core.service.DefaultMarketplaceService in project epp.mpc by eclipse.

the class SelectionModelStateSerializerTest method setUp.

@Before
public void setUp() throws Exception {
    CatalogDescriptor catalogDescriptor = new CatalogDescriptor(new URL("http://marketplace.eclipse.org"), "Eclipse.org Marketplace");
    discoveryStrategy = new MarketplaceDiscoveryStrategy(catalogDescriptor) {

        @Override
        public IMarketplaceService createMarketplaceService() {
            DefaultMarketplaceService marketplaceService = new DefaultMarketplaceService(catalogDescriptor.getUrl());
            Map<String, String> requestMetaParameters = ServiceLocator.computeDefaultRequestMetaParameters();
            marketplaceService.setRequestMetaParameters(requestMetaParameters);
            return marketplaceService;
        }
    };
    catalog = new MarketplaceCatalog();
    catalog.getDiscoveryStrategies().add(discoveryStrategy);
    selectionModel = new SelectionModel(new InstallProfile() {

        public Set<String> getInstalledFeatures() {
            return Collections.emptySet();
        }
    });
}
Also used : MarketplaceDiscoveryStrategy(org.eclipse.epp.internal.mpc.ui.catalog.MarketplaceDiscoveryStrategy) DefaultMarketplaceService(org.eclipse.epp.internal.mpc.core.service.DefaultMarketplaceService) SelectionModel(org.eclipse.epp.internal.mpc.ui.wizards.SelectionModel) MarketplaceCatalog(org.eclipse.epp.internal.mpc.ui.catalog.MarketplaceCatalog) IMarketplaceService(org.eclipse.epp.mpc.core.service.IMarketplaceService) InstallProfile(org.eclipse.epp.internal.mpc.ui.wizards.InstallProfile) Map(java.util.Map) URL(java.net.URL) CatalogDescriptor(org.eclipse.epp.mpc.ui.CatalogDescriptor) Before(org.junit.Before)

Example 4 with DefaultMarketplaceService

use of org.eclipse.epp.internal.mpc.core.service.DefaultMarketplaceService in project epp.mpc by eclipse.

the class ServiceLocator method createMarketplaceService.

protected IMarketplaceService createMarketplaceService(String baseUrl) {
    IMarketplaceService service;
    URL base;
    try {
        base = URLUtil.toURL(baseUrl);
    } catch (MalformedURLException e) {
        throw new IllegalArgumentException(e);
    }
    DefaultMarketplaceService defaultService = new DefaultMarketplaceService(base);
    Map<String, String> requestMetaParameters = computeDefaultRequestMetaParameters();
    defaultService.setRequestMetaParameters(requestMetaParameters);
    IUserFavoritesService favoritesService = getFavoritesService(baseUrl);
    // FIXME this should be a service reference!
    defaultService.setUserFavoritesService(favoritesService);
    service = new CachingMarketplaceService(defaultService);
    return service;
}
Also used : MalformedURLException(java.net.MalformedURLException) CachingMarketplaceService(org.eclipse.epp.internal.mpc.core.service.CachingMarketplaceService) DefaultMarketplaceService(org.eclipse.epp.internal.mpc.core.service.DefaultMarketplaceService) IUserFavoritesService(org.eclipse.epp.mpc.core.service.IUserFavoritesService) IMarketplaceService(org.eclipse.epp.mpc.core.service.IMarketplaceService) URL(java.net.URL)

Example 5 with DefaultMarketplaceService

use of org.eclipse.epp.internal.mpc.core.service.DefaultMarketplaceService in project epp.mpc by eclipse.

the class MarketplaceDiscoveryStrategyTest method testSearchByNodeUrl.

@Test
public void testSearchByNodeUrl() throws Exception {
    final INode[] testNode = new INode[1];
    final IMarketplaceService marketplaceService = new DefaultMarketplaceService(catalogUrl) {

        @Override
        public Node getNode(INode node, IProgressMonitor monitor) throws CoreException {
            testNode[0] = node;
            return (Node) node;
        }

        @Override
        public SearchResult search(IMarket market, ICategory category, String queryText, IProgressMonitor monitor) throws CoreException {
            Assert.fail("Unexpected invocation");
            // dead code
            return null;
        }
    };
    setupCatalog(marketplaceService);
    testNode[0] = null;
    catalog.performQuery(null, null, new URL(catalogUrl, "content/test").toExternalForm(), new NullProgressMonitor());
    assertNotNull(testNode[0]);
    assertNotNull(testNode[0].getUrl());
    testNode[0] = null;
    catalog.performQuery(null, null, new URL(catalogUrl, "node/12345").toExternalForm(), new NullProgressMonitor());
    assertNotNull(testNode[0]);
    assertNotNull(testNode[0].getId());
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) INode(org.eclipse.epp.mpc.core.model.INode) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) DefaultMarketplaceService(org.eclipse.epp.internal.mpc.core.service.DefaultMarketplaceService) Node(org.eclipse.epp.internal.mpc.core.model.Node) INode(org.eclipse.epp.mpc.core.model.INode) ICategory(org.eclipse.epp.mpc.core.model.ICategory) IMarketplaceService(org.eclipse.epp.mpc.core.service.IMarketplaceService) IMarket(org.eclipse.epp.mpc.core.model.IMarket) URL(java.net.URL) Test(org.junit.Test)

Aggregations

DefaultMarketplaceService (org.eclipse.epp.internal.mpc.core.service.DefaultMarketplaceService)7 URL (java.net.URL)5 ICategory (org.eclipse.epp.mpc.core.model.ICategory)3 IMarket (org.eclipse.epp.mpc.core.model.IMarket)3 IMarketplaceService (org.eclipse.epp.mpc.core.service.IMarketplaceService)3 Before (org.junit.Before)3 MalformedURLException (java.net.MalformedURLException)2 Test (org.junit.Test)2 URI (java.net.URI)1 Map (java.util.Map)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 Category (org.eclipse.epp.internal.mpc.core.model.Category)1 Market (org.eclipse.epp.internal.mpc.core.model.Market)1 Node (org.eclipse.epp.internal.mpc.core.model.Node)1 CachingMarketplaceService (org.eclipse.epp.internal.mpc.core.service.CachingMarketplaceService)1 MarketplaceCatalog (org.eclipse.epp.internal.mpc.ui.catalog.MarketplaceCatalog)1 MarketplaceDiscoveryStrategy (org.eclipse.epp.internal.mpc.ui.catalog.MarketplaceDiscoveryStrategy)1 InstallProfile (org.eclipse.epp.internal.mpc.ui.wizards.InstallProfile)1 ContentType (org.eclipse.epp.internal.mpc.ui.wizards.MarketplaceViewer.ContentType)1