Skip to content

Commit

Permalink
Remove custom model class: HarEntry
Browse files Browse the repository at this point in the history
  • Loading branch information
valfirst committed Nov 19, 2024
1 parent 3ceb5ad commit 907edc3
Show file tree
Hide file tree
Showing 35 changed files with 106 additions and 258 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
`com.browserup.harreader.model.HarContent` | `de.sstoehr.harreader.model.HarContent`
`com.browserup.harreader.model.HarCookie` | `de.sstoehr.harreader.model.HarCookie`
`com.browserup.harreader.model.HarCreatorBrowser` | `de.sstoehr.harreader.model.HarCreatorBrowser`
`com.browserup.harreader.model.HarEntry` | `de.sstoehr.harreader.model.HarEntry`
`com.browserup.harreader.model.HarHeader` | `de.sstoehr.harreader.model.HarHeader`
`com.browserup.harreader.model.HarPage` | `de.sstoehr.harreader.model.HarPage`
`com.browserup.harreader.model.HarPageTiming` | `de.sstoehr.harreader.model.HarPageTiming`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
import com.browserup.bup.proxy.dns.AdvancedHostResolver;
import com.browserup.bup.util.HttpStatusClass;
import com.browserup.harreader.model.Har;
import com.browserup.harreader.model.HarEntry;

import de.sstoehr.harreader.model.HarEntry;
import de.sstoehr.harreader.model.HarPageTiming;
import org.littleshoot.proxy.HttpFiltersSource;
import org.littleshoot.proxy.MitmManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@
import com.browserup.bup.util.BrowserUpProxyUtil;
import com.browserup.bup.util.HttpStatusClass;
import com.browserup.harreader.model.Har;
import com.browserup.harreader.model.HarEntry;
import com.browserup.harreader.model.HarLog;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.MapMaker;
import de.sstoehr.harreader.model.HarCreatorBrowser;
import de.sstoehr.harreader.model.HarEntry;
import de.sstoehr.harreader.model.HarPage;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.http.HttpHeaderNames;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import com.browserup.bup.util.BrowserUpHttpUtil;
import com.browserup.bup.util.HttpStatusClass;
import com.browserup.harreader.model.Har;
import com.browserup.harreader.model.HarEntry;
import com.google.common.collect.ImmutableMap;
import org.apache.commons.lang3.StringUtils;
import org.littleshoot.proxy.HttpFiltersSource;
Expand All @@ -47,6 +46,8 @@
import java.util.regex.Pattern;
import java.util.stream.Collectors;

import de.sstoehr.harreader.model.HarEntry;

public class MitmProxyServer implements BrowserUpProxy {
private static final Logger log = LoggerFactory.getLogger(MitmProxyServer.class);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package com.browserup.bup.assertion;

import com.browserup.bup.assertion.error.HarEntryAssertionError;
import com.browserup.harreader.model.HarEntry;

import java.util.Optional;

import de.sstoehr.harreader.model.HarEntry;

@FunctionalInterface
public interface HarEntryAssertion {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package com.browserup.bup.assertion;

import com.browserup.bup.assertion.error.HarEntryAssertionError;
import com.browserup.harreader.model.HarEntry;

import java.util.Optional;

import de.sstoehr.harreader.model.HarEntry;

public class ResponseTimeLessThanOrEqualAssertion implements HarEntryAssertion {
private final Long time;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

import com.browserup.bup.assertion.HarEntryAssertion;
import com.browserup.bup.assertion.error.HarEntryAssertionError;
import com.browserup.harreader.model.HarEntry;

import java.util.Optional;

import de.sstoehr.harreader.model.HarEntry;

public abstract class FieldPassesPredicateAssertion<FieldType> implements HarEntryAssertion {

public abstract HarEntryAssertionFieldSupplier<FieldType> getFieldSupplier();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.browserup.bup.assertion.field;

import com.browserup.harreader.model.HarEntry;

import java.util.function.Function;

import de.sstoehr.harreader.model.HarEntry;

@FunctionalInterface
public interface HarEntryAssertionFieldSupplier<FieldType> extends Function<HarEntry, FieldType> {
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

import com.browserup.bup.assertion.model.filter.AssertionFilterInfo;
import com.browserup.harreader.model.Har;
import com.browserup.harreader.model.HarEntry;

import java.util.List;

import de.sstoehr.harreader.model.HarEntry;

public class CurrentStepHarEntriesSupplier extends HarEntriesSupplier {
public CurrentStepHarEntriesSupplier(Har har) {
super(har, new AssertionFilterInfo());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

import com.browserup.bup.assertion.model.filter.AssertionFilterInfo;
import com.browserup.harreader.model.Har;
import com.browserup.harreader.model.HarEntry;

import java.util.List;
import java.util.function.Supplier;

import de.sstoehr.harreader.model.HarEntry;

public abstract class HarEntriesSupplier implements Supplier<List<HarEntry>> {
private final Har har;
private final AssertionFilterInfo filterInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

import com.browserup.bup.assertion.model.filter.AssertionFilterInfo;
import com.browserup.harreader.model.Har;
import com.browserup.harreader.model.HarEntry;

import java.util.Collections;
import java.util.Comparator;
import java.util.List;

import de.sstoehr.harreader.model.HarEntry;

public class MostRecentHarEntrySupplier extends HarEntriesSupplier {

public MostRecentHarEntrySupplier(Har har) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

import com.browserup.harreader.filter.HarLogFilter;
import com.browserup.harreader.model.Har;
import com.browserup.harreader.model.HarEntry;

import java.util.Collections;
import java.util.List;
import java.util.regex.Pattern;

import de.sstoehr.harreader.model.HarEntry;

public class MostRecentUrlFilteredHarEntrySupplier extends UrlFilteredHarEntriesSupplier {

public MostRecentUrlFilteredHarEntrySupplier(Har har, Pattern pattern) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
import com.browserup.bup.assertion.model.filter.AssertionUrlFilterInfo;
import com.browserup.harreader.filter.HarLogFilter;
import com.browserup.harreader.model.Har;
import com.browserup.harreader.model.HarEntry;

import java.util.List;
import java.util.regex.Pattern;

import de.sstoehr.harreader.model.HarEntry;

public class UrlFilteredHarEntriesSupplier extends HarEntriesSupplier {
private final Pattern pattern;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import io.netty.handler.codec.http.cookie.Cookie;
import io.netty.handler.codec.http.cookie.ServerCookieDecoder;
import com.browserup.harreader.model.Har;
import com.browserup.harreader.model.HarEntry;
import com.browserup.bup.exception.UnsupportedCharsetException;
import com.browserup.bup.filters.support.HttpConnectTiming;
import com.browserup.bup.filters.util.HarCaptureUtil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.google.common.cache.CacheBuilder;

import de.sstoehr.harreader.model.HarEntry;
import de.sstoehr.harreader.model.HarRequest;
import de.sstoehr.harreader.model.HarResponse;
import de.sstoehr.harreader.model.HarTiming;
Expand All @@ -11,7 +12,6 @@
import io.netty.handler.codec.http.HttpRequest;
import io.netty.handler.codec.http.HttpResponse;
import com.browserup.harreader.model.Har;
import com.browserup.harreader.model.HarEntry;
import com.browserup.bup.filters.support.HttpConnectTiming;
import com.browserup.bup.filters.util.HarCaptureUtil;
import com.browserup.bup.util.HttpUtil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import java.net.URI;
import java.net.URISyntaxException;
import com.browserup.harreader.model.Har;
import com.browserup.harreader.model.HarEntry;
import com.browserup.harreader.model.HarLog;
import com.browserup.bup.mitm.exception.UncheckedIOException;

import de.sstoehr.harreader.model.HarPage;
import de.sstoehr.harreader.model.HarTiming;

Expand Down Expand Up @@ -41,9 +41,9 @@ public class BrowserUpProxyUtil {
private static final Supplier<String> version = Suppliers.memoize(BrowserUpProxyUtil::readVersionFileOnClasspath);

/**
* Copies {@link HarEntry} and {@link HarPage} references from the specified har to a new har copy, up to and including
* the specified pageRef. Does not perform a "deep copy", so any subsequent modification to the entries or pages will
* be reflected in the copied har.
* Copies {@link de.sstoehr.harreader.model.HarEntry} and {@link HarPage} references from the specified har to a
* new har copy, up to and including the specified pageRef. Does not perform a "deep copy", so any subsequent
* modification to the entries or pages will be reflected in the copied har.
*
* @param har existing har to copy
* @param pageRef last page ID to copy
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package com.browserup.harreader.filter;

import com.browserup.harreader.model.HarEntry;
import java.util.function.Predicate;

import de.sstoehr.harreader.model.HarEntry;

public interface HarEntriesFilter extends Predicate<HarEntry> {

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package com.browserup.harreader.filter;

import com.browserup.harreader.model.HarEntry;
import java.util.regex.Pattern;

import de.sstoehr.harreader.model.HarEntry;

public class HarEntriesUrlPatternFilter implements HarEntriesFilter {

private final Pattern pattern;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.browserup.harreader.filter;

import com.browserup.harreader.model.HarEntry;
import com.browserup.harreader.model.HarLog;

import java.util.Comparator;
Expand All @@ -9,6 +8,8 @@
import java.util.regex.Pattern;
import java.util.stream.Collectors;

import de.sstoehr.harreader.model.HarEntry;

public final class HarLogFilter {

private HarLogFilter() {
Expand Down
Loading

0 comments on commit 907edc3

Please sign in to comment.