Search in sources :

Example 1 with RepositoryService

use of org.mule.runtime.module.repository.api.RepositoryService in project mule by mulesoft.

the class RepositorySystemTestCase method existingResourceFromMaven.

@Test
public void existingResourceFromMaven() throws Exception {
    executeTestWithDefaultRemoteRepo(() -> {
        RepositoryService defaultRepositoryService = new RepositoryServiceFactory().createRepositoryService();
        File bundleFile = defaultRepositoryService.lookupBundle(VALID_BUNDLE);
        assertThat(bundleFile, notNullValue());
        assertThat(bundleFile.exists(), is(true));
        assertThat(bundleFile.getAbsolutePath().startsWith(temporaryFolder.getRoot().getAbsolutePath()), is(true));
    });
}
Also used : File(java.io.File) RepositoryService(org.mule.runtime.module.repository.api.RepositoryService) Test(org.junit.Test)

Example 2 with RepositoryService

use of org.mule.runtime.module.repository.api.RepositoryService in project mule by mulesoft.

the class RepositorySystemTestCase method noExistentResource.

@Test
public void noExistentResource() throws Exception {
    executeTestWithDefaultRemoteRepo(() -> {
        RepositoryService defaultRepositoryService = new RepositoryServiceFactory().createRepositoryService();
        BundleDescriptor bundleDescriptor = new BundleDescriptor.Builder().setGroupId("no").setArtifactId("existent").setVersion("bundle").build();
        expectedException.expect(BundleNotFoundException.class);
        defaultRepositoryService.lookupBundle(new BundleDependency.Builder().setDescriptor(bundleDescriptor).build());
    });
}
Also used : BundleDescriptor(org.mule.runtime.module.artifact.api.descriptor.BundleDescriptor) BundleDependency(org.mule.runtime.module.artifact.api.descriptor.BundleDependency) RepositoryService(org.mule.runtime.module.repository.api.RepositoryService) Test(org.junit.Test)

Example 3 with RepositoryService

use of org.mule.runtime.module.repository.api.RepositoryService in project mule by mulesoft.

the class RepositorySystemTestCase method invalidExternalRepository.

@Test
public void invalidExternalRepository() throws Exception {
    executeTestWithCustomRepoRepo("http://doesnotexists/repo", () -> {
        RepositoryService defaultRepositoryService = new RepositoryServiceFactory().createRepositoryService();
        expectedException.expect(RepositoryConnectionException.class);
        defaultRepositoryService.lookupBundle(VALID_BUNDLE);
    });
}
Also used : RepositoryService(org.mule.runtime.module.repository.api.RepositoryService) Test(org.junit.Test)

Example 4 with RepositoryService

use of org.mule.runtime.module.repository.api.RepositoryService in project mule by mulesoft.

the class RepositorySystemTestCase method noRepositoryConfigured.

@Test
public void noRepositoryConfigured() throws Exception {
    executeTestWithCustomRepoRepo(null, () -> {
        RepositoryService defaultRepositoryService = new RepositoryServiceFactory().createRepositoryService();
        expectedException.expect(RepositoryServiceDisabledException.class);
        defaultRepositoryService.lookupBundle(VALID_BUNDLE);
    });
}
Also used : RepositoryService(org.mule.runtime.module.repository.api.RepositoryService) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)4 RepositoryService (org.mule.runtime.module.repository.api.RepositoryService)4 File (java.io.File)1 BundleDependency (org.mule.runtime.module.artifact.api.descriptor.BundleDependency)1 BundleDescriptor (org.mule.runtime.module.artifact.api.descriptor.BundleDescriptor)1