Skip to content

Commit

Permalink
Refactor to move Classpath Jar reports into the API module
Browse files Browse the repository at this point in the history
  • Loading branch information
kittylyst committed Nov 9, 2023
1 parent 28e0da1 commit 2393ae8
Show file tree
Hide file tree
Showing 32 changed files with 48 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import com.redhat.insights.http.InsightsHttpClient;
import com.redhat.insights.jars.JarInfo;
import com.redhat.insights.logging.InsightsLogger;
import com.redhat.insights.reports.InsightsReport;
import com.redhat.insights.reports.UpdateReportImpl;
import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import java.util.concurrent.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import static com.redhat.insights.InsightsErrorCode.ERROR_WRITING_FILE;

import com.redhat.insights.InsightsException;
import com.redhat.insights.InsightsReport;
import com.redhat.insights.config.InsightsConfiguration;
import com.redhat.insights.logging.InsightsLogger;
import com.redhat.insights.reports.InsightsReport;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import static com.redhat.insights.InsightsErrorCode.ERROR_GZIP_FILE;

import com.redhat.insights.InsightsException;
import com.redhat.insights.InsightsReport;
import com.redhat.insights.reports.InsightsReport;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import static com.redhat.insights.InsightsErrorCode.ERROR_CLIENT_FAILED;

import com.redhat.insights.InsightsException;
import com.redhat.insights.InsightsReport;
import com.redhat.insights.logging.InsightsLogger;
import com.redhat.insights.reports.InsightsReport;
import java.util.Arrays;
import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.redhat.insights.InsightsException;
import com.redhat.insights.InsightsSubreport;
import com.redhat.insights.logging.InsightsLogger;
import com.redhat.insights.reports.InsightsSubreport;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.redhat.insights.InsightsSubreport;
import com.redhat.insights.reports.InsightsSubreport;
import java.io.IOException;

public class JarInfoSubreportSerializer extends JsonSerializer<InsightsSubreport> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/* Copyright (C) Red Hat 2022-2023 */
package com.redhat.insights;
package com.redhat.insights.reports;

import com.fasterxml.jackson.databind.JsonSerializer;
import com.redhat.insights.Filtering;
import com.redhat.insights.config.InsightsConfiguration;
import com.redhat.insights.logging.InsightsLogger;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/* Copyright (C) Red Hat 2022-2023 */
package com.redhat.insights.core.app;
package com.redhat.insights.reports;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.redhat.insights.InsightsSubreport;
import java.io.IOException;

/** A generic Java application {@link InsightsSubreport} JSON serializer implementation. */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/* Copyright (C) Red Hat 2022-2023 */
package com.redhat.insights.core.app;
package com.redhat.insights.reports;

import com.fasterxml.jackson.databind.JsonSerializer;
import com.redhat.insights.InsightsSubreport;

/** A generic Java application {@link InsightsSubreport} implementation. */
public final class AppInsightsSubreport implements InsightsSubreport {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
/* Copyright (C) Red Hat 2022-2023 */
package com.redhat.insights;
package com.redhat.insights.reports;

import static com.redhat.insights.InsightsErrorCode.ERROR_SERIALIZING_TO_JSON;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.redhat.insights.Filtering;
import com.redhat.insights.InsightsException;
import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Copyright (C) Red Hat 2022-2023 */
package com.redhat.insights;
package com.redhat.insights.reports;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Copyright (C) Red Hat 2022-2023 */
package com.redhat.insights;
package com.redhat.insights.reports;

import com.fasterxml.jackson.databind.JsonSerializer;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Copyright (C) Red Hat 2023 */
package com.redhat.insights;
package com.redhat.insights.reports;

import com.fasterxml.jackson.core.Version;
import com.fasterxml.jackson.databind.ObjectMapper;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/* Copyright (C) Red Hat 2023 */
package com.redhat.insights;
package com.redhat.insights.reports;

import com.fasterxml.jackson.databind.JsonSerializer;
import com.redhat.insights.Filtering;
import com.redhat.insights.jars.JarInfo;
import com.redhat.insights.jars.JarInfoSubreport;
import com.redhat.insights.logging.InsightsLogger;
Expand Down
2 changes: 2 additions & 0 deletions api/src/test/java/com/redhat/insights/AbstractReportTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import com.redhat.insights.jars.JarInfoSubreport;
import com.redhat.insights.jars.JarInfoSubreportSerializer;
import com.redhat.insights.logging.InsightsLogger;
import com.redhat.insights.reports.InsightsReport;
import com.redhat.insights.reports.InsightsReportSerializer;
import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.redhat.insights.doubles.NoopInsightsLogger;
import com.redhat.insights.http.InsightsHttpClient;
import com.redhat.insights.logging.InsightsLogger;
import com.redhat.insights.reports.InsightsReport;
import java.util.Collections;
import java.util.concurrent.atomic.AtomicInteger;
import org.junit.jupiter.api.Test;
Expand Down
2 changes: 2 additions & 0 deletions api/src/test/java/com/redhat/insights/TestTopLevelReport.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import com.redhat.insights.jars.ClasspathJarInfoSubreport;
import com.redhat.insights.jars.JarInfo;
import com.redhat.insights.jars.JarInfoSubreport;
import com.redhat.insights.reports.InsightsReport;
import com.redhat.insights.reports.InsightsSubreport;
import java.io.IOException;
import java.util.*;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import static org.junit.jupiter.api.Assertions.assertTrue;

import com.redhat.insights.jars.JarInfo;
import com.redhat.insights.reports.UpdateReportImpl;
import java.io.IOException;
import java.util.*;
import java.util.concurrent.ArrayBlockingQueue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
package com.redhat.insights.doubles;

import com.fasterxml.jackson.databind.JsonSerializer;
import com.redhat.insights.InsightsSubreport;
import com.redhat.insights.reports.InsightsSubreport;

/** A generic Java application {@link InsightsSubreport} implementation. */
public final class DummyInsightsSubreport implements InsightsSubreport {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* Copyright (C) Red Hat 2022-2023 */
package com.redhat.insights.doubles;

import com.redhat.insights.AbstractTopLevelReportBase;
import com.redhat.insights.InsightsSubreport;
import com.redhat.insights.logging.InsightsLogger;
import com.redhat.insights.reports.AbstractTopLevelReportBase;
import com.redhat.insights.reports.InsightsSubreport;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* Copyright (C) Red Hat 2023 */
package com.redhat.insights.doubles;

import com.redhat.insights.InsightsReport;
import com.redhat.insights.http.InsightsHttpClient;
import com.redhat.insights.reports.InsightsReport;

public final class NoopInsightsHttpClient implements InsightsHttpClient {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* Copyright (C) Red Hat 2023 */
package com.redhat.insights.doubles;

import com.redhat.insights.InsightsReport;
import com.redhat.insights.http.InsightsHttpClient;
import com.redhat.insights.reports.InsightsReport;

/**
* Fake http client, which will store content of report sent. Designed to test @link
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
import static org.mockito.Mockito.when;

import com.redhat.insights.InsightsException;
import com.redhat.insights.InsightsReport;
import com.redhat.insights.config.InsightsConfiguration;
import com.redhat.insights.doubles.NoopInsightsLogger;
import com.redhat.insights.logging.InsightsLogger;
import com.redhat.insights.reports.InsightsReport;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
import static org.mockito.Mockito.*;

import com.redhat.insights.InsightsException;
import com.redhat.insights.InsightsReport;
import com.redhat.insights.config.InsightsConfiguration;
import com.redhat.insights.doubles.DummyTopLevelReport;
import com.redhat.insights.doubles.NoopInsightsLogger;
import com.redhat.insights.doubles.StoringInsightsHttpClient;
import com.redhat.insights.logging.InsightsLogger;
import com.redhat.insights.reports.InsightsReport;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.json.JsonMapper;
import com.redhat.insights.InsightsException;
import com.redhat.insights.InsightsReport;
import com.redhat.insights.InsightsReportController;
import com.redhat.insights.InsightsSubreport;
import com.redhat.insights.config.InsightsConfiguration;
import com.redhat.insights.doubles.*;
import com.redhat.insights.jars.ClasspathJarInfoSubreport;
import com.redhat.insights.jars.JarInfo;
import com.redhat.insights.jars.JarInfoSubreport;
import com.redhat.insights.logging.InsightsLogger;
import com.redhat.insights.reports.InsightsReport;
import com.redhat.insights.reports.InsightsSubreport;
import java.io.IOException;
import java.time.Duration;
import java.util.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import static com.redhat.insights.InsightsErrorCode.*;

import com.redhat.insights.InsightsException;
import com.redhat.insights.InsightsReport;
import com.redhat.insights.config.InsightsConfiguration;
import com.redhat.insights.http.InsightsHttpClient;
import com.redhat.insights.logging.InsightsLogger;
import com.redhat.insights.reports.InsightsReport;
import java.io.File;
import java.net.InetSocketAddress;
import java.net.ProxySelector;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/* Copyright (C) Red Hat 2022-2023 */
package com.redhat.insights.core.app;
package com.redhat.insights.core.reports;

import com.redhat.insights.InsightsSubreport;
import com.redhat.insights.config.InsightsConfiguration;
import com.redhat.insights.core.TopLevelReportBaseImpl;
import com.redhat.insights.jars.ClasspathJarInfoSubreport;
import com.redhat.insights.logging.InsightsLogger;
import com.redhat.insights.reports.AppInsightsSubreport;
import com.redhat.insights.reports.InsightsSubreport;
import java.util.Map;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* Copyright (C) Red Hat 2022-2023 */
package com.redhat.insights.core;
package com.redhat.insights.core.reports;

import com.redhat.insights.AbstractTopLevelReportBase;
import com.redhat.insights.InsightsSubreport;
import com.redhat.insights.config.InsightsConfiguration;
import com.redhat.insights.logging.InsightsLogger;
import com.redhat.insights.reports.AbstractTopLevelReportBase;
import com.redhat.insights.reports.InsightsSubreport;
import java.util.*;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.*;

import com.redhat.insights.core.app.AppTopLevelReport;
import com.redhat.insights.core.httpclient.HttpResponseBase;
import com.redhat.insights.core.httpclient.MockInsightsJdkHttpClient;
import com.redhat.insights.core.reports.AppTopLevelReport;
import com.redhat.insights.doubles.MockInsightsConfiguration;
import com.redhat.insights.doubles.NoopInsightsLogger;
import com.redhat.insights.tls.PEMSupport;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
import static org.junit.jupiter.api.Assertions.*;

import com.redhat.insights.config.EnvAndSysPropsInsightsConfiguration;
import com.redhat.insights.core.app.AppInsightsSubreport;
import com.redhat.insights.core.app.AppTopLevelReport;
import com.redhat.insights.core.reports.AppTopLevelReport;
import com.redhat.insights.jars.ClasspathJarInfoSubreport;
import com.redhat.insights.jars.JarInfo;
import com.redhat.insights.logging.PrintLogger;
import com.redhat.insights.reports.AppInsightsSubreport;
import java.util.Map;
import org.junit.jupiter.api.Test;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.*;

import com.redhat.insights.InsightsReport;
import com.redhat.insights.config.InsightsConfiguration;
import com.redhat.insights.core.app.AppTopLevelReport;
import com.redhat.insights.core.reports.AppTopLevelReport;
import com.redhat.insights.doubles.DummyTopLevelReport;
import com.redhat.insights.doubles.MockInsightsConfiguration;
import com.redhat.insights.doubles.NoopInsightsLogger;
import com.redhat.insights.logging.InsightsLogger;
import com.redhat.insights.reports.InsightsReport;
import com.redhat.insights.tls.PEMSupport;
import java.io.File;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

import com.redhat.insights.InsightsReportController;
import com.redhat.insights.config.EnvAndSysPropsInsightsConfiguration;
import com.redhat.insights.core.app.AppInsightsSubreport;
import com.redhat.insights.core.app.AppTopLevelReport;
import com.redhat.insights.core.httpclient.InsightsJdkHttpClient;
import com.redhat.insights.core.reports.AppTopLevelReport;
import com.redhat.insights.doubles.DefaultConfiguration;
import com.redhat.insights.jars.ClasspathJarInfoSubreport;
import com.redhat.insights.logging.TestLogger;
import com.redhat.insights.reports.AppInsightsSubreport;
import com.redhat.insights.tls.PEMSupport;
import java.nio.file.Path;
import java.time.Duration;
Expand Down

0 comments on commit 2393ae8

Please sign in to comment.