From 80d4d8bb26ac48d6cb4dee3e09d91a9625099223 Mon Sep 17 00:00:00 2001 From: Jason Prickett Date: Thu, 19 Nov 2015 13:13:08 -0500 Subject: [PATCH] small changes to fix the jar names and remove some build warnings #464476 --- build.gradle | 9 ++++++++- .../idea/ui/checkout/TfsCheckoutPageModel.java | 5 ----- .../idea/ui/pullrequest/CreatePullRequestForm.java | 8 ++++++-- .../plugin/idea/utils/ServerContextSettings.java | 4 +--- .../ui/pullrequest/DiffCompareInfoProviderTest.java | 11 +++++------ .../alm/plugin/context/soap/CatalogServiceImpl.java | 13 ++++++++----- 6 files changed, 28 insertions(+), 22 deletions(-) diff --git a/build.gradle b/build.gradle index 6d6d0d28..e3d51824 100644 --- a/build.gradle +++ b/build.gradle @@ -43,12 +43,19 @@ subprojects { * specific settings for each project */ project(":common") { + jar { + baseName 'com.microsoft.alm.common' + } } project(":plugin") { dependencies { compile project(':common') } + + jar { + baseName 'com.microsoft.alm.plugin' + } } project(":plugin.idea") { @@ -58,7 +65,7 @@ project(":plugin.idea") { } jar { - baseName 'com.microsoft.alm' + baseName 'com.microsoft.alm.plugin.idea' from('.') { include 'META-INF/plugin.xml' } diff --git a/plugin.idea/src/com/microsoft/alm/plugin/idea/ui/checkout/TfsCheckoutPageModel.java b/plugin.idea/src/com/microsoft/alm/plugin/idea/ui/checkout/TfsCheckoutPageModel.java index bf5c4ada..8ca5311b 100644 --- a/plugin.idea/src/com/microsoft/alm/plugin/idea/ui/checkout/TfsCheckoutPageModel.java +++ b/plugin.idea/src/com/microsoft/alm/plugin/idea/ui/checkout/TfsCheckoutPageModel.java @@ -62,11 +62,6 @@ class TfsCheckoutPageModel extends CheckoutPageModelImpl { authenticationProvider.clearAuthenticationDetails(); } - @Override - protected void setServerNameInternal(String serverName) { - super.setServerNameInternal(serverName); - } - @Override public void loadRepositories() { clearErrors(); diff --git a/plugin.idea/src/com/microsoft/alm/plugin/idea/ui/pullrequest/CreatePullRequestForm.java b/plugin.idea/src/com/microsoft/alm/plugin/idea/ui/pullrequest/CreatePullRequestForm.java index 70adcdeb..7b7ca521 100644 --- a/plugin.idea/src/com/microsoft/alm/plugin/idea/ui/pullrequest/CreatePullRequestForm.java +++ b/plugin.idea/src/com/microsoft/alm/plugin/idea/ui/pullrequest/CreatePullRequestForm.java @@ -126,9 +126,13 @@ public class CreatePullRequestForm { return this.descriptionTextArea.getText(); } - @SuppressWarnings("unchecked") public GitRemoteBranch getSelectedRemoteBranch() { - return (GitRemoteBranch) this.targetBranchDropdown.getSelectedItem(); + Object o = this.targetBranchDropdown.getSelectedItem(); + if (o instanceof GitRemoteBranch) { + return (GitRemoteBranch) this.targetBranchDropdown.getSelectedItem(); + } + + return null; } public void setSelectedTargetBranch(final GitRemoteBranch targetBranch) { diff --git a/plugin.idea/src/com/microsoft/alm/plugin/idea/utils/ServerContextSettings.java b/plugin.idea/src/com/microsoft/alm/plugin/idea/utils/ServerContextSettings.java index 409fdc02..4d567bd6 100644 --- a/plugin.idea/src/com/microsoft/alm/plugin/idea/utils/ServerContextSettings.java +++ b/plugin.idea/src/com/microsoft/alm/plugin/idea/utils/ServerContextSettings.java @@ -67,8 +67,6 @@ public class ServerContextSettings implements PersistentStateComponent * Shortly thereafter, ServerContextManager will initialize and will take ownership of this data with actively * managed ServerContexts, and this state data should not be used again. - * - * @param state */ public void loadState(final ServerContextItemsStore state) { this.restoreState = state; @@ -162,7 +160,7 @@ public class ServerContextSettings implements PersistentStateComponent getServerContextsToRestore() { if (restoreState == null || restoreState.serverContextItemStores == null) { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } final List serverContexts = new ArrayList(); diff --git a/plugin.idea/test/com/microsoft/alm/plugin/idea/ui/pullrequest/DiffCompareInfoProviderTest.java b/plugin.idea/test/com/microsoft/alm/plugin/idea/ui/pullrequest/DiffCompareInfoProviderTest.java index 91cc1ccd..03a4e9c1 100644 --- a/plugin.idea/test/com/microsoft/alm/plugin/idea/ui/pullrequest/DiffCompareInfoProviderTest.java +++ b/plugin.idea/test/com/microsoft/alm/plugin/idea/ui/pullrequest/DiffCompareInfoProviderTest.java @@ -16,8 +16,8 @@ import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; -import java.util.Arrays; import java.util.Collection; +import java.util.Collections; import java.util.LinkedList; import java.util.List; @@ -76,7 +76,6 @@ public class DiffCompareInfoProviderTest extends IdeaAbstractTest { assertCompareInfoEmptiness(underTest.getBranchCompareInfo(projectMock, gitRepositoryMock, "test1", "test2")); } - @SuppressWarnings("unchecked") @Test public void testBranchCompare() throws VcsException { when(gitUtilWrapperMock.getMergeBase(any(Project.class), any(VirtualFile.class), eq("test2"), eq("test1"))) @@ -84,15 +83,15 @@ public class DiffCompareInfoProviderTest extends IdeaAbstractTest { GitCommit commitMock1 = PRGitObjectMockHelper.getCommit(projectMock, fileMock); when(gitUtilWrapperMock.history(any(Project.class), any(VirtualFile.class), eq("myparent.."))) - .thenReturn(Arrays.asList(commitMock1)); + .thenReturn(Collections.singletonList(commitMock1)); GitCommit commitMock2 = PRGitObjectMockHelper.getCommit(projectMock, fileMock); when(gitUtilWrapperMock.history(any(Project.class), any(VirtualFile.class), eq("..myparent"))) - .thenReturn(Arrays.asList(commitMock2)); + .thenReturn(Collections.singletonList(commitMock2)); Change diff = Mockito.mock(Change.class); when(gitUtilWrapperMock.getDiff(any(Project.class), any(VirtualFile.class), eq("myparent"), eq("test1"))) - .thenReturn(Arrays.asList(diff)); + .thenReturn(Collections.singletonList(diff)); final GitCommitCompareInfo compareInfo = underTest.getBranchCompareInfo(projectMock, gitRepositoryMock, "test1", "test2"); @@ -107,7 +106,7 @@ public class DiffCompareInfoProviderTest extends IdeaAbstractTest { Collection diffs = compareInfo.getTotalDiff(); assertEquals(1, diffs.size()); - assertEquals(diff, new LinkedList(diffs).get(0)); + assertEquals(diff, new LinkedList(diffs).get(0)); } diff --git a/plugin/src/com/microsoft/alm/plugin/context/soap/CatalogServiceImpl.java b/plugin/src/com/microsoft/alm/plugin/context/soap/CatalogServiceImpl.java index 28623d39..f5bc2d00 100644 --- a/plugin/src/com/microsoft/alm/plugin/context/soap/CatalogServiceImpl.java +++ b/plugin/src/com/microsoft/alm/plugin/context/soap/CatalogServiceImpl.java @@ -62,6 +62,7 @@ public class CatalogServiceImpl implements CatalogService { } public CatalogServiceImpl(final ServerContext context) { + assert context != null; this.context = context; final URI baseURI = context.getUri(); @@ -73,7 +74,7 @@ public class CatalogServiceImpl implements CatalogService { final QueryData queryForOrganizationRoot = new QueryData(SINGLE_RECURSE_STAR, QUERY_OPTIONS_NONE, ORGANIZATIONAL_ROOT); final CatalogData catalogDataOrganizationRoot = getCatalogDataFromServer(queryForOrganizationRoot); //If auth fails, you can get here and catalogDataOrganizationRoot is null - //TODO: can we get to null from our UI workflows, should we bubble up exception? + //TODO: can we get to null from our UI work flows, should we bubble up exception? if (catalogDataOrganizationRoot != null) { final CatalogResource organizationRoot = catalogDataOrganizationRoot.catalogResources.get(0); @@ -127,14 +128,14 @@ public class CatalogServiceImpl implements CatalogService { httpPost.addHeader(new BasicHeader("Content-Type", "application/soap+xml; charset=utf-8")); //$NON-NLS-1$ //$NON-NLS-2$ try { - if (context == null || context.getHttpClient() == null) { + if (context.getHttpClient() == null) { logger.warn("getCatalogDataFromServer context.getHttpClient() is null"); return null; } final HttpResponse httpResponse = context.getHttpClient().execute(httpPost); final int responseStatusCode = httpResponse.getStatusLine().getStatusCode(); - CatalogData catalogData = null; + CatalogData catalogData; if (responseStatusCode == HttpStatus.SC_OK) { catalogData = new CatalogData(queryData.filterOnResourceType); readResponse(httpResponse, catalogData); @@ -213,6 +214,7 @@ public class CatalogServiceImpl implements CatalogService { try { reader.close(); } catch (final XMLStreamException e) { + // Ignore and continue } } } @@ -224,6 +226,7 @@ public class CatalogServiceImpl implements CatalogService { try { responseStream.close(); } catch (IOException e) { + // Ignore and continue } } } @@ -361,7 +364,7 @@ public class CatalogServiceImpl implements CatalogService { * The element type is an array. */ int event0; - final List list0 = new ArrayList(); + final List list0 = new ArrayList(); do { event0 = reader.nextTag(); @@ -372,7 +375,7 @@ public class CatalogServiceImpl implements CatalogService { } while (event0 != XMLStreamConstants.END_ELEMENT); - this.nodeReferencePaths = (String[]) list0.toArray(new String[list0.size()]); + this.nodeReferencePaths = list0.toArray(new String[list0.size()]); } else { // Read the unknown child element until its end readUntilElementEnd(reader);