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",
"eject": "react-scripts eject",
"flow": "flow",
"pre-commit": "jest && flow && eslint src"
"pre-commit": "jest && eslint src"
},
"proxy": {
"/scm/api": {

View File

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

View File

@@ -22,7 +22,7 @@ const git = {
displayName: "Git",
_links: {
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",
_links: {
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",
_links: {
self: {
href: "http://localhost:8081/scm/api/rest/v2/repository-types/svn"
href: "http://localhost:8081/scm/api/rest/v2/repositoryTypes/svn"
}
}
};
const collection = {
_embedded: {
"repository-types": [git, hg, svn]
repositoryTypes: [git, hg, svn]
},
_links: {
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", () => {
const URL = "/scm/api/rest/v2/repository-types";
const URL = "/scm/api/rest/v2/repositoryTypes";
const mockStore = configureMockStore([thunk]);
afterEach(() => {

View File

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

View File

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

View File

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

View File

@@ -45,7 +45,7 @@ public class RepositoryTypeCollectionToDtoMapperTest {
public void shouldHaveEmbeddedDtos() {
HalRepresentation mappedTypes = collectionMapper.map(types);
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("hog", embeddedTypes.get(1).getName());
}
@@ -54,7 +54,7 @@ public class RepositoryTypeCollectionToDtoMapperTest {
public void shouldHaveSelfLink() {
HalRepresentation mappedTypes = collectionMapper.map(types);
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() {
RepositoryTypeDto dto = mapper.map(type);
assertEquals(
"https://scm-manager.org/scm/v2/repository-types/hk",
"https://scm-manager.org/scm/v2/repositoryTypes/hk",
dto.getLinks().getLinkBy("self").get().getHref()
);
}