Remove direct dependency to UriInfo

This commit is contained in:
René Pfeuffer
2018-09-12 08:40:41 +02:00
parent e5e3e678ad
commit f718a2ba4c
22 changed files with 64 additions and 60 deletions

View File

@@ -61,7 +61,7 @@ public class HgConfigInstallationsResourceTest {
new HgConfigResource(null, null, null, null,
null, resourceProvider));
when(uriInfoStore.get().getBaseUri()).thenReturn(baseUri);
when(uriInfoStore.get().getApiRestUri()).thenReturn(baseUri);
}
@Test

View File

@@ -34,7 +34,7 @@ public class HgConfigInstallationsToDtoMapperTest {
@Before
public void init() {
when(uriInfoStore.get().getBaseUri()).thenReturn(baseUri);
when(uriInfoStore.get().getApiRestUri()).thenReturn(baseUri);
expectedBaseUri = baseUri.resolve(HgConfigResource.HG_CONFIG_PATH_V2 + "/installations/" + expectedPath);
}

View File

@@ -81,7 +81,7 @@ public class HgConfigPackageResourceTest {
public void prepareEnvironment() {
setupResources();
when(uriInfoStore.get().getBaseUri()).thenReturn(baseUri);
when(uriInfoStore.get().getApiRestUri()).thenReturn(baseUri);
when(hgPackageReader.getPackages().getPackages()).thenReturn(createPackages());
}

View File

@@ -1,6 +1,5 @@
package sonia.scm.api.v2.resources;
import de.otto.edison.hal.HalRepresentation;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -13,12 +12,10 @@ import sonia.scm.installer.HgPackages;
import java.net.URI;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when;
import static sonia.scm.api.v2.resources.HgConfigTests.assertEqualsPackage;
import static sonia.scm.api.v2.resources.HgConfigTests.createPackage;
@@ -38,7 +35,7 @@ public class HgConfigPackagesToDtoMapperTest {
@Before
public void init() {
when(uriInfoStore.get().getBaseUri()).thenReturn(baseUri);
when(uriInfoStore.get().getApiRestUri()).thenReturn(baseUri);
expectedBaseUri = baseUri.resolve(HgConfigResource.HG_CONFIG_PATH_V2 + "/packages");
}

View File

@@ -79,7 +79,7 @@ public class HgConfigResourceTest {
new HgConfigResource(dtoToConfigMapper, configToDtoMapper, repositoryHandler, packagesResource,
autoconfigResource, installationsResource);
dispatcher.getRegistry().addSingletonResource(gitConfigResource);
when(uriInfoStore.get().getBaseUri()).thenReturn(baseUri);
when(uriInfoStore.get().getApiRestUri()).thenReturn(baseUri);
}
@Test

View File

@@ -41,7 +41,7 @@ public class HgConfigToHgConfigDtoMapperTest {
@Before
public void init() {
when(uriInfoStore.get().getBaseUri()).thenReturn(baseUri);
when(uriInfoStore.get().getApiRestUri()).thenReturn(baseUri);
expectedBaseUri = baseUri.resolve(HgConfigResource.HG_CONFIG_PATH_V2);
subjectThreadState.bind();
ThreadContext.bind(subject);