diff --git a/.gitignore b/.gitignore index 3a02ff71..12b07834 100644 --- a/.gitignore +++ b/.gitignore @@ -7,8 +7,7 @@ target/ .settings/ .classpath .vscode/ - - +.factorypath maven-confluence-parent.iml maven-confluence-reporting-plugin/confluence-reporting-maven-plugin.iml @@ -64,3 +63,5 @@ patches # maven-project-info-reports-plugin/ + + diff --git a/README.md b/README.md index f43e5fea..3b0951d1 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,9 @@ Please donate whether you wish support us to give more time to plugin's growth | ### News ### +Feb 7, 2019 | [Release 6.2](https://github.com/bsorrentino/maven-confluence-plugin/releases/tag/v6.2) | available from **[MAVEN CENTRAL REPO](http://search.maven.org/#artifactdetails%7Corg.bsc.maven%7Cconfluence-reporting-maven-plugin%7C6.2%7Cmaven-plugin)** | +---- | ---- | ---- | + jan 16, 2019 | [Release 6.1](https://github.com/bsorrentino/maven-confluence-plugin/releases/tag/v6.1) | available from **[MAVEN CENTRAL REPO](http://search.maven.org/#artifactdetails%7Corg.bsc.maven%7Cconfluence-reporting-maven-plugin%7C6.1%7Cmaven-plugin)** | ---- | ---- | ---- | diff --git a/maven-confluence-core/pom.xml b/maven-confluence-core/pom.xml index f7c516d2..00651a27 100644 --- a/maven-confluence-core/pom.xml +++ b/maven-confluence-core/pom.xml @@ -4,7 +4,7 @@ maven-confluence-parent org.bsc.maven - 6.1 + 6.2 4.0.0 @@ -112,7 +112,11 @@ org.pegdown pegdown - + + org.parboiled + parboiled-java + 1.1.7 + com.fasterxml.jackson.dataformat jackson-dataformat-yaml diff --git a/maven-confluence-core/src/main/java/org/bsc/confluence/xmlrpc/BlogEntry.java b/maven-confluence-core/src/main/java/org/bsc/confluence/xmlrpc/BlogEntry.java index 4bb8a119..e3f871da 100644 --- a/maven-confluence-core/src/main/java/org/bsc/confluence/xmlrpc/BlogEntry.java +++ b/maven-confluence-core/src/main/java/org/bsc/confluence/xmlrpc/BlogEntry.java @@ -121,8 +121,8 @@ public void setLocks(int locks) { public Map toRawMap() { Map map = super.toRawMap(); - map.put("version", new Integer(getVersion())); - map.put("locks", new Integer(getLocks())); + map.put("version", getVersion()); + map.put("locks", getLocks()); return map; } diff --git a/maven-confluence-core/src/main/java/org/bsc/confluence/xmlrpc/BlogEntrySummary.java b/maven-confluence-core/src/main/java/org/bsc/confluence/xmlrpc/BlogEntrySummary.java index 8058df98..b3d67d02 100644 --- a/maven-confluence-core/src/main/java/org/bsc/confluence/xmlrpc/BlogEntrySummary.java +++ b/maven-confluence-core/src/main/java/org/bsc/confluence/xmlrpc/BlogEntrySummary.java @@ -101,7 +101,7 @@ public void setPublishDate(Date publishDate) { public Map toRawMap() { Map map = super.toRawMap(); map.put("publishDate", getPublishDate()); - map.put("locks", new Integer(getLocks())); + map.put("locks", getLocks()); return map; } diff --git a/maven-confluence-core/src/main/java/org/bsc/confluence/xmlrpc/Confluence.java b/maven-confluence-core/src/main/java/org/bsc/confluence/xmlrpc/Confluence.java index f604b5a4..f84da7d8 100644 --- a/maven-confluence-core/src/main/java/org/bsc/confluence/xmlrpc/Confluence.java +++ b/maven-confluence-core/src/main/java/org/bsc/confluence/xmlrpc/Confluence.java @@ -161,7 +161,7 @@ public boolean logout() throws Exception { * exports a Confluence instance and returns a String holding the URL for the download. The boolean argument indicates whether or not attachments ought to be included in the export. */ public String exportSite(boolean exportAttachments) throws Exception { - return (String) call("exportSite", new Boolean(exportAttachments)); + return (String) call("exportSite", exportAttachments); } /** @@ -374,7 +374,7 @@ public byte[] getAttachmentData(String pageId, String fileName, String versionNu * add a new attachment to a content entity object. *Note that this uses a lot of memory -- about 4 times the size of the attachment.* */ public Attachment addAttachment(long contentId, Attachment attachment, byte[] attachmentData) throws Exception { - Map data = call("addAttachment", new Long(contentId), attachment, attachmentData); + Map data = call("addAttachment", contentId, attachment, attachmentData); return new Attachment(data); } @@ -423,7 +423,7 @@ public BlogEntry storeBlogEntry(BlogEntry entry) throws Exception { * Retrieves a blog post in the Space with the given spaceKey, with the title 'postTitle' and posted on the day 'dayOfMonth'. */ public BlogEntry getBlogEntryByDayAndTitle(String spaceKey, int dayOfMonth, String postTitle) throws Exception { - Map data = call("getBlogEntryByDayAndTitle", spaceKey, new Integer(dayOfMonth), postTitle); + Map data = call("getBlogEntryByDayAndTitle", spaceKey, dayOfMonth, postTitle); return new BlogEntry(data); } @@ -432,7 +432,7 @@ public BlogEntry getBlogEntryByDayAndTitle(String spaceKey, int dayOfMonth, Stri * empty parameter map. */ public Listsearch(String query, int maxResults) throws Exception { - Object[] vector = (Object[]) call("search", query, new Integer(maxResults)); + Object[] vector = (Object[]) call("search", query, maxResults); return toList(vector, SearchResult.class); } @@ -441,7 +441,7 @@ public BlogEntry getBlogEntryByDayAndTitle(String spaceKey, int dayOfMonth, Stri * default is used instead. */ public Listsearch(String query, Map parameters, int maxResults) throws Exception { - Object[] vector = (Object[]) call("search", query, parameters, new Integer(maxResults)); + Object[] vector = (Object[]) call("search", query, parameters, (maxResults)); return toList(vector, SearchResult.class); } @@ -647,7 +647,7 @@ public boolean reactivateUser(String username) throws Exception { * returns all registered users as Strings */ public ListgetActiveUsers(boolean viewAll) throws Exception { - Object[] vector = (Object[]) call("getActiveUsers", new Boolean(viewAll)); + Object[] vector = (Object[]) call("getActiveUsers", (viewAll)); return Arrays.asList(vector); } @@ -687,7 +687,7 @@ public boolean changeUserPassword(String username, String newPass) throws Except * Returns all {@link Label}s for the given ContentEntityObject ID */ public ListgetLabelsById(long objectId) throws Exception { - Object[] vector = (Object[]) call("getLabelsById", new Long(objectId)); + Object[] vector = (Object[]) call("getLabelsById", (objectId)); return toList(vector, Label.class); } @@ -695,7 +695,7 @@ public boolean changeUserPassword(String username, String newPass) throws Except * Returns the most popular {@link Label}s for the Confluence instance, with a specified maximum number. */ public ListgetMostPopularLabels(int maxCount) throws Exception { - Object[] vector = (Object[]) call("getMostPopularLabels", new Integer(maxCount)); + Object[] vector = (Object[]) call("getMostPopularLabels", (maxCount)); return toList(vector, Label.class); } @@ -703,7 +703,7 @@ public boolean changeUserPassword(String username, String newPass) throws Except * Returns the most popular {@link Label}s for the given {{spaceKey}}, with a specified maximum number of results. */ public ListgetMostPopularLabelsInSpace(String spaceKey, int maxCount) throws Exception { - Object[] vector = (Object[]) call("getMostPopularLabelsInSpace", spaceKey, new Integer(maxCount)); + Object[] vector = (Object[]) call("getMostPopularLabelsInSpace", spaceKey, (maxCount)); return toList(vector, Label.class); } @@ -711,7 +711,7 @@ public boolean changeUserPassword(String username, String newPass) throws Except * Returns the recently used {@link Label}s for the Confluence instance, with a specified maximum number of results. */ public ListgetRecentlyUsedLabels(int maxResults) throws Exception { - Object[] vector = (Object[]) call("getRecentlyUsedLabels", new Integer(maxResults)); + Object[] vector = (Object[]) call("getRecentlyUsedLabels", (maxResults)); return toList(vector, Label.class); } @@ -719,7 +719,7 @@ public boolean changeUserPassword(String username, String newPass) throws Except * Returns the recently used {@link Label}s for the given {{spaceKey}}, with a specified maximum number of results. */ public ListgetRecentlyUsedLabelsInSpace(String spaceKey, int maxResults) throws Exception { - Object[] vector = (Object[]) call("getRecentlyUsedLabelsInSpace", spaceKey, new Integer(maxResults)); + Object[] vector = (Object[]) call("getRecentlyUsedLabelsInSpace", spaceKey, (maxResults)); return toList(vector, Label.class); } @@ -735,7 +735,7 @@ public boolean changeUserPassword(String username, String newPass) throws Except * Returns the {@link Label}s related to the given label name, with a specified maximum number of results. */ public ListgetRelatedLabels(String labelName, int maxResults) throws Exception { - Object[] vector = (Object[]) call("getRelatedLabels", labelName, new Integer(maxResults)); + Object[] vector = (Object[]) call("getRelatedLabels", labelName, (maxResults)); return toList(vector, Label.class); } @@ -743,7 +743,7 @@ public boolean changeUserPassword(String username, String newPass) throws Except * Returns the {@link Label}s related to the given label name for the given {{spaceKey}}, with a specified maximum number of results. */ public ListgetRelatedLabelsInSpace(String labelName, String spaceKey, int maxResults) throws Exception { - Object[] vector = (Object[]) call("getRelatedLabelsInSpace", labelName, spaceKey, new Integer(maxResults)); + Object[] vector = (Object[]) call("getRelatedLabelsInSpace", labelName, spaceKey, (maxResults)); return toList(vector, Label.class); } @@ -759,7 +759,7 @@ public boolean changeUserPassword(String username, String newPass) throws Except * Returns the content for a given label ID */ public List getLabelContentById(long labelId) throws Exception { - Object[] vector = (Object[]) call("getLabelContentById", new Long(labelId)); + Object[] vector = (Object[]) call("getLabelContentById", (labelId)); return Arrays.asList(vector); } @@ -791,7 +791,7 @@ public List getSpacesContainingContentWithLabel(String labelName) throws * Adds a label to the object with the given ContentEntityObject ID. */ public boolean addLabelByName(String labelName, long objectId) throws Exception { - Boolean value = (Boolean) call("addLabelByName", labelName, new Long(objectId)); + Boolean value = (Boolean) call("addLabelByName", labelName, (objectId)); return value.booleanValue(); } @@ -799,7 +799,7 @@ public boolean addLabelByName(String labelName, long objectId) throws Exception * Adds a label with the given ID to the object with the given ContentEntityObject ID. */ public boolean addLabelById(long labelId, long objectId) throws Exception { - Boolean value = (Boolean) call("addLabelById", new Long(labelId), new Long(objectId)); + Boolean value = (Boolean) call("addLabelById", (labelId), (objectId)); return value.booleanValue(); } @@ -807,7 +807,7 @@ public boolean addLabelById(long labelId, long objectId) throws Exception { * Adds the given label object to the object with the given ContentEntityObject ID. */ public boolean addLabelByObject(Label labelObject, long objectId) throws Exception { - Boolean value = (Boolean) call("addLabelByObject", labelObject, new Long(objectId)); + Boolean value = (Boolean) call("addLabelByObject", labelObject, (objectId)); return value.booleanValue(); } @@ -823,7 +823,7 @@ public boolean addLabelByNameToSpace(String labelName, String spaceKey) throws E * Removes the given label from the object with the given ContentEntityObject ID. */ public boolean removeLabelByName(String labelName, long objectId) throws Exception { - Boolean value = (Boolean) call("removeLabelByName", labelName, new Long(objectId)); + Boolean value = (Boolean) call("removeLabelByName", labelName, (objectId)); return value.booleanValue(); } @@ -831,7 +831,7 @@ public boolean removeLabelByName(String labelName, long objectId) throws Excepti * Removes the label with the given ID from the object with the given ContentEntityObject ID. */ public boolean removeLabelById(long labelId, long objectId) throws Exception { - Boolean value = (Boolean) call("removeLabelById", new Long(labelId), new Long(objectId)); + Boolean value = (Boolean) call("removeLabelById", (labelId), (objectId)); return value.booleanValue(); } @@ -839,7 +839,7 @@ public boolean removeLabelById(long labelId, long objectId) throws Exception { * Removes the given label object from the object with the given ContentEntityObject ID. */ public boolean removeLabelByObject(Label labelObject, long objectId) throws Exception { - Boolean value = (Boolean) call("removeLabelByObject", labelObject, new Long(objectId)); + Boolean value = (Boolean) call("removeLabelByObject", labelObject, (objectId)); return value.booleanValue(); } diff --git a/maven-confluence-core/src/main/java/org/bsc/confluence/xmlrpc/MapObject.java b/maven-confluence-core/src/main/java/org/bsc/confluence/xmlrpc/MapObject.java index 7dfe991c..25dfee56 100644 --- a/maven-confluence-core/src/main/java/org/bsc/confluence/xmlrpc/MapObject.java +++ b/maven-confluence-core/src/main/java/org/bsc/confluence/xmlrpc/MapObject.java @@ -76,11 +76,11 @@ protected void setString(String key, String value) { } protected void setInt(String key, int value) { - fields.put(key, new Integer(value)); + fields.put(key,value); } protected void setInt(String key, String value) { - fields.put(key, new Integer(value)); + fields.put(key, value); } protected int getInt(String key) { @@ -101,7 +101,7 @@ protected int getInt(String key) { } protected void setBoolean(String key, boolean value) { - fields.put(key, new Boolean(value)); + fields.put(key, value); } protected void setBoolean(String key, String value) { diff --git a/maven-confluence-core/src/main/java/org/bsc/confluence/xmlrpc/ServerInfo.java b/maven-confluence-core/src/main/java/org/bsc/confluence/xmlrpc/ServerInfo.java index 3e9c910d..00e3d2fe 100644 --- a/maven-confluence-core/src/main/java/org/bsc/confluence/xmlrpc/ServerInfo.java +++ b/maven-confluence-core/src/main/java/org/bsc/confluence/xmlrpc/ServerInfo.java @@ -99,10 +99,10 @@ public void setBaseUrl(String baseUrl) { public Map toRawMap() { Map map = super.toRawMap(); - map.put("majorVersion", new Integer(getMajorVersion())); - map.put("minorVersion", new Integer(getMinorVersion())); - map.put("patchLevel", new Integer(getPatchLevel())); - map.put("developmentBuild", new Boolean(isDevelopmentBuild())); + map.put("majorVersion", getMajorVersion()); + map.put("minorVersion", getMinorVersion()); + map.put("patchLevel", getPatchLevel()); + map.put("developmentBuild", isDevelopmentBuild()); return map; } } diff --git a/maven-confluence-core/src/main/java/org/bsc/confluence/xmlrpc/UserInformation.java b/maven-confluence-core/src/main/java/org/bsc/confluence/xmlrpc/UserInformation.java index d789f49a..32ec831f 100644 --- a/maven-confluence-core/src/main/java/org/bsc/confluence/xmlrpc/UserInformation.java +++ b/maven-confluence-core/src/main/java/org/bsc/confluence/xmlrpc/UserInformation.java @@ -122,7 +122,7 @@ public void setLastModificationDate(Date lastModificationDate) { public Map toRawMap() { Map map = super.toRawMap(); - map.put("version", new Integer(getVersion())); + map.put("version", getVersion()); map.put("creationDate", getCreationDate()); map.put("lastModificationDate", getLastModificationDate()); return map; diff --git a/maven-confluence-core/src/main/java/org/bsc/confluence/xmlrpc/XMLRPCConfluenceServiceImpl.java b/maven-confluence-core/src/main/java/org/bsc/confluence/xmlrpc/XMLRPCConfluenceServiceImpl.java index ed8afc36..0f433182 100644 --- a/maven-confluence-core/src/main/java/org/bsc/confluence/xmlrpc/XMLRPCConfluenceServiceImpl.java +++ b/maven-confluence-core/src/main/java/org/bsc/confluence/xmlrpc/XMLRPCConfluenceServiceImpl.java @@ -209,7 +209,7 @@ public CompletableFuture addAttachment(Model.Page page, Model. a.setPageId( page.getId() ); - result.complete(connection.addAttachment( new Long(page.getId()), a, baos.toByteArray() )); + result.complete(connection.addAttachment( Long.parseLong(page.getId()), a, baos.toByteArray() )); } catch (Exception e) { result.completeExceptionally(e); diff --git a/maven-confluence-core/src/test/java/org/bsc/confluence/model/SiteTest.java b/maven-confluence-core/src/test/java/org/bsc/confluence/model/SiteTest.java index 4de144fc..5322605a 100644 --- a/maven-confluence-core/src/test/java/org/bsc/confluence/model/SiteTest.java +++ b/maven-confluence-core/src/test/java/org/bsc/confluence/model/SiteTest.java @@ -4,7 +4,7 @@ import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertThat; -import static org.junit.matchers.JUnitMatchers.containsString; +import static org.hamcrest.CoreMatchers.containsString; import java.io.IOException; import java.io.InputStream; diff --git a/maven-confluence-itest/pom.xml b/maven-confluence-itest/pom.xml index b93dedf8..ec30e981 100644 --- a/maven-confluence-itest/pom.xml +++ b/maven-confluence-itest/pom.xml @@ -5,7 +5,7 @@ maven-confluence-parent org.bsc.maven - 6.1 + 6.2 4.0.0 @@ -44,7 +44,6 @@ junit junit - 4.12 test diff --git a/maven-confluence-itest/src/test/java/org/bsc/maven/confluence/plugin/TemplateVariablesInPagesTest.java b/maven-confluence-itest/src/test/java/org/bsc/maven/confluence/plugin/TemplateVariablesInPagesTest.java index 30968448..af610d88 100644 --- a/maven-confluence-itest/src/test/java/org/bsc/maven/confluence/plugin/TemplateVariablesInPagesTest.java +++ b/maven-confluence-itest/src/test/java/org/bsc/maven/confluence/plugin/TemplateVariablesInPagesTest.java @@ -1,38 +1,50 @@ package org.bsc.maven.confluence.plugin; -import org.apache.commons.codec.digest.DigestUtils; -import org.apache.maven.it.VerificationException; -import org.apache.maven.it.Verifier; -import org.apache.maven.it.util.ResourceExtractor; -import org.apache.xmlrpc.WebServer; -import org.codehaus.swizzle.confluence.Page; -import org.junit.*; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; - -import java.io.File; -import java.io.IOException; -import java.util.*; - import static java.lang.String.format; -import static org.apache.maven.it.util.FileUtils.*; +import static org.apache.maven.it.util.FileUtils.deleteDirectory; +import static org.apache.maven.it.util.FileUtils.fileExists; +import static org.apache.maven.it.util.FileUtils.fileRead; +import static org.apache.maven.it.util.FileUtils.fileWrite; +import static org.apache.maven.it.util.FileUtils.mkdir; import static org.apache.maven.it.util.ResourceExtractor.simpleExtractResources; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.not; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.*; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyString; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.List; +import java.util.Map; + +import org.apache.commons.codec.digest.DigestUtils; +import org.apache.maven.it.VerificationException; +import org.apache.maven.it.Verifier; +import org.apache.maven.it.util.ResourceExtractor; +import org.apache.xmlrpc.WebServer; +import org.codehaus.swizzle.confluence.Page; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + @SuppressWarnings("unchecked") public class TemplateVariablesInPagesTest { public interface Handler { Map getPage(String tokken, String space, String page); Map getServerInfo(String tokken); - List getChildren(String tokken, String parentId); + List> getChildren(String tokken, String parentId); String login(String username, String password); boolean logout(String tokken); Map storePage(String tokken, Hashtable page); @@ -64,9 +76,9 @@ public void setUp() { when(handler.getServerInfo(tokken)).thenReturn(serverInfo); when(handler.logout(tokken)).thenReturn(true); - when(handler.getChildren(tokken, "0")).thenReturn(new Vector()); + when(handler.getChildren(tokken, "0")).thenReturn(new ArrayList>()); String homePageName = "Hello Plugin"; - when(handler.getChildren(tokken, DigestUtils.md5Hex(homePageName))).thenReturn(new Vector()); + when(handler.getChildren(tokken, DigestUtils.md5Hex(homePageName))).thenReturn(new ArrayList>()); } @@ -83,36 +95,35 @@ private Verifier testLaunchingMaven(File testBasedir, List cliOptions, S final String results = testBasedir.getAbsolutePath() + "/results"; mkdir(results); - final HashMap titleToPage = new HashMap(); - Hashtable homePage = new Hashtable(); + final HashMap> titleToPage = new HashMap<>(); + Map homePage = new HashMap(); homePage.put("title", "Fake Root"); homePage.put("id", "0"); homePage.put("space", "DOC"); titleToPage.put("Fake Root", homePage); - when(handler.getPage(anyString(), anyString(), anyString())).then(new Answer() { - @Override - public Hashtable answer(InvocationOnMock invocationOnMock) throws Throwable { - String title = (String)invocationOnMock.getArguments()[2]; + when(handler.getPage(anyString(), anyString(), anyString())).then( ( invocationOnMock ) -> { + + String title = (String)invocationOnMock.getArguments()[2]; if (titleToPage.containsKey(title)) { - return (Hashtable) titleToPage.get(title); + return titleToPage.get(title); } - return new Hashtable(); - } + return Collections.emptyMap(); }); - - when(handler.storePage(anyString(), any(Hashtable.class))).then(new Answer>() { - @Override - public Map answer(InvocationOnMock invocationOnMock) throws Throwable { - Hashtable hashtable = new Hashtable(); - Map pageMap = (Map) invocationOnMock.getArguments()[1]; + + + + when(handler.storePage(anyString(), any(Hashtable.class))).then( ( invocationOnMock ) -> { + Map hashtable = new HashMap<>(); + Map pageMap = (Map)invocationOnMock.getArguments()[1]; hashtable.putAll(pageMap); Page page = new Page(pageMap); String parentId = page.getParentId(); if (parentId != null) { String parentTitle = null; - for (Map map : titleToPage.values()) { + + for (Map map : titleToPage.values()) { Page p = new Page(map); if (parentId.equals(p.getId())) { parentTitle = p.getTitle(); @@ -132,23 +143,23 @@ public Map answer(InvocationOnMock invocationOnMock) throws Thro hashtable.put("space", "DOC"); titleToPage.put(page.getTitle(), hashtable); return hashtable; - } - }); + }); + + + when(handler.getChildren(anyString(), anyString())).then(( invocationOnMock ) -> { - when(handler.getChildren(anyString(), anyString())).then(new Answer() { - @Override - public List answer(InvocationOnMock invocationOnMock) throws Throwable { - String parentPageId = (String)invocationOnMock.getArguments()[1]; - Vector children = new Vector(); - for (Map pageMap : titleToPage.values()) { + String parentPageId = (String)invocationOnMock.getArguments()[1]; + + List> children = new ArrayList<>(); + + for (Map pageMap : titleToPage.values()) { Page page = new Page(pageMap); if (parentPageId.equals(page.getParentId())) { children.add(pageMap); } } return children; - } - }); + }); Verifier verifier = new Verifier(testBasedir.getAbsolutePath()); verifier.deleteArtifact("sample.plugin", "hello-maven-plugin", "1.0-SNAPSHOT", "jar"); @@ -167,7 +178,7 @@ public List answer(InvocationOnMock invocationOnMock) throws Throwable { @Test public void shouldRenderTheIndexPage() throws IOException, VerificationException, InterruptedException { File testDir = simpleExtractResources(getClass(), "/simple-plugin-project"); - testLaunchingMaven(testDir, new ArrayList() {}, "clean", "package", "confluence-reporting:deploy"); + testLaunchingMaven(testDir, Collections.emptyList(), "clean", "package", "confluence-reporting:deploy"); assertTrue(fileExists(testDir.getAbsolutePath() + "/results/Fake Root=>Hello Plugin")); assertTrue(fileExists(testDir.getAbsolutePath() + "/results/Hello Plugin=>Hello Plugin - Summary")); @@ -184,7 +195,7 @@ public void shouldRenderTheIndexPage() throws IOException, VerificationException @Test public void shouldPutTheGoalsAsChildrenOfGoalsPage() throws IOException, VerificationException, InterruptedException { File testDir = simpleExtractResources(getClass(), "/plugin-project-goals-in-subpage"); - testLaunchingMaven(testDir, new ArrayList() {}, "clean", "package", "confluence-reporting:deploy"); + testLaunchingMaven(testDir, Collections.emptyList(), "clean", "package", "confluence-reporting:deploy"); assertTrue(fileExists(testDir.getAbsolutePath() + "/results/Fake Root=>Hello Plugin")); String pluginGoalsPath = testDir.getAbsolutePath() + "/results/Hello Plugin=>Hello Plugin - Goals"; assertTrue(fileExists(pluginGoalsPath)); diff --git a/maven-confluence-reporting-plugin/pom.xml b/maven-confluence-reporting-plugin/pom.xml index a379728d..9826639e 100755 --- a/maven-confluence-reporting-plugin/pom.xml +++ b/maven-confluence-reporting-plugin/pom.xml @@ -4,7 +4,7 @@ maven-confluence-parent org.bsc.maven - 6.1 + 6.2 @@ -337,11 +337,20 @@ TEST softphone-server .confluence + false true + + + + deploy + + package + + diff --git a/maven-confluence-reporting-plugin/src/main/java/org/bsc/maven/confluence/plugin/ReportingResolutionListener.java b/maven-confluence-reporting-plugin/src/main/java/org/bsc/maven/confluence/plugin/ReportingResolutionListener.java index 79dd75a2..9cf434dc 100755 --- a/maven-confluence-reporting-plugin/src/main/java/org/bsc/maven/confluence/plugin/ReportingResolutionListener.java +++ b/maven-confluence-reporting-plugin/src/main/java/org/bsc/maven/confluence/plugin/ReportingResolutionListener.java @@ -20,7 +20,7 @@ public class ReportingResolutionListener implements ResolutionListener { private Stack parents = new Stack<>(); - private Map artifacts = new HashMap<>(); + private Map artifacts = new HashMap<>(); private Node rootNode; @@ -34,7 +34,7 @@ public void testArtifact( Artifact artifact ) @Override public void startProcessChildren( Artifact artifact ) { - Node node = (Node) artifacts.get( artifact.getDependencyConflictId() ); + Node node = artifacts.get( artifact.getDependencyConflictId() ); if ( parents.isEmpty() ) { rootNode = node; @@ -46,7 +46,7 @@ public void startProcessChildren( Artifact artifact ) @Override public void endProcessChildren( Artifact artifact ) { - Node check = (Node) parents.pop(); + Node check = parents.pop(); assert artifact.equals( check.artifact ); } @@ -55,7 +55,7 @@ public void omitForNearer( Artifact omitted, Artifact kept ) { assert omitted.getDependencyConflictId().equals( kept.getDependencyConflictId() ); - Node prev = (Node) artifacts.get( omitted.getDependencyConflictId() ); + Node prev = artifacts.get( omitted.getDependencyConflictId() ); if ( prev != null ) { if ( prev.parent != null ) @@ -79,7 +79,7 @@ public void includeArtifact( Artifact artifact ) { if ( artifacts.containsKey( artifact.getDependencyConflictId() ) ) { - Node prev = (Node) artifacts.get( artifact.getDependencyConflictId() ); + Node prev = artifacts.get( artifact.getDependencyConflictId() ); if ( prev.parent != null ) { prev.parent.children.remove( prev ); @@ -100,7 +100,7 @@ public void includeArtifact( Artifact artifact ) @Override public void updateScope( Artifact artifact, String scope ) { - Node node = (Node) artifacts.get( artifact.getDependencyConflictId() ); + Node node = artifacts.get( artifact.getDependencyConflictId() ); node.artifact.setScope( scope ); } @@ -108,7 +108,7 @@ public void updateScope( Artifact artifact, String scope ) @Override public void manageArtifact( Artifact artifact, Artifact replacement ) { - Node node = (Node) artifacts.get( artifact.getDependencyConflictId() ); + Node node = artifacts.get( artifact.getDependencyConflictId() ); if ( node != null ) { @@ -141,7 +141,7 @@ public void restrictRange( Artifact artifact, Artifact artifact1, VersionRange v // intentionally blank } - public Collection getArtifacts() + public Collection getArtifacts() { return artifacts.values(); } @@ -150,11 +150,11 @@ static public class Node { private Node parent; - private List children = new ArrayList<>(); + private List children = new ArrayList<>(); private Artifact artifact; - public List getChildren() + public List getChildren() { return children; } diff --git a/maven-confluence-reporting-plugin/src/main/java/org/bsc/maven/reporting/renderer/DependenciesRenderer.java b/maven-confluence-reporting-plugin/src/main/java/org/bsc/maven/reporting/renderer/DependenciesRenderer.java index 8cc36530..859e6035 100755 --- a/maven-confluence-reporting-plugin/src/main/java/org/bsc/maven/reporting/renderer/DependenciesRenderer.java +++ b/maven-confluence-reporting-plugin/src/main/java/org/bsc/maven/reporting/renderer/DependenciesRenderer.java @@ -4,7 +4,6 @@ import java.util.Collections; import java.util.Comparator; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.Map; @@ -77,7 +76,7 @@ public void renderBody() { // Dependencies report - List dependencies = listener.getRootNode().getChildren(); + final List dependencies = listener.getRootNode().getChildren(); if ( dependencies.isEmpty() ) { @@ -102,23 +101,23 @@ public void renderBody() String[] tableHeader = new String[]{groupId, artifactId, version, classifier, type, optional}; // collect dependencies by scope - Map dependenciesByScope = getDependenciesByScope( dependencies ); + Map> dependenciesByScope = getDependenciesByScope( dependencies ); renderDependenciesForScope( Artifact.SCOPE_COMPILE, - (List) dependenciesByScope.get( Artifact.SCOPE_COMPILE ), tableHeader ); + dependenciesByScope.get( Artifact.SCOPE_COMPILE ), tableHeader ); renderDependenciesForScope( Artifact.SCOPE_RUNTIME, - (List) dependenciesByScope.get( Artifact.SCOPE_RUNTIME ), tableHeader ); - renderDependenciesForScope( Artifact.SCOPE_TEST, (List) dependenciesByScope.get( Artifact.SCOPE_TEST ), + dependenciesByScope.get( Artifact.SCOPE_RUNTIME ), tableHeader ); + renderDependenciesForScope( Artifact.SCOPE_TEST, dependenciesByScope.get( Artifact.SCOPE_TEST ), tableHeader ); renderDependenciesForScope( Artifact.SCOPE_PROVIDED, - (List) dependenciesByScope.get( Artifact.SCOPE_PROVIDED ), tableHeader ); - renderDependenciesForScope( Artifact.SCOPE_SYSTEM, (List) dependenciesByScope.get( Artifact.SCOPE_SYSTEM ), + dependenciesByScope.get( Artifact.SCOPE_PROVIDED ), tableHeader ); + renderDependenciesForScope( Artifact.SCOPE_SYSTEM, dependenciesByScope.get( Artifact.SCOPE_SYSTEM ), tableHeader ); endSection(); // Transitive dependencies - List artifacts = new ArrayList( listener.getArtifacts() ); + final List artifacts = new ArrayList<>( listener.getArtifacts() ); artifacts.removeAll( dependencies ); startSection( getReportString( "report.dependencies.transitive.title" ) ); @@ -134,15 +133,15 @@ public void renderBody() dependenciesByScope = getDependenciesByScope( artifacts ); renderDependenciesForScope( Artifact.SCOPE_COMPILE, - (List) dependenciesByScope.get( Artifact.SCOPE_COMPILE ), tableHeader ); + dependenciesByScope.get( Artifact.SCOPE_COMPILE ), tableHeader ); renderDependenciesForScope( Artifact.SCOPE_RUNTIME, - (List) dependenciesByScope.get( Artifact.SCOPE_RUNTIME ), tableHeader ); - renderDependenciesForScope( Artifact.SCOPE_TEST, (List) dependenciesByScope.get( Artifact.SCOPE_TEST ), + dependenciesByScope.get( Artifact.SCOPE_RUNTIME ), tableHeader ); + renderDependenciesForScope( Artifact.SCOPE_TEST, dependenciesByScope.get( Artifact.SCOPE_TEST ), tableHeader ); renderDependenciesForScope( Artifact.SCOPE_PROVIDED, - (List) dependenciesByScope.get( Artifact.SCOPE_PROVIDED ), tableHeader ); + dependenciesByScope.get( Artifact.SCOPE_PROVIDED ), tableHeader ); renderDependenciesForScope( Artifact.SCOPE_SYSTEM, - (List) dependenciesByScope.get( Artifact.SCOPE_SYSTEM ), tableHeader ); + dependenciesByScope.get( Artifact.SCOPE_SYSTEM ), tableHeader ); } endSection(); @@ -170,26 +169,27 @@ public void renderBody() endSection(); } - private Map getDependenciesByScope( List dependencies ) + private Map> getDependenciesByScope( List dependencies ) { - Map dependenciesByScope = new HashMap(); - for ( Iterator i = dependencies.iterator(); i.hasNext(); ) - { - ReportingResolutionListener.Node node = (ReportingResolutionListener.Node) i.next(); + Map> dependenciesByScope = new HashMap<>(); + + dependencies.forEach( node -> { + Artifact artifact = node.getArtifact(); - List multiValue = (List) dependenciesByScope.get( artifact.getScope() ); + List multiValue = dependenciesByScope.get( artifact.getScope() ); if ( multiValue == null ) { - multiValue = new ArrayList(); + multiValue = new ArrayList<>(); } multiValue.add( artifact ); dependenciesByScope.put( artifact.getScope(), multiValue ); - } + + }); return dependenciesByScope; } - private void renderDependenciesForScope( String scope, List artifacts, String[] tableHeader ) + private void renderDependenciesForScope( String scope, List artifacts, String[] tableHeader ) { if ( artifacts != null ) { @@ -202,47 +202,44 @@ private void renderDependenciesForScope( String scope, List artifacts, String[] startTable(); tableHeader( tableHeader ); - for ( Iterator iterator = artifacts.iterator(); iterator.hasNext(); ) - { - Artifact artifact = (Artifact) iterator.next(); - tableRow( getArtifactRow( artifact ) ); - } + artifacts.forEach( artifact -> tableRow( getArtifactRow( artifact ) ) ); + endTable(); endSection(); } } - private Comparator getArtifactComparator() + private Comparator getArtifactComparator() { - return new Comparator() + return ( Artifact a1, Artifact a2 ) -> { - public int compare( Object o1, Object o2 ) + // put optional last + if ( a1.isOptional() && !a2.isOptional() ) { - Artifact a1 = (Artifact) o1; - Artifact a2 = (Artifact) o2; - - // put optional last - if ( a1.isOptional() && !a2.isOptional() ) - { - return +1; - } - else if ( !a1.isOptional() && a2.isOptional() ) - { - return -1; - } - else - { - return a1.compareTo( a2 ); - } + return +1; + } + else if ( !a1.isOptional() && a2.isOptional() ) + { + return -1; + } + else + { + return a1.compareTo( a2 ); } }; } private String[] getArtifactRow( Artifact artifact ) { - return new String[]{artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), - artifact.getClassifier(), artifact.getType(), artifact.isOptional() ? "(optional)" : " "}; + return new String[] { + artifact.getGroupId(), + artifact.getArtifactId(), + artifact.getVersion(), + artifact.getClassifier(), + artifact.getType(), + artifact.isOptional() ? "(optional)" : " " + }; } private void printDependencyListing( ReportingResolutionListener.Node node, boolean printRoot ) @@ -262,11 +259,7 @@ private void printDependencyListing( ReportingResolutionListener.Node node, bool if ( !node.getChildren().isEmpty() ) { sink.list(); - for ( Iterator deps = node.getChildren().iterator(); deps.hasNext(); ) - { - ReportingResolutionListener.Node dep = (ReportingResolutionListener.Node) deps.next(); - printDependencyListing( dep, true ); - } + node.getChildren().forEach( dep -> printDependencyListing( dep, true ) ); sink.list_(); } @@ -316,12 +309,7 @@ private void printDescriptionsAndURLs( ReportingResolutionListener.Node node ) { log.debug( e ); } - - for ( Iterator deps = node.getChildren().iterator(); deps.hasNext(); ) - { - ReportingResolutionListener.Node dep = (ReportingResolutionListener.Node) deps.next(); - printDescriptionsAndURLs( dep ); - } + node.getChildren().forEach( dep -> printDescriptionsAndURLs( dep )); } else { diff --git a/maven-confluence-reporting-plugin/src/site/confluence/site.xml b/maven-confluence-reporting-plugin/src/site/confluence/site.xml index 0d131609..acd92c9e 100644 --- a/maven-confluence-reporting-plugin/src/site/confluence/site.xml +++ b/maven-confluence-reporting-plugin/src/site/confluence/site.xml @@ -17,9 +17,8 @@ - - - + + diff --git a/maven-confluence-reporting-plugin/src/site/confluence/usage.confluence b/maven-confluence-reporting-plugin/src/site/confluence/usage.confluence index f015294a..f44a67be 100644 --- a/maven-confluence-reporting-plugin/src/site/confluence/usage.confluence +++ b/maven-confluence-reporting-plugin/src/site/confluence/usage.confluence @@ -240,6 +240,6 @@ From Release 3.0.1 this plugin is available from [MAVEN CENTRAL REPO|http://repo {code} ----- -${plugin.goals} + + diff --git a/maven-confluence-reporting-plugin/src/test/java/com/github/qwazer/mavenplugins/gitlog/VersionUtilTest.java b/maven-confluence-reporting-plugin/src/test/java/com/github/qwazer/mavenplugins/gitlog/VersionUtilTest.java index 7013247f..195f04e5 100644 --- a/maven-confluence-reporting-plugin/src/test/java/com/github/qwazer/mavenplugins/gitlog/VersionUtilTest.java +++ b/maven-confluence-reporting-plugin/src/test/java/com/github/qwazer/mavenplugins/gitlog/VersionUtilTest.java @@ -1,14 +1,14 @@ package com.github.qwazer.mavenplugins.gitlog; -import org.apache.maven.artifact.versioning.ArtifactVersion; -import org.junit.Test; +import static java.util.Arrays.asList; +import static org.hamcrest.core.IsEqual.equalTo; +import static org.junit.Assert.assertThat; import java.util.LinkedList; import java.util.List; -import static java.util.Arrays.asList; -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertTrue; +import org.apache.maven.artifact.versioning.ArtifactVersion; +import org.junit.Test; public class VersionUtilTest { @@ -18,42 +18,42 @@ public class VersionUtilTest { public void testCalculateVersionTagNamePartPatch() throws Exception { String version = "1.2.3"; String part = VersionUtil.calculateVersionTagNamePart(version, CalculateRuleForSinceTagName.LATEST_RELEASE_VERSION); - assertEquals("1.2.2", part); + assertThat("1.2.2", equalTo(part)); } @Test public void testCalculateVersionTagNamePartPatchSame() throws Exception { String version = "1.2.0"; String part = VersionUtil.calculateVersionTagNamePart(version, CalculateRuleForSinceTagName.LATEST_RELEASE_VERSION); - assertEquals("1.2.0", part); + assertThat("1.2.0", equalTo(part)); } @Test public void testCalculateVersionTagNamePartMinor() throws Exception { String version = "1.2.1"; String part = VersionUtil.calculateVersionTagNamePart(version, CalculateRuleForSinceTagName.CURRENT_MINOR_VERSION); - assertEquals("1.2.0", part); + assertThat("1.2.0", equalTo(part)); } @Test public void testCalculateVersionTagNamePartMinorZeroPatch() throws Exception { String version = "1.2.0"; String part = VersionUtil.calculateVersionTagNamePart(version, CalculateRuleForSinceTagName.CURRENT_MINOR_VERSION); - assertEquals("1.2.0", part); + assertThat("1.2.0", equalTo(part)); } @Test public void testCalculateVersionTagNamePartMajor() throws Exception { String version = "1.2.0"; String part = VersionUtil.calculateVersionTagNamePart(version, CalculateRuleForSinceTagName.CURRENT_MAJOR_VERSION); - assertEquals("1.0.0", part); + assertThat("1.0.0", equalTo(part)); } @Test public void testCalculateVersionTagNamePartMajorZero() throws Exception { String version = "2.0.0"; String part = VersionUtil.calculateVersionTagNamePart(version, CalculateRuleForSinceTagName.CURRENT_MAJOR_VERSION); - assertEquals("2.0.0", part); + assertThat("2.0.0", equalTo(part)); } @@ -61,9 +61,9 @@ public void testCalculateVersionTagNamePartMajorZero() throws Exception { public void testParseArtifactVersionSimple() throws Exception { String version = "2.1.10"; ArtifactVersion artifactVersion = VersionUtil.parseArtifactVersion(version); - assertEquals(2, artifactVersion.getMajorVersion()); - assertEquals(1, artifactVersion.getMinorVersion()); - assertEquals(10, artifactVersion.getIncrementalVersion()); + assertThat(2, equalTo(artifactVersion.getMajorVersion())); + assertThat(1, equalTo(artifactVersion.getMinorVersion())); + assertThat(10, equalTo(artifactVersion.getIncrementalVersion())); } @@ -71,9 +71,9 @@ public void testParseArtifactVersionSimple() throws Exception { public void testParseArtifactVersionSimple2() throws Exception { String version = "v25.1.9010"; ArtifactVersion artifactVersion = VersionUtil.parseArtifactVersion(version); - assertEquals(25, artifactVersion.getMajorVersion()); - assertEquals(1, artifactVersion.getMinorVersion()); - assertEquals(9010, artifactVersion.getIncrementalVersion()); + assertThat(25, equalTo(artifactVersion.getMajorVersion())); + assertThat(1, equalTo(artifactVersion.getMinorVersion())); + assertThat(9010, equalTo(artifactVersion.getIncrementalVersion())); } @@ -81,9 +81,9 @@ public void testParseArtifactVersionSimple2() throws Exception { public void testParseArtifactVersionSimple3() throws Exception { String version = "saasa v254545.11.9010"; ArtifactVersion artifactVersion = VersionUtil.parseArtifactVersion(version); - assertEquals(254545, artifactVersion.getMajorVersion()); - assertEquals(11, artifactVersion.getMinorVersion()); - assertEquals(9010, artifactVersion.getIncrementalVersion()); + assertThat(254545, equalTo(artifactVersion.getMajorVersion())); + assertThat(11, equalTo(artifactVersion.getMinorVersion())); + assertThat(9010, equalTo(artifactVersion.getIncrementalVersion())); } @@ -91,9 +91,9 @@ public void testParseArtifactVersionSimple3() throws Exception { public void testParseArtifactVersionPrefix() throws Exception { String version = "asa-2.1.10"; ArtifactVersion artifactVersion = VersionUtil.parseArtifactVersion(version); - assertEquals(2, artifactVersion.getMajorVersion()); - assertEquals(1, artifactVersion.getMinorVersion()); - assertEquals(10, artifactVersion.getIncrementalVersion()); + assertThat(2, equalTo(artifactVersion.getMajorVersion())); + assertThat(1, equalTo(artifactVersion.getMinorVersion())); + assertThat(10, equalTo(artifactVersion.getIncrementalVersion())); } @@ -101,9 +101,9 @@ public void testParseArtifactVersionPrefix() throws Exception { public void testParseArtifactVersionPrefix2() throws Exception { String version = "V 2.1.10"; ArtifactVersion artifactVersion = VersionUtil.parseArtifactVersion(version); - assertEquals(2, artifactVersion.getMajorVersion()); - assertEquals(1, artifactVersion.getMinorVersion()); - assertEquals(10, artifactVersion.getIncrementalVersion()); + assertThat(2, equalTo((artifactVersion.getMajorVersion()))); + assertThat(1, equalTo((artifactVersion.getMinorVersion()))); + assertThat(10, equalTo((artifactVersion.getIncrementalVersion()))); } @@ -112,9 +112,9 @@ public void testParseArtifactVersionPrefix2() throws Exception { public void testParseArtifactVersionSuffix() throws Exception { String version = "2.1.10-V"; ArtifactVersion artifactVersion = VersionUtil.parseArtifactVersion(version); - assertEquals(2, artifactVersion.getMajorVersion()); - assertEquals(1, artifactVersion.getMinorVersion()); - assertEquals(10, artifactVersion.getIncrementalVersion()); + assertThat(2, equalTo((artifactVersion.getMajorVersion()))); + assertThat(1, equalTo((artifactVersion.getMinorVersion()))); + assertThat(10, equalTo((artifactVersion.getIncrementalVersion()))); } @@ -122,9 +122,9 @@ public void testParseArtifactVersionSuffix() throws Exception { public void testParseArtifactVersionIncomplete() throws Exception { String version = "2.1"; ArtifactVersion artifactVersion = VersionUtil.parseArtifactVersion(version); - assertEquals(2, artifactVersion.getMajorVersion()); - assertEquals(1, artifactVersion.getMinorVersion()); - assertEquals(0, artifactVersion.getIncrementalVersion()); + assertThat(2, equalTo((artifactVersion.getMajorVersion()))); + assertThat(1, equalTo((artifactVersion.getMinorVersion()))); + assertThat(0, equalTo((artifactVersion.getIncrementalVersion()))); } @@ -132,47 +132,47 @@ public void testParseArtifactVersionIncomplete() throws Exception { public void testParseArtifactVersionSuffix2() throws Exception { String version = "2.1.10 v"; ArtifactVersion artifactVersion = VersionUtil.parseArtifactVersion(version); - assertEquals(2, artifactVersion.getMajorVersion()); - assertEquals(1, artifactVersion.getMinorVersion()); - assertEquals(10, artifactVersion.getIncrementalVersion()); + assertThat(2, equalTo((artifactVersion.getMajorVersion()))); + assertThat(1, equalTo((artifactVersion.getMinorVersion()))); + assertThat(10, equalTo((artifactVersion.getIncrementalVersion()))); } @Test public void testParseArtifactVersionSuffix3() throws Exception { String version = "2.v"; ArtifactVersion artifactVersion = VersionUtil.parseArtifactVersion(version); - assertEquals(2, artifactVersion.getMajorVersion()); - assertEquals(0, artifactVersion.getMinorVersion()); - assertEquals(0, artifactVersion.getIncrementalVersion()); + assertThat(2, equalTo((artifactVersion.getMajorVersion()))); + assertThat(0, equalTo((artifactVersion.getMinorVersion()))); + assertThat(0, equalTo((artifactVersion.getIncrementalVersion()))); } @Test public void testParseArtifactVersionSuffix4() throws Exception { String version = "25 version of progamm"; ArtifactVersion artifactVersion = VersionUtil.parseArtifactVersion(version); - assertEquals(25, artifactVersion.getMajorVersion()); - assertEquals(0, artifactVersion.getMinorVersion()); - assertEquals(0, artifactVersion.getIncrementalVersion()); + assertThat(25, equalTo((artifactVersion.getMajorVersion()))); + assertThat(0, equalTo((artifactVersion.getMinorVersion()))); + assertThat(0, equalTo((artifactVersion.getIncrementalVersion()))); } @Test public void testParseArtifactVersionMix() throws Exception { String version = "this is version 25.9 of progamm"; ArtifactVersion artifactVersion = VersionUtil.parseArtifactVersion(version); - assertEquals(25, artifactVersion.getMajorVersion()); - assertEquals(9, artifactVersion.getMinorVersion()); - assertEquals(0, artifactVersion.getIncrementalVersion()); + assertThat(25, equalTo((artifactVersion.getMajorVersion()))); + assertThat(9, equalTo((artifactVersion.getMinorVersion()))); + assertThat(0, equalTo((artifactVersion.getIncrementalVersion()))); } @Test public void testAddSuffixIfNeeded() throws Exception { String s = VersionUtil.addSuffixDelimeterIfNeeded("1.2.3v"); - assertEquals("1.2.3-v", s); + assertThat("1.2.3-v", equalTo(s)); } @Test public void testAddSuffixIfNeeded2() throws Exception { String s = VersionUtil.addSuffixDelimeterIfNeeded("1.2.3.v"); - assertEquals("1.2.3-v", s); + assertThat("1.2.3-v", equalTo((s))); } @Test @@ -182,7 +182,7 @@ public void testFindNearestVersionTagsBefore() throws Exception { String version = "1.2.0"; String foundVersion = VersionUtil.findNearestVersionTagsBefore(list, version); - assertEquals("1.1.0", foundVersion); + assertThat("1.1.0", equalTo((foundVersion))); } @@ -193,7 +193,7 @@ public void testFindNearestVersionTagsBeforeRC() throws Exception { String version = "1.0.0-RC2"; String foundVersion = VersionUtil.findNearestVersionTagsBefore(list, version); - assertEquals("1.0.0-RC2", foundVersion); + assertThat("1.0.0-RC2", equalTo((foundVersion))); } @@ -204,7 +204,7 @@ public void testFindNearestVersionTagsBeforeRC3() throws Exception { String version = "1.0.0-RC3"; String foundVersion = VersionUtil.findNearestVersionTagsBefore(list, version); - assertEquals("1.0.0-RC2", foundVersion); + assertThat("1.0.0-RC2", equalTo((foundVersion))); } @@ -215,7 +215,7 @@ public void testFindNearestVersionTagsBeforeMC1() throws Exception { String version = "1.0.0-RC3"; String foundVersion = VersionUtil.findNearestVersionTagsBefore(list, version); - assertEquals("1.0.0-RC2", foundVersion); + assertThat("1.0.0-RC2", equalTo((foundVersion))); } @@ -226,7 +226,7 @@ public void testFindNearestVersionTagsBeforeMC2() throws Exception { String version = "1.0.0-RC3"; String foundVersion = VersionUtil.findNearestVersionTagsBefore(list, version); - assertEquals("1.0.0-M2", foundVersion); + assertThat("1.0.0-M2", equalTo((foundVersion))); } @@ -237,7 +237,7 @@ public void testFindNearestVersionTagsBefore1() throws Exception { String version = "1.2.0"; String foundVersion = VersionUtil.findNearestVersionTagsBefore(list, version); - assertEquals("1.0.0", foundVersion); + assertThat("1.0.0", equalTo((foundVersion))); } @@ -248,7 +248,7 @@ public void testFindNearestVersionTagsBeforeNull() throws Exception { String version = "1.2.0"; String foundVersion = VersionUtil.findNearestVersionTagsBefore(list, version); - assertEquals(null, foundVersion); + assertThat(null, equalTo((foundVersion))); } @@ -260,7 +260,7 @@ public void testFindNearestVersionTagsBefore12() throws Exception { String version = "1.2.0"; String foundVersion = VersionUtil.findNearestVersionTagsBefore(list, version); - assertEquals("tagName", foundVersion); + assertThat("tagName", equalTo((foundVersion))); } @@ -272,7 +272,7 @@ public void testFindNearestVersionTagsBeforeLeadingZero() throws Exception { String version = "01.02"; String foundVersion = VersionUtil.findNearestVersionTagsBefore(list, version); - assertEquals("01.01", foundVersion); + assertThat("01.01", equalTo((foundVersion))); } @@ -283,28 +283,28 @@ public void testFindNearestVersionTagsBeforeLeadingZeroPrefix() throws Exception String version = "01.02"; String foundVersion = VersionUtil.findNearestVersionTagsBefore(list, version); - assertEquals("v01.01", foundVersion); + assertThat("v01.01", equalTo((foundVersion))); } @Test public void testRemoveNonDigitPrefix() throws Exception { String s = "1.2.3"; String r = VersionUtil.removeNonDigitPrefix(s); - assertEquals(s, r); + assertThat(s, equalTo((r))); } @Test public void testRemoveNonDigitPrefix2() throws Exception { String s = "abs-1.2.3"; String r = VersionUtil.removeNonDigitPrefix(s); - assertEquals("1.2.3", r); + assertThat("1.2.3", equalTo((r))); } @Test public void testRemoveNonDigitPrefix3() throws Exception { String s = ""; String r = VersionUtil.removeNonDigitPrefix(s); - assertEquals("", r); + assertThat("", equalTo((r))); } @Test @@ -322,7 +322,7 @@ public void testFindNearestVersionTagsRealCase01() throws Exception { String version = "8.1.0"; String foundVersion = VersionUtil.findNearestVersionTagsBefore(list, version); - assertEquals("v8.0.9", foundVersion); + assertThat("v8.0.9", equalTo((foundVersion))); } @@ -342,7 +342,7 @@ public void testFindNearestVersionTagsRealCase02() throws Exception { String version = "8.2.0"; String foundVersion = VersionUtil.findNearestVersionTagsBefore(list, version); - assertEquals("v8.2.0", foundVersion); + assertThat("v8.2.0", equalTo((foundVersion))); } @@ -360,24 +360,24 @@ public void testFindNearestVersionTagsRealCase03() throws Exception { String version = "1.3.0"; String foundVersion = VersionUtil.findNearestVersionTagsBefore(list, version); - assertEquals("1.3.0.RELEASE", foundVersion); + assertThat("1.3.0.RELEASE", equalTo((foundVersion))); } @Test public void testSortAndFilter() throws Exception { List list = asList("1.0.0.M1", "1.1.0.M2", "1.1.1.RELEASE","1.2.5.RELEASE" ); - LinkedList linkedList = VersionUtil.sortAndFilter(list, "1.1.0.M2", "1.1.1.RELEASE") ; - assertEquals(2, linkedList.size()); - assertTrue(linkedList.contains("1.1.0.M2")); - assertTrue(linkedList.contains("1.1.1.RELEASE")); + LinkedList linkedList = VersionUtil.sortAndFilter(list, "1.1.0.M2", "1.1.1.RELEASE") ; + assertThat(2, equalTo(linkedList.size())); + assertThat(linkedList.contains("1.1.0.M2"), equalTo(true)); + assertThat(linkedList.contains("1.1.1.RELEASE"), equalTo(true)); } @Test(expected = IllegalArgumentException.class) public void testSortAndFilterIllegal() throws Exception { List list = asList("1.0.0.M1", "1.1.0.M2", "1.1.1.RELEASE","1.2.5.RELEASE" ); - LinkedList linkedList = VersionUtil.sortAndFilter(list, "2.1.0.M2", "1.1.1.RELEASE") ; + /*LinkedList linkedList = */VersionUtil.sortAndFilter(list, "2.1.0.M2", "1.1.1.RELEASE") ; } diff --git a/maven-confluence-reporting-plugin/src/test/java/org/bsc/maven/plugin/test/Issue133Test.java b/maven-confluence-reporting-plugin/src/test/java/org/bsc/maven/plugin/test/Issue133Test.java index f1e8bf68..66425b3d 100644 --- a/maven-confluence-reporting-plugin/src/test/java/org/bsc/maven/plugin/test/Issue133Test.java +++ b/maven-confluence-reporting-plugin/src/test/java/org/bsc/maven/plugin/test/Issue133Test.java @@ -31,13 +31,12 @@ public void htttpUrlBuilderWithoutPort() throws MalformedURLException { Assert.assertThat( endpoint.getPort(), Is.is(-1)); - final HttpUrl.Builder builder = new HttpUrl.Builder() + /*final HttpUrl.Builder builder = */new HttpUrl.Builder() .scheme(endpoint.getProtocol()) .host(endpoint.getHost()) .port(endpoint.getPort()) .addPathSegments("rest/api") ; - } @Test diff --git a/maven-confluence-test/plugin-test/pom.xml b/maven-confluence-test/plugin-test/pom.xml index d8370461..2241e72d 100644 --- a/maven-confluence-test/plugin-test/pom.xml +++ b/maven-confluence-test/plugin-test/pom.xml @@ -6,7 +6,7 @@ maven-confluence-parent org.bsc.maven - 6.1 + 6.2 ../.. diff --git a/maven-confluence-test/pom.xml b/maven-confluence-test/pom.xml index e9d55dd2..ba307c4e 100644 --- a/maven-confluence-test/pom.xml +++ b/maven-confluence-test/pom.xml @@ -2,7 +2,7 @@ maven-confluence-parent org.bsc.maven - 6.1 + 6.2 4.0.0 diff --git a/pom.xml b/pom.xml index 1f45aa69..59e170c4 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.bsc.maven maven-confluence-parent pom - 6.1 + 6.2 CONFLUENCE-REPORTING::Parent - ${project.version} junit junit - 4.8.2 + 4.12