下面列出了org.apache.hadoop.fs.swift.exceptions.SwiftInternalStateException#org.apache.commons.httpclient.methods.PutMethod 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
protected PutMethod internalCreateOrUpdate(String encodedHref, byte[] mimeContent) throws IOException {
PutMethod putmethod = new PutMethod(encodedHref);
putmethod.setRequestHeader("Translate", "f");
putmethod.setRequestHeader("Overwrite", "f");
if (etag != null) {
putmethod.setRequestHeader("If-Match", etag);
}
if (noneMatch != null) {
putmethod.setRequestHeader("If-None-Match", noneMatch);
}
putmethod.setRequestHeader("Content-Type", "message/rfc822");
putmethod.setRequestEntity(new ByteArrayRequestEntity(mimeContent, "message/rfc822"));
try {
httpClient.executeMethod(putmethod);
} finally {
putmethod.releaseConnection();
}
return putmethod;
}
protected static HttpMethodBase buildHttpClientMethod(String url, String method)
{
if ("GET".equals(method))
{
return new GetMethod(url);
}
if ("POST".equals(method))
{
return new PostMethod(url);
}
if ("PUT".equals(method))
{
return new PutMethod(url);
}
if ("DELETE".equals(method))
{
return new DeleteMethod(url);
}
if (TestingMethod.METHOD_NAME.equals(method))
{
return new TestingMethod(url);
}
throw new UnsupportedOperationException("Method '"+method+"' not supported");
}
@Override
protected ServerStatus _doIt() {
try {
/* attach route to application */
URI targetURI = URIUtil.toURI(target.getUrl());
PutMethod attachRouteMethod = new PutMethod(targetURI.resolve("/v2/apps/" + application.getGuid() + "/routes/" + routeGUID).toString()); //$NON-NLS-1$//$NON-NLS-2$
ServerStatus confStatus = HttpUtil.configureHttpMethod(attachRouteMethod, target.getCloud());
if (!confStatus.isOK())
return confStatus;
return HttpUtil.executeMethod(attachRouteMethod);
} catch (Exception e) {
String msg = NLS.bind("An error occured when performing operation {0}", commandName); //$NON-NLS-1$
logger.error(msg, e);
return new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg, e);
}
}
private static HttpMethodBase getMethod(HttpMethod method, String address) {
String addr = address;
if (method.equals(HttpMethod.Delete)) {
return new DeleteMethod(addr);
}
if (method.equals(HttpMethod.Post)) {
return new PostMethod(addr);
}
if (method.equals(HttpMethod.Get)) {
return new GetMethod(addr);
}
if (method.equals(HttpMethod.Put)) {
return new PutMethod(addr);
}
Assert.assertUnreachable("method doesn't exist");
return null;
}
protected HttpMethod createMethod(final String type, final String uri, final int port) throws BigSwitchBcfApiException {
String url;
try {
url = new URL(S_PROTOCOL, host, port, uri).toString();
} catch (MalformedURLException e) {
S_LOGGER.error("Unable to build Big Switch API URL", e);
throw new BigSwitchBcfApiException("Unable to build Big Switch API URL", e);
}
if ("post".equalsIgnoreCase(type)) {
return new PostMethod(url);
} else if ("get".equalsIgnoreCase(type)) {
return new GetMethod(url);
} else if ("delete".equalsIgnoreCase(type)) {
return new DeleteMethod(url);
} else if ("put".equalsIgnoreCase(type)) {
return new PutMethod(url);
} else {
throw new BigSwitchBcfApiException("Requesting unknown method type");
}
}
public HttpResponse putBinary(final RequestContext rq, final String scope, final int version, final String entityCollectionName,
final Object entityId, final String relationCollectionName, final Object relationshipEntityId, final BinaryPayload payload,
final Map<String, String> params) throws IOException
{
RestApiEndpoint endpoint = new RestApiEndpoint(rq.getNetworkId(), scope, version, entityCollectionName, entityId, relationCollectionName,
relationshipEntityId, params);
String url = endpoint.getUrl();
PutMethod req = new PutMethod(url);
if (payload != null)
{
BinaryRequestEntity requestEntity = new BinaryRequestEntity(payload.getFile(), payload.getMimeType(), payload.getCharset());
req.setRequestEntity(requestEntity);
}
return submitRequest(req, rq);
}
private void uploadArtifact(@NotNull final String artifactPath, @NotNull final URL uploadUrl, @NotNull final File file, @NotNull final HttpClient awsHttpClient)
throws IOException {
try {
final PutMethod putMethod = new PutMethod(uploadUrl.toString());
putMethod.addRequestHeader("User-Agent", "TeamCity Agent");
putMethod.setRequestEntity(new FileRequestEntity(file, S3Util.getContentType(file)));
HttpClientCloseUtil.executeAndReleaseConnection(awsHttpClient, putMethod);
LOG.debug(String.format("Successfully uploaded artifact %s to %s", artifactPath, uploadUrl));
} catch (HttpClientCloseUtil.HttpErrorCodeException e) {
final String msg;
if (e.getResponseCode() == HttpStatus.SC_FORBIDDEN) {
msg = "Failed to upload artifact " + artifactPath + ": received response code HTTP 403. Ensure that the credentials in S3 storage profile are correct.";
} else {
msg = "Failed to upload artifact " + artifactPath + " to " + uploadUrl + ": received response code HTTP " + e.getResponseCode() + ".";
}
LOG.info(msg);
throw new IOException(msg);
}
}
/**
* 处理Put请求
* @param url
* @param headers
* @param object
* @param property
* @return
*/
public static JSONObject doPut(String url, Map<String, String> headers,String jsonString) {
HttpClient httpClient = new HttpClient();
PutMethod putMethod = new PutMethod(url);
//设置header
setHeaders(putMethod,headers);
//设置put传递的json数据
if(jsonString!=null&&!"".equals(jsonString)){
putMethod.setRequestEntity(new ByteArrayRequestEntity(jsonString.getBytes()));
}
String responseStr = "";
try {
httpClient.executeMethod(putMethod);
responseStr = putMethod.getResponseBodyAsString();
} catch (Exception e) {
log.error(e);
responseStr="{status:0}";
}
return JSONObject.parseObject(responseStr);
}
@Test
public void testRenameNote() throws IOException {
LOG.info("Running testRenameNote");
Note note = null;
try {
String oldName = "old_name";
note = TestUtils.getInstance(Notebook.class).createNote(oldName, anonymous);
assertEquals(note.getName(), oldName);
String noteId = note.getId();
final String newName = "testName";
String jsonRequest = "{\"name\": " + newName + "}";
PutMethod put = httpPut("/notebook/" + noteId + "/rename/", jsonRequest);
assertThat("test testRenameNote:", put, isAllowed());
put.releaseConnection();
assertEquals(note.getName(), newName);
} finally {
// cleanup
if (null != note) {
TestUtils.getInstance(Notebook.class).removeNote(note, anonymous);
}
}
}
@Test
public void testThatOtherUserCannotAccessNoteIfPermissionSet() throws IOException {
String noteId = createNoteForUser("test", "admin", "password1");
//set permission
String payload = "{ \"owners\": [\"admin\"], \"readers\": [\"user2\"], " +
"\"runners\": [\"user2\"], \"writers\": [\"user2\"] }";
PutMethod put = httpPut("/notebook/" + noteId + "/permissions", payload , "admin", "password1");
assertThat("test set note permission method:", put, isAllowed());
put.releaseConnection();
userTryGetNote(noteId, "user1", "password2", isForbidden());
userTryGetNote(noteId, "user2", "password3", isAllowed());
deleteNoteForUser(noteId, "admin", "password1");
}
@Test
public void testThatWriterCannotRemoveNote() throws IOException {
String noteId = createNoteForUser("test", "admin", "password1");
//set permission
String payload = "{ \"owners\": [\"admin\", \"user1\"], \"readers\": [\"user2\"], " +
"\"runners\": [\"user2\"], \"writers\": [\"user2\"] }";
PutMethod put = httpPut("/notebook/" + noteId + "/permissions", payload , "admin", "password1");
assertThat("test set note permission method:", put, isAllowed());
put.releaseConnection();
userTryRemoveNote(noteId, "user2", "password3", isForbidden());
userTryRemoveNote(noteId, "user1", "password2", isAllowed());
Note deletedNote = TestUtils.getInstance(Notebook.class).getNote(noteId);
assertNull("Deleted note should be null", deletedNote);
}
@Test
public void testAddOwner() throws IOException {
final HttpClient c = loginWithCookie("administrator", "olat");
final URI uri = UriBuilder.fromUri(getContextURI()).path("catalog").path(entry1.getKey().toString()).path("owners").path(id1.getKey().toString()).build();
final PutMethod method = createPut(uri, MediaType.APPLICATION_JSON, true);
final int code = c.executeMethod(method);
method.releaseConnection();
assertEquals(200, code);
final CatalogEntry entry = catalogService.loadCatalogEntry(entry1.getKey());
final List<Identity> identities = securityManager.getIdentitiesOfSecurityGroup(entry.getOwnerGroup());
boolean found = false;
for (final Identity identity : identities) {
if (identity.getKey().equals(id1.getKey())) {
found = true;
}
}
assertTrue(found);
}
@Test
public void testBareBoneConfig() throws IOException {
final HttpClient c = loginWithCookie("administrator", "olat");
// create an contact node
final URI newContactUri = getElementsUri(course1).path("contact").queryParam("parentNodeId", rootNodeId).queryParam("position", "0")
.queryParam("shortTitle", "Contact-0").queryParam("longTitle", "Contact-long-0").queryParam("objectives", "Contact-objectives-0").build();
final PutMethod method = createPut(newContactUri, MediaType.APPLICATION_JSON, true);
final int code = c.executeMethod(method);
final String body = method.getResponseBodyAsString();
method.releaseConnection();
assertEquals(200, code);
final CourseNodeVO contactNode = parse(body, CourseNodeVO.class);
assertNotNull(contactNode);
assertNotNull(contactNode.getId());
assertEquals(contactNode.getShortTitle(), "Contact-0");
assertEquals(contactNode.getLongTitle(), "Contact-long-0");
assertEquals(contactNode.getLearningObjectives(), "Contact-objectives-0");
assertEquals(contactNode.getParentId(), rootNodeId);
}
@Test
public void testCreateEmptyCourse() throws IOException {
final HttpClient c = loginWithCookie("administrator", "olat");
final URI uri = UriBuilder.fromUri(getContextURI()).path("repo").path("courses").queryParam("shortTitle", "course3").queryParam("title", "course3 long name")
.build();
final PutMethod method = createPut(uri, MediaType.APPLICATION_JSON, true);
final int code = c.executeMethod(method);
assertEquals(code, 200);
final String body = method.getResponseBodyAsString();
final CourseVO course = parse(body, CourseVO.class);
assertNotNull(course);
assertEquals("course3", course.getTitle());
// check repository entry
final RepositoryEntry re = RepositoryServiceImpl.getInstance().lookupRepositoryEntry(course.getRepoEntryKey());
assertNotNull(re);
assertNotNull(re.getOlatResource());
assertNotNull(re.getOwnerGroup());
}
@Test
public void testUploadFile() throws IOException, URISyntaxException {
final HttpClient c = loginWithCookie("administrator", "olat");
final URI uri = UriBuilder.fromUri(getNodeURI()).path("files").build();
// create single page
final URL fileUrl = RepositoryEntriesITCase.class.getResource("singlepage.html");
assertNotNull(fileUrl);
final File file = new File(fileUrl.toURI());
final PutMethod method = createPut(uri, MediaType.APPLICATION_JSON, true);
method.addRequestHeader("Content-Type", MediaType.MULTIPART_FORM_DATA);
final Part[] parts = { new FilePart("file", file), new StringPart("filename", file.getName()) };
method.setRequestEntity(new MultipartRequestEntity(parts, method.getParams()));
final int code = c.executeMethod(method);
assertEquals(code, 200);
final OlatNamedContainerImpl folder = BCCourseNode.getNodeFolderContainer((BCCourseNode) bcNode, course1.getCourseEnvironment());
final VFSItem item = folder.resolve(file.getName());
assertNotNull(item);
}
@Test
public void testAddOwner() throws IOException {
final HttpClient c = loginWithCookie("administrator", "olat");
final URI uri = UriBuilder.fromUri(getContextURI()).path("catalog").path(entry1.getKey().toString()).path("owners").path(id1.getKey().toString()).build();
final PutMethod method = createPut(uri, MediaType.APPLICATION_JSON, true);
final int code = c.executeMethod(method);
method.releaseConnection();
assertEquals(200, code);
final CatalogEntry entry = catalogService.loadCatalogEntry(entry1.getKey());
final List<Identity> identities = securityManager.getIdentitiesOfSecurityGroup(entry.getOwnerGroup());
boolean found = false;
for (final Identity identity : identities) {
if (identity.getKey().equals(id1.getKey())) {
found = true;
}
}
assertTrue(found);
}
@Test
public void testBasicSecurityPutCall() throws IOException {
final HttpClient c = loginWithCookie("rest-catalog-two", "A6B7C8");
final URI uri = UriBuilder.fromUri(getContextURI()).path("catalog").path(entry1.getKey().toString()).build();
final PutMethod method = createPut(uri, MediaType.APPLICATION_JSON, true);
method.setQueryString(new NameValuePair[] { new NameValuePair("name", "Not-sub-entry-3"), new NameValuePair("description", "Not-sub-entry-description-3"),
new NameValuePair("type", String.valueOf(CatalogEntry.TYPE_NODE)) });
final int code = c.executeMethod(method);
assertEquals(401, code);
method.releaseConnection();
final List<CatalogEntry> children = catalogService.getChildrenOf(entry1);
boolean saved = false;
for (final CatalogEntry child : children) {
if ("Not-sub-entry-3".equals(child.getName())) {
saved = true;
break;
}
}
assertFalse(saved);
}
public void wipeCache(String type, String action, String name) throws IOException {
String url = baseUrl + "/cache/" + type + "/" + name + "/" + action;
HttpMethod request = new PutMethod(url);
try {
int code = client.executeMethod(request);
String msg = Bytes.toString(request.getResponseBody());
if (code != 200)
throw new IOException("Invalid response " + code + " with cache wipe url " + url + "\n" + msg);
} catch (HttpException ex) {
throw new IOException(ex);
} finally {
request.releaseConnection();
}
}
protected <T> String executeUpdateObject(final T newObject, final String uri,
final Map<String, String> parameters) throws BigSwitchBcfApiException,
IllegalArgumentException{
checkInvariants();
PutMethod pm = (PutMethod)createMethod("put", uri, _port);
setHttpHeader(pm);
try {
pm.setRequestEntity(new StringRequestEntity(gson.toJson(newObject), CONTENT_JSON, null));
} catch (UnsupportedEncodingException e) {
throw new BigSwitchBcfApiException("Failed to encode json request body", e);
}
executeMethod(pm);
String hash = checkResponse(pm, "BigSwitch HTTP update failed: ");
pm.releaseConnection();
return hash;
}
@Test
public void testAddAuthor() throws IOException {
final HttpClient c = loginWithCookie("administrator", "olat");
final String uri = "/repo/courses/" + course1.getResourceableId() + "/authors/" + auth0.getKey();
final PutMethod method = createPut(uri, MediaType.APPLICATION_JSON, true);
final int code = c.executeMethod(method);
assertEquals(code, 200);
// is auth0 author
final SecurityGroup authorGroup = securityManager.findSecurityGroupByName(Constants.GROUP_AUTHORS);
final boolean isAuthor = securityManager.isIdentityInSecurityGroup(auth0, authorGroup);
DBFactory.getInstance().intermediateCommit();
assertTrue(isAuthor);
// is auth0 owner
final RepositoryService rm = RepositoryServiceImpl.getInstance();
final RepositoryEntry repositoryEntry = rm.lookupRepositoryEntry(course1, true);
final SecurityGroup ownerGroup = repositoryEntry.getOwnerGroup();
final boolean isOwner = securityManager.isIdentityInSecurityGroup(auth0, ownerGroup);
DBFactory.getInstance().intermediateCommit();
assertTrue(isOwner);
}
@Test
public void testCreateEmptyCourse() throws IOException {
final HttpClient c = loginWithCookie("administrator", "olat");
final URI uri = UriBuilder.fromUri(getContextURI()).path("repo").path("courses").queryParam("shortTitle", "course3").queryParam("title", "course3 long name")
.build();
final PutMethod method = createPut(uri, MediaType.APPLICATION_JSON, true);
final int code = c.executeMethod(method);
assertEquals(code, 200);
final String body = method.getResponseBodyAsString();
final CourseVO course = parse(body, CourseVO.class);
assertNotNull(course);
assertEquals("course3", course.getTitle());
// check repository entry
final RepositoryEntry re = RepositoryServiceImpl.getInstance().lookupRepositoryEntry(course.getRepoEntryKey());
assertNotNull(re);
assertNotNull(re.getOlatResource());
assertNotNull(re.getOwnerGroup());
}
public static PutMethod sendMultipartPutRequest(String url, String body)
throws IOException {
HttpClient httpClient = new HttpClient();
PutMethod putMethod = new PutMethod(url);
// our handlers ignore key...so we can put anything here
Part[] parts = {new StringPart("body", body)};
putMethod.setRequestEntity(new MultipartRequestEntity(parts, putMethod.getParams()));
httpClient.executeMethod(putMethod);
return putMethod;
}
@Test
public void testPutCourseGroup() throws IOException {
final HttpClient c = loginWithCookie("administrator", "olat");
final GroupVO vo = new GroupVO();
vo.setName("hello");
vo.setDescription("hello description");
vo.setMinParticipants(new Integer(-1));
vo.setMaxParticipants(new Integer(-1));
final String stringuifiedAuth = stringuified(vo);
final RequestEntity entity = new StringRequestEntity(stringuifiedAuth, MediaType.APPLICATION_JSON, "UTF-8");
final String request = "/repo/courses/" + course.getResourceableId() + "/groups";
final PutMethod method = createPut(request, MediaType.APPLICATION_JSON, true);
method.setRequestEntity(entity);
final int code = c.executeMethod(method);
assertEquals(200, code);
final String body = method.getResponseBodyAsString();
method.releaseConnection();
final GroupVO responseVo = parse(body, GroupVO.class);
assertNotNull(responseVo);
assertEquals(vo.getName(), responseVo.getName());
final BusinessGroup bg = businessGroupService.loadBusinessGroup(responseVo.getKey(), false);
assertNotNull(bg);
assertEquals(bg.getKey(), responseVo.getKey());
assertEquals(bg.getName(), vo.getName());
assertEquals(bg.getDescription(), vo.getDescription());
assertEquals(new Integer(0), bg.getMinParticipants());
assertEquals(new Integer(0), bg.getMaxParticipants());
}
@Test
public void testAuthorCanEditCourse() throws IOException {
// author and owner
final HttpClient c = loginWithCookie("id-c-s-2", "A6B7C8");
// create an structure node
final URI newStructureUri = getElementsUri(course).path("structure").build();
final PutMethod method = createPut(newStructureUri, MediaType.APPLICATION_JSON, true);
method.setQueryString(new NameValuePair[] { new NameValuePair("position", "0"), new NameValuePair("shortTitle", "Structure-id-0"),
new NameValuePair("longTitle", "Structure-long-id-0"), new NameValuePair("objectives", "Structure-objectives-id-0") });
final int code = c.executeMethod(method);
assertEquals(200, code);
}
public ServerStatus _doIt() {
try {
URI targetURI = URIUtil.toURI(target.getUrl());
String appUrl = this.app.getAppJSON().getString("url");
URI appURI = targetURI.resolve(appUrl);
PutMethod stopMethod = new PutMethod(appURI.toString());
ServerStatus confStatus = HttpUtil.configureHttpMethod(stopMethod, target.getCloud());
if (!confStatus.isOK())
return confStatus;
stopMethod.setQueryString("inline-relations-depth=1");
JSONObject stopComand = new JSONObject();
stopComand.put("console", true);
stopComand.put("state", "STOPPED");
StringRequestEntity requestEntity = new StringRequestEntity(stopComand.toString(), CFProtocolConstants.JSON_CONTENT_TYPE, "UTF-8");
stopMethod.setRequestEntity(requestEntity);
GetAppCommand.expire(target, app.getName());
return HttpUtil.executeMethod(stopMethod);
} catch (Exception e) {
String msg = NLS.bind("An error occured when performing operation {0}", commandName); //$NON-NLS-1$
logger.error(msg, e);
return new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg, e);
}
}
public HttpResponse put(final Class<?> c, final RequestContext rq, final Object entityId, final Object relationshipEntityId, final String body)
throws IOException
{
RestApiEndpoint endpoint = new RestApiEndpoint(c, rq.getNetworkId(), entityId, relationshipEntityId, null);
String url = endpoint.getUrl();
PutMethod req = new PutMethod(url);
if (body != null)
{
StringRequestEntity requestEntity = new StringRequestEntity(body, "application/json", "UTF-8");
req.setRequestEntity(requestEntity);
}
return submitRequest(req, rq);
}
private PutMethod getMethod(Resource resource, String path, String encoding) {
PutMethod method = new PutMethod(this.csp.getUrl() + this.csp.getVersion() + path + resource.getId());
ComplienceUtils.configureMethod(method);
method.setRequestHeader(new Header("Accept", "application/" + encoding));
if (resource.getMeta() != null && !resource.getMeta().getVersion().isEmpty()) {
method.setRequestHeader(new Header("If-Match", resource.getMeta().getVersion()));
}
return method;
}
@Test
public void testNewThread() throws IOException {
final HttpClient c = loginWithCookie("administrator", "olat");
final URI uri = getForumUriBuilder().path("threads").queryParam("authorKey", id1.getKey()).queryParam("title", "New thread")
.queryParam("body", "A very interesting thread").build();
final PutMethod method = createPut(uri, MediaType.APPLICATION_JSON, true);
final int code = c.executeMethod(method);
assertEquals(code, 200);
final String body = method.getResponseBodyAsString();
final MessageVO thread = parse(body, MessageVO.class);
assertNotNull(thread);
assertNotNull(thread.getKey());
assertEquals(thread.getForumKey(), forum.getKey());
assertEquals(thread.getAuthorKey(), id1.getKey());
// really saved?
boolean saved = false;
final ForumService fm = getForumService();
final List<Message> allMessages = fm.getMessagesByForum(forum);
for (final Message message : allMessages) {
if (message.getKey().equals(thread.getKey())) {
saved = true;
}
}
assertTrue(saved);
}
private void callPutFileApi(String fileType, String url, String filePath, String oui, String prodClass, String version) throws HttpException, IOException, HitDMException {
org.apache.commons.httpclient.HttpClient client = new org.apache.commons.httpclient.HttpClient();
PutMethod putMethod = new PutMethod(url);
File input = new File(filePath);
RequestEntity entity = new FileRequestEntity(input, "Content-Length: 1431");
putMethod.setRequestEntity(entity);
putMethod.setRequestHeader("fileType", fileType);
putMethod.setRequestHeader("oui", oui);
putMethod.setRequestHeader("productClass", prodClass);
putMethod.setRequestHeader("version", version);
client.executeMethod(putMethod);
if (putMethod.getStatusCode() != 200) {
String debugStr = "DM Server return:"+ putMethod.getStatusCode();
byte[] body;
try {
body = putMethod.getResponseBody();
if (body != null) {
debugStr += "\r\nBody:"+new String(body);
}
} catch (Exception e) {
debugStr += e.getMessage();
}
throw new HitDMException(putMethod.getStatusCode(), debugStr);
}
}
@Test
public void testImportWiki() throws HttpException, IOException, URISyntaxException {
final URL cpUrl = RepositoryEntriesITCase.class.getResource("wiki-demo.zip");
assertNotNull(cpUrl);
final File cp = new File(cpUrl.toURI());
final HttpClient c = loginWithCookie("administrator", "olat");
final PutMethod method = createPut("repo/entries", MediaType.APPLICATION_JSON, true);
method.addRequestHeader("Content-Type", MediaType.MULTIPART_FORM_DATA);
final Part[] parts = { new FilePart("file", cp), new StringPart("filename", "wiki-demo.zip"), new StringPart("resourcename", "Wiki demo"),
new StringPart("displayname", "Wiki demo") };
method.setRequestEntity(new MultipartRequestEntity(parts, method.getParams()));
final int code = c.executeMethod(method);
assertTrue(code == 200 || code == 201);
final String body = method.getResponseBodyAsString();
method.releaseConnection();
final RepositoryEntryVO vo = parse(body, RepositoryEntryVO.class);
assertNotNull(vo);
final Long key = vo.getKey();
final RepositoryEntry re = RepositoryServiceImpl.getInstance().lookupRepositoryEntry(key);
assertNotNull(re);
assertNotNull(re.getOwnerGroup());
assertNotNull(re.getOlatResource());
assertEquals("Wiki demo", re.getDisplayname());
log.info(re.getOlatResource().getResourceableTypeName());
}