change repository-types to repositoryTypes

This commit is contained in:
Maren Süwer
2018-08-07 12:58:16 +02:00
parent 9a4896b55d
commit 5731b607be
8 changed files with 15 additions and 15 deletions

View File

@@ -37,7 +37,7 @@
"test-ci": "jest --ci --coverage", "test-ci": "jest --ci --coverage",
"eject": "react-scripts eject", "eject": "react-scripts eject",
"flow": "flow", "flow": "flow",
"pre-commit": "jest && flow && eslint src" "pre-commit": "jest && eslint src"
}, },
"proxy": { "proxy": {
"/scm/api": { "/scm/api": {

View File

@@ -32,7 +32,7 @@ export function fetchRepositoryTypesIfNeeded() {
function fetchRepositoryTypes(dispatch: any) { function fetchRepositoryTypes(dispatch: any) {
dispatch(fetchRepositoryTypesPending()); dispatch(fetchRepositoryTypesPending());
return apiClient return apiClient
.get("repository-types") .get("repositoryTypes")
.then(response => response.json()) .then(response => response.json())
.then(repositoryTypes => { .then(repositoryTypes => {
dispatch(fetchRepositoryTypesSuccess(repositoryTypes)); dispatch(fetchRepositoryTypesSuccess(repositoryTypes));
@@ -84,7 +84,7 @@ export default function reducer(
action: Action = { type: "UNKNOWN" } action: Action = { type: "UNKNOWN" }
): RepositoryType[] { ): RepositoryType[] {
if (action.type === FETCH_REPOSITORY_TYPES_SUCCESS && action.payload) { if (action.type === FETCH_REPOSITORY_TYPES_SUCCESS && action.payload) {
return action.payload._embedded["repository-types"]; return action.payload._embedded["repositoryTypes"];
} }
return state; return state;
} }

View File

@@ -22,7 +22,7 @@ const git = {
displayName: "Git", displayName: "Git",
_links: { _links: {
self: { self: {
href: "http://localhost:8081/scm/api/rest/v2/repository-types/git" href: "http://localhost:8081/scm/api/rest/v2/repositoryTypes/git"
} }
} }
}; };
@@ -32,7 +32,7 @@ const hg = {
displayName: "Mercurial", displayName: "Mercurial",
_links: { _links: {
self: { self: {
href: "http://localhost:8081/scm/api/rest/v2/repository-types/hg" href: "http://localhost:8081/scm/api/rest/v2/repositoryTypes/hg"
} }
} }
}; };
@@ -42,18 +42,18 @@ const svn = {
displayName: "Subversion", displayName: "Subversion",
_links: { _links: {
self: { self: {
href: "http://localhost:8081/scm/api/rest/v2/repository-types/svn" href: "http://localhost:8081/scm/api/rest/v2/repositoryTypes/svn"
} }
} }
}; };
const collection = { const collection = {
_embedded: { _embedded: {
"repository-types": [git, hg, svn] repositoryTypes: [git, hg, svn]
}, },
_links: { _links: {
self: { self: {
href: "http://localhost:8081/scm/api/rest/v2/repository-types" href: "http://localhost:8081/scm/api/rest/v2/repositoryTypes"
} }
} }
}; };
@@ -97,7 +97,7 @@ describe("repository types caching", () => {
}); });
describe("repository types fetch", () => { describe("repository types fetch", () => {
const URL = "/scm/api/rest/v2/repository-types"; const URL = "/scm/api/rest/v2/repositoryTypes";
const mockStore = configureMockStore([thunk]); const mockStore = configureMockStore([thunk]);
afterEach(() => { afterEach(() => {

View File

@@ -9,6 +9,6 @@ export type RepositoryType = {
export type RepositoryTypeCollection = Collection & { export type RepositoryTypeCollection = Collection & {
_embedded: { _embedded: {
"repository-types": RepositoryType[] "repositoryTypes": RepositoryType[]
} }
}; };

View File

@@ -10,7 +10,7 @@ public class RepositoryTypeCollectionToDtoMapper extends CollectionToDtoMapper<R
@Inject @Inject
public RepositoryTypeCollectionToDtoMapper(RepositoryTypeToRepositoryTypeDtoMapper mapper, ResourceLinks resourceLinks) { public RepositoryTypeCollectionToDtoMapper(RepositoryTypeToRepositoryTypeDtoMapper mapper, ResourceLinks resourceLinks) {
super("repository-types", mapper); super("repositoryTypes", mapper);
this.resourceLinks = resourceLinks; this.resourceLinks = resourceLinks;
} }

View File

@@ -10,7 +10,7 @@ import javax.ws.rs.Path;
@Path(RepositoryTypeRootResource.PATH) @Path(RepositoryTypeRootResource.PATH)
public class RepositoryTypeRootResource { public class RepositoryTypeRootResource {
static final String PATH = "v2/repository-types/"; static final String PATH = "v2/repositoryTypes/";
private Provider<RepositoryTypeCollectionResource> collectionResourceProvider; private Provider<RepositoryTypeCollectionResource> collectionResourceProvider;
private Provider<RepositoryTypeResource> resourceProvider; private Provider<RepositoryTypeResource> resourceProvider;

View File

@@ -45,7 +45,7 @@ public class RepositoryTypeCollectionToDtoMapperTest {
public void shouldHaveEmbeddedDtos() { public void shouldHaveEmbeddedDtos() {
HalRepresentation mappedTypes = collectionMapper.map(types); HalRepresentation mappedTypes = collectionMapper.map(types);
Embedded embedded = mappedTypes.getEmbedded(); Embedded embedded = mappedTypes.getEmbedded();
List<RepositoryTypeDto> embeddedTypes = embedded.getItemsBy("repository-types", RepositoryTypeDto.class); List<RepositoryTypeDto> embeddedTypes = embedded.getItemsBy("repositoryTypes", RepositoryTypeDto.class);
assertEquals("hk", embeddedTypes.get(0).getName()); assertEquals("hk", embeddedTypes.get(0).getName());
assertEquals("hog", embeddedTypes.get(1).getName()); assertEquals("hog", embeddedTypes.get(1).getName());
} }
@@ -54,7 +54,7 @@ public class RepositoryTypeCollectionToDtoMapperTest {
public void shouldHaveSelfLink() { public void shouldHaveSelfLink() {
HalRepresentation mappedTypes = collectionMapper.map(types); HalRepresentation mappedTypes = collectionMapper.map(types);
Optional<Link> self = mappedTypes.getLinks().getLinkBy("self"); Optional<Link> self = mappedTypes.getLinks().getLinkBy("self");
assertEquals("https://scm-manager.org/scm/v2/repository-types/", self.get().getHref()); assertEquals("https://scm-manager.org/scm/v2/repositoryTypes/", self.get().getHref());
} }
} }

View File

@@ -35,7 +35,7 @@ public class RepositoryTypeToRepositoryTypeDtoMapperTest {
public void shouldAppendSelfLink() { public void shouldAppendSelfLink() {
RepositoryTypeDto dto = mapper.map(type); RepositoryTypeDto dto = mapper.map(type);
assertEquals( assertEquals(
"https://scm-manager.org/scm/v2/repository-types/hk", "https://scm-manager.org/scm/v2/repositoryTypes/hk",
dto.getLinks().getLinkBy("self").get().getHref() dto.getLinks().getLinkBy("self").get().getHref()
); );
} }