use of com.google.idea.blaze.base.sync.workspace.MockArtifactLocationDecoder in project intellij by bazelbuild.
the class JarCacheTest method refresh_fullSync_remoteArtifact_lintJarCached.
@Test
public void refresh_fullSync_remoteArtifact_lintJarCached() throws IOException {
ArtifactLocationDecoder remoteArtifactLocationDecoder = new MockArtifactLocationDecoder(workspaceRoot.directory(), /* isRemote= */
true);
testRefreshLintJarCached(remoteArtifactLocationDecoder, SyncMode.FULL);
}
use of com.google.idea.blaze.base.sync.workspace.MockArtifactLocationDecoder in project intellij by bazelbuild.
the class JarCacheTest method refresh_incrementalSync_remoteArtifact_lintJarCached.
@Test
public void refresh_incrementalSync_remoteArtifact_lintJarCached() throws IOException {
ArtifactLocationDecoder remoteArtifactLocationDecoder = new MockArtifactLocationDecoder(workspaceRoot.directory(), /* isRemote= */
true);
testRefreshLintJarCached(remoteArtifactLocationDecoder, SyncMode.INCREMENTAL);
}
use of com.google.idea.blaze.base.sync.workspace.MockArtifactLocationDecoder in project intellij by bazelbuild.
the class JarCacheTest method refresh_fullSync_localArtifact_lintJarCached.
@Test
public void refresh_fullSync_localArtifact_lintJarCached() throws IOException {
ArtifactLocationDecoder localArtifactLocationDecoder = new MockArtifactLocationDecoder(workspaceRoot.directory(), /* isRemote= */
false);
testRefreshLintJarCached(localArtifactLocationDecoder, SyncMode.FULL);
}
use of com.google.idea.blaze.base.sync.workspace.MockArtifactLocationDecoder in project intellij by bazelbuild.
the class JarCacheTest method refresh_lintJarCachedAndRepackaged.
@Test
public void refresh_lintJarCachedAndRepackaged() throws IOException {
ArtifactLocationDecoder artifactLocationDecoder = new MockArtifactLocationDecoder(workspaceRoot.directory(), /* isRemote= */
true);
// arrange: set up a project that have PluginProcessorJars and register a fake repackager that
// will repackage jars
fakeJarRepackager.setEnable(true);
File jar = workspaceRoot.fileForPath(new WorkspacePath(PLUGIN_PROCESSOR_JAR));
BlazeProjectData blazeProjectData = setupProjectWithLintRuleJar(jar, artifactLocationDecoder);
// act: refresh all the file caches, which in turn will fetch the plugin processor jar to local
// and use FakeJarRepackager to repackage it
FileCache.EP_NAME.extensions().forEach(ep -> ep.onSync(getProject(), context, ProjectViewSet.builder().add(ProjectView.builder().build()).build(), blazeProjectData, null, SyncMode.FULL));
// assert
File cacheDir = JarCacheFolderProvider.getInstance(project).getJarCacheFolder();
File[] cachedFiles = cacheDir.listFiles();
assertThat(cachedFiles).hasLength(2);
assertThat(stream(cachedFiles).filter(file -> !file.getName().startsWith(fakeJarRepackager.getRepackagePrefix()) && new File(cacheDir, fakeJarRepackager.getRepackagePrefix() + file.getName()).exists()).count()).isEqualTo(1);
for (File file : cachedFiles) {
byte[] actualJarContent = Files.readAllBytes(file.toPath());
byte[] expectedJarContent = Files.readAllBytes(jar.toPath());
assertThat(actualJarContent).isEqualTo(expectedJarContent);
}
}
use of com.google.idea.blaze.base.sync.workspace.MockArtifactLocationDecoder in project intellij by bazelbuild.
the class JarCacheTest method refresh_incrementalSync_localArtifact_lintJarCached.
@Test
public void refresh_incrementalSync_localArtifact_lintJarCached() throws IOException {
ArtifactLocationDecoder localArtifactLocationDecoder = new MockArtifactLocationDecoder(workspaceRoot.directory(), /* isRemote= */
false);
testRefreshLintJarCached(localArtifactLocationDecoder, SyncMode.INCREMENTAL);
}
Aggregations