Merged 2.0.0-m3

This commit is contained in:
Philipp Czora
2018-10-04 11:53:08 +02:00
21 changed files with 126 additions and 125 deletions

View File

@@ -4,11 +4,11 @@ import java.net.URI;
public interface ScmPathInfo {
String REST_API_PATH = "/api/rest";
String REST_API_PATH = "/api";
URI getApiRestUri();
default URI getRootUri() {
return getApiRestUri().resolve("../..");
return getApiRestUri().resolve("..");
}
}

View File

@@ -114,7 +114,7 @@ public class InitializingHttpScmProtocolWrapperTest {
}
private OngoingStubbing<ScmPathInfo> mockSetPathInfo() {
return when(pathInfoStore.get()).thenReturn(() -> URI.create("http://example.com/scm/api/rest/"));
return when(pathInfoStore.get()).thenReturn(() -> URI.create("http://example.com/scm/api/"));
}
}

View File

@@ -36,6 +36,7 @@ package sonia.scm.it;
import org.apache.http.HttpStatus;
import org.assertj.core.api.Assertions;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;

View File

@@ -10,7 +10,7 @@ import static java.net.URI.create;
public class RestUtil {
public static final URI BASE_URL = create("http://localhost:8081/scm/");
public static final URI REST_BASE_URL = BASE_URL.resolve("api/rest/v2/");
public static final URI REST_BASE_URL = BASE_URL.resolve("api/v2/");
public static URI createResourceUrl(String path) {
return REST_BASE_URL.resolve(path);

View File

@@ -5,7 +5,7 @@
"scripts": {
"bootstrap": "lerna bootstrap",
"link": "lerna exec -- yarn link",
"unlink": "lerna exec -- yarn unlink"
"unlink": "lerna exec --no-bail -- yarn unlink"
},
"devDependencies": {
"lerna": "^3.2.1"

View File

@@ -32,7 +32,7 @@ export function createUrl(url: string) {
if (url.indexOf("/") !== 0) {
urlWithStartingSlash = "/" + urlWithStartingSlash;
}
return `${contextPath}/api/rest/v2${urlWithStartingSlash}`;
return `${contextPath}/api/v2${urlWithStartingSlash}`;
}
class ApiClient {

View File

@@ -9,7 +9,7 @@ describe("create url", () => {
});
it("should add prefix for api", () => {
expect(createUrl("/users")).toBe("/api/rest/v2/users");
expect(createUrl("users")).toBe("/api/rest/v2/users");
expect(createUrl("/users")).toBe("/api/v2/users");
expect(createUrl("users")).toBe("/api/v2/users");
});
});

View File

@@ -48,6 +48,16 @@
<script>bootstrap</script>
</configuration>
</execution>
<execution>
<id>unlink</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<script>unlink</script>
</configuration>
</execution>
<execution>
<id>link</id>
<phase>package</phase>
@@ -58,16 +68,6 @@
<script>link</script>
</configuration>
</execution>
<execution>
<id>unlink</id>
<phase>clean</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<script>unlink</script>
</configuration>
</execution>
</executions>
</plugin>

View File

@@ -23,7 +23,7 @@ import reducer, {
getConfigUpdatePermission
} from "./config";
const CONFIG_URL = "/api/rest/v2/config";
const CONFIG_URL = "/api/v2/config";
const error = new Error("You have an error!");
@@ -51,8 +51,8 @@ const config = {
enabledXsrfProtection: true,
defaultNamespaceStrategy: "sonia.scm.repository.DefaultNamespaceStrategy",
_links: {
self: { href: "http://localhost:8081/api/rest/v2/config" },
update: { href: "http://localhost:8081/api/rest/v2/config" }
self: { href: "http://localhost:8081/api/v2/config" },
update: { href: "http://localhost:8081/api/v2/config" }
}
};
@@ -80,8 +80,8 @@ const configWithNullValues = {
enabledXsrfProtection: true,
defaultNamespaceStrategy: "sonia.scm.repository.DefaultNamespaceStrategy",
_links: {
self: { href: "http://localhost:8081/api/rest/v2/config" },
update: { href: "http://localhost:8081/api/rest/v2/config" }
self: { href: "http://localhost:8081/api/v2/config" },
update: { href: "http://localhost:8081/api/v2/config" }
}
};
@@ -135,7 +135,7 @@ describe("config fetch()", () => {
});
it("should successfully modify config", () => {
fetchMock.putOnce("http://localhost:8081/api/rest/v2/config", {
fetchMock.putOnce("http://localhost:8081/api/v2/config", {
status: 204
});
@@ -150,7 +150,7 @@ describe("config fetch()", () => {
});
it("should call the callback after modifying config", () => {
fetchMock.putOnce("http://localhost:8081/api/rest/v2/config", {
fetchMock.putOnce("http://localhost:8081/api/v2/config", {
status: 204
});
@@ -169,7 +169,7 @@ describe("config fetch()", () => {
});
it("should fail modifying config on HTTP 500", () => {
fetchMock.putOnce("http://localhost:8081/api/rest/v2/config", {
fetchMock.putOnce("http://localhost:8081/api/v2/config", {
status: 500
});

View File

@@ -44,7 +44,7 @@ import reducer, {
MODIFY_GROUP_SUCCESS,
MODIFY_GROUP_FAILURE
} from "./groups";
const GROUPS_URL = "/api/rest/v2/groups";
const GROUPS_URL = "/api/v2/groups";
const error = new Error("You have an error!");
@@ -57,13 +57,13 @@ const humanGroup = {
members: ["userZaphod"],
_links: {
self: {
href: "http://localhost:8081/api/rest/v2/groups/humanGroup"
href: "http://localhost:8081/api/v2/groups/humanGroup"
},
delete: {
href: "http://localhost:8081/api/rest/v2/groups/humanGroup"
href: "http://localhost:8081/api/v2/groups/humanGroup"
},
update: {
href:"http://localhost:8081/api/rest/v2/groups/humanGroup"
href:"http://localhost:8081/api/v2/groups/humanGroup"
}
},
_embedded: {
@@ -72,7 +72,7 @@ const humanGroup = {
name: "userZaphod",
_links: {
self: {
href: "http://localhost:8081/api/rest/v2/users/userZaphod"
href: "http://localhost:8081/api/v2/users/userZaphod"
}
}
}
@@ -89,13 +89,13 @@ const emptyGroup = {
members: [],
_links: {
self: {
href: "http://localhost:8081/api/rest/v2/groups/emptyGroup"
href: "http://localhost:8081/api/v2/groups/emptyGroup"
},
delete: {
href: "http://localhost:8081/api/rest/v2/groups/emptyGroup"
href: "http://localhost:8081/api/v2/groups/emptyGroup"
},
update: {
href:"http://localhost:8081/api/rest/v2/groups/emptyGroup"
href:"http://localhost:8081/api/v2/groups/emptyGroup"
}
},
_embedded: {
@@ -108,16 +108,16 @@ const responseBody = {
pageTotal: 1,
_links: {
self: {
href: "http://localhost:3000/api/rest/v2/groups/?page=0&pageSize=10"
href: "http://localhost:3000/api/v2/groups/?page=0&pageSize=10"
},
first: {
href: "http://localhost:3000/api/rest/v2/groups/?page=0&pageSize=10"
href: "http://localhost:3000/api/v2/groups/?page=0&pageSize=10"
},
last: {
href: "http://localhost:3000/api/rest/v2/groups/?page=0&pageSize=10"
href: "http://localhost:3000/api/v2/groups/?page=0&pageSize=10"
},
create: {
href: "http://localhost:3000/api/rest/v2/groups/"
href: "http://localhost:3000/api/v2/groups/"
}
},
_embedded: {
@@ -244,7 +244,7 @@ describe("groups fetch()", () => {
});
it("should successfully modify group", () => {
fetchMock.putOnce("http://localhost:8081/api/rest/v2/groups/humanGroup", {
fetchMock.putOnce("http://localhost:8081/api/v2/groups/humanGroup", {
status: 204
});
@@ -259,7 +259,7 @@ describe("groups fetch()", () => {
});
it("should call the callback after modifying group", () => {
fetchMock.putOnce("http://localhost:8081/api/rest/v2/groups/humanGroup", {
fetchMock.putOnce("http://localhost:8081/api/v2/groups/humanGroup", {
status: 204
});
@@ -278,7 +278,7 @@ describe("groups fetch()", () => {
});
it("should fail modifying group on HTTP 500", () => {
fetchMock.putOnce("http://localhost:8081/api/rest/v2/groups/humanGroup", {
fetchMock.putOnce("http://localhost:8081/api/v2/groups/humanGroup", {
status: 500
});
@@ -293,7 +293,7 @@ describe("groups fetch()", () => {
});
it("should delete successfully group humanGroup", () => {
fetchMock.deleteOnce("http://localhost:8081/api/rest/v2/groups/humanGroup", {
fetchMock.deleteOnce("http://localhost:8081/api/v2/groups/humanGroup", {
status: 204
});
@@ -308,7 +308,7 @@ describe("groups fetch()", () => {
});
it("should call the callback, after successful delete", () => {
fetchMock.deleteOnce("http://localhost:8081/api/rest/v2/groups/humanGroup", {
fetchMock.deleteOnce("http://localhost:8081/api/v2/groups/humanGroup", {
status: 204
});
@@ -324,7 +324,7 @@ describe("groups fetch()", () => {
});
it("should fail to delete group humanGroup", () => {
fetchMock.deleteOnce("http://localhost:8081/api/rest/v2/groups/humanGroup", {
fetchMock.deleteOnce("http://localhost:8081/api/v2/groups/humanGroup", {
status: 500
});

View File

@@ -78,7 +78,7 @@ describe("auth actions", () => {
});
it("should dispatch login success and dispatch fetch me", () => {
fetchMock.postOnce("/api/rest/v2/auth/access_token", {
fetchMock.postOnce("/api/v2/auth/access_token", {
body: {
cookie: true,
grant_type: "password",
@@ -88,7 +88,7 @@ describe("auth actions", () => {
headers: { "content-type": "application/json" }
});
fetchMock.getOnce("/api/rest/v2/me", {
fetchMock.getOnce("/api/v2/me", {
body: me,
headers: { "content-type": "application/json" }
});
@@ -106,7 +106,7 @@ describe("auth actions", () => {
});
it("should dispatch login failure", () => {
fetchMock.postOnce("/api/rest/v2/auth/access_token", {
fetchMock.postOnce("/api/v2/auth/access_token", {
status: 400
});
@@ -120,7 +120,7 @@ describe("auth actions", () => {
});
it("should dispatch fetch me success", () => {
fetchMock.getOnce("/api/rest/v2/me", {
fetchMock.getOnce("/api/v2/me", {
body: me,
headers: { "content-type": "application/json" }
});
@@ -141,7 +141,7 @@ describe("auth actions", () => {
});
it("should dispatch fetch me failure", () => {
fetchMock.getOnce("/api/rest/v2/me", {
fetchMock.getOnce("/api/v2/me", {
status: 500
});
@@ -155,7 +155,7 @@ describe("auth actions", () => {
});
it("should dispatch fetch me unauthorized", () => {
fetchMock.getOnce("/api/rest/v2/me", {
fetchMock.getOnce("/api/v2/me", {
status: 401
});
@@ -173,11 +173,11 @@ describe("auth actions", () => {
});
it("should dispatch logout success", () => {
fetchMock.deleteOnce("/api/rest/v2/auth/access_token", {
fetchMock.deleteOnce("/api/v2/auth/access_token", {
status: 204
});
fetchMock.getOnce("/api/rest/v2/me", {
fetchMock.getOnce("/api/v2/me", {
status: 401
});
@@ -194,7 +194,7 @@ describe("auth actions", () => {
});
it("should dispatch logout failure", () => {
fetchMock.deleteOnce("/api/rest/v2/auth/access_token", {
fetchMock.deleteOnce("/api/v2/auth/access_token", {
status: 500
});

View File

@@ -58,33 +58,33 @@ const hitchhikerPuzzle42: Repository = {
type: "svn",
_links: {
self: {
href: "http://localhost:8081/api/rest/v2/repositories/hitchhiker/puzzle42"
href: "http://localhost:8081/api/v2/repositories/hitchhiker/puzzle42"
},
delete: {
href: "http://localhost:8081/api/rest/v2/repositories/hitchhiker/puzzle42"
href: "http://localhost:8081/api/v2/repositories/hitchhiker/puzzle42"
},
update: {
href: "http://localhost:8081/api/rest/v2/repositories/hitchhiker/puzzle42"
href: "http://localhost:8081/api/v2/repositories/hitchhiker/puzzle42"
},
permissions: {
href:
"http://localhost:8081/api/rest/v2/repositories/hitchhiker/puzzle42/permissions/"
"http://localhost:8081/api/v2/repositories/hitchhiker/puzzle42/permissions/"
},
tags: {
href:
"http://localhost:8081/api/rest/v2/repositories/hitchhiker/puzzle42/tags/"
"http://localhost:8081/api/v2/repositories/hitchhiker/puzzle42/tags/"
},
branches: {
href:
"http://localhost:8081/api/rest/v2/repositories/hitchhiker/puzzle42/branches/"
"http://localhost:8081/api/v2/repositories/hitchhiker/puzzle42/branches/"
},
changesets: {
href:
"http://localhost:8081/api/rest/v2/repositories/hitchhiker/puzzle42/changesets/"
"http://localhost:8081/api/v2/repositories/hitchhiker/puzzle42/changesets/"
},
sources: {
href:
"http://localhost:8081/api/rest/v2/repositories/hitchhiker/puzzle42/sources/"
"http://localhost:8081/api/v2/repositories/hitchhiker/puzzle42/sources/"
}
}
};
@@ -100,35 +100,35 @@ const hitchhikerRestatend: Repository = {
_links: {
self: {
href:
"http://localhost:8081/api/rest/v2/repositories/hitchhiker/restatend"
"http://localhost:8081/api/v2/repositories/hitchhiker/restatend"
},
delete: {
href:
"http://localhost:8081/api/rest/v2/repositories/hitchhiker/restatend"
"http://localhost:8081/api/v2/repositories/hitchhiker/restatend"
},
update: {
href:
"http://localhost:8081/api/rest/v2/repositories/hitchhiker/restatend"
"http://localhost:8081/api/v2/repositories/hitchhiker/restatend"
},
permissions: {
href:
"http://localhost:8081/api/rest/v2/repositories/hitchhiker/restatend/permissions/"
"http://localhost:8081/api/v2/repositories/hitchhiker/restatend/permissions/"
},
tags: {
href:
"http://localhost:8081/api/rest/v2/repositories/hitchhiker/restatend/tags/"
"http://localhost:8081/api/v2/repositories/hitchhiker/restatend/tags/"
},
branches: {
href:
"http://localhost:8081/api/rest/v2/repositories/hitchhiker/restatend/branches/"
"http://localhost:8081/api/v2/repositories/hitchhiker/restatend/branches/"
},
changesets: {
href:
"http://localhost:8081/api/rest/v2/repositories/hitchhiker/restatend/changesets/"
"http://localhost:8081/api/v2/repositories/hitchhiker/restatend/changesets/"
},
sources: {
href:
"http://localhost:8081/api/rest/v2/repositories/hitchhiker/restatend/sources/"
"http://localhost:8081/api/v2/repositories/hitchhiker/restatend/sources/"
}
}
};
@@ -142,32 +142,32 @@ const slartiFjords: Repository = {
creationDate: "2018-07-31T08:59:05.653Z",
_links: {
self: {
href: "http://localhost:8081/api/rest/v2/repositories/slarti/fjords"
href: "http://localhost:8081/api/v2/repositories/slarti/fjords"
},
delete: {
href: "http://localhost:8081/api/rest/v2/repositories/slarti/fjords"
href: "http://localhost:8081/api/v2/repositories/slarti/fjords"
},
update: {
href: "http://localhost:8081/api/rest/v2/repositories/slarti/fjords"
href: "http://localhost:8081/api/v2/repositories/slarti/fjords"
},
permissions: {
href:
"http://localhost:8081/api/rest/v2/repositories/slarti/fjords/permissions/"
"http://localhost:8081/api/v2/repositories/slarti/fjords/permissions/"
},
tags: {
href: "http://localhost:8081/api/rest/v2/repositories/slarti/fjords/tags/"
href: "http://localhost:8081/api/v2/repositories/slarti/fjords/tags/"
},
branches: {
href:
"http://localhost:8081/api/rest/v2/repositories/slarti/fjords/branches/"
"http://localhost:8081/api/v2/repositories/slarti/fjords/branches/"
},
changesets: {
href:
"http://localhost:8081/api/rest/v2/repositories/slarti/fjords/changesets/"
"http://localhost:8081/api/v2/repositories/slarti/fjords/changesets/"
},
sources: {
href:
"http://localhost:8081/api/rest/v2/repositories/slarti/fjords/sources/"
"http://localhost:8081/api/v2/repositories/slarti/fjords/sources/"
}
}
};
@@ -177,16 +177,16 @@ const repositoryCollection: RepositoryCollection = {
pageTotal: 1,
_links: {
self: {
href: "http://localhost:8081/api/rest/v2/repositories/?page=0&pageSize=10"
href: "http://localhost:8081/api/v2/repositories/?page=0&pageSize=10"
},
first: {
href: "http://localhost:8081/api/rest/v2/repositories/?page=0&pageSize=10"
href: "http://localhost:8081/api/v2/repositories/?page=0&pageSize=10"
},
last: {
href: "http://localhost:8081/api/rest/v2/repositories/?page=0&pageSize=10"
href: "http://localhost:8081/api/v2/repositories/?page=0&pageSize=10"
},
create: {
href: "http://localhost:8081/api/rest/v2/repositories/"
href: "http://localhost:8081/api/v2/repositories/"
}
},
_embedded: {
@@ -199,16 +199,16 @@ const repositoryCollectionWithNames: RepositoryCollection = {
pageTotal: 1,
_links: {
self: {
href: "http://localhost:8081/api/rest/v2/repositories/?page=0&pageSize=10"
href: "http://localhost:8081/api/v2/repositories/?page=0&pageSize=10"
},
first: {
href: "http://localhost:8081/api/rest/v2/repositories/?page=0&pageSize=10"
href: "http://localhost:8081/api/v2/repositories/?page=0&pageSize=10"
},
last: {
href: "http://localhost:8081/api/rest/v2/repositories/?page=0&pageSize=10"
href: "http://localhost:8081/api/v2/repositories/?page=0&pageSize=10"
},
create: {
href: "http://localhost:8081/api/rest/v2/repositories/"
href: "http://localhost:8081/api/v2/repositories/"
}
},
_embedded: {
@@ -221,7 +221,7 @@ const repositoryCollectionWithNames: RepositoryCollection = {
};
describe("repos fetch", () => {
const REPOS_URL = "/api/rest/v2/repositories";
const REPOS_URL = "/api/v2/repositories";
const SORT = "sortBy=namespaceAndName";
const REPOS_URL_WITH_SORT = REPOS_URL + "?" + SORT;
const mockStore = configureMockStore([thunk]);
@@ -293,7 +293,7 @@ describe("repos fetch", () => {
it("should append sortby parameter and successfully fetch repos from link", () => {
fetchMock.getOnce(
"/api/rest/v2/repositories?one=1&sortBy=namespaceAndName",
"/api/v2/repositories?one=1&sortBy=namespaceAndName",
repositoryCollection
);
@@ -421,7 +421,7 @@ describe("repos fetch", () => {
it("should successfully delete repo slarti/fjords", () => {
fetchMock.delete(
"http://localhost:8081/api/rest/v2/repositories/slarti/fjords",
"http://localhost:8081/api/v2/repositories/slarti/fjords",
{
status: 204
}
@@ -448,7 +448,7 @@ describe("repos fetch", () => {
it("should successfully delete repo slarti/fjords and call the callback", () => {
fetchMock.delete(
"http://localhost:8081/api/rest/v2/repositories/slarti/fjords",
"http://localhost:8081/api/v2/repositories/slarti/fjords",
{
status: 204
}
@@ -468,7 +468,7 @@ describe("repos fetch", () => {
it("should disapatch failure on delete, if server returns status code 500", () => {
fetchMock.delete(
"http://localhost:8081/api/rest/v2/repositories/slarti/fjords",
"http://localhost:8081/api/v2/repositories/slarti/fjords",
{
status: 500
}

View File

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

View File

@@ -100,7 +100,7 @@ const hitchhiker_puzzle42RepoPermissions = {
};
describe("permission fetch", () => {
const REPOS_URL = "/api/rest/v2/repositories";
const REPOS_URL = "/api/v2/repositories";
const mockStore = configureMockStore([thunk]);
afterEach(() => {

View File

@@ -61,13 +61,13 @@ const userZaphod = {
properties: {},
_links: {
self: {
href: "http://localhost:8081/api/rest/v2/users/zaphod"
href: "http://localhost:8081/api/v2/users/zaphod"
},
delete: {
href: "http://localhost:8081/api/rest/v2/users/zaphod"
href: "http://localhost:8081/api/v2/users/zaphod"
},
update: {
href: "http://localhost:8081/api/rest/v2/users/zaphod"
href: "http://localhost:8081/api/v2/users/zaphod"
}
}
};
@@ -84,13 +84,13 @@ const userFord = {
properties: {},
_links: {
self: {
href: "http://localhost:8081/api/rest/v2/users/ford"
href: "http://localhost:8081/api/v2/users/ford"
},
delete: {
href: "http://localhost:8081/api/rest/v2/users/ford"
href: "http://localhost:8081/api/v2/users/ford"
},
update: {
href: "http://localhost:8081/api/rest/v2/users/ford"
href: "http://localhost:8081/api/v2/users/ford"
}
}
};
@@ -100,16 +100,16 @@ const responseBody = {
pageTotal: 1,
_links: {
self: {
href: "http://localhost:3000/api/rest/v2/users/?page=0&pageSize=10"
href: "http://localhost:3000/api/v2/users/?page=0&pageSize=10"
},
first: {
href: "http://localhost:3000/api/rest/v2/users/?page=0&pageSize=10"
href: "http://localhost:3000/api/v2/users/?page=0&pageSize=10"
},
last: {
href: "http://localhost:3000/api/rest/v2/users/?page=0&pageSize=10"
href: "http://localhost:3000/api/v2/users/?page=0&pageSize=10"
},
create: {
href: "http://localhost:3000/api/rest/v2/users/"
href: "http://localhost:3000/api/v2/users/"
}
},
_embedded: {
@@ -122,7 +122,7 @@ const response = {
responseBody
};
const USERS_URL = "/api/rest/v2/users";
const USERS_URL = "/api/v2/users";
const error = new Error("KAPUTT");
@@ -241,7 +241,7 @@ describe("users fetch()", () => {
});
it("successfully update user", () => {
fetchMock.putOnce("http://localhost:8081/api/rest/v2/users/zaphod", {
fetchMock.putOnce("http://localhost:8081/api/v2/users/zaphod", {
status: 204
});
@@ -255,7 +255,7 @@ describe("users fetch()", () => {
});
it("should call callback, after successful modified user", () => {
fetchMock.putOnce("http://localhost:8081/api/rest/v2/users/zaphod", {
fetchMock.putOnce("http://localhost:8081/api/v2/users/zaphod", {
status: 204
});
@@ -271,7 +271,7 @@ describe("users fetch()", () => {
});
it("should fail updating user on HTTP 500", () => {
fetchMock.putOnce("http://localhost:8081/api/rest/v2/users/zaphod", {
fetchMock.putOnce("http://localhost:8081/api/v2/users/zaphod", {
status: 500
});
@@ -285,7 +285,7 @@ describe("users fetch()", () => {
});
it("should delete successfully user zaphod", () => {
fetchMock.deleteOnce("http://localhost:8081/api/rest/v2/users/zaphod", {
fetchMock.deleteOnce("http://localhost:8081/api/v2/users/zaphod", {
status: 204
});
@@ -300,7 +300,7 @@ describe("users fetch()", () => {
});
it("should call the callback, after successful delete", () => {
fetchMock.deleteOnce("http://localhost:8081/api/rest/v2/users/zaphod", {
fetchMock.deleteOnce("http://localhost:8081/api/v2/users/zaphod", {
status: 204
});
@@ -316,7 +316,7 @@ describe("users fetch()", () => {
});
it("should fail to delete user zaphod", () => {
fetchMock.deleteOnce("http://localhost:8081/api/rest/v2/users/zaphod", {
fetchMock.deleteOnce("http://localhost:8081/api/v2/users/zaphod", {
status: 500
});

View File

@@ -62,7 +62,7 @@
<modules>
<jaxrs datatype-detection="local">
<application path="/api/rest" />
<application path="/api" />
</jaxrs>
<docs disableResourceLinks="true" includeApplicationPath="true" />

View File

@@ -152,7 +152,7 @@ public class ScmServletModule extends ServletModule
public static final String PATTERN_PLUGIN_SCRIPT = "/plugins/resources/js/*";
/** Field description */
public static final String PATTERN_RESTAPI = "/api/rest/*";
public static final String PATTERN_RESTAPI = "/api/*";
/** Field description */
public static final String PATTERN_SCRIPT = "*.js";

View File

@@ -59,7 +59,7 @@
<context-param>
<param-name>resteasy.servlet.mapping.prefix</param-name>
<param-value>/api/rest</param-value>
<param-value>/api</param-value>
</context-param>
<servlet>
@@ -71,7 +71,7 @@
<servlet-mapping>
<servlet-name>Resteasy</servlet-name>
<url-pattern>/api/rest/*</url-pattern>
<url-pattern>/api/*</url-pattern>
</servlet-mapping>
<!-- capture sessions -->

View File

@@ -107,7 +107,7 @@ public class SecurityFilterTest {
*/
@Test
public void testDoOnAuthenticationUrlV1() throws IOException, ServletException {
checkIfAuthenticationUrlIsPassedThrough("/scm/api/rest/auth/access_token");
checkIfAuthenticationUrlIsPassedThrough("/scm/api/auth/access_token");
}
/**
@@ -118,7 +118,7 @@ public class SecurityFilterTest {
*/
@Test
public void testDoOnAuthenticationUrlV2() throws IOException, ServletException {
checkIfAuthenticationUrlIsPassedThrough("/scm/api/rest/v2/auth/access_token");
checkIfAuthenticationUrlIsPassedThrough("/scm/api/v2/auth/access_token");
}
private void checkIfAuthenticationUrlIsPassedThrough(String uri) throws IOException, ServletException {

View File

@@ -78,7 +78,7 @@ public final class IntegrationTestUtil
public static final String BASE_URL = "http://localhost:8081/scm/";
/** scm-manager base url for the rest api */
public static final String REST_BASE_URL = BASE_URL.concat("api/rest/v2/");
public static final String REST_BASE_URL = BASE_URL.concat("api/v2/");
//~--- constructors ---------------------------------------------------------

View File

@@ -21,7 +21,7 @@ public class SecurityRequestsTest {
@Test
public void testIsAuthenticationRequestWithContextPath() {
when(request.getRequestURI()).thenReturn("/scm/api/rest/auth/access_token");
when(request.getRequestURI()).thenReturn("/scm/api/auth/access_token");
when(request.getContextPath()).thenReturn("/scm");
assertTrue(SecurityRequests.isAuthenticationRequest(request));
@@ -29,9 +29,9 @@ public class SecurityRequestsTest {
@Test
public void testIsAuthenticationRequest() throws Exception {
assertTrue(SecurityRequests.isAuthenticationRequest("/api/rest/auth/access_token"));
assertTrue(SecurityRequests.isAuthenticationRequest("/api/rest/v2/auth/access_token"));
assertFalse(SecurityRequests.isAuthenticationRequest("/api/rest/repositories"));
assertFalse(SecurityRequests.isAuthenticationRequest("/api/rest/v2/repositories"));
assertTrue(SecurityRequests.isAuthenticationRequest("/api/auth/access_token"));
assertTrue(SecurityRequests.isAuthenticationRequest("/api/v2/auth/access_token"));
assertFalse(SecurityRequests.isAuthenticationRequest("/api/repositories"));
assertFalse(SecurityRequests.isAuthenticationRequest("/api/v2/repositories"));
}
}