Skip to content

Commit

Permalink
MARP-760 Handle Sonar
Browse files Browse the repository at this point in the history
  • Loading branch information
tvtphuc-axonivy committed Aug 30, 2024
1 parent 2d08f4e commit c9ea382
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.axonivy.market.entity.Product;
import com.axonivy.market.model.ProductDetailModel;
import com.axonivy.market.util.VersionUtils;
import com.fasterxml.jackson.core.JsonProcessingException;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.lang3.StringUtils;
import org.springframework.hateoas.Link;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import java.util.Map;

import com.axonivy.market.model.VersionAndUrlModel;
import com.fasterxml.jackson.core.JsonProcessingException;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
Expand Down Expand Up @@ -108,8 +107,7 @@ public ResponseEntity<Map<String, Object>> findProductJsonContent(@PathVariable(

@GetMapping(VERSIONS_IN_DESIGNER)
@Operation(summary = "Get the list of released version in product", description = "Collect the released versions in product for ivy designer")
public ResponseEntity<List<VersionAndUrlModel>> findVersionsForDesigner(@PathVariable(ID) String id)
throws JsonProcessingException {
public ResponseEntity<List<VersionAndUrlModel>> findVersionsForDesigner(@PathVariable(ID) String id) {
List<VersionAndUrlModel> versionList = versionService.getVersionsForDesigner(id);
return new ResponseEntity<>(versionList, HttpStatus.OK);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.axonivy.market.model.MavenArtifactVersionModel;
import com.axonivy.market.model.VersionAndUrlModel;
import com.fasterxml.jackson.core.JsonProcessingException;
import java.util.List;
import java.util.Map;

Expand All @@ -17,5 +16,5 @@ List<MavenArtifactVersionModel> getArtifactsAndVersionToDisplay(String productId

Map<String, Object> getProductJsonContentByIdAndVersion(String name , String version);

List<VersionAndUrlModel> getVersionsForDesigner(String productId) throws JsonProcessingException;
List<VersionAndUrlModel> getVersionsForDesigner(String productId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public Map<String, Object> getProductJsonContentByIdAndVersion(String productId,
}

@Override
public List<VersionAndUrlModel> getVersionsForDesigner(String productId) throws JsonProcessingException {
public List<VersionAndUrlModel> getVersionsForDesigner(String productId) {
List<VersionAndUrlModel> versionAndUrlList = new ArrayList<>();
List<String> versions = productRepository.getReleasedVersionsById(productId);
for (String version : versions) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import com.axonivy.market.constants.RequestMappingConstants;
import com.axonivy.market.entity.productjsonfilecontent.ProductJsonContent;
import com.axonivy.market.model.VersionAndUrlModel;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -125,7 +124,7 @@ void testSyncInstallationCount() {
}

@Test
void findProductVersionsById() throws JsonProcessingException {
void findProductVersionsById() {
when(versionService.getVersionsForDesigner("google-maps-connector")).thenReturn(mockVersionAndUrlModels());

var result = productDetailsController.findVersionsForDesigner("google-maps-connector");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import com.axonivy.market.repository.ProductJsonContentRepository;
import com.axonivy.market.repository.ProductRepository;
import com.axonivy.market.util.XmlReaderUtils;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.apache.commons.lang3.StringUtils;
import org.assertj.core.api.Fail;
import org.junit.jupiter.api.Assertions;
Expand Down Expand Up @@ -420,7 +419,7 @@ void testGetRepoNameFromMarketRepo() {
}

@Test
void testGetVersionsForDesigner() throws JsonProcessingException {
void testGetVersionsForDesigner() {
Mockito.when(productRepository.getReleasedVersionsById(anyString()))
.thenReturn(List.of("11.3.0", "11.1.1", "11.1.0", "10.0.2"));

Expand All @@ -436,7 +435,7 @@ void testGetVersionsForDesigner() throws JsonProcessingException {
}

@Test
void testGetProductJsonContentByIdAndVersion() throws JsonProcessingException {
void testGetProductJsonContentByIdAndVersion() {
ProductJsonContent mockProductJsonContent = new ProductJsonContent();
String mockContent = """
{
Expand Down

0 comments on commit c9ea382

Please sign in to comment.