-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CHE-4014; remove deprecated RemotePreferenceDao (#4455)
- Loading branch information
1 parent
c69d7aa
commit 4521969
Showing
10 changed files
with
107 additions
and
469 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
wsagent/che-core-api-git/src/test/java/org/eclipse/che/api/git/LocalGitUserResolverTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2012-2017 Codenvy, S.A. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Codenvy, S.A. - initial API and implementation | ||
*******************************************************************************/ | ||
/******************************************************************************* | ||
+ * Copyright (c) 2012-2017 Codenvy, S.A. | ||
+ * All rights reserved. This program and the accompanying materials | ||
+ * are made available under the terms of the Eclipse Public License v1.0 | ||
+ * which accompanies this distribution, and is available at | ||
+ * http://www.eclipse.org/legal/epl-v10.html | ||
+ * | ||
+ * Contributors: | ||
+ * Codenvy, S.A. - initial API and implementation | ||
+ *******************************************************************************/ | ||
package org.eclipse.che.api.git; | ||
|
||
import org.eclipse.che.api.core.rest.HttpJsonRequest; | ||
import org.eclipse.che.api.core.rest.HttpJsonRequestFactory; | ||
import org.eclipse.che.api.core.rest.HttpJsonResponse; | ||
import org.eclipse.che.api.user.server.PreferencesService; | ||
import org.eclipse.che.commons.test.mockito.answer.SelfReturningAnswer; | ||
import org.mockito.Mock; | ||
import org.mockito.testng.MockitoTestNGListener; | ||
import org.testng.annotations.BeforeMethod; | ||
import org.testng.annotations.Listeners; | ||
import org.testng.annotations.Test; | ||
|
||
|
||
import static javax.ws.rs.core.UriBuilder.fromUri; | ||
import static org.mockito.Matchers.anyString; | ||
import static org.mockito.Matchers.eq; | ||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.verify; | ||
import static org.mockito.Mockito.when; | ||
|
||
/** | ||
* Tests for {@link LocalGitUserResolver} | ||
* | ||
* @author Max Shaposhnik | ||
*/ | ||
|
||
@Listeners(MockitoTestNGListener.class) | ||
public class LocalGitUserResolverTest { | ||
|
||
private final static String API_URL = "apiUrl"; | ||
private final static String PREFECENCES_URL = "apiUrl/preferences"; | ||
|
||
@Mock | ||
private HttpJsonRequestFactory requestFactory; | ||
@Mock | ||
private HttpJsonResponse jsonResponse; | ||
|
||
private HttpJsonRequest jsonRequest; | ||
|
||
private LocalGitUserResolver resolver; | ||
|
||
@BeforeMethod | ||
public void setup() throws Exception { | ||
jsonRequest = mock(HttpJsonRequest.class, new SelfReturningAnswer()); | ||
when(jsonRequest.request()).thenReturn(jsonResponse); | ||
when(requestFactory.fromUrl(anyString())).thenReturn(jsonRequest); | ||
resolver = new LocalGitUserResolver(API_URL, requestFactory); | ||
} | ||
|
||
@Test | ||
public void shouldMakeGetPreferencesRequest() throws Exception { | ||
//when | ||
resolver.getUser(); | ||
//then | ||
String url = fromUri(PREFECENCES_URL).path(PreferencesService.class, "find").build().toString(); | ||
verify(requestFactory).fromUrl(eq(url)); | ||
verify(jsonRequest).useGetMethod(); | ||
verify(jsonRequest).request(); | ||
verify(jsonResponse).asProperties(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
116 changes: 0 additions & 116 deletions
116
wsagent/wsagent-local/src/main/java/org/eclipse/che/RemotePreferenceDao.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.