-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
122 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
...d/src/test/java/eu/maveniverse/maven/toolbox/shared/internal/ToolboxCommandoImplTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright (c) 2023-2024 Maveniverse Org. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-v20.html | ||
*/ | ||
package eu.maveniverse.maven.toolbox.shared.internal; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertInstanceOf; | ||
|
||
import eu.maveniverse.maven.mima.context.Context; | ||
import eu.maveniverse.maven.mima.context.ContextOverrides; | ||
import eu.maveniverse.maven.mima.context.Runtime; | ||
import eu.maveniverse.maven.mima.context.Runtimes; | ||
import eu.maveniverse.maven.toolbox.shared.ArtifactSink; | ||
import eu.maveniverse.maven.toolbox.shared.DeployingSink; | ||
import eu.maveniverse.maven.toolbox.shared.DirectorySink; | ||
import eu.maveniverse.maven.toolbox.shared.NullOutput; | ||
import java.io.IOException; | ||
import java.nio.file.Path; | ||
import org.eclipse.aether.repository.RemoteRepository; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.io.TempDir; | ||
|
||
public class ToolboxCommandoImplTest { | ||
@Test | ||
void artifactSinkSpec(@TempDir Path tempDir) throws IOException { | ||
Runtime runtime = Runtimes.INSTANCE.getRuntime(); | ||
try (Context context = runtime.create(ContextOverrides.create().build())) { | ||
ToolboxCommandoImpl commando = new ToolboxCommandoImpl(runtime, context); | ||
ArtifactSink sink; | ||
|
||
sink = commando.artifactSink(new NullOutput(), tempDir.toString()); | ||
assertInstanceOf(DirectorySink.class, sink); | ||
assertEquals(((DirectorySink) sink).getDirectory(), tempDir); | ||
|
||
sink = commando.artifactSink(new NullOutput(), "flat:" + tempDir); | ||
assertInstanceOf(DirectorySink.class, sink); | ||
assertEquals(((DirectorySink) sink).getDirectory(), tempDir); | ||
|
||
sink = commando.artifactSink(new NullOutput(), "repository:" + tempDir); | ||
assertInstanceOf(DirectorySink.class, sink); | ||
assertEquals(((DirectorySink) sink).getDirectory(), tempDir); | ||
|
||
sink = commando.artifactSink(new NullOutput(), "deploy:id::https://somewhere.com/"); | ||
assertInstanceOf(DeployingSink.class, sink); | ||
assertEquals( | ||
((DeployingSink) sink).getRemoteRepository(), | ||
new RemoteRepository.Builder("id", "default", "https://somewhere.com/").build()); | ||
} | ||
} | ||
} |