List of usage examples for java.net HttpURLConnection HTTP_CREATED
int HTTP_CREATED
To view the source code for java.net HttpURLConnection HTTP_CREATED.
Click Source Link
From source file:org.eclipse.orion.server.tests.servlets.files.CoreFilesTest.java
/** * Test the creation of a folder at the workspace root level /file/workspace, see Bug 415700. * @throws CoreException//from w ww.j a v a 2 s . co m * @throws IOException * @throws SAXException * @throws JSONException * @throws URISyntaxException */ @Test public void testCreateWorkspaceLevelFolder() throws CoreException, IOException, SAXException, JSONException, URISyntaxException { if (!(OrionConfiguration.getMetaStore() instanceof SimpleMetaStore)) { // This test is only supported by a SimpleMetaStore return; } String newDirectoryName = "sample" + System.currentTimeMillis(); webConversation.setExceptionsThrownOnErrorStatus(false); IPath projectLocation = new Path(getTestBaseResourceURILocation()); String workspaceId = projectLocation.segment(0); String path = new Path(FILE_SERVLET_LOCATION).append(workspaceId).toString(); String uriPath = URIUtil.fromString(SERVER_LOCATION + path).toString(); WebRequest request = new PostMethodWebRequest(uriPath, IOUtilities.toInputStream(getNewDirJSON(newDirectoryName).toString()), "application/json"); request.setHeaderField(ProtocolConstants.HEADER_SLUG, newDirectoryName); request.setHeaderField(ProtocolConstants.HEADER_ORION_VERSION, "1"); setAuthentication(request); WebResponse response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_CREATED, response.getResponseCode()); assertEquals("Response should contain directory metadata in JSON, but was " + response.getText(), "application/json", response.getContentType()); JSONObject responseObject = new JSONObject(response.getText()); assertNotNull("No directory information in response", responseObject); String userRoot = OrionConfiguration.getUserHome(testUserId).toURI().toString(); String workspaceName = SimpleMetaStoreUtil.decodeWorkspaceNameFromWorkspaceId(workspaceId); URI localFolderURI = new URI(new Path(userRoot).append(workspaceName).append(newDirectoryName).toString()); IFileStore localFolder = EFS.getStore(localFolderURI); assertTrue("Create directory response was OK, but the directory does not exist", localFolder.fetchInfo().exists() && localFolder.fetchInfo().isDirectory()); checkDirectoryMetadata(responseObject, newDirectoryName, null, null, null, null, null); //should be able to perform GET on location header to obtain metadata String location = response.getHeaderField(ProtocolConstants.HEADER_LOCATION); request = getGetRequest(location); response = webConversation.getResource(request); assertNotNull(location); assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode()); responseObject = new JSONObject(response.getText()); assertNotNull("No direcory information in response", responseObject); checkDirectoryMetadata(responseObject, newDirectoryName, null, null, null, null, null); }
From source file:org.eclipse.orion.server.tests.servlets.workspace.WorkspaceServiceTest.java
/** * Tests creating a project that is stored at a non-default location on the server. *//*from w w w.j a va 2 s . c o m*/ @Test public void testCreateProjectNonDefaultLocation() throws IOException, SAXException, JSONException { //create workspace String workspaceName = WorkspaceServiceTest.class.getName() + "#testCreateProjectNonDefaultLocation"; URI workspaceLocation = createWorkspace(workspaceName); String tmp = System.getProperty("java.io.tmpdir"); File projectLocation = new File(new File(tmp), "Orion-testCreateProjectNonDefaultLocation"); toDelete.add(EFS.getLocalFileSystem().getStore(projectLocation.toURI())); projectLocation.mkdir(); //at first forbid all project locations ServletTestingSupport.allowedPrefixes = null; //create a project String projectName = "My Project"; WebRequest request = getCreateProjectRequest(workspaceLocation, projectName, projectLocation.toString()); if (projectName != null) request.setHeaderField(ProtocolConstants.HEADER_SLUG, projectName); request.setHeaderField(ProtocolConstants.HEADER_ORION_VERSION, "1"); setAuthentication(request); WebResponse response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_FORBIDDEN, response.getResponseCode()); //now set the allowed prefixes and try again ServletTestingSupport.allowedPrefixes = projectLocation.toString(); response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_CREATED, response.getResponseCode()); JSONObject project = new JSONObject(response.getText()); assertEquals(projectName, project.getString(ProtocolConstants.KEY_NAME)); String projectId = project.optString(ProtocolConstants.KEY_ID, null); assertNotNull(projectId); }
From source file:org.eclipse.orion.server.tests.metastore.RemoteMetaStoreTests.java
/** * Create a folder in a project on the Orion server for the test user. * /*from ww w . j a v a 2 s . co m*/ * @throws URISyntaxException * @throws IOException * @throws JSONException * @throws SAXException */ @Test public void testCreateUFolder() throws URISyntaxException, IOException, JSONException, SAXException { WebConversation webConversation = new WebConversation(); assertEquals(HttpURLConnection.HTTP_CREATED, createFolder(webConversation, getOrionTestName(), getOrionTestName(), "Project")); }
From source file:com.microsoft.azure.storage.table.TableOperation.java
private StorageRequest<CloudTableClient, TableOperation, TableResult> insertImpl(final CloudTableClient client, final String tableName, final TableRequestOptions options, final OperationContext opContext) throws StorageException { final boolean isTableEntry = TableConstants.TABLES_SERVICE_TABLES_NAME.equals(tableName); final String tableIdentity = isTableEntry ? this.getEntity().writeEntity(opContext).get(TableConstants.TABLE_NAME).getValueAsString() : null;/* www .j ava 2s. c o m*/ // Inserts need row key and partition key if (!isTableEntry) { Utility.assertNotNull(SR.PARTITIONKEY_MISSING_FOR_INSERT, this.getEntity().getPartitionKey()); Utility.assertNotNull(SR.ROWKEY_MISSING_FOR_INSERT, this.getEntity().getRowKey()); } ByteArrayOutputStream entityStream = new ByteArrayOutputStream(); try { TableEntitySerializer.writeSingleEntityToStream(entityStream, options, this.entity, isTableEntry, opContext); // We need to buffer once and use it for all retries instead of serializing the entity every single time. // In the future, this could also be used to calculate transactional MD5 for table operations. final byte[] entityBytes = entityStream.toByteArray(); final StorageRequest<CloudTableClient, TableOperation, TableResult> putRequest = new StorageRequest<CloudTableClient, TableOperation, TableResult>( options, client.getStorageUri()) { @Override public HttpURLConnection buildRequest(CloudTableClient client, TableOperation operation, OperationContext context) throws Exception { this.setSendStream(new ByteArrayInputStream(entityBytes)); this.setLength((long) entityBytes.length); return TableRequest.insert( client.getTransformedEndPoint(opContext).getUri(this.getCurrentLocation()), options, null, opContext, tableName, generateRequestIdentity(isTableEntry, tableIdentity), operation.opType != TableOperationType.INSERT ? operation.getEntity().getEtag() : null, operation.getEchoContent(), operation.opType.getUpdateType()); } @Override public void signRequest(HttpURLConnection connection, CloudTableClient client, OperationContext context) throws Exception { StorageRequest.signTableRequest(connection, client, -1L, context); } @Override public TableResult preProcessResponse(TableOperation operation, CloudTableClient client, OperationContext context) throws Exception { if (operation.opType == TableOperationType.INSERT) { if (operation.getEchoContent() && this.getResult().getStatusCode() == HttpURLConnection.HTTP_CREATED) { // Insert should receive created if echo content is on return new TableResult(); } else if (!operation.getEchoContent() && this.getResult().getStatusCode() == HttpURLConnection.HTTP_NO_CONTENT) { // Insert should receive no content if echo content is off return operation.parseResponse(null, this.getResult().getStatusCode(), this.getConnection().getHeaderField(TableConstants.HeaderConstants.ETAG), opContext, options); } } else if (this.getResult().getStatusCode() == HttpURLConnection.HTTP_NO_CONTENT) { // InsertOrMerge and InsertOrReplace should always receive no content return operation.parseResponse(null, this.getResult().getStatusCode(), this.getConnection().getHeaderField(TableConstants.HeaderConstants.ETAG), opContext, options); } throw TableServiceException.generateTableServiceException(this.getResult(), operation, this.getConnection().getErrorStream(), options.getTablePayloadFormat()); } @Override public TableResult postProcessResponse(HttpURLConnection connection, TableOperation operation, CloudTableClient client, OperationContext context, TableResult result) throws Exception { if (operation.opType == TableOperationType.INSERT && operation.getEchoContent()) { result = operation.parseResponse(this.getConnection().getInputStream(), this.getResult().getStatusCode(), this.getConnection().getHeaderField(TableConstants.HeaderConstants.ETAG), opContext, options); } return result; } @Override public StorageExtendedErrorInformation parseErrorDetails() { return TableStorageErrorDeserializer.parseErrorDetails(this); } }; return putRequest; } catch (IOException e) { // The request was not even made. There was an error while trying to read the entity. Just throw. StorageException translatedException = StorageException.translateClientException(e); throw translatedException; } }
From source file:org.apache.nifi.controller.livy.LivySessionController.java
private JSONObject readJSONObjectFromUrlPOST(String urlString, Map<String, String> headers, String payload) throws IOException, JSONException { URL url = new URL(urlString); HttpURLConnection connection = getConnection(urlString); connection.setRequestMethod(POST);/*from ww w . java 2 s .c om*/ connection.setDoOutput(true); for (Map.Entry<String, String> entry : headers.entrySet()) { connection.setRequestProperty(entry.getKey(), entry.getValue()); } OutputStream os = connection.getOutputStream(); os.write(payload.getBytes()); os.flush(); if (connection.getResponseCode() != HttpURLConnection.HTTP_OK && connection.getResponseCode() != HttpURLConnection.HTTP_CREATED) { throw new RuntimeException("Failed : HTTP error code : " + connection.getResponseCode() + " : " + connection.getResponseMessage()); } InputStream content = connection.getInputStream(); return readAllIntoJSONObject(content); }
From source file:org.apache.hadoop.fs.http.client.HttpFSFileSystem.java
/** * Opens an FSDataOutputStream at the indicated Path with write-progress * reporting./*from ww w . ja va2 s. co m*/ * <p/> * IMPORTANT: The <code>Progressable</code> parameter is not used. * * @param f * the file name to open. * @param permission * file permission. * @param overwrite * if a file with this name already exists, then if true, the * file will be overwritten, and if false an error will be * thrown. * @param bufferSize * the size of the buffer to be used. * @param replication * required block replication for the file. * @param blockSize * block size. * @param progress * progressable. * * @throws IOException * @see #setPermission(Path, FsPermission) */ @Override public FSDataOutputStream create(Path f, FsPermission permission, boolean overwrite, int bufferSize, short replication, long blockSize, Progressable progress) throws IOException { Map<String, String> params = new HashMap<String, String>(); params.put(OP_PARAM, Operation.CREATE.toString()); params.put(OVERWRITE_PARAM, Boolean.toString(overwrite)); params.put(REPLICATION_PARAM, Short.toString(replication)); params.put(BLOCKSIZE_PARAM, Long.toString(blockSize)); params.put(PERMISSION_PARAM, permissionToString(permission)); return uploadData(Operation.CREATE.getMethod(), f, params, bufferSize, HttpURLConnection.HTTP_CREATED); }
From source file:org.eclipse.orion.server.tests.servlets.git.GitDiffTest.java
@Test public void testDiffUntrackedUri() throws Exception { URI workspaceLocation = createWorkspace(getMethodName()); String projectName = getMethodName(); JSONObject project = createProjectOrLink(workspaceLocation, projectName, gitDir.toString()); String fileName = "new.txt"; WebRequest request = getPostFilesRequest("", getNewFileJSON(fileName).toString(), fileName); WebResponse response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_CREATED, response.getResponseCode()); JSONObject newTxt = getChild(project, "new.txt"); String gitDiffUri = newTxt.getJSONObject(GitConstants.KEY_GIT).getString(GitConstants.KEY_DIFF); request = getGetRequest(gitDiffUri + "?parts=uris"); response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode()); // modified assertDiffUris(...); JSONObject jsonPart = new JSONObject(response.getText()); assertEquals(Diff.TYPE, jsonPart.getString(ProtocolConstants.KEY_TYPE)); String fileOldUri = jsonPart.getString(GitConstants.KEY_COMMIT_OLD); request = getGetRequest(fileOldUri); response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_NOT_FOUND, response.getResponseCode()); String fileNewUri = jsonPart.getString(GitConstants.KEY_COMMIT_NEW); request = getGetRequest(fileNewUri); response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode()); assertEquals("", response.getText()); String fileBaseUri = jsonPart.getString(GitConstants.KEY_COMMIT_BASE); request = getGetRequest(fileBaseUri); response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_NOT_FOUND, response.getResponseCode()); assertEquals(gitDiffUri, jsonPart.getString(ProtocolConstants.KEY_LOCATION)); }
From source file:org.eclipse.orion.server.tests.servlets.workspace.WorkspaceServiceTest.java
@Test public void testGetProjectMetadata() throws IOException, SAXException, JSONException { //create workspace String workspaceName = WorkspaceServiceTest.class.getName() + "#testGetProjectMetadata"; URI workspaceLocation = createWorkspace(workspaceName); //create a project String sourceName = "testGetProjectMetadata Project"; WebRequest request = getCreateProjectRequest(workspaceLocation, sourceName, null); WebResponse response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_CREATED, response.getResponseCode()); String sourceLocation = response.getHeaderField(ProtocolConstants.HEADER_LOCATION); //now get the project metadata request = getGetRequest(sourceLocation); response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode()); JSONObject responseObject = new JSONObject(response.getText()); String sourceContentLocation = responseObject.optString(ProtocolConstants.KEY_CONTENT_LOCATION); assertEquals(sourceName, responseObject.optString(ProtocolConstants.KEY_NAME)); assertNotNull(sourceContentLocation); }
From source file:org.eclipse.orion.server.tests.servlets.git.GitMergeTest.java
@Test public void testMergeRemovingFolders() throws Exception { // see org.eclipse.jgit.api.MergeCommandTest.testMergeRemovingFolders() URI workspaceLocation = createWorkspace(getMethodName()); IPath[] clonePaths = createTestProjects(workspaceLocation); for (IPath clonePath : clonePaths) { // clone a repo JSONObject clone = clone(clonePath); String cloneContentLocation = clone.getString(ProtocolConstants.KEY_CONTENT_LOCATION); // get project/folder metadata WebRequest request = getGetRequest(cloneContentLocation); WebResponse response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode()); JSONObject folder = new JSONObject(response.getText()); String folderChildrenLocation = folder.getString(ProtocolConstants.KEY_CHILDREN_LOCATION); String folderLocation = folder.getString(ProtocolConstants.KEY_LOCATION); JSONObject gitSection = folder.getJSONObject(GitConstants.KEY_GIT); String gitIndexUri = gitSection.getString(GitConstants.KEY_INDEX); String gitHeadUri = gitSection.getString(GitConstants.KEY_HEAD); String folderName = "folder1"; request = getPostFilesRequest(folderLocation + "/", getNewDirJSON(folderName).toString(), folderName); response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_CREATED, response.getResponseCode()); JSONObject folder1 = getChild(folder, "folder1"); String fileName = "file1.txt"; request = getPostFilesRequest(folder1.getString(ProtocolConstants.KEY_LOCATION), getNewFileJSON(fileName).toString(), fileName); response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_CREATED, response.getResponseCode()); fileName = "file2.txt"; request = getPostFilesRequest(folder1.getString(ProtocolConstants.KEY_LOCATION), getNewFileJSON(fileName).toString(), fileName); response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_CREATED, response.getResponseCode()); folderName = "folder2"; request = getPostFilesRequest(folderLocation + "/", getNewDirJSON(folderName).toString(), folderName); response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_CREATED, response.getResponseCode()); JSONObject folder2 = getChild(folder, "folder2"); fileName = "file1.txt"; request = getPostFilesRequest(folder2.getString(ProtocolConstants.KEY_LOCATION), getNewFileJSON(fileName).toString(), fileName); response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_CREATED, response.getResponseCode()); fileName = "file2.txt"; request = getPostFilesRequest(folder2.getString(ProtocolConstants.KEY_LOCATION), getNewFileJSON(fileName).toString(), fileName); response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_CREATED, response.getResponseCode()); request = GitAddTest.getPutGitIndexRequest(gitIndexUri); response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode()); request = GitCommitTest.getPostGitCommitRequest(gitHeadUri, "folders and files", false); response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode()); deleteFile(folder1);//w ww . ja v a 2s . c o m deleteFile(folder2); request = GitAddTest.getPutGitIndexRequest(gitIndexUri); response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode()); request = GitCommitTest.getPostGitCommitRequest(gitHeadUri, "removing folders", false); response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode()); JSONArray commitsArray = log(gitHeadUri); assertEquals(3, commitsArray.length()); JSONObject commit = commitsArray.getJSONObject(0); assertEquals("removing folders", commit.get(GitConstants.KEY_COMMIT_MESSAGE)); String toMerge = commit.getString(ProtocolConstants.KEY_NAME); commit = commitsArray.getJSONObject(1); assertEquals("folders and files", commit.get(GitConstants.KEY_COMMIT_MESSAGE)); String toCheckout = commit.getString(ProtocolConstants.KEY_NAME); Repository db1 = getRepositoryForContentLocation(cloneContentLocation); Git git = new Git(db1); git.checkout().setName(toCheckout).call(); JSONObject merge = merge(gitHeadUri, toMerge); MergeStatus mergeResult = MergeStatus.valueOf(merge.getString(GitConstants.KEY_RESULT)); assertEquals(MergeStatus.FAST_FORWARD, mergeResult); request = getGetRequest(folderChildrenLocation); response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode()); List<JSONObject> children = getDirectoryChildren(new JSONObject(response.getText())); assertNull(getChildByName(children, "folder1")); assertNull(getChildByName(children, "folder2")); } }
From source file:org.eclipse.orion.server.tests.servlets.git.GitMergeSquashTest.java
@Test public void testMergeSquashRemovingFolders() throws Exception { // see org.eclipse.jgit.api.MergeCommandTest.testMergeRemovingFolders() URI workspaceLocation = createWorkspace(getMethodName()); IPath[] clonePaths = createTestProjects(workspaceLocation); for (IPath clonePath : clonePaths) { // clone a repo JSONObject clone = clone(clonePath); String cloneContentLocation = clone.getString(ProtocolConstants.KEY_CONTENT_LOCATION); // get project/folder metadata WebRequest request = getGetRequest(cloneContentLocation); WebResponse response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode()); JSONObject folder = new JSONObject(response.getText()); String folderChildrenLocation = folder.getString(ProtocolConstants.KEY_CHILDREN_LOCATION); String folderLocation = folder.getString(ProtocolConstants.KEY_LOCATION); JSONObject gitSection = folder.getJSONObject(GitConstants.KEY_GIT); String gitIndexUri = gitSection.getString(GitConstants.KEY_INDEX); String gitHeadUri = gitSection.getString(GitConstants.KEY_HEAD); String folderName = "folder1"; request = getPostFilesRequest(folderLocation + "/", getNewDirJSON(folderName).toString(), folderName); response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_CREATED, response.getResponseCode()); JSONObject folder1 = getChild(folder, "folder1"); String fileName = "file1.txt"; request = getPostFilesRequest(folder1.getString(ProtocolConstants.KEY_LOCATION), getNewFileJSON(fileName).toString(), fileName); response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_CREATED, response.getResponseCode()); fileName = "file2.txt"; request = getPostFilesRequest(folder1.getString(ProtocolConstants.KEY_LOCATION), getNewFileJSON(fileName).toString(), fileName); response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_CREATED, response.getResponseCode()); folderName = "folder2"; request = getPostFilesRequest(folderLocation + "/", getNewDirJSON(folderName).toString(), folderName); response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_CREATED, response.getResponseCode()); JSONObject folder2 = getChild(folder, "folder2"); fileName = "file1.txt"; request = getPostFilesRequest(folder2.getString(ProtocolConstants.KEY_LOCATION), getNewFileJSON(fileName).toString(), fileName); response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_CREATED, response.getResponseCode()); fileName = "file2.txt"; request = getPostFilesRequest(folder2.getString(ProtocolConstants.KEY_LOCATION), getNewFileJSON(fileName).toString(), fileName); response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_CREATED, response.getResponseCode()); request = GitAddTest.getPutGitIndexRequest(gitIndexUri); response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode()); request = GitCommitTest.getPostGitCommitRequest(gitHeadUri, "folders and files", false); response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode()); deleteFile(folder1);//from ww w . ja va2 s.c o m deleteFile(folder2); request = GitAddTest.getPutGitIndexRequest(gitIndexUri); response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode()); request = GitCommitTest.getPostGitCommitRequest(gitHeadUri, "removing folders", false); response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode()); JSONArray commitsArray = log(gitHeadUri); assertEquals(3, commitsArray.length()); JSONObject commit = commitsArray.getJSONObject(0); assertEquals("removing folders", commit.get(GitConstants.KEY_COMMIT_MESSAGE)); String toMerge = commit.getString(ProtocolConstants.KEY_NAME); commit = commitsArray.getJSONObject(1); assertEquals("folders and files", commit.get(GitConstants.KEY_COMMIT_MESSAGE)); String toCheckout = commit.getString(ProtocolConstants.KEY_NAME); Repository db1 = getRepositoryForContentLocation(cloneContentLocation); Git git = new Git(db1); git.checkout().setName(toCheckout).call(); JSONObject merge = merge(gitHeadUri, toMerge, true); MergeStatus mergeResult = MergeStatus.valueOf(merge.getString(GitConstants.KEY_RESULT)); assertEquals(MergeStatus.FAST_FORWARD_SQUASHED, mergeResult); request = getGetRequest(folderChildrenLocation); response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode()); List<JSONObject> children = getDirectoryChildren(new JSONObject(response.getText())); assertNull(getChildByName(children, "folder1")); assertNull(getChildByName(children, "folder2")); } }