mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-14 17:26:22 +01:00
close ClientResponse
This commit is contained in:
@@ -76,6 +76,7 @@ public class AuthenticationITCase extends AbstractITCaseBase
|
|||||||
|
|
||||||
assertNotNull(response);
|
assertNotNull(response);
|
||||||
assertTrue(response.getStatus() == 401);
|
assertTrue(response.getStatus() == 401);
|
||||||
|
response.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -120,6 +120,7 @@ public class GroupITCase extends AbstractAdminITCaseBase
|
|||||||
|
|
||||||
assertNotNull(response);
|
assertNotNull(response);
|
||||||
assertTrue(response.getStatus() == 204);
|
assertTrue(response.getStatus() == 204);
|
||||||
|
response.close();
|
||||||
|
|
||||||
Group other = getGroup("group-d");
|
Group other = getGroup("group-d");
|
||||||
|
|
||||||
@@ -149,6 +150,7 @@ public class GroupITCase extends AbstractAdminITCaseBase
|
|||||||
response.getEntity(new GenericType<Collection<Group>>() {}
|
response.getEntity(new GenericType<Collection<Group>>() {}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
response.close();
|
||||||
assertNotNull(groups);
|
assertNotNull(groups);
|
||||||
assertFalse(groups.isEmpty());
|
assertFalse(groups.isEmpty());
|
||||||
|
|
||||||
@@ -182,6 +184,7 @@ public class GroupITCase extends AbstractAdminITCaseBase
|
|||||||
|
|
||||||
assertNotNull(response);
|
assertNotNull(response);
|
||||||
assertTrue(response.getStatus() == 201);
|
assertTrue(response.getStatus() == 201);
|
||||||
|
response.close();
|
||||||
|
|
||||||
Group other = getGroup(group.getName());
|
Group other = getGroup(group.getName());
|
||||||
|
|
||||||
@@ -207,13 +210,12 @@ public class GroupITCase extends AbstractAdminITCaseBase
|
|||||||
|
|
||||||
assertNotNull(response);
|
assertNotNull(response);
|
||||||
assertTrue(response.getStatus() == 204);
|
assertTrue(response.getStatus() == 204);
|
||||||
|
response.close();
|
||||||
|
|
||||||
wr = createResource(client, "groups/".concat(name));
|
wr = createResource(client, "groups/".concat(name));
|
||||||
response = wr.get(ClientResponse.class);
|
response = wr.get(ClientResponse.class);
|
||||||
|
|
||||||
assertNotNull(response);
|
assertNotNull(response);
|
||||||
assertTrue(response.getStatus() == 404);
|
assertTrue(response.getStatus() == 404);
|
||||||
|
response.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- get methods ----------------------------------------------------------
|
//~--- get methods ----------------------------------------------------------
|
||||||
@@ -235,6 +237,7 @@ public class GroupITCase extends AbstractAdminITCaseBase
|
|||||||
|
|
||||||
Group group = response.getEntity(Group.class);
|
Group group = response.getEntity(Group.class);
|
||||||
|
|
||||||
|
response.close();
|
||||||
assertNotNull(group);
|
assertNotNull(group);
|
||||||
assertEquals(group.getName(), groupname);
|
assertEquals(group.getName(), groupname);
|
||||||
|
|
||||||
|
|||||||
@@ -164,6 +164,7 @@ public class RepositoryITCase extends AbstractAdminITCaseBase
|
|||||||
|
|
||||||
assertNotNull(response);
|
assertNotNull(response);
|
||||||
assertTrue(response.getStatus() == 204);
|
assertTrue(response.getStatus() == 204);
|
||||||
|
response.close();
|
||||||
|
|
||||||
Repository other = getRepositoryById(repository.getId());
|
Repository other = getRepositoryById(repository.getId());
|
||||||
|
|
||||||
@@ -195,6 +196,7 @@ public class RepositoryITCase extends AbstractAdminITCaseBase
|
|||||||
response.getEntity(new GenericType<Collection<Repository>>() {}
|
response.getEntity(new GenericType<Collection<Repository>>() {}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
response.close();
|
||||||
assertNotNull(repositories);
|
assertNotNull(repositories);
|
||||||
assertFalse(repositories.isEmpty());
|
assertFalse(repositories.isEmpty());
|
||||||
|
|
||||||
@@ -248,6 +250,9 @@ public class RepositoryITCase extends AbstractAdminITCaseBase
|
|||||||
assertTrue(response.getStatus() == 201);
|
assertTrue(response.getStatus() == 201);
|
||||||
|
|
||||||
String url = response.getHeaders().get("Location").get(0);
|
String url = response.getHeaders().get("Location").get(0);
|
||||||
|
|
||||||
|
response.close();
|
||||||
|
|
||||||
Repository other = getRepository(url);
|
Repository other = getRepository(url);
|
||||||
|
|
||||||
assertNotNull(other);
|
assertNotNull(other);
|
||||||
@@ -272,10 +277,12 @@ public class RepositoryITCase extends AbstractAdminITCaseBase
|
|||||||
|
|
||||||
assertNotNull(response);
|
assertNotNull(response);
|
||||||
assertTrue(response.getStatus() == 204);
|
assertTrue(response.getStatus() == 204);
|
||||||
|
response.close();
|
||||||
wr = createResource(client, "repositories/".concat(id));
|
wr = createResource(client, "repositories/".concat(id));
|
||||||
response = wr.get(ClientResponse.class);
|
response = wr.get(ClientResponse.class);
|
||||||
assertNotNull(response);
|
assertNotNull(response);
|
||||||
assertTrue(response.getStatus() == 404);
|
assertTrue(response.getStatus() == 404);
|
||||||
|
response.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- get methods ----------------------------------------------------------
|
//~--- get methods ----------------------------------------------------------
|
||||||
@@ -299,6 +306,7 @@ public class RepositoryITCase extends AbstractAdminITCaseBase
|
|||||||
|
|
||||||
Repository repository = response.getEntity(Repository.class);
|
Repository repository = response.getEntity(Repository.class);
|
||||||
|
|
||||||
|
response.close();
|
||||||
assertNotNull(repository);
|
assertNotNull(repository);
|
||||||
|
|
||||||
return repository;
|
return repository;
|
||||||
@@ -324,6 +332,7 @@ public class RepositoryITCase extends AbstractAdminITCaseBase
|
|||||||
|
|
||||||
Repository repository = response.getEntity(Repository.class);
|
Repository repository = response.getEntity(Repository.class);
|
||||||
|
|
||||||
|
response.close();
|
||||||
assertNotNull(repository);
|
assertNotNull(repository);
|
||||||
|
|
||||||
return repository;
|
return repository;
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ public class UserITCase extends AbstractAdminITCaseBase
|
|||||||
|
|
||||||
assertNotNull(response);
|
assertNotNull(response);
|
||||||
assertTrue(response.getStatus() == 204);
|
assertTrue(response.getStatus() == 204);
|
||||||
|
response.close();
|
||||||
|
|
||||||
User other = getUser(marvin.getName());
|
User other = getUser(marvin.getName());
|
||||||
|
|
||||||
@@ -134,15 +135,16 @@ public class UserITCase extends AbstractAdminITCaseBase
|
|||||||
public void getAll()
|
public void getAll()
|
||||||
{
|
{
|
||||||
WebResource wr = createResource(client, "users");
|
WebResource wr = createResource(client, "users");
|
||||||
ClientResponse respone = wr.get(ClientResponse.class);
|
ClientResponse response = wr.get(ClientResponse.class);
|
||||||
|
|
||||||
assertNotNull(respone);
|
assertNotNull(response);
|
||||||
assertTrue(respone.getStatus() == 200);
|
assertTrue(response.getStatus() == 200);
|
||||||
|
|
||||||
Collection<User> users =
|
Collection<User> users =
|
||||||
respone.getEntity(new GenericType<Collection<User>>() {}
|
response.getEntity(new GenericType<Collection<User>>() {}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
response.close();
|
||||||
assertNotNull(users);
|
assertNotNull(users);
|
||||||
assertFalse(users.isEmpty());
|
assertFalse(users.isEmpty());
|
||||||
|
|
||||||
@@ -175,6 +177,7 @@ public class UserITCase extends AbstractAdminITCaseBase
|
|||||||
|
|
||||||
assertNotNull(response);
|
assertNotNull(response);
|
||||||
assertTrue(response.getStatus() == 201);
|
assertTrue(response.getStatus() == 201);
|
||||||
|
response.close();
|
||||||
|
|
||||||
User other = getUser(user.getName());
|
User other = getUser(user.getName());
|
||||||
|
|
||||||
@@ -198,10 +201,12 @@ public class UserITCase extends AbstractAdminITCaseBase
|
|||||||
|
|
||||||
assertNotNull(response);
|
assertNotNull(response);
|
||||||
assertTrue(response.getStatus() == 204);
|
assertTrue(response.getStatus() == 204);
|
||||||
|
response.close();
|
||||||
wr = createResource(client, "users/".concat(user.getName()));
|
wr = createResource(client, "users/".concat(user.getName()));
|
||||||
response = wr.get(ClientResponse.class);
|
response = wr.get(ClientResponse.class);
|
||||||
assertNotNull(response);
|
assertNotNull(response);
|
||||||
assertTrue(response.getStatus() == 404);
|
assertTrue(response.getStatus() == 404);
|
||||||
|
response.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -230,13 +235,14 @@ public class UserITCase extends AbstractAdminITCaseBase
|
|||||||
private User getUser(String username)
|
private User getUser(String username)
|
||||||
{
|
{
|
||||||
WebResource wr = createResource(client, "users/".concat(username));
|
WebResource wr = createResource(client, "users/".concat(username));
|
||||||
ClientResponse respone = wr.get(ClientResponse.class);
|
ClientResponse response = wr.get(ClientResponse.class);
|
||||||
|
|
||||||
assertNotNull(respone);
|
assertNotNull(response);
|
||||||
assertTrue(respone.getStatus() == 200);
|
assertTrue(response.getStatus() == 200);
|
||||||
|
|
||||||
User user = respone.getEntity(User.class);
|
User user = response.getEntity(User.class);
|
||||||
|
|
||||||
|
response.close();
|
||||||
assertNotNull(user);
|
assertNotNull(user);
|
||||||
|
|
||||||
return user;
|
return user;
|
||||||
|
|||||||
Reference in New Issue
Block a user