mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 18:17:43 +00:00
Merge branch '6770-Domain-Discovery-Thumbnail-API' into 6847-Hook-Up-Domain-UI-And-Thumbnailing
This commit is contained in:
commit
98d543d28d
@ -18,6 +18,7 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.discovery.search;
|
||||
|
||||
import java.awt.Image;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
@ -33,13 +34,15 @@ import org.sleuthkit.datamodel.SleuthkitCase;
|
||||
public class DomainSearch {
|
||||
|
||||
private final DomainSearchCache searchCache;
|
||||
private final DomainSearchThumbnailCache thumbnailCache;
|
||||
|
||||
public DomainSearch() {
|
||||
this(new DomainSearchCache());
|
||||
this(new DomainSearchCache(), new DomainSearchThumbnailCache());
|
||||
}
|
||||
|
||||
DomainSearch(DomainSearchCache cache) {
|
||||
DomainSearch(DomainSearchCache cache, DomainSearchThumbnailCache thumbnailCache) {
|
||||
this.searchCache = cache;
|
||||
this.thumbnailCache = thumbnailCache;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -123,4 +126,18 @@ public class DomainSearch {
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a thumbnail representation of a domain name. See
|
||||
* DomainSearchThumbnailRequest for more details.
|
||||
*
|
||||
* @param thumbnailRequest Thumbnail request for domain
|
||||
* @return An Image instance or null if no thumbnail is available.
|
||||
*
|
||||
* @throws DiscoveryException If there is an error with Discovery related
|
||||
* processing
|
||||
*/
|
||||
public Image getThumbnail(DomainSearchThumbnailRequest thumbnailRequest) throws DiscoveryException {
|
||||
return thumbnailCache.get(thumbnailRequest);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2020 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.sleuthkit.autopsy.discovery.search;
|
||||
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||
|
||||
/**
|
||||
* Caches artifact requests.
|
||||
*/
|
||||
public class DomainSearchArtifactsCache {
|
||||
|
||||
private static final int MAXIMUM_CACHE_SIZE = 5;
|
||||
private static final LoadingCache<DomainSearchArtifactsRequest, List<BlackboardArtifact>> cache
|
||||
= CacheBuilder.newBuilder()
|
||||
.maximumSize(MAXIMUM_CACHE_SIZE)
|
||||
.build(new DomainSearchArtifactsLoader());
|
||||
|
||||
/**
|
||||
* Get artifact instances that match the requested criteria. If the request
|
||||
* is new, the results will be automatically loaded.
|
||||
*
|
||||
* @param request Artifact request, specifies type, Case, and domain name.
|
||||
* @return A list of matching artifacts
|
||||
*
|
||||
* @throws DiscoveryException Any error that occurs during the loading
|
||||
* process.
|
||||
*/
|
||||
public List<BlackboardArtifact> get(DomainSearchArtifactsRequest request) throws DiscoveryException {
|
||||
try {
|
||||
return cache.get(request);
|
||||
} catch (ExecutionException ex) {
|
||||
throw new DiscoveryException("Error fetching artifacts from cache", ex.getCause());
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2020 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.sleuthkit.autopsy.discovery.search;
|
||||
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import org.sleuthkit.datamodel.BlackboardAttribute;
|
||||
import org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE;
|
||||
import org.sleuthkit.datamodel.BlackboardAttribute.Type;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
import org.sleuthkit.datamodel.SleuthkitCase;
|
||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||
|
||||
/**
|
||||
* Loads artifacts for the given request. Searches TSK_DOMAIN and TSK_URL
|
||||
* attributes for the requested domain name. TSK_DOMAIN is exact match (ignoring
|
||||
* case). TSK_URL is sub-string match (ignoring case).
|
||||
*/
|
||||
public class DomainSearchArtifactsLoader extends CacheLoader<DomainSearchArtifactsRequest, List<BlackboardArtifact>> {
|
||||
|
||||
private static final Type TSK_DOMAIN = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_DOMAIN);
|
||||
private static final Type TSK_URL = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_URL);
|
||||
|
||||
@Override
|
||||
public List<BlackboardArtifact> load(DomainSearchArtifactsRequest artifactsRequest) throws TskCoreException {
|
||||
final SleuthkitCase caseDb = artifactsRequest.getSleuthkitCase();
|
||||
final String normalizedDomain = artifactsRequest.getDomain().toLowerCase();
|
||||
final List<BlackboardArtifact> artifacts = caseDb.getBlackboardArtifacts(artifactsRequest.getArtifactType());
|
||||
final List<BlackboardArtifact> matchingDomainArtifacts = new ArrayList<>();
|
||||
|
||||
for (BlackboardArtifact artifact : artifacts) {
|
||||
final BlackboardAttribute tskDomain = artifact.getAttribute(TSK_DOMAIN);
|
||||
final BlackboardAttribute tskUrl = artifact.getAttribute(TSK_URL);
|
||||
|
||||
if (tskDomain != null && tskDomain.getValueString().toLowerCase().equals(normalizedDomain)) {
|
||||
matchingDomainArtifacts.add(artifact);
|
||||
} else if (tskUrl != null && tskUrl.getValueString().toLowerCase().contains(normalizedDomain)) {
|
||||
matchingDomainArtifacts.add(artifact);
|
||||
}
|
||||
}
|
||||
|
||||
return matchingDomainArtifacts;
|
||||
}
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2020 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.sleuthkit.autopsy.discovery.search;
|
||||
|
||||
import java.util.Objects;
|
||||
import org.sleuthkit.datamodel.SleuthkitCase;
|
||||
import org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE;
|
||||
|
||||
/**
|
||||
* Requests artifacts of a specific type and domain from a given Case.
|
||||
*/
|
||||
public class DomainSearchArtifactsRequest {
|
||||
|
||||
private final SleuthkitCase sleuthkitCase;
|
||||
private final String domain;
|
||||
private final ARTIFACT_TYPE artifactType;
|
||||
|
||||
public DomainSearchArtifactsRequest(SleuthkitCase sleuthkitCase,
|
||||
String domain, ARTIFACT_TYPE artifactType) {
|
||||
this.sleuthkitCase = sleuthkitCase;
|
||||
this.domain = domain;
|
||||
this.artifactType = artifactType;
|
||||
}
|
||||
|
||||
public SleuthkitCase getSleuthkitCase() {
|
||||
return sleuthkitCase;
|
||||
}
|
||||
|
||||
public String getDomain() {
|
||||
return domain;
|
||||
}
|
||||
|
||||
public ARTIFACT_TYPE getArtifactType() {
|
||||
return artifactType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (other == this) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(other instanceof DomainSearchArtifactsRequest)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
DomainSearchArtifactsRequest otherRequest = (DomainSearchArtifactsRequest) other;
|
||||
return this.sleuthkitCase == otherRequest.getSleuthkitCase()
|
||||
&& this.domain.equals(otherRequest.getDomain())
|
||||
&& this.artifactType == otherRequest.getArtifactType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return 79 * 5 + Objects.hash(this.domain, this.artifactType);
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2020 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.sleuthkit.autopsy.discovery.search;
|
||||
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import java.awt.Image;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
/**
|
||||
* Caches thumbnail requests.
|
||||
*/
|
||||
public class DomainSearchThumbnailCache {
|
||||
|
||||
private static final int MAXIMUM_CACHE_SIZE = 500;
|
||||
private static final LoadingCache<DomainSearchThumbnailRequest, Image> cache
|
||||
= CacheBuilder.newBuilder()
|
||||
.maximumSize(MAXIMUM_CACHE_SIZE)
|
||||
.build(new DomainSearchThumbnailLoader());
|
||||
|
||||
/**
|
||||
* Get a thumbnail for the requested domain. If the request is new, the
|
||||
* thumbnail will be automatically loaded.
|
||||
*
|
||||
* @param request Requested domain to thumbnail
|
||||
* @return The thumbnail Image instance, or null if no thumbnail is available
|
||||
*
|
||||
* @throws DiscoveryException If any error occurs during thumbnail generation.
|
||||
*/
|
||||
public Image get(DomainSearchThumbnailRequest request) throws DiscoveryException {
|
||||
try {
|
||||
return cache.get(request);
|
||||
} catch (ExecutionException ex) {
|
||||
throw new DiscoveryException("Error fetching artifacts from cache", ex.getCause());
|
||||
}
|
||||
}
|
||||
}
|
145
Core/src/org/sleuthkit/autopsy/discovery/search/DomainSearchThumbnailLoader.java
Executable file
145
Core/src/org/sleuthkit/autopsy/discovery/search/DomainSearchThumbnailLoader.java
Executable file
@ -0,0 +1,145 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2020 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.sleuthkit.autopsy.discovery.search;
|
||||
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import java.awt.Image;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import org.sleuthkit.autopsy.coreutils.ImageUtils;
|
||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||
import org.sleuthkit.datamodel.AbstractFile;
|
||||
import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE;
|
||||
import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD;
|
||||
import org.sleuthkit.datamodel.BlackboardAttribute;
|
||||
import org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE;
|
||||
import org.sleuthkit.datamodel.Content;
|
||||
import org.sleuthkit.datamodel.DataSource;
|
||||
import org.sleuthkit.datamodel.SleuthkitCase;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
|
||||
/**
|
||||
* Loads a thumbnail for the given request. Thumbnail candidates are JPEG files
|
||||
* that are either TSK_WEB_DOWNLOAD or TSK_WEB_CACHE artifacts. JPEG files are
|
||||
* sorted by most recent if sourced from TSK_WEB_DOWNLOADs. JPEG files are
|
||||
* sorted by size if sourced from TSK_WEB_CACHE artifacts. Artifacts are first
|
||||
* loaded from the DomainSearchArtifactsCache and then further analyzed.
|
||||
*/
|
||||
public class DomainSearchThumbnailLoader extends CacheLoader<DomainSearchThumbnailRequest, Image> {
|
||||
|
||||
private static final String JPG_EXTENSION = "jpg";
|
||||
private static final String JPG_MIME_TYPE = "image/jpeg";
|
||||
private final DomainSearchArtifactsCache artifactsCache;
|
||||
|
||||
public DomainSearchThumbnailLoader() {
|
||||
this(new DomainSearchArtifactsCache());
|
||||
}
|
||||
|
||||
DomainSearchThumbnailLoader(DomainSearchArtifactsCache artifactsCache) {
|
||||
this.artifactsCache = artifactsCache;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Image load(DomainSearchThumbnailRequest thumbnailRequest) throws TskCoreException, DiscoveryException {
|
||||
|
||||
final SleuthkitCase caseDb = thumbnailRequest.getSleuthkitCase();
|
||||
|
||||
final DomainSearchArtifactsRequest webDownloadsRequest = new DomainSearchArtifactsRequest(
|
||||
caseDb, thumbnailRequest.getDomain(), TSK_WEB_DOWNLOAD);
|
||||
|
||||
final List<BlackboardArtifact> webDownloads = artifactsCache.get(webDownloadsRequest);
|
||||
final List<AbstractFile> webDownloadPictures = getJpegsFromWebDownload(caseDb, webDownloads);
|
||||
Collections.sort(webDownloadPictures, (file1, file2) -> Long.compare(file1.getCrtime(), file2.getCrtime()));
|
||||
|
||||
for (int i = webDownloadPictures.size() - 1; i >= 0; i--) {
|
||||
// Get the most recent image, according to creation time.
|
||||
final AbstractFile mostRecent = webDownloadPictures.get(i);
|
||||
|
||||
final Image candidateThumbnail = ImageUtils.getThumbnail(mostRecent, thumbnailRequest.getIconSize());
|
||||
if (candidateThumbnail != ImageUtils.getDefaultThumbnail()) {
|
||||
return candidateThumbnail;
|
||||
}
|
||||
}
|
||||
|
||||
final DomainSearchArtifactsRequest webCacheRequest = new DomainSearchArtifactsRequest(
|
||||
caseDb, thumbnailRequest.getDomain(), TSK_WEB_CACHE);
|
||||
|
||||
final List<BlackboardArtifact> webCacheArtifacts = artifactsCache.get(webCacheRequest);
|
||||
final List<AbstractFile> webCachePictures = getJpegsFromWebCache(caseDb, webCacheArtifacts);
|
||||
Collections.sort(webCachePictures, (file1, file2) -> Long.compare(file1.getSize(), file2.getSize()));
|
||||
|
||||
for (int i = webCachePictures.size() - 1; i >= 0; i--) {
|
||||
// Get the largest image, according to file size.
|
||||
final AbstractFile largest = webCachePictures.get(i);
|
||||
|
||||
final Image candidateThumbnail = ImageUtils.getThumbnail(largest, thumbnailRequest.getIconSize());
|
||||
if (candidateThumbnail != ImageUtils.getDefaultThumbnail()) {
|
||||
return candidateThumbnail;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds all JPEG source files from TSK_WEB_DOWNLOAD instances.
|
||||
*/
|
||||
private List<AbstractFile> getJpegsFromWebDownload(SleuthkitCase caseDb, List<BlackboardArtifact> artifacts) throws TskCoreException {
|
||||
final List<AbstractFile> jpegs = new ArrayList<>();
|
||||
|
||||
for (BlackboardArtifact artifact : artifacts) {
|
||||
final Content sourceContent = caseDb.getContentById(artifact.getObjectID());
|
||||
addIfJpeg(jpegs, sourceContent);
|
||||
}
|
||||
|
||||
return jpegs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds all JPEG source files from TSK_WEB_CACHE instances.
|
||||
*/
|
||||
private List<AbstractFile> getJpegsFromWebCache(SleuthkitCase caseDb, List<BlackboardArtifact> artifacts) throws TskCoreException {
|
||||
final BlackboardAttribute.Type TSK_PATH_ID = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_PATH_ID);
|
||||
|
||||
final List<AbstractFile> jpegs = new ArrayList<>();
|
||||
for (BlackboardArtifact artifact : artifacts) {
|
||||
final BlackboardAttribute tskPathId = artifact.getAttribute(TSK_PATH_ID);
|
||||
if (tskPathId != null) {
|
||||
final Content sourceContent = caseDb.getContentById(tskPathId.getValueLong());
|
||||
addIfJpeg(jpegs, sourceContent);
|
||||
}
|
||||
}
|
||||
|
||||
return jpegs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the candidate source content is indeed a JPEG file.
|
||||
*/
|
||||
private void addIfJpeg(List<AbstractFile> files, Content sourceContent) {
|
||||
if ((sourceContent instanceof AbstractFile) && !(sourceContent instanceof DataSource)) {
|
||||
final AbstractFile file = (AbstractFile) sourceContent;
|
||||
if (JPG_EXTENSION.equals(file.getNameExtension())
|
||||
|| JPG_MIME_TYPE.equals(file.getMIMEType())) {
|
||||
files.add(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2020 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.sleuthkit.autopsy.discovery.search;
|
||||
|
||||
import java.util.Objects;
|
||||
import org.sleuthkit.datamodel.SleuthkitCase;
|
||||
|
||||
/**
|
||||
* Requests a thumbnail to be generated for a given Case, domain and
|
||||
* size. IconSize should be a value obtained from ImageUtils.
|
||||
*/
|
||||
public class DomainSearchThumbnailRequest {
|
||||
|
||||
private final SleuthkitCase sleuthkitCase;
|
||||
private final String domain;
|
||||
private final int iconSize;
|
||||
|
||||
public DomainSearchThumbnailRequest(SleuthkitCase sleuthkitCase,
|
||||
String domain, int iconSize) {
|
||||
this.sleuthkitCase = sleuthkitCase;
|
||||
this.domain = domain;
|
||||
this.iconSize = iconSize;
|
||||
}
|
||||
|
||||
public SleuthkitCase getSleuthkitCase() {
|
||||
return sleuthkitCase;
|
||||
}
|
||||
|
||||
public String getDomain() {
|
||||
return domain;
|
||||
}
|
||||
|
||||
public int getIconSize() {
|
||||
return iconSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (other == this) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(other instanceof DomainSearchThumbnailRequest)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
DomainSearchThumbnailRequest otherRequest = (DomainSearchThumbnailRequest) other;
|
||||
return this.sleuthkitCase == otherRequest.getSleuthkitCase()
|
||||
&& this.domain.equals(otherRequest.getDomain())
|
||||
&& this.iconSize == otherRequest.getIconSize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return 79 * 5 + Objects.hash(this.domain, this.iconSize);
|
||||
}
|
||||
}
|
@ -48,7 +48,7 @@ public class DomainSearchTest {
|
||||
};
|
||||
when(cache.get(null, new ArrayList<>(), null, null, null, null, null)).thenReturn(dummyData);
|
||||
|
||||
DomainSearch domainSearch = new DomainSearch(cache);
|
||||
DomainSearch domainSearch = new DomainSearch(cache, null);
|
||||
Map<GroupKey, Integer> sizes = domainSearch.getGroupSizes(null,
|
||||
new ArrayList<>(), null, null, null, null, null);
|
||||
assertEquals(4, sizes.get(groupOne).longValue());
|
||||
@ -83,7 +83,7 @@ public class DomainSearchTest {
|
||||
|
||||
when(cache.get(null, new ArrayList<>(), null, null, null, null, null)).thenReturn(dummyData);
|
||||
|
||||
DomainSearch domainSearch = new DomainSearch(cache);
|
||||
DomainSearch domainSearch = new DomainSearch(cache, null);
|
||||
Map<GroupKey, Integer> sizes = domainSearch.getGroupSizes(null,
|
||||
new ArrayList<>(), null, null, null, null, null);
|
||||
assertEquals(4, sizes.get(groupOne).longValue());
|
||||
@ -97,7 +97,7 @@ public class DomainSearchTest {
|
||||
|
||||
when(cache.get(null, new ArrayList<>(), null, null, null, null, null)).thenReturn(new HashMap<>());
|
||||
|
||||
DomainSearch domainSearch = new DomainSearch(cache);
|
||||
DomainSearch domainSearch = new DomainSearch(cache, null);
|
||||
Map<GroupKey, Integer> sizes = domainSearch.getGroupSizes(null,
|
||||
new ArrayList<>(), null, null, null, null, null);
|
||||
assertEquals(0, sizes.size());
|
||||
@ -122,7 +122,7 @@ public class DomainSearchTest {
|
||||
|
||||
when(cache.get(null, new ArrayList<>(), null, null, null, null, null)).thenReturn(dummyData);
|
||||
|
||||
DomainSearch domainSearch = new DomainSearch(cache);
|
||||
DomainSearch domainSearch = new DomainSearch(cache, null);
|
||||
List<Result> firstPage = domainSearch.getDomainsInGroup(null,
|
||||
new ArrayList<>(), null, null, null, groupOne, 0, 3, null, null);
|
||||
assertEquals(3, firstPage.size());
|
||||
@ -150,7 +150,7 @@ public class DomainSearchTest {
|
||||
|
||||
when(cache.get(null, new ArrayList<>(), null, null, null, null, null)).thenReturn(dummyData);
|
||||
|
||||
DomainSearch domainSearch = new DomainSearch(cache);
|
||||
DomainSearch domainSearch = new DomainSearch(cache, null);
|
||||
List<Result> firstPage = domainSearch.getDomainsInGroup(null,
|
||||
new ArrayList<>(), null, null, null, groupOne, 0, 100, null, null);
|
||||
assertEquals(4, firstPage.size());
|
||||
@ -178,7 +178,7 @@ public class DomainSearchTest {
|
||||
|
||||
when(cache.get(null, new ArrayList<>(), null, null, null, null, null)).thenReturn(dummyData);
|
||||
|
||||
DomainSearch domainSearch = new DomainSearch(cache);
|
||||
DomainSearch domainSearch = new DomainSearch(cache, null);
|
||||
List<Result> firstPage = domainSearch.getDomainsInGroup(null,
|
||||
new ArrayList<>(), null, null, null, groupOne, 0, 2, null, null);
|
||||
assertEquals(2, firstPage.size());
|
||||
@ -206,7 +206,7 @@ public class DomainSearchTest {
|
||||
|
||||
when(cache.get(null, new ArrayList<>(), null, null, null, null, null)).thenReturn(dummyData);
|
||||
|
||||
DomainSearch domainSearch = new DomainSearch(cache);
|
||||
DomainSearch domainSearch = new DomainSearch(cache, null);
|
||||
List<Result> firstPage = domainSearch.getDomainsInGroup(null,
|
||||
new ArrayList<>(), null, null, null, groupOne, 3, 1, null, null);
|
||||
assertEquals(1, firstPage.size());
|
||||
@ -232,7 +232,7 @@ public class DomainSearchTest {
|
||||
|
||||
when(cache.get(null, new ArrayList<>(), null, null, null, null, null)).thenReturn(dummyData);
|
||||
|
||||
DomainSearch domainSearch = new DomainSearch(cache);
|
||||
DomainSearch domainSearch = new DomainSearch(cache, null);
|
||||
List<Result> firstPage = domainSearch.getDomainsInGroup(null,
|
||||
new ArrayList<>(), null, null, null, groupOne, 20, 5, null, null);
|
||||
assertEquals(0, firstPage.size());
|
||||
@ -257,7 +257,7 @@ public class DomainSearchTest {
|
||||
|
||||
when(cache.get(null, new ArrayList<>(), null, null, null, null, null)).thenReturn(dummyData);
|
||||
|
||||
DomainSearch domainSearch = new DomainSearch(cache);
|
||||
DomainSearch domainSearch = new DomainSearch(cache, null);
|
||||
List<Result> firstPage = domainSearch.getDomainsInGroup(null,
|
||||
new ArrayList<>(), null, null, null, groupOne, 0, 0, null, null);
|
||||
assertEquals(0, firstPage.size());
|
||||
@ -292,7 +292,7 @@ public class DomainSearchTest {
|
||||
|
||||
when(cache.get(null, new ArrayList<>(), null, null, null, null, null)).thenReturn(dummyData);
|
||||
|
||||
DomainSearch domainSearch = new DomainSearch(cache);
|
||||
DomainSearch domainSearch = new DomainSearch(cache, null);
|
||||
List<Result> firstPage = domainSearch.getDomainsInGroup(null,
|
||||
new ArrayList<>(), null, null, null, groupOne, 0, 3, null, null);
|
||||
assertEquals(3, firstPage.size());
|
||||
@ -327,7 +327,7 @@ public class DomainSearchTest {
|
||||
|
||||
when(cache.get(null, new ArrayList<>(), null, null, null, null, null)).thenReturn(dummyData);
|
||||
|
||||
DomainSearch domainSearch = new DomainSearch(cache);
|
||||
DomainSearch domainSearch = new DomainSearch(cache, null);
|
||||
List<Result> firstPage = domainSearch.getDomainsInGroup(null,
|
||||
new ArrayList<>(), null, null, null, groupTwo, 1, 2, null, null);
|
||||
assertEquals(2, firstPage.size());
|
||||
@ -359,7 +359,7 @@ public class DomainSearchTest {
|
||||
|
||||
when(cache.get(null, new ArrayList<>(), null, null, null, null, null)).thenReturn(dummyData);
|
||||
|
||||
DomainSearch domainSearch = new DomainSearch(cache);
|
||||
DomainSearch domainSearch = new DomainSearch(cache, null);
|
||||
|
||||
int start = 0;
|
||||
int size = 2;
|
||||
|
Loading…
x
Reference in New Issue
Block a user