Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public GitContext(
ExtensionContext.Store contextStore = extensionContext.getStore(ExtensionContext.Namespace.create(ArtifactBuilderExtension.class));
contextStore.put(ArtifactExchangeJson.class, artifactExchangeJsonType);
contextStore.put("filePath", fileName);
contextStore.put("artifactType", artifactType);
this.fileName = fileName;
this.artifactExchangeJsonType = artifactExchangeJsonType;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package com.appsmith.server.git;

import com.appsmith.git.configurations.GitServiceConfig;
import com.appsmith.server.applications.base.ApplicationService;
import com.appsmith.server.artifacts.base.ArtifactService;
import com.appsmith.server.constants.ArtifactType;
import com.appsmith.server.constants.FieldName;
import com.appsmith.server.domains.GitAuth;
import com.appsmith.server.dtos.ArtifactExchangeJson;
import com.appsmith.server.git.common.CommonGitService;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.extension.AfterAllCallback;
import org.junit.jupiter.api.extension.AfterEachCallback;
import org.junit.jupiter.api.extension.BeforeAllCallback;
Expand All @@ -19,8 +18,6 @@
import org.springframework.web.reactive.function.client.WebClient;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import reactor.core.publisher.Mono;

import java.nio.file.Path;
Expand All @@ -40,7 +37,7 @@
public class GitServerInitializerExtension implements BeforeAllCallback, BeforeEachCallback, AfterEachCallback, AfterAllCallback {

@Autowired
ApplicationService applicationService;
ArtifactService artifactService;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be parameterized?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably not in the scope of this PR, however something to note down


@Autowired
GitServiceConfig gitServiceConfig;
Expand All @@ -59,16 +56,15 @@ public void beforeAll(ExtensionContext extensionContext) {
@Override
public void beforeEach(ExtensionContext extensionContext) {
ExtensionContext.Store parentContextStore = extensionContext.getParent().get().getStore(ExtensionContext.Namespace.create(ArtifactBuilderExtension.class));
Class<? extends ArtifactExchangeJson> aClass = parentContextStore.get(ArtifactExchangeJson.class, Class.class);
String filePath = parentContextStore.get("filePath", String.class);
ArtifactType artifactType = parentContextStore.get("artifactType", ArtifactType.class);
ExtensionContext.Store contextStore = extensionContext.getStore(ExtensionContext.Namespace.create(ArtifactBuilderExtension.class));

String artifactId = contextStore.get(FieldName.ARTIFACT_ID, String.class);
String repoName = "test" + artifactId;

// TODO : Move this to artifact service to enable packages
// Generate RSA public key for the given artifact
Mono<GitAuth> gitAuthMono = applicationService.createOrUpdateSshKeyPair(artifactId, "RSA");
Mono<GitAuth> gitAuthMono = artifactService.createOrUpdateSshKeyPair(artifactType, artifactId, "RSA");

String tedGitApiPath = "http://" + gitContainer.getHost() + ":" + gitContainer.getMappedPort(4200) + "/api/v1/git/";

Expand Down
62 changes: 62 additions & 0 deletions app/server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
<reactor-test.version>3.5.1</reactor-test.version>
<!-- By default skip the dockerization step. Only activate if necessary -->
<skipDockerBuild>true</skipDockerBuild>
<skipITs>${skipTests}</skipITs>
<skipTests>false</skipTests>
<skipUTs>${skipTests}</skipUTs>
<!-- We're forcing this version temporarily to fix CVE-2022-1471-->
<snakeyaml.version>2.0</snakeyaml.version>
<source.disabled>true</source.disabled>
Expand Down Expand Up @@ -74,6 +77,30 @@
<artifactId>maven-dependency-plugin</artifactId>
<version>3.4.0</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>add-test-source</id>
<goals>
<goal>add-test-source</goal>
</goals>
<phase>generate-test-sources</phase>
<configuration>
<sources>
<source>src/test/java</source>
<!-- Default test directory -->
<source>src/test/it</source>
<!-- Additional test directory -->
<source>src/test/utils</source>
<!-- Another additional directory -->
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
Expand All @@ -84,6 +111,41 @@
<argLine>--add-opens java.base/java.lang=ALL-UNNAMED
--add-opens java.base/java.time=ALL-UNNAMED
--add-opens java.base/java.util=ALL-UNNAMED</argLine>
<testSourceDirectory>src/test/java</testSourceDirectory>
<skipTests>${skipUTs}</skipTests>
</configuration>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.6.2</version>
<exclusions>
<exclusion>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-commons</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<printSummary>true</printSummary>
<!-- Allow JUnit to access the test classes -->
<argLine>-ea
--add-opens java.base/java.lang=ALL-UNNAMED
--add-opens java.base/java.time=ALL-UNNAMED
--add-opens java.base/java.util=ALL-UNNAMED</argLine>
<systemPropertyVariables>
<pf4j.pluginsDir>../dist/plugins</pf4j.pluginsDir>
<!-- Specify plugin directory -->
</systemPropertyVariables>
<testSourceDirectory>src/test/it</testSourceDirectory>
<skipITs>${skipITs}</skipITs>
<!-- Property for skipping integration tests -->
</configuration>
<dependencies>
<dependency>
Expand Down