Skip to content

Commit

Permalink
GH-438: Rename SourceCodeGenerator to ProtobufBuildOrchestrator
Browse files Browse the repository at this point in the history
This more clearly represents what this class is doing, and will allow separating
out source detection logic elsewhere at a later date to reduce the scope of this
monolithic class.
  • Loading branch information
ascopes committed Nov 9, 2024
1 parent 83b838c commit 453958b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@
* @author Ashley Scopes
*/
@Named
public final class SourceCodeGenerator {
public final class ProtobufBuildOrchestrator {

private static final Logger log = LoggerFactory.getLogger(SourceCodeGenerator.class);
private static final Logger log = LoggerFactory.getLogger(ProtobufBuildOrchestrator.class);

private final MavenSession mavenSession;
private final MavenArtifactPathResolver artifactPathResolver;
Expand All @@ -65,7 +65,7 @@ public final class SourceCodeGenerator {
private final CommandLineExecutor commandLineExecutor;

@Inject
public SourceCodeGenerator(
public ProtobufBuildOrchestrator(
MavenSession mavenSession,
MavenArtifactPathResolver artifactPathResolver,
ProtocResolver protocResolver,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import io.github.ascopes.protobufmavenplugin.dependencies.ResolutionException;
import io.github.ascopes.protobufmavenplugin.generation.ImmutableGenerationRequest;
import io.github.ascopes.protobufmavenplugin.generation.Language;
import io.github.ascopes.protobufmavenplugin.generation.SourceCodeGenerator;
import io.github.ascopes.protobufmavenplugin.generation.ProtobufBuildOrchestrator;
import io.github.ascopes.protobufmavenplugin.generation.SourceRootRegistrar;
import io.github.ascopes.protobufmavenplugin.plugins.MavenProtocPluginBean;
import io.github.ascopes.protobufmavenplugin.plugins.PathProtocPluginBean;
Expand Down Expand Up @@ -76,7 +76,7 @@ public AbstractGenerateMojo() {
* The source code generator.
*/
@Inject
SourceCodeGenerator sourceCodeGenerator;
ProtobufBuildOrchestrator sourceCodeGenerator;

/**
* The active Maven project.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import io.github.ascopes.protobufmavenplugin.fixtures.UsesSystemProperties;
import io.github.ascopes.protobufmavenplugin.generation.GenerationRequest;
import io.github.ascopes.protobufmavenplugin.generation.Language;
import io.github.ascopes.protobufmavenplugin.generation.SourceCodeGenerator;
import io.github.ascopes.protobufmavenplugin.generation.ProtobufBuildOrchestrator;
import io.github.ascopes.protobufmavenplugin.generation.SourceRootRegistrar;
import io.github.ascopes.protobufmavenplugin.plugins.MavenProtocPluginBean;
import io.github.ascopes.protobufmavenplugin.plugins.PathProtocPluginBean;
Expand Down Expand Up @@ -955,19 +955,19 @@ static Consumer<AbstractGenerateMojo> consumer(Consumer<AbstractGenerateMojo> co
return consumer;
}

static SourceCodeGenerator sourceCodeGenerator(boolean result) throws Throwable {
static ProtobufBuildOrchestrator sourceCodeGenerator(boolean result) throws Throwable {
var sourceCodeGenerator = mock(
SourceCodeGenerator.class,
ProtobufBuildOrchestrator.class,
withSettings().strictness(Strictness.LENIENT)
);
when(sourceCodeGenerator.generate(any()))
.thenReturn(result);
return sourceCodeGenerator;
}

static SourceCodeGenerator erroringSourceCodeGenerator(Throwable cause) throws Throwable {
static ProtobufBuildOrchestrator erroringSourceCodeGenerator(Throwable cause) throws Throwable {
var sourceCodeGenerator = mock(
SourceCodeGenerator.class,
ProtobufBuildOrchestrator.class,
withSettings().strictness(Strictness.LENIENT)
);
when(sourceCodeGenerator.generate(any()))
Expand Down

0 comments on commit 453958b

Please sign in to comment.