Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into emissary-extracti…
Browse files Browse the repository at this point in the history
…ontest-884
  • Loading branch information
sambish5 committed Feb 22, 2024
2 parents 073c11a + 42054ea commit 197596d
Show file tree
Hide file tree
Showing 15 changed files with 141 additions and 239 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/maven-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ jobs:
needs: verify
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Get the version
run: echo "RELEASE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | grep -v '\[.*' | awk -F- '{print ""$1"${{ github.event.inputs.release_suffix }}"}')" >> "$GITHUB_ENV"
outputs:
Expand Down
174 changes: 76 additions & 98 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,11 @@
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.janino</groupId>
<artifactId>janino</artifactId>
<version>3.1.7</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-plus</artifactId>
Expand Down Expand Up @@ -552,12 +557,57 @@
<groupId>com.github.ekryd.sortpom</groupId>
<artifactId>sortpom-maven-plugin</artifactId>
<version>2.15.0</version>
<configuration>
<predefinedSortOrder>recommended_2008_06</predefinedSortOrder>
<createBackupFile>false</createBackupFile>
<lineSeparator>\n</lineSeparator>
<expandEmptyElements>false</expandEmptyElements>
<nrOfIndentSpace>2</nrOfIndentSpace>
<sortDependencies>scope,groupId,artifactId</sortDependencies>
<sortDependencyExclusions>scope,groupId,artifactId</sortDependencyExclusions>
<sortPlugins>groupId,artifactId</sortPlugins>
<sortProperties>true</sortProperties>
</configuration>
<executions>
<execution>
<id>sort-pom</id>
<goals>
<goal>sort</goal>
</goals>
<phase>process-sources</phase>
</execution>
<execution>
<id>verify-sorted-pom</id>
<goals>
<goal>verify</goal>
</goals>
<phase>process-resources</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<version>1.5.3</version>
</plugin>
<plugin>
<groupId>io.github.git-commit-id</groupId>
<artifactId>git-commit-id-maven-plugin</artifactId>
<version>4.9.9</version>
<configuration>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<generateGitPropertiesFilename>${project.build.outputDirectory}/emissary.git.properties</generateGitPropertiesFilename>
<commitIdGenerationMode>full</commitIdGenerationMode>
<useNativeGit>${git.useNative}</useNativeGit>
</configuration>
<executions>
<execution>
<goals>
<goal>revision</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>net.revelc.code</groupId>
<artifactId>impsort-maven-plugin</artifactId>
Expand Down Expand Up @@ -595,18 +645,9 @@
</configuration>
<executions>
<execution>
<id>format-java-sources</id>
<goals>
<goal>format</goal>
</goals>
<phase>generate-sources</phase>
</execution>
<execution>
<id>format-java-test-sources</id>
<goals>
<goal>format</goal>
</goals>
<phase>generate-test-sources</phase>
</execution>
</executions>
</plugin>
Expand Down Expand Up @@ -641,18 +682,9 @@
</dependencies>
<executions>
<execution>
<id>checkstyle-sources</id>
<goals>
<goal>check</goal>
</goals>
<phase>process-sources</phase>
</execution>
<execution>
<id>checkstyle-test-sources</id>
<goals>
<goal>check</goal>
</goals>
<phase>process-test-sources</phase>
</execution>
</executions>
</plugin>
Expand Down Expand Up @@ -684,7 +716,6 @@
<version>3.2.1</version>
<executions>
<execution>
<id>check-maven-version</id>
<goals>
<goal>enforce</goal>
</goals>
Expand Down Expand Up @@ -716,6 +747,23 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${dep.maven-surefire-plugin.version}</version>
<configuration>
<argLine>${surefire.argline}</argLine>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<environmentVariables>
<PROJECT_BASE>${project.build.directory}</PROJECT_BASE>
</environmentVariables>
<reuseForks>false</reuseForks>
<forkCount>${surefire.forkCount}</forkCount>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -751,7 +799,6 @@
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
<goal>test-jar</goal>
Expand Down Expand Up @@ -842,7 +889,6 @@
<version>3.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
<goal>test-jar</goal>
Expand All @@ -856,7 +902,14 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${dep.maven-surefire-plugin.version}</version>
<configuration>
<argLine>${surefire.argline}</argLine>
<environmentVariables>
<PROJECT_BASE>${project.build.directory}</PROJECT_BASE>
</environmentVariables>
<forkCount>${surefire.forkCount}</forkCount>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<reuseForks>true</reuseForks>
<runOrder>random</runOrder>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -992,57 +1045,9 @@
</plugins>
</pluginManagement>
<plugins>
<plugin>
<!-- verify before compile; should be sorted already -->
<groupId>com.github.ekryd.sortpom</groupId>
<artifactId>sortpom-maven-plugin</artifactId>
<configuration>
<predefinedSortOrder>recommended_2008_06</predefinedSortOrder>
<createBackupFile>false</createBackupFile>
<lineSeparator>\n</lineSeparator>
<expandEmptyElements>false</expandEmptyElements>
<nrOfIndentSpace>2</nrOfIndentSpace>
<sortDependencies>scope,groupId,artifactId</sortDependencies>
<sortDependencyExclusions>scope,groupId,artifactId</sortDependencyExclusions>
<sortPlugins>groupId,artifactId</sortPlugins>
<sortProperties>true</sortProperties>
</configuration>
<executions>
<execution>
<id>sort-pom</id>
<goals>
<goal>sort</goal>
</goals>
<phase>process-sources</phase>
</execution>
<execution>
<id>verify-sorted-pom</id>
<goals>
<goal>verify</goal>
</goals>
<phase>process-resources</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>io.github.git-commit-id</groupId>
<artifactId>git-commit-id-maven-plugin</artifactId>
<version>4.9.9</version>
<configuration>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<generateGitPropertiesFilename>${project.build.outputDirectory}/emissary.git.properties</generateGitPropertiesFilename>
<commitIdGenerationMode>full</commitIdGenerationMode>
<useNativeGit>${git.useNative}</useNativeGit>
</configuration>
<executions>
<execution>
<id>git-properties</id>
<goals>
<goal>revision</goal>
</goals>
<phase>initialize</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -1108,24 +1113,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<argLine>${surefire.argline}</argLine>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<environmentVariables>
<PROJECT_BASE>${project.build.directory}</PROJECT_BASE>
</environmentVariables>
<reuseForks>false</reuseForks>
<forkCount>${surefire.forkCount}</forkCount>
</configuration>
<executions>
<execution>
<id>run-integration-tests</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -1166,16 +1153,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>${surefire.argline}</argLine>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<environmentVariables>
<PROJECT_BASE>${project.build.directory}</PROJECT_BASE>
</environmentVariables>
<runOrder>random</runOrder>
<reuseForks>true</reuseForks>
<forkCount>${surefire.forkCount}</forkCount>
</configuration>
</plugin>
<plugin>
<groupId>org.basepom.maven</groupId>
Expand Down Expand Up @@ -1420,7 +1397,8 @@
-Xep:Java8ApiChecker:OFF \
-Xep:UnnecessaryFinal:OFF \
-Xep:Var:OFF \
-Xep:Varifier:OFF</arg>
-Xep:Varifier:OFF \
-Xep:YodaCondition:OFF</arg>
</compilerArgs>
<annotationProcessorPaths>
<path>
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/emissary/admin/PlaceStarter.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import emissary.core.NamespaceException;
import emissary.directory.DirectoryEntry;
import emissary.directory.DirectoryPlace;
import emissary.directory.EmissaryNode;
import emissary.directory.IDirectoryPlace;
import emissary.directory.KeyManipulator;
import emissary.place.IServiceProviderPlace;
Expand Down Expand Up @@ -75,6 +76,23 @@ public static IServiceProviderPlace createPlace(final String theLocation, final
return createPlace(theLocation, constructorArgs, theClassStr);
}

/**
* Create a place using Stream based config
*
* @param theLocation key for the new place
* @param theConfigStream stream configuration for the place
* @param theClassStr string name of the class to instantiate
* @param directory the string directory name to register in
* @param node the emissary node
* @return the place that was found or created, or null if it can't be done
*/
public static IServiceProviderPlace createPlace(final String theLocation, final InputStream theConfigStream, final String theClassStr,
final String directory, final EmissaryNode node) {
// generate constructor args
final Object[] constructorArgs = {theConfigStream, directory, theLocation, node};
return createPlace(theLocation, constructorArgs, theClassStr);
}

/**
* Create a place using generic Object[] constructor args for maximum flexibility for finding any existing constructor.
* Will check to see if the place already exists first and return the existing instance from the Namespace if it does.
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/emissary/admin/Startup.java
Original file line number Diff line number Diff line change
Expand Up @@ -279,14 +279,15 @@ protected boolean localDirectorySetup(final Map<String, String> localDirectories

final long start = System.currentTimeMillis();
final Map<String, String> dirStarts = new HashMap<>();
EmissaryNode emissaryNode = new EmissaryNode();
for (final String thePlaceLocation : hostParameters) {

final String host = placeHost(thePlaceLocation);

if (KeyManipulator.isLocalTo(thePlaceLocation, "http://" + this.node.getNodeName() + ":" + this.node.getNodePort() + "/StartupEngine")) {
logger.info("Doing local startup for directory {} ", thePlaceLocation);
final String thePlaceClassStr = PlaceStarter.getClassString(thePlaceLocation);
final IServiceProviderPlace p = PlaceStarter.createPlace(thePlaceLocation, null, thePlaceClassStr, null);
final IServiceProviderPlace p = PlaceStarter.createPlace(thePlaceLocation, null, thePlaceClassStr, null, emissaryNode);
if (p != null) {
dirStarts.put(host, thePlaceLocation);
localDirectoriesArg.put(host, p.toString());
Expand Down
Loading

0 comments on commit 197596d

Please sign in to comment.