Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 3c3bd3e
Author: scroix <[email protected]>
Date:   Wed Apr 24 20:38:13 2024 +1000

    Fix broken versioning of nodehost builds

    - museumsvictoria#314 (comment)

commit a2a27fd
Author: scroix <[email protected]>
Date:   Wed Apr 24 19:29:40 2024 +1000

    Apply Java 11 compile patch from @justparking

commit 1d9d4ad
Author: scroix <[email protected]>
Date:   Wed Apr 24 19:18:20 2024 +1000

    Revert "Revert to Java 8 compatible logback dependency"

    This reverts commit 1b9e15b.

commit 1b9e15b
Author: scroix <[email protected]>
Date:   Fri Apr 19 18:46:43 2024 +1000

    Revert to Java 8 compatible logback dependency

commit ca5bc00
Author: scroix <[email protected]>
Date:   Sat Apr 20 12:19:25 2024 +1000

    Revert "Merge branch 'feature/introduce-junit-testing' of github.com:scroix/nodel into feature/introduce-junit-testing"

    This reverts commit 50dfbcb, reversing
    changes made to b1a73ad.

commit 50dfbcb
Merge: b1a73ad d9830bc
Author: scroix <[email protected]>
Date:   Sat Apr 20 12:15:05 2024 +1000

    Merge branch 'feature/introduce-junit-testing' of github.com:scroix/nodel into feature/introduce-junit-testing

    # Conflicts:
    #	nodel-framework/build.gradle
    #	nodel-framework/src/test/java/org/nodel/SimpleNameTest.java

commit b1a73ad
Author: scroix <[email protected]>
Date:   Thu Apr 4 17:42:25 2024 +1100

    Add first ever JUnit tests

    - Cover SimpleNameTest with a couple of test cases
    - Ensure they pass

commit 9a0ebd2
Author: scroix <[email protected]>
Date:   Thu Apr 4 17:41:21 2024 +1100

    Add JUnit as a testing framework

    - Configure Gradle build to include JUnit dependencies

commit 1198db3
Author: scroix <[email protected]>
Date:   Fri Apr 5 09:17:53 2024 +1100

    Introduce test cases to cover expected names of dynamically generated Actions and Events

    - These are in preparation for changes related to issue museumsvictoria#284

commit da01834
Author: scroix <[email protected]>
Date:   Fri Apr 5 09:16:42 2024 +1100

    Add GitHubIssue annotation to mark up tests

commit a1c0e13
Author: scroix <[email protected]>
Date:   Fri Apr 5 09:15:51 2024 +1100

    minor: Remove public declaration from SimpleNameTest

commit c04baf2
Author: scroix <[email protected]>
Date:   Fri Apr 5 09:14:50 2024 +1100

    Add Mockito and Logback test dependencies

commit 2daa92b
Author: scroix <[email protected]>
Date:   Thu Apr 4 17:42:25 2024 +1100

    Add first ever JUnit tests

    - Cover SimpleNameTest with a couple of test cases
    - Ensure they pass

commit 14b7033
Author: scroix <[email protected]>
Date:   Thu Apr 4 17:41:21 2024 +1100

    Add JUnit as a testing framework

    - Configure Gradle build to include JUnit dependencies

commit d9830bc
Author: scroix <[email protected]>
Date:   Fri Apr 19 18:46:43 2024 +1000

    Revert to Java 8 compatible logback dependency

commit e74f409
Author: scroix <[email protected]>
Date:   Sat Apr 6 16:11:43 2024 +1100

    Revert to original parent build file

commit 128dbe2
Author: scroix <[email protected]>
Date:   Sat Apr 6 16:10:18 2024 +1100

    Re-add Gradle job for running tests

commit 6a0ed30
Author: scroix <[email protected]>
Date:   Sat Apr 6 16:08:20 2024 +1100

    Revert "minor: ignore IntelliJ IDE files"

    This reverts commit 9a23d63.

commit 08e99fe
Author: scroix <[email protected]>
Date:   Sat Apr 6 16:04:59 2024 +1100

    Manually 'rebase' in preparation for PR

commit 2ff6dda
Merge: e386b21 1440a78
Author: Julien de-Sainte-Croix <[email protected]>
Date:   Sat Apr 6 15:21:28 2024 +1100

    Merge branch 'feature/introduce-junit-testing' of github.com:scroix/nodel into feature/introduce-junit-testing

    # Conflicts:
    #	nodel-framework/build.gradle

commit e386b21
Author: scroix <[email protected]>
Date:   Fri Apr 5 09:17:53 2024 +1100

    Introduce test cases to cover expected names of dynamically generated Actions and Events

    - These are in preparation for changes related to issue museumsvictoria#284

commit b67c120
Author: scroix <[email protected]>
Date:   Fri Apr 5 09:16:42 2024 +1100

    Add GitHubIssue annotation to mark up tests

commit 9d003b7
Author: scroix <[email protected]>
Date:   Fri Apr 5 09:15:51 2024 +1100

    minor: Remove public declaration from SimpleNameTest

commit 5ebcf19
Author: scroix <[email protected]>
Date:   Fri Apr 5 09:14:50 2024 +1100

    Add Mockito and Logback test dependencies

commit 7586d24
Author: scroix <[email protected]>
Date:   Thu Apr 4 17:42:25 2024 +1100

    Add first ever JUnit tests

    - Cover SimpleNameTest with a couple of test cases
    - Ensure they pass

commit e7b7e3e
Author: scroix <[email protected]>
Date:   Thu Apr 4 17:41:21 2024 +1100

    Add JUnit as a testing framework

    - Configure Gradle build to include JUnit dependencies

commit 9a23d63
Author: scroix <[email protected]>
Date:   Thu Apr 4 17:40:05 2024 +1100

    minor: ignore IntelliJ IDE files

commit 1440a78
Author: scroix <[email protected]>
Date:   Fri Apr 5 09:17:53 2024 +1100

    Introduce test cases to cover expected names of dynamically generated Actions and Events

    - These are in preparation for changes related to issue museumsvictoria#284

commit ac56791
Author: scroix <[email protected]>
Date:   Fri Apr 5 09:16:42 2024 +1100

    Add GitHubIssue annotation to mark up tests

commit 9e53135
Author: scroix <[email protected]>
Date:   Fri Apr 5 09:15:51 2024 +1100

    minor: Remove public declaration from SimpleNameTest

commit a37d107
Author: scroix <[email protected]>
Date:   Fri Apr 5 09:14:50 2024 +1100

    Add Mockito and Logback test dependencies

commit 6114356
Author: scroix <[email protected]>
Date:   Thu Apr 4 17:42:25 2024 +1100

    Add first ever JUnit tests

    - Cover SimpleNameTest with a couple of test cases
    - Ensure they pass

commit 9328669
Author: scroix <[email protected]>
Date:   Thu Apr 4 17:41:21 2024 +1100

    Add JUnit as a testing framework

    - Configure Gradle build to include JUnit dependencies

commit 36a59f3
Author: scroix <[email protected]>
Date:   Thu Apr 4 17:40:05 2024 +1100

    minor: ignore IntelliJ IDE files

commit de67ed4
Author: scroix <[email protected]>
Date:   Thu Apr 4 14:51:47 2024 +1100

    Rename branch in support of .jar generation

    - This tackles a tiny regression which saw us lose -dev- handled in the generated .jar filename
    - We also handle the odd case of building in a git branch which includes a forward slash

commit 138c477
Author: scroix <[email protected]>
Date:   Thu Apr 4 07:29:27 2024 +1100

    Stop targetting specific Gruntfile command

    - 'default' includes googlefonts build, but the 'build' command does not

commit 997b677
Author: scroix <[email protected]>
Date:   Sat Mar 30 13:46:36 2024 +1100

    Revert "Update gradle-wrapper.jar"

    This reverts commit 058a407.

commit 058a407
Author: scroix <[email protected]>
Date:   Sat Mar 30 13:46:17 2024 +1100

    Update gradle-wrapper.jar

commit d23abeb
Author: scroix <[email protected]>
Date:   Sat Mar 30 13:41:50 2024 +1100

    Switch to Gradle bin

commit 90c5066
Author: scroix <[email protected]>
Date:   Sat Mar 30 13:36:28 2024 +1100

    Update gradlew files

    - Using `gradle wrapper` command

commit 9018716
Author: scroix <[email protected]>
Date:   Sat Mar 30 13:24:58 2024 +1100

    Move project info variables to top-level build file

commit 0cfb6fd
Author: scroix <[email protected]>
Date:   Sat Mar 30 13:24:33 2024 +1100

    Revert to original devDependencies

commit 162d58d
Author: scroix <[email protected]>
Date:   Sat Mar 30 12:03:12 2024 +1100

    Revert node version to simplify grunt issue

commit 1b0b706
Author: scroix <[email protected]>
Date:   Sat Mar 30 08:13:58 2024 +1100

    Add a couple more optimisations

commit d65be71
Author: scroix <[email protected]>
Date:   Sat Mar 30 07:42:54 2024 +1100

    Move the feature to check for file changes into a class

commit 027a129
Author: scroix <[email protected]>
Date:   Sat Mar 30 07:18:03 2024 +1100

    Remove unneccesary dir check during Gradle webui tasks

commit 1a766c2
Author: scroix <[email protected]>
Date:   Sat Mar 30 07:17:27 2024 +1100

    Remove Gradle optimisation flags

commit 2fd735b
Author: Julien de-Sainte-Croix <[email protected]>
Date:   Fri Mar 29 22:26:53 2024 +1100

    Maybe this is working now

commit 820dba9
Author: Julien de-Sainte-Croix <[email protected]>
Date:   Fri Mar 29 21:57:48 2024 +1100

    Remove the grunt script from the package.json

commit 3e66086
Author: Julien de-Sainte-Croix <[email protected]>
Date:   Fri Mar 29 21:57:37 2024 +1100

    Further attempt to cache the grunt task

commit 3121adf
Author: Julien de-Sainte-Croix <[email protected]>
Date:   Fri Mar 29 20:51:49 2024 +1100

    Add hack for "cache" of grunt tasks

commit 48c0b59
Author: scroix <[email protected]>
Date:   Fri Mar 29 19:43:22 2024 +1100

    Attempt to cache grunt

commit 8a93e80
Author: scroix <[email protected]>
Date:   Fri Mar 29 19:42:47 2024 +1100

    Enable some speed-ups

commit d151cda
Author: scroix <[email protected]>
Date:   Fri Mar 29 16:29:48 2024 +1100

    Bump node-gradle plugin version to 7.0.2

commit 2c8f6f5
Author: scroix <[email protected]>
Date:   Fri Mar 29 16:29:22 2024 +1100

    Resolve minor warnings

commit 0fcc59e
Author: scroix <[email protected]>
Date:   Fri Mar 29 16:28:48 2024 +1100

    Replace deprecated jcenter

commit c10d6ef
Author: Julien de-Sainte-Croix <[email protected]>
Date:   Fri Mar 29 15:10:53 2024 +1100

    Bump Gradle version to 7.6.4

commit 9e05637
Author: Julien de-Sainte-Croix <[email protected]>
Date:   Mon Mar 18 21:13:46 2024 +1100

    Upgrade Gradle to 7.4 and Node.js to 16.x

    - Migrate build scripts to be compatible
    - Bump Node.js version to one which supports ARM/Silicon builds
    - Configure the node-gradle-plugin
  • Loading branch information
scroix committed May 3, 2024
1 parent c5d34e5 commit bdd3e44
Show file tree
Hide file tree
Showing 6 changed files with 168 additions and 1 deletion.
21 changes: 20 additions & 1 deletion nodel-framework/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,29 @@ jar {
}
}

compileJava {
options.release = 8
}

test {
useJUnitPlatform()
testLogging {
events 'passed', 'skipped', 'failed'
}
}

dependencies {
implementation 'joda-time:joda-time:2.6'
implementation 'org.slf4j:slf4j-api:1.7.10'

// SSH features
implementation group: 'com.jcraft', name: 'jsch', version: '0.1.55'
}

// Test dependencies
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.7.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
testImplementation 'org.mockito:mockito-core:3.+'
testImplementation 'ch.qos.logback:logback-classic:1.4.14'
}

12 changes: 12 additions & 0 deletions nodel-framework/src/test/java/org/nodel/GitHubIssue.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.nodel;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target({ ElementType.TYPE, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
public @interface GitHubIssue {
String value(); // The URL or ID of the GitHub issue
}
37 changes: 37 additions & 0 deletions nodel-framework/src/test/java/org/nodel/SimpleNameTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package org.nodel;

import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import org.junit.jupiter.params.provider.ValueSource;
import static org.junit.jupiter.api.Assertions.*;

@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class SimpleNameTest {

@ParameterizedTest
@ValueSource(strings = {
"node_name",
"Node Name",
"node-name",
"node.name",
"node name"
})
void testGetOriginalName(String originalName) {
SimpleName name = new SimpleName(originalName);
assertEquals(originalName, name.getOriginalName());
}

@ParameterizedTest
@CsvSource({
"node_name, nodename",
"Node Name, NodeName",
"node-name, nodename",
"node.name, nodename",
"node name, nodename"
})
public void testGetReducedName(String originalName, String expectedReducedName) {
SimpleName name = new SimpleName(originalName);
assertEquals(expectedReducedName, name.getReducedName());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
package org.nodel.toolkit;

import org.junit.jupiter.api.*;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import org.nodel.GitHubIssue;
import org.nodel.SimpleName;
import org.nodel.core.NodelServerAction;
import org.nodel.core.NodelServerEvent;
import org.nodel.core.NodelServers;
import org.nodel.host.BaseDynamicNode;
import org.nodel.host.Binding;

import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.*;

class ManagedToolkitTest {

private ManagedToolkit managedToolkit;
private Binding metadata;
private ActionFunction actionFunction;

@FunctionalInterface
interface ActionFunction {
void handle(Object arg);
}

@BeforeEach
void setUp() {
BaseDynamicNode mockNode = mock(BaseDynamicNode.class);
when(mockNode.getName()).thenReturn(new SimpleName("MockNode"));
managedToolkit = new ManagedToolkit(mockNode);
metadata = new Binding();
actionFunction = arg -> {};
}

@Disabled("Awaiting fix for issue: #284")
@DisplayName("Original name of generated action")
@GitHubIssue("https://github.com/museumsvictoria/nodel/issues/284")
@ParameterizedTest
@CsvSource({
"Action With Spaces, Action With Spaces",
"Action-With-Hyphens, Action-With-Hyphens",
})
void testCreateActionWithDefaultName(String actionName, String expectedName) {
try (NodelServerAction action = managedToolkit.createAction(actionName, actionFunction::handle, metadata)) {
assertEquals(expectedName, action.getAction().getOriginalName());
}
}

@DisplayName("Reduced name of generated action")
@ParameterizedTest
@CsvSource({
"Action With Spaces, ActionWithSpaces",
"Action-With-Hyphens, ActionWithHyphens",
})
void testCreateActionWithReducedName(String actionName, String expectedName) {
try (NodelServerAction action = managedToolkit.createAction(actionName, actionFunction::handle, metadata)) {
assertEquals(expectedName, action.getAction().getReducedName());
}
}

@Disabled("Awaiting fix for issue: #284")
@DisplayName("Original name of generated event")
@GitHubIssue("https://github.com/museumsvictoria/nodel/issues/284")
@ParameterizedTest
@CsvSource({
"Event With Spaces, Event With Spaces",
"Event-With-Hyphens, Event-With-Hyphens",
})
void testCreateEventWithDefaultName(String eventName, String expectedName) {
try (NodelServerEvent event = managedToolkit.createEvent(eventName, metadata)) {
NodelServers.instance().registerEvent(event);
assertEquals(expectedName, event.getEvent().getOriginalName());
}
}

@DisplayName("Reduced name of generated event")
@ParameterizedTest
@CsvSource({
"Event With Spaces, EventWithSpaces",
"Event-With-Hyphens, EventWithHyphens",
})

void testCreateEventWithReducedName(String eventName, String expectedName) {
try (NodelServerEvent event = managedToolkit.createEvent(eventName, metadata)) {
NodelServers.instance().registerEvent(event);
assertEquals(expectedName, event.getEvent().getReducedName());
}
}
}
4 changes: 4 additions & 0 deletions nodel-jyhost/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ application {
mainClass = 'org.nodel.jyhost.Launch'
}

compileJava {
options.release = 8
}

jar {
from "$buildDir/output"
archiveBaseName = 'nodel-jyhost'
Expand Down
4 changes: 4 additions & 0 deletions nodel-webui-js/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ plugins {
id 'com.github.node-gradle.node' version '7.0.2'
}

compileJava {
options.release = 8
}

repositories {
mavenCentral()
}
Expand Down

0 comments on commit bdd3e44

Please sign in to comment.