Skip to content

Commit

Permalink
fixed formatting
Browse files Browse the repository at this point in the history
Signed-off-by: Dmytro Kulieshov <dkuliesh@redhat.com>
  • Loading branch information
Dmytro Kulieshov committed Oct 17, 2017
1 parent 776d3d9 commit b745dc7
Show file tree
Hide file tree
Showing 39 changed files with 643 additions and 669 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ public Promise<Void> importProject(Path path, SourceStorageDto source) {
if (url.contains("?")) {
url += "&clientId=" + appContext.getApplicationId().orElse("");
} else {

url += "?clientId=" + appContext.getApplicationId().orElse("");
}

Expand Down Expand Up @@ -271,7 +270,6 @@ public Promise<List<ProjectConfigDto>> createBatchProjects(
if (url.contains("?")) {
url += "&clientId=" + appContext.getApplicationId().orElse("");
} else {

url += "?clientId=" + appContext.getApplicationId().orElse("");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@

import static com.google.gwt.http.client.RequestBuilder.DELETE;
import static com.google.gwt.http.client.RequestBuilder.PUT;
import static java.util.Collections.singletonList;
import static org.eclipse.che.ide.MimeType.APPLICATION_JSON;
import static org.eclipse.che.ide.rest.HTTPHeader.ACCEPT;
import static org.eclipse.che.ide.rest.HTTPHeader.CONTENT_TYPE;
import static org.junit.Assert.assertEquals;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyBoolean;
import static org.mockito.Matchers.anyString;
Expand All @@ -25,7 +28,9 @@

import com.google.gwt.http.client.RequestBuilder;
import com.google.gwtmockito.GwtMockitoTestRunner;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import org.eclipse.che.api.core.model.workspace.config.ProjectConfig;
import org.eclipse.che.api.project.shared.dto.CopyOptions;
import org.eclipse.che.api.project.shared.dto.ItemReference;
Expand Down Expand Up @@ -105,6 +110,7 @@ public void setUp() throws Exception {
loaderFactory, requestFactory, dtoFactory, unmarshaller, appContext);

when(appContext.getWsAgentServerApiEndpoint()).thenReturn("http://127.0.0.3/api");
when(appContext.getApplicationId()).thenReturn(Optional.empty());

when(loaderFactory.newLoader(any())).thenReturn(messageLoader);
when(asyncRequest.loader(messageLoader)).thenReturn(asyncRequest);
Expand Down Expand Up @@ -146,7 +152,7 @@ public void shouldReturnListProjects() {
client.getProjects();

verify(requestFactory).createGetRequest(any());
verify(asyncRequest).header(ACCEPT, MimeType.APPLICATION_JSON);
verify(asyncRequest).header(ACCEPT, APPLICATION_JSON);
verify(unmarshaller).newListUnmarshaller(ProjectConfigDto.class);
verify(asyncRequest).send(unmarshallablePrjsConf);
}
Expand All @@ -158,7 +164,7 @@ public void shouldEncodeUrlAndEstimateProject() {
client.estimate(resourcePath, prjType);

verify(requestFactory).createGetRequest(any());
verify(asyncRequest).header(ACCEPT, MimeType.APPLICATION_JSON);
verify(asyncRequest).header(ACCEPT, APPLICATION_JSON);
verify(loaderFactory).newLoader("Estimating project...");
verify(asyncRequest).loader(messageLoader);
verify(asyncRequest).send(unmarshallbleSourceEstimation);
Expand All @@ -169,7 +175,7 @@ public void shouldEncodeUrlAndResolveProjectSources() {
client.resolveSources(resourcePath);

verify(requestFactory).createGetRequest(any());
verify(asyncRequest).header(ACCEPT, MimeType.APPLICATION_JSON);
verify(asyncRequest).header(ACCEPT, APPLICATION_JSON);
verify(loaderFactory).newLoader("Resolving sources...");
verify(asyncRequest).loader(messageLoader);
verify(unmarshaller).newListUnmarshaller(SourceEstimation.class);
Expand All @@ -178,11 +184,11 @@ public void shouldEncodeUrlAndResolveProjectSources() {

@Test
public void shouldEncodeUrlAndImportProject() {
// client.importProject(resourcePath, source);
//
// verify(requestFactory).createPostRequest(any(), eq(source));
// verify(asyncRequest).header(CONTENT_TYPE, APPLICATION_JSON);
// verify(asyncRequest).send();
client.importProject(resourcePath, source);

verify(requestFactory).createPostRequest(any(), eq(source));
verify(asyncRequest).header(CONTENT_TYPE, APPLICATION_JSON);
verify(asyncRequest).send();
}

@Test
Expand All @@ -198,7 +204,7 @@ public void shouldEncodeUrlAndSearchResourceReferences() {
client.search(expression);

verify(requestFactory).createGetRequest(any());
verify(asyncRequest).header(ACCEPT, MimeType.APPLICATION_JSON);
verify(asyncRequest).header(ACCEPT, APPLICATION_JSON);
verify(loaderFactory).newLoader("Searching...");
verify(asyncRequest).loader(messageLoader);
verify(unmarshaller).newUnmarshaller(ProjectSearchResponseDto.class);
Expand All @@ -207,34 +213,34 @@ public void shouldEncodeUrlAndSearchResourceReferences() {

@Test
public void shouldCreateOneProjectByBatch() {
// List<NewProjectConfigDto> configs = singletonList(prjConfig1);
//
// client.createBatchProjects(configs);
//
// verify(requestFactory).createPostRequest(anyString(), prjsArgCaptor.capture());
// verify(asyncRequest).header(ACCEPT, MimeType.APPLICATION_JSON);
// verify(loaderFactory).newLoader("Creating project...");
// verify(asyncRequest).loader(messageLoader);
// verify(asyncRequest).send(unmarshallablePrjsConf);
// verify(unmarshaller).newListUnmarshaller(ProjectConfigDto.class);
//
// assertEquals(1, prjsArgCaptor.getValue().size());
List<NewProjectConfigDto> configs = singletonList(prjConfig1);

client.createBatchProjects(configs);

verify(requestFactory).createPostRequest(anyString(), prjsArgCaptor.capture());
verify(asyncRequest).header(ACCEPT, APPLICATION_JSON);
verify(loaderFactory).newLoader("Creating project...");
verify(asyncRequest).loader(messageLoader);
verify(asyncRequest).send(unmarshallablePrjsConf);
verify(unmarshaller).newListUnmarshaller(ProjectConfigDto.class);

assertEquals(1, prjsArgCaptor.getValue().size());
}

@Test
public void shouldCreateFewProjectByBatch() {
// List<NewProjectConfigDto> configs = Arrays.asList(prjConfig1, prjConfig2);
//
// client.createBatchProjects(configs);
//
// verify(requestFactory).createPostRequest(anyString(), prjsArgCaptor.capture());
// verify(asyncRequest).header(ACCEPT, MimeType.APPLICATION_JSON);
// verify(loaderFactory).newLoader("Creating the batch of projects...");
// verify(asyncRequest).loader(messageLoader);
// verify(asyncRequest).send(unmarshallablePrjsConf);
// verify(unmarshaller).newListUnmarshaller(ProjectConfigDto.class);
//
// assertEquals(2, prjsArgCaptor.getValue().size());
List<NewProjectConfigDto> configs = Arrays.asList(prjConfig1, prjConfig2);

client.createBatchProjects(configs);

verify(requestFactory).createPostRequest(anyString(), prjsArgCaptor.capture());
verify(asyncRequest).header(ACCEPT, APPLICATION_JSON);
verify(loaderFactory).newLoader("Creating the batch of projects...");
verify(asyncRequest).loader(messageLoader);
verify(asyncRequest).send(unmarshallablePrjsConf);
verify(unmarshaller).newListUnmarshaller(ProjectConfigDto.class);

assertEquals(2, prjsArgCaptor.getValue().size());
}

@Test
Expand Down Expand Up @@ -324,7 +330,7 @@ public void shouldEncodeUrlAndGetTree() {
client.getTree(resourcePath, 2, true);

verify(requestFactory).createGetRequest(any());
verify(asyncRequest).header(ACCEPT, MimeType.APPLICATION_JSON);
verify(asyncRequest).header(ACCEPT, APPLICATION_JSON);
verify(unmarshaller).newUnmarshaller(TreeElement.class);
verify(asyncRequest).send(unmarshallableTreeElem);
}
Expand All @@ -334,7 +340,7 @@ public void shouldEncodeUrlAndGetItem() {
client.getItem(resourcePath);

verify(requestFactory).createGetRequest(any());
verify(asyncRequest).header(ACCEPT, MimeType.APPLICATION_JSON);
verify(asyncRequest).header(ACCEPT, APPLICATION_JSON);
verify(loaderFactory).newLoader("Getting item...");
verify(unmarshaller).newUnmarshaller(ItemReference.class);
verify(asyncRequest).send(unmarshallableItemRef);
Expand All @@ -345,7 +351,7 @@ public void shouldEncodeUrlAndGetProject() {
client.getProject(Path.valueOf(TEXT));

verify(requestFactory).createGetRequest(any());
verify(asyncRequest).header(ACCEPT, MimeType.APPLICATION_JSON);
verify(asyncRequest).header(ACCEPT, APPLICATION_JSON);
verify(loaderFactory).newLoader("Getting project...");
verify(asyncRequest).loader(messageLoader);
verify(unmarshaller).newUnmarshaller(ProjectConfigDto.class);
Expand All @@ -362,8 +368,8 @@ public void shouldEncodeUrlAndUpdateProject() {
client.updateProject(prjConfig1);

verify(requestFactory).createRequest(eq(PUT), anyString(), eq(prjConfig1), eq(false));
verify(asyncRequest).header(CONTENT_TYPE, MimeType.APPLICATION_JSON);
verify(asyncRequest).header(ACCEPT, MimeType.APPLICATION_JSON);
verify(asyncRequest).header(CONTENT_TYPE, APPLICATION_JSON);
verify(asyncRequest).header(ACCEPT, APPLICATION_JSON);
verify(loaderFactory).newLoader("Updating project...");
verify(asyncRequest).loader(messageLoader);
verify(unmarshaller).newUnmarshaller(ProjectConfigDto.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
</dependency>
<dependency>
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-assistedinject</artifactId>
</dependency>
<dependency>
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-multibindings</artifactId>
Expand All @@ -42,6 +46,10 @@
<groupId>org.eclipse.birt.runtime</groupId>
<artifactId>org.eclipse.equinox.common</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-api-core</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-api-debug</artifactId>
Expand All @@ -54,6 +62,10 @@
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-api-dto</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-api-project</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-commons-annotations</artifactId>
Expand All @@ -80,6 +92,10 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.che.plugin</groupId>
<artifactId>org.eclipse.core.resources</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.plugin</groupId>
<artifactId>org.eclipse.jdt.ui</artifactId>
Expand Down
Loading

0 comments on commit b745dc7

Please sign in to comment.