mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-05-07 17:55:59 +02:00
Renames globalConfig to config.
From an SCMM point of view there is only one config, so no "global" necessary. The others configs are provided by plugins.
This commit is contained in:
@@ -19,7 +19,7 @@ public class VndMediaType {
|
||||
public static final String GROUP_COLLECTION = PREFIX + "groupCollection" + SUFFIX;
|
||||
public static final String REPOSITORY_COLLECTION = PREFIX + "repositoryCollection" + SUFFIX;
|
||||
|
||||
public static final String GLOBAL_CONFIG = PREFIX + "global_config" + SUFFIX;
|
||||
public static final String CONFIG = PREFIX + "config" + SUFFIX;
|
||||
|
||||
private VndMediaType() {
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.Set;
|
||||
@NoArgsConstructor
|
||||
@Getter
|
||||
@Setter
|
||||
public class GlobalConfigDto extends HalRepresentation {
|
||||
public class ConfigDto extends HalRepresentation {
|
||||
|
||||
private String proxyPassword;
|
||||
private int proxyPort;
|
||||
@@ -6,7 +6,7 @@ import sonia.scm.config.ScmConfiguration;
|
||||
// Mapstruct does not support parameterized (i.e. non-default) constructors. Thus, we need to use field injection.
|
||||
@SuppressWarnings("squid:S3306")
|
||||
@Mapper
|
||||
public abstract class GlobalConfigDtoToScmConfigurationMapper {
|
||||
public abstract class ConfigDtoToScmConfigurationMapper {
|
||||
|
||||
public abstract ScmConfiguration map(GlobalConfigDto dto);
|
||||
public abstract ScmConfiguration map(ConfigDto dto);
|
||||
}
|
||||
@@ -18,16 +18,16 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
@Path(GlobalConfigResource.GLOBAL_CONFIG_PATH_V2)
|
||||
public class GlobalConfigResource {
|
||||
@Path(ConfigResource.CONFIG_PATH_V2)
|
||||
public class ConfigResource {
|
||||
|
||||
static final String GLOBAL_CONFIG_PATH_V2 = "v2/config/global";
|
||||
private final GlobalConfigDtoToScmConfigurationMapper dtoToConfigMapper;
|
||||
private final ScmConfigurationToGlobalConfigDtoMapper configToDtoMapper;
|
||||
static final String CONFIG_PATH_V2 = "v2/config";
|
||||
private final ConfigDtoToScmConfigurationMapper dtoToConfigMapper;
|
||||
private final ScmConfigurationToConfigDtoMapper configToDtoMapper;
|
||||
private final ScmConfiguration configuration;
|
||||
|
||||
@Inject
|
||||
public GlobalConfigResource(GlobalConfigDtoToScmConfigurationMapper dtoToConfigMapper, ScmConfigurationToGlobalConfigDtoMapper configToDtoMapper, ScmConfiguration configuration) {
|
||||
public ConfigResource(ConfigDtoToScmConfigurationMapper dtoToConfigMapper, ScmConfigurationToConfigDtoMapper configToDtoMapper, ScmConfiguration configuration) {
|
||||
this.dtoToConfigMapper = dtoToConfigMapper;
|
||||
this.configToDtoMapper = configToDtoMapper;
|
||||
this.configuration = configuration;
|
||||
@@ -38,7 +38,7 @@ public class GlobalConfigResource {
|
||||
*/
|
||||
@GET
|
||||
@Path("")
|
||||
@Produces(VndMediaType.GLOBAL_CONFIG)
|
||||
@Produces(VndMediaType.CONFIG)
|
||||
@TypeHint(UserDto.class)
|
||||
@StatusCodes({
|
||||
@ResponseCode(code = 200, condition = "success"),
|
||||
@@ -62,7 +62,7 @@ public class GlobalConfigResource {
|
||||
*/
|
||||
@PUT
|
||||
@Path("")
|
||||
@Consumes(VndMediaType.GLOBAL_CONFIG)
|
||||
@Consumes(VndMediaType.CONFIG)
|
||||
@StatusCodes({
|
||||
@ResponseCode(code = 201, condition = "update success"),
|
||||
@ResponseCode(code = 401, condition = "not authenticated / invalid credentials"),
|
||||
@@ -70,7 +70,7 @@ public class GlobalConfigResource {
|
||||
@ResponseCode(code = 500, condition = "internal server error")
|
||||
})
|
||||
@TypeHint(TypeHint.NO_CONTENT.class)
|
||||
public Response update(GlobalConfigDto configDto, @Context UriInfo uriInfo) {
|
||||
public Response update(ConfigDto configDto, @Context UriInfo uriInfo) {
|
||||
|
||||
// This *could* be moved to ScmConfiguration or ScmConfigurationUtil classes.
|
||||
// But to where to check? load() or store()? Leave it for now, SCMv1 legacy that can be cleaned up later.
|
||||
@@ -15,8 +15,8 @@ public class MapperModule extends AbstractModule {
|
||||
bind(GroupToGroupDtoMapper.class).to(Mappers.getMapper(GroupToGroupDtoMapper.class).getClass());
|
||||
bind(GroupCollectionToDtoMapper.class);
|
||||
|
||||
bind(ScmConfigurationToGlobalConfigDtoMapper.class).to(Mappers.getMapper(ScmConfigurationToGlobalConfigDtoMapper.class).getClass());
|
||||
bind(GlobalConfigDtoToScmConfigurationMapper.class).to(Mappers.getMapper(GlobalConfigDtoToScmConfigurationMapper.class).getClass());
|
||||
bind(ScmConfigurationToConfigDtoMapper.class).to(Mappers.getMapper(ScmConfigurationToConfigDtoMapper.class).getClass());
|
||||
bind(ConfigDtoToScmConfigurationMapper.class).to(Mappers.getMapper(ConfigDtoToScmConfigurationMapper.class).getClass());
|
||||
|
||||
bind(RepositoryToRepositoryDtoMapper.class).to(Mappers.getMapper(RepositoryToRepositoryDtoMapper.class).getClass());
|
||||
bind(RepositoryDtoToRepositoryMapper.class).to(Mappers.getMapper(RepositoryDtoToRepositoryMapper.class).getClass());
|
||||
|
||||
@@ -101,23 +101,23 @@ class ResourceLinks {
|
||||
}
|
||||
}
|
||||
|
||||
GlobalConfigLinks globalConfig() {
|
||||
return new GlobalConfigLinks(uriInfoStore.get());
|
||||
ConfigLinks config() {
|
||||
return new ConfigLinks(uriInfoStore.get());
|
||||
}
|
||||
|
||||
static class GlobalConfigLinks {
|
||||
private final LinkBuilder globalConfigLinkBuilder;
|
||||
static class ConfigLinks {
|
||||
private final LinkBuilder configLinkBuilder;
|
||||
|
||||
GlobalConfigLinks(UriInfo uriInfo) {
|
||||
globalConfigLinkBuilder = new LinkBuilder(uriInfo, GlobalConfigResource.class);
|
||||
ConfigLinks(UriInfo uriInfo) {
|
||||
configLinkBuilder = new LinkBuilder(uriInfo, ConfigResource.class);
|
||||
}
|
||||
|
||||
String self() {
|
||||
return globalConfigLinkBuilder.method("get").parameters().href();
|
||||
return configLinkBuilder.method("get").parameters().href();
|
||||
}
|
||||
|
||||
String update() {
|
||||
return globalConfigLinkBuilder.method("update").parameters().href();
|
||||
return configLinkBuilder.method("update").parameters().href();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,18 +15,18 @@ import static de.otto.edison.hal.Links.linkingTo;
|
||||
// Mapstruct does not support parameterized (i.e. non-default) constructors. Thus, we need to use field injection.
|
||||
@SuppressWarnings("squid:S3306")
|
||||
@Mapper
|
||||
public abstract class ScmConfigurationToGlobalConfigDtoMapper {
|
||||
public abstract class ScmConfigurationToConfigDtoMapper {
|
||||
|
||||
@Inject
|
||||
private ResourceLinks resourceLinks;
|
||||
|
||||
public abstract GlobalConfigDto map(ScmConfiguration config);
|
||||
public abstract ConfigDto map(ScmConfiguration config);
|
||||
|
||||
@AfterMapping
|
||||
void appendLinks(ScmConfiguration config, @MappingTarget GlobalConfigDto target) {
|
||||
Links.Builder linksBuilder = linkingTo().self(resourceLinks.globalConfig().self());
|
||||
void appendLinks(ScmConfiguration config, @MappingTarget ConfigDto target) {
|
||||
Links.Builder linksBuilder = linkingTo().self(resourceLinks.config().self());
|
||||
if (ConfigurationPermissions.write(config).isPermitted()) {
|
||||
linksBuilder.single(link("update", resourceLinks.globalConfig().update()));
|
||||
linksBuilder.single(link("update", resourceLinks.config().update()));
|
||||
}
|
||||
target.add(linksBuilder.build());
|
||||
}
|
||||
@@ -12,10 +12,10 @@ import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.MockitoAnnotations.initMocks;
|
||||
|
||||
public class GlobalConfigDtoToScmConfigurationMapperTest {
|
||||
public class ConfigDtoToScmConfigurationMapperTest {
|
||||
|
||||
@InjectMocks
|
||||
private GlobalConfigDtoToScmConfigurationMapperImpl mapper;
|
||||
private ConfigDtoToScmConfigurationMapperImpl mapper;
|
||||
|
||||
private String[] expectedUsers = { "trillian", "arthur" };
|
||||
private String[] expectedGroups = { "admin", "plebs" };
|
||||
@@ -28,7 +28,7 @@ public class GlobalConfigDtoToScmConfigurationMapperTest {
|
||||
|
||||
@Test
|
||||
public void shouldMapFields() {
|
||||
GlobalConfigDto dto = createDefaultDto();
|
||||
ConfigDto dto = createDefaultDto();
|
||||
ScmConfiguration config = mapper.map(dto);
|
||||
|
||||
assertEquals("prPw" , config.getProxyPassword());
|
||||
@@ -53,29 +53,29 @@ public class GlobalConfigDtoToScmConfigurationMapperTest {
|
||||
assertTrue(config.isEnabledXsrfProtection());
|
||||
}
|
||||
|
||||
private GlobalConfigDto createDefaultDto() {
|
||||
GlobalConfigDto globalConfigDto = new GlobalConfigDto();
|
||||
globalConfigDto.setProxyPassword("prPw");
|
||||
globalConfigDto.setProxyPort(42);
|
||||
globalConfigDto.setProxyServer("srvr");
|
||||
globalConfigDto.setProxyUser("user");
|
||||
globalConfigDto.setEnableProxy(true);
|
||||
globalConfigDto.setRealmDescription("realm");
|
||||
globalConfigDto.setEnableRepositoryArchive(true);
|
||||
globalConfigDto.setDisableGroupingGrid(true);
|
||||
globalConfigDto.setDateFormat("yyyy");
|
||||
globalConfigDto.setAnonymousAccessEnabled(true);
|
||||
globalConfigDto.setAdminGroups(Sets.newSet(expectedGroups));
|
||||
globalConfigDto.setAdminUsers(Sets.newSet(expectedUsers));
|
||||
globalConfigDto.setBaseUrl("baseurl");
|
||||
globalConfigDto.setForceBaseUrl(true);
|
||||
globalConfigDto.setLoginAttemptLimit(41);
|
||||
globalConfigDto.setProxyExcludes(Sets.newSet(expectedExcludes));
|
||||
globalConfigDto.setSkipFailedAuthenticators(true);
|
||||
globalConfigDto.setPluginUrl("https://plug.ins");
|
||||
globalConfigDto.setLoginAttemptLimitTimeout(40);
|
||||
globalConfigDto.setEnabledXsrfProtection(true);
|
||||
private ConfigDto createDefaultDto() {
|
||||
ConfigDto configDto = new ConfigDto();
|
||||
configDto.setProxyPassword("prPw");
|
||||
configDto.setProxyPort(42);
|
||||
configDto.setProxyServer("srvr");
|
||||
configDto.setProxyUser("user");
|
||||
configDto.setEnableProxy(true);
|
||||
configDto.setRealmDescription("realm");
|
||||
configDto.setEnableRepositoryArchive(true);
|
||||
configDto.setDisableGroupingGrid(true);
|
||||
configDto.setDateFormat("yyyy");
|
||||
configDto.setAnonymousAccessEnabled(true);
|
||||
configDto.setAdminGroups(Sets.newSet(expectedGroups));
|
||||
configDto.setAdminUsers(Sets.newSet(expectedUsers));
|
||||
configDto.setBaseUrl("baseurl");
|
||||
configDto.setForceBaseUrl(true);
|
||||
configDto.setLoginAttemptLimit(41);
|
||||
configDto.setProxyExcludes(Sets.newSet(expectedExcludes));
|
||||
configDto.setSkipFailedAuthenticators(true);
|
||||
configDto.setPluginUrl("https://plug.ins");
|
||||
configDto.setLoginAttemptLimitTimeout(40);
|
||||
configDto.setEnabledXsrfProtection(true);
|
||||
|
||||
return globalConfigDto;
|
||||
return configDto;
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ import static org.mockito.MockitoAnnotations.initMocks;
|
||||
configuration = "classpath:sonia/scm/configuration/shiro.ini",
|
||||
password = "secret"
|
||||
)
|
||||
public class GlobalConfigResourceTest {
|
||||
public class ConfigResourceTest {
|
||||
|
||||
@Rule
|
||||
public ShiroRule shiro = new ShiroRule();
|
||||
@@ -45,36 +45,35 @@ public class GlobalConfigResourceTest {
|
||||
private ResourceLinks resourceLinks = ResourceLinksMock.createMock(baseUri);
|
||||
|
||||
@InjectMocks
|
||||
private GlobalConfigDtoToScmConfigurationMapperImpl dtoToConfigMapper;
|
||||
private ConfigDtoToScmConfigurationMapperImpl dtoToConfigMapper;
|
||||
@InjectMocks
|
||||
private ScmConfigurationToGlobalConfigDtoMapperImpl configToDtoMapper;
|
||||
private ScmConfigurationToConfigDtoMapperImpl configToDtoMapper;
|
||||
|
||||
@Before
|
||||
public void prepareEnvironment() {
|
||||
initMocks(this);
|
||||
|
||||
GlobalConfigResource globalConfigResource = new GlobalConfigResource(dtoToConfigMapper,
|
||||
configToDtoMapper, createConfiguration());
|
||||
ConfigResource configResource = new ConfigResource(dtoToConfigMapper, configToDtoMapper, createConfiguration());
|
||||
|
||||
dispatcher.getRegistry().addSingletonResource(globalConfigResource);
|
||||
dispatcher.getRegistry().addSingletonResource(configResource);
|
||||
}
|
||||
|
||||
@Test
|
||||
@SubjectAware(username = "readOnly")
|
||||
public void shouldGetGlobalConfig() throws URISyntaxException {
|
||||
MockHttpRequest request = MockHttpRequest.get("/" + GlobalConfigResource.GLOBAL_CONFIG_PATH_V2);
|
||||
MockHttpRequest request = MockHttpRequest.get("/" + ConfigResource.CONFIG_PATH_V2);
|
||||
MockHttpResponse response = new MockHttpResponse();
|
||||
dispatcher.invoke(request, response);
|
||||
assertEquals(HttpServletResponse.SC_OK, response.getStatus());
|
||||
assertTrue(response.getContentAsString().contains("\"proxyPassword\":\"heartOfGold\""));
|
||||
assertTrue(response.getContentAsString().contains("\"self\":{\"href\":\"/v2/config/global"));
|
||||
assertFalse("Update link present", response.getContentAsString().contains("\"update\":{\"href\":\"/v2/config/global"));
|
||||
assertTrue(response.getContentAsString().contains("\"self\":{\"href\":\"/v2/config"));
|
||||
assertFalse("Update link present", response.getContentAsString().contains("\"update\":{\"href\":\"/v2/config"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@SubjectAware(username = "writeOnly")
|
||||
public void shouldGetGlobalConfigOnlyWhenAuthorized() throws URISyntaxException {
|
||||
MockHttpRequest request = MockHttpRequest.get("/" + GlobalConfigResource.GLOBAL_CONFIG_PATH_V2);
|
||||
public void shouldGetConfigOnlyWhenAuthorized() throws URISyntaxException {
|
||||
MockHttpRequest request = MockHttpRequest.get("/" + ConfigResource.CONFIG_PATH_V2);
|
||||
MockHttpResponse response = new MockHttpResponse();
|
||||
|
||||
thrown.expectMessage("Subject does not have permission [configuration:read:global]");
|
||||
@@ -84,39 +83,38 @@ public class GlobalConfigResourceTest {
|
||||
|
||||
@Test
|
||||
@SubjectAware(username = "readWrite")
|
||||
public void shouldUpdateGlobalConfig() throws URISyntaxException, IOException {
|
||||
URL url = Resources.getResource("sonia/scm/api/v2/globalConfig-test-update.json");
|
||||
public void shouldUpdateConfig() throws URISyntaxException, IOException {
|
||||
URL url = Resources.getResource("sonia/scm/api/v2/config-test-update.json");
|
||||
byte[] configJson = Resources.toByteArray(url);
|
||||
MockHttpRequest request = MockHttpRequest.put("/" + GlobalConfigResource.GLOBAL_CONFIG_PATH_V2)
|
||||
.contentType(VndMediaType.GLOBAL_CONFIG)
|
||||
MockHttpRequest request = MockHttpRequest.put("/" + ConfigResource.CONFIG_PATH_V2)
|
||||
.contentType(VndMediaType.CONFIG)
|
||||
.content(configJson);
|
||||
|
||||
MockHttpResponse response = new MockHttpResponse();
|
||||
dispatcher.invoke(request, response);
|
||||
assertEquals(HttpServletResponse.SC_NO_CONTENT, response.getStatus());
|
||||
|
||||
request = MockHttpRequest.get("/" + GlobalConfigResource.GLOBAL_CONFIG_PATH_V2);
|
||||
request = MockHttpRequest.get("/" + ConfigResource.CONFIG_PATH_V2);
|
||||
response = new MockHttpResponse();
|
||||
dispatcher.invoke(request, response);
|
||||
assertEquals(HttpServletResponse.SC_OK, response.getStatus());
|
||||
assertTrue(response.getContentAsString().contains("\"proxyPassword\":\"newPassword\""));
|
||||
assertTrue(response.getContentAsString().contains("\"self\":{\"href\":\"/v2/config/global"));
|
||||
assertTrue("link not found", response.getContentAsString().contains("\"update\":{\"href\":\"/v2/config/global"));
|
||||
assertTrue(response.getContentAsString().contains("\"self\":{\"href\":\"/v2/config"));
|
||||
assertTrue("link not found", response.getContentAsString().contains("\"update\":{\"href\":\"/v2/config"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@SubjectAware(username = "readOnly")
|
||||
public void shouldUpdateGlobalConfigOnlyWhenAuthorized() throws URISyntaxException, IOException {
|
||||
URL url = Resources.getResource("sonia/scm/api/v2/globalConfig-test-update.json");
|
||||
public void shouldUpdateConfigOnlyWhenAuthorized() throws URISyntaxException, IOException {
|
||||
URL url = Resources.getResource("sonia/scm/api/v2/config-test-update.json");
|
||||
byte[] configJson = Resources.toByteArray(url);
|
||||
MockHttpRequest request = MockHttpRequest.put("/" + GlobalConfigResource.GLOBAL_CONFIG_PATH_V2)
|
||||
.contentType(VndMediaType.GLOBAL_CONFIG)
|
||||
MockHttpRequest request = MockHttpRequest.put("/" + ConfigResource.CONFIG_PATH_V2)
|
||||
.contentType(VndMediaType.CONFIG)
|
||||
.content(configJson);
|
||||
MockHttpResponse response = new MockHttpResponse();
|
||||
|
||||
thrown.expectMessage("Subject does not have permission [configuration:write:global]");
|
||||
|
||||
|
||||
dispatcher.invoke(request, response);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public class ResourceLinksMock {
|
||||
when(resourceLinks.changesetCollection()).thenReturn(new ResourceLinks.ChangesetCollectionLinks(uriInfo));
|
||||
when(resourceLinks.sourceCollection()).thenReturn(new ResourceLinks.SourceCollectionLinks(uriInfo));
|
||||
when(resourceLinks.permissionCollection()).thenReturn(new ResourceLinks.PermissionCollectionLinks(uriInfo));
|
||||
when(resourceLinks.globalConfig()).thenReturn(new ResourceLinks.GlobalConfigLinks(uriInfo));
|
||||
when(resourceLinks.config()).thenReturn(new ResourceLinks.ConfigLinks(uriInfo));
|
||||
return resourceLinks;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,15 +133,15 @@ public class ResourceLinksTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldCreateCorrectGlobalConfigSelfUrl() {
|
||||
String url = resourceLinks.globalConfig().self();
|
||||
assertEquals(BASE_URL + GlobalConfigResource.GLOBAL_CONFIG_PATH_V2, url);
|
||||
public void shouldCreateCorrectConfigSelfUrl() {
|
||||
String url = resourceLinks.config().self();
|
||||
assertEquals(BASE_URL + ConfigResource.CONFIG_PATH_V2, url);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldCreateCorrectGlobalConfigUpdateUrl() {
|
||||
String url = resourceLinks.globalConfig().update();
|
||||
assertEquals(BASE_URL + GlobalConfigResource.GLOBAL_CONFIG_PATH_V2, url);
|
||||
public void shouldCreateCorrectConfigUpdateUrl() {
|
||||
String url = resourceLinks.config().update();
|
||||
assertEquals(BASE_URL + ConfigResource.CONFIG_PATH_V2, url);
|
||||
}
|
||||
|
||||
@Before
|
||||
|
||||
@@ -21,7 +21,7 @@ import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.mockito.MockitoAnnotations.initMocks;
|
||||
|
||||
public class ScmConfigurationToGlobalConfigDtoMapperTest {
|
||||
public class ScmConfigurationToConfigDtoMapperTest {
|
||||
|
||||
private URI baseUri = URI.create("http://example.com/base/");
|
||||
|
||||
@@ -33,7 +33,7 @@ public class ScmConfigurationToGlobalConfigDtoMapperTest {
|
||||
private ResourceLinks resourceLinks = ResourceLinksMock.createMock(baseUri);
|
||||
|
||||
@InjectMocks
|
||||
private ScmConfigurationToGlobalConfigDtoMapperImpl mapper;
|
||||
private ScmConfigurationToConfigDtoMapperImpl mapper;
|
||||
|
||||
private final Subject subject = mock(Subject.class);
|
||||
private final ThreadState subjectThreadState = new SubjectThreadState(subject);
|
||||
@@ -43,7 +43,7 @@ public class ScmConfigurationToGlobalConfigDtoMapperTest {
|
||||
@Before
|
||||
public void init() {
|
||||
initMocks(this);
|
||||
expectedBaseUri = baseUri.resolve(GlobalConfigResource.GLOBAL_CONFIG_PATH_V2);
|
||||
expectedBaseUri = baseUri.resolve(ConfigResource.CONFIG_PATH_V2);
|
||||
subjectThreadState.bind();
|
||||
ThreadContext.bind(subject);
|
||||
}
|
||||
@@ -59,7 +59,7 @@ public class ScmConfigurationToGlobalConfigDtoMapperTest {
|
||||
|
||||
|
||||
when(subject.isPermitted("configuration:write:global")).thenReturn(true);
|
||||
GlobalConfigDto dto = mapper.map(config);
|
||||
ConfigDto dto = mapper.map(config);
|
||||
|
||||
assertEquals("heartOfGold" , dto.getProxyPassword());
|
||||
assertEquals(1234 , dto.getProxyPort());
|
||||
@@ -91,7 +91,7 @@ public class ScmConfigurationToGlobalConfigDtoMapperTest {
|
||||
ScmConfiguration config = createConfiguration();
|
||||
|
||||
when(subject.hasRole("configuration:write:global")).thenReturn(false);
|
||||
GlobalConfigDto dto = mapper.map(config);
|
||||
ConfigDto dto = mapper.map(config);
|
||||
|
||||
assertEquals("baseurl", dto.getBaseUrl());
|
||||
assertEquals(expectedBaseUri.toString(), dto.getLinks().getLinkBy("self").get().getHref());
|
||||
Reference in New Issue
Block a user