Commit 5eadb07d authored by Jay Billings's avatar Jay Billings
Browse files

Fixed a build bug. Removed conflicting classpath file.


Signed-off-by: Jay Billings's avatarJay Jay Billings <jayjaybillings@gmail.com>
parents 59cd999e 62fa3c78
......@@ -35,6 +35,7 @@ You do this by adding the `-s` flag when you make the commit(s), e.g.
## Making your changes
If you are not a committer on this project, please follow these steps to submit your changes:
* Fork the repository on GitHub.
* Create a new branch for your changes.
* Make your changes.
......@@ -44,7 +45,19 @@ You do this by adding the `-s` flag when you make the commit(s), e.g.
* Use descriptive and meaningful commit messages.
* If you have a lot of commits, squash them into a single commit.
* Make sure you use the `-s` flag when committing as explained above.
* Push your changes to your branch in your forked repository.
* Push your changes to your branch in your forked repository and create a Pull Request.
## Code quality requirements
All submissions are reviewed for technical merit. In addition to a technical review, pull requests are reviewed for code quality to maintain a standard across the code base. This includes:
* Reviewing tests to understand the client-facing API of the submission and its general functionality.
* Insuring sufficient test coverage such that at least 80% (preferrably more) of the submission is executed by the tests.
* Insuring that the code satisfies basic quality metrics in a code quality tool (linter).
* Reviewing the general look and feel, including the format, of the submission.
Generated classes, including those from annotation processors, Lombok, and other tools, may not need to have unit tests.
The project committers reserve the right to ask for more tests and other improvements to quality for any submission.
## Submitting the changes
......
......@@ -2,7 +2,7 @@
This README serves as an overview of the commands package, which is a standalone maven package that can be used within or outside of ICE. The package provides the necessary API to set up and run jobs on either one's local computer or a remote host. Additionally, the API includes file transfer and file system browsing capabilities, with the option to move or copy files on the local host or remote host. It is suggested that users encode their file processing logic into a bash/python/powershell script to be run locally/remotely. For example, a remote job on a remote host B could be run from commands on local host A which executes a remote job on remote host C, assuming the script contains the necessary logic to connect remote host B to remote host C.
Examples can be found in either the `src/test/java/org/eclipse/ice/tests/commands` directory or in the standalone package within ICE `org/eclipse/ice/demo/commands/`.
Examples can be found directly underneath this directory in`src/test/java/org/eclipse/ice/tests/commands` or in the standalone demo package within ICE `org.eclipse.ice.demo/src/org/eclipse/ice/demo/commands`. Other tests, that can serve as examples of remote command usage, can be found in `org.eclipse.ice.tests.integration/org.eclipse.ice.tests.commands`.
## Build Instructions
......@@ -24,62 +24,12 @@ In both cases one can skip the tests by including `-DskipTests` in your build.
All dependencies are noted in the `pom` file, and all but one are within maven central. The only non-centralized dependency is the ICE package `org.eclipse.ice.tests.data`. To install it, perform the following commands (after cloning the ICE repositiory) so that the Commands package can build successfully:
```shell
$ cd org.eclipse.ice.tests
$ cd org.eclipse.ice.data
$ mvn clean install
```
### Notes about tests
The automated testing is performed with a dummy remote host, which has private credentials. Thus, if the tests are built with the package, a significant portion of the tests will fail due to the fact that the dummy remote host credentials are not distributed publicly. To solve this, one may enter any generic remote host credentials into the file `$TEST_DATA_PATH/commands/ice-remote-creds.txt` in the following order
```
username
password
hostname
```
See the README in `org.eclipse.ice.tests/org.eclipse.ice.tests.data` for information regarding the `$TEST_DATA_PATH` environment variable; [this link](https://github.com/dbluhm/ice/blob/next/org.eclipse.ice.tests/org.eclipse.ice.tests.data/README.md) takes you to the README on the `next` branch.
The automated tests will then grab the necessary credentials from this file to run. Any valid ssh connection will work. If you still find that the tests fail, ensure that the ssh connection you are using has been logged into before from your host computer such that there is a key fingerprint associated to that host in your `~/.ssh/known_hosts` file. The Commands package requires that this key exists in order for authentication to proceed, no matter what form of authentication you use. In the event that tests fail on a host that already exists in `known_hosts` (e.g. with the error message `server key did not validate`, try deleting your `known_hosts` file (or the entries in your `known_hosts` that correspond to the host you are trying to run the tests on), logging in again to re-establish a fingerprint, and running the tests again.
Alternatively, you can set `StrictHostKeyChecking` to false in the `ConnectionManager`, which is in general not advised as it is inherently unsecure. To do this for the static `ConnectionManager`, just write:
```java
ConnectionManagerFactory.getConnectionManager().setRequireStrictHostKeyChecking(false);
```
Note that this is also a way through which ssh validation can be performed in the package for running actual remote commands/file transfers.
#### EmailHandler test
To test the `EmailUpdateHandler` class, a similar file to the ssh credential file must be created. Instead, a file in the location `$TEST_DATA_PATH/commands/ice-email-creds.txt` must exist which contains the following information:
```
email@address
password
SmtpHost
```
The EmailHandler will send an email from your own address to the same address with updates on when the job finishes. In order for this to happen, the email address must be authenticated. In the case of the tests, and for CI purposes, these authentications are placed in the above text file. For developer use, one could simply enter this information as it is entered in EmailHandlerTest, or you could implement another method (e.g. through use of the text file).
#### KeyGen Tests and Connections
Connections may be established via a public/private key pair that is generated between the local and remote host. Commands can function with ECDSA or RSA type keys. To generate an RSA key, for example, use:
```bash
$ ssh-keygen -t rsa -m PEM
$ ssh-copy-id -i ~/.ssh/keyname.pub username@hostname
```
Then you should be able to remotely login via `ssh -i /path/to/key username@hostname` without a password requirement.
For the keygen connection tests to pass, you should also create a key to a remote host that the tests expect to find. This can be done with any arbitrary remote server that you have credential access to; however, the key must be named dummyhostkey and must exist in your home `.ssh` directory. In other words, the key must be here:
```
$HOME/.ssh/dummyhostkey
```
where `$HOME` is the result returned from `System.getProperty("user.home")`.
### Test packages
The tests are split into two separate directories to enable simplified compilation. Tests pertaining to local commands are available within this package, while the tests pertaining to remote commands are available in `org.eclipse.ice.tests.integration/org.eclipse.ice.tests.commands`. The remote tests require additional testing setup, which is why they are available in the integration testing suite. Please see [this link](https://github.com/eclipse/ice/tree/next/org.eclipse.ice.tests.integration/org.eclipse.ice.tests.commands) for further details.
## Commands API
......
......@@ -29,6 +29,15 @@
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
</plugins>
</build>
......
......@@ -8,6 +8,11 @@
<version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.ice.dev.annotations.proxytest</artifactId>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
......@@ -15,13 +20,6 @@
<version>3.8.1</version>
<configuration>
<release>11</release>
<annotationProcessorPaths>
<path>
<groupId>org.eclipse.ice</groupId>
<artifactId>org.eclipse.ice.dev.annotations</artifactId>
<version>3.0.0-SNAPSHOT</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
......
......@@ -19,18 +19,6 @@
<version>3.8.1</version>
<configuration>
<release>11</release>
<annotationProcessorPaths>
<path>
<groupId>org.eclipse.ice</groupId>
<artifactId>org.eclipse.ice.dev.annotations</artifactId>
<version>3.0.0-SNAPSHOT</version>
</path>
<path>
<groupId>com.google.dagger</groupId>
<artifactId>dagger-compiler</artifactId>
<version>2.16</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
......
......@@ -322,6 +322,7 @@ class DataElementTest {
assertFalse(element.matches(null));
// Now check equality with a clone - therefore also confirming clone works
@SuppressWarnings("unchecked")
DataElement<String> elementClone = (DataElement<String>) element.clone();
// Check reflexivity first
assertEquals(element, element);
......
# Integration Tests
Tests associated to several packages in ICE can be found in the available subdirectories. These integration tests require additional setup. Please see the READMEs in the various subdirectories for more information.
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="target/generated-sources/annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
# Commands Integration Tests
This README serves as additional information for setting up the more complicated tests for the Commands package. Additional information about Commands can be found in the ICE package `org.eclipse.ice.commands`. These tests can also serve as examples for how to use the Commands API.
### Dependencies
All dependencies are noted in the `pom` file, and all but one are within maven central. The only non-centralized dependency is the ICE package `org.eclipse.ice.tests.data`. To install it, perform the following commands (after cloning the ICE repositiory) so that the Commands package can build successfully:
......
/**
* Person DataElement.
* In the future, we hope to be able to generate data structures like this
* directly from DataElement Spec classes.
*/
import { DataElement } from "./data-element";
export class Person extends DataElement {
age: number;
firstName: string;
lastName: string;
constructor() {
super();
this.age = -1;
this.firstName = "";
this.lastName = "";
}
}
\ No newline at end of file
......@@ -4,14 +4,26 @@
* *Move DataElement<T> to its ts file. It would be really nice to put this in the data structures project since it shadows a class there.
* *Add a unit test?
*/
import {v4 as uuidv4} from 'uuid';
export class DataElement<T> {
export class DataElement {
privateId: string;
id: number;
name: string;
description: string;
data!: T;
comment: string;
context: string;
required: boolean;
secret: boolean;
constructor() {
this.privateId = uuidv4();
this.id = 0;
this.name = 'name';
this.description = 'description';
}
this.comment = 'comment';
this.context = 'context';
this.required = false;
this.secret = true;
}
}
\ No newline at end of file
import {css, customElement, html, LitElement, property} from 'lit-element';
import {css, customElement, html, LitElement, property, TemplateResult} from 'lit-element';
import '@vaadin/vaadin-text-field';
import { DataElement } from './data-element'
import '@vaadin/vaadin-checkbox';
import { Person } from './Person';
import { DataElement } from './data-element';
/**
* Tasks:
* *This class should be templated or take a function call back in place of updateDataElement and loadData.
* Tasks:
* *This class should be templated or take a function call back in place of
* updateDataElement and loadData.
* *Add documentation as required.
* *Remove console debug statements
* *This is just an example so the rest doesn't matter much, (the rest being changing the render() function, etc.).
* *This is just an example so the rest doesn't matter much, (the rest being
* changing the render() function, etc.).
*/
@customElement("renderer-template")
class Renderer extends LitElement {
/**
* This is the default data value. It is the empty string and indicates that the JSON has not yet been received from the server.
*/
dataElement = new DataElement<string>();
person: Person = new Person();
@property({type: String})
dataElementJSON = '';
static styles = css`
h1 {
color: hotpink;
color: blue;
text-transform: uppercase;
}
`;
constructor() {
super();
console.log("Constructed");
}
loadData() {
this.person = <Person> JSON.parse(this.dataElementJSON);
}
/**
* This operation updates the content of the template from the contents of the data element.
* Create an updater method for updating the objects field on form events.
* @param obj holding object of field
* @param field field for which an updater is generated
* @returns updater method
*/
updateDataElement(e: {target: HTMLInputElement}) {
console.log("dataElementJSON on update call = " + this.dataElementJSON);
console.log("dataElement on update call = " + this.dataElement);
// First, the event data needs to be read into the local structure
this.dataElement.data = e.target.value;
// Second, dump into the JSON property
this.dataElementJSON = JSON.stringify(this.dataElement);
console.log("dataElementJSON = " + this.dataElementJSON);
// Notify the listeners of the change.
this.dispatchEvent(new CustomEvent('data-changed', {bubbles: true, composed: true, detail: e.target.value}))
fieldUpdater(obj: object, field: string):
(e: {target: HTMLInputElement}) => void
{
let that = this;
return function(e: {target: HTMLInputElement}) {
if (typeof Reflect.get(obj, field) === 'number') {
Reflect.set(obj, field, Number(e.target.value))
} else if (typeof Reflect.get(obj, field) === 'string') {
Reflect.set(obj, field, e.target.value);
} else if (typeof Reflect.get(obj, field) === 'boolean') {
Reflect.set(obj, field, e.target.checked);
}
that.dataElementJSON = JSON.stringify(that.person);
that.dispatchEvent(new CustomEvent(
'data-changed',
{bubbles: true, composed: true, detail: e.target.value}
));
};
}
return;
/**
* Create input form element for the given field.
* @param obj holding object of field
* @param field field for which input is generated
* @returns html template result
*/
fieldInput(obj: object, field: string): TemplateResult {
if (typeof Reflect.get(obj, field) === 'boolean') {
return html`
<vaadin-checkbox
value="${field}"
?checked=${Reflect.get(obj, field)}
@change=${this.fieldUpdater(obj, field)}
>${field}</vaadin-checkbox>
`;
} else {
return html`
<vaadin-text-field
label="${field}"
.value=${Reflect.get(obj, field)}
@input=${this.fieldUpdater(obj, field)}
></vaadin-text-field>
`;
}
}
loadData() {
this.dataElement = <DataElement<string>> JSON.parse(this.dataElementJSON);
console.log("dEJ-ld = ");
console.log(this.dataElementJSON);
console.log("dataElement-ld = ")
console.log(this.dataElement);
console.log(this.dataElement.data);
/**
* Create a form for the passed DataElement.
*
* In this experiment, forms are generated by inspecting the data element.
* In the future, we hope to generate these forms directly from the DataElement
* Spec classes during Annotation Processing.
* @param element element for which a form will be generated
* @returns form html
*/
dataElementForm(element: DataElement): TemplateResult {
let form = html``;
for (let field in element) {
form = html`${form}${this.fieldInput(element, field)}`;
}
return form;
}
/**
* Render this LitElement.
*/
render() {
// Might clean this up a bit - remove some of the <h2> statements.
return html`
<script>${this.loadData()}</script>
<h1>Greetings ${this.dataElement.name}!</h1>
<h1>Greetings ${this.person.age} year old ${this.person.firstName}!</h1>
<div>
<vaadin-text-field
label="Name"
.value=${this.dataElement.data}
@input=${this.updateDataElement}
></vaadin-text-field>
${this.dataElementForm(this.person)}
</div>
<h2>${this.dataElementJSON}</h2>
<h2>${this.dataElement.description}</h2>
<h2>${this.dataElement.name}</h2>
<pre>${JSON.stringify(this.person, null, 2)}</pre>
`;
}
}
\ No newline at end of file
......@@ -1163,6 +1163,11 @@
"integrity": "sha512-oVeL12C6gQS/GAExndigSaLxTrKpQPxewx9bOcwfvJiJge4rr7wNaph4J+ns5hrmIV2as5qxqN8YKthn9qh0jw==",
"dev": true
},
"@types/uuid": {
"version": "8.0.1",
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.0.1.tgz",
"integrity": "sha512-2kE8rEFgJpbBAPw5JghccEevQb0XVU0tewF/8h7wPQTeCtoJ6h8qmBIwuzUVm2MutmzC/cpCkwxudixoNYDp1A=="
},
"@vaadin/flow-deps": {
"version": "file:target/frontend",
"requires": {
......@@ -9256,6 +9261,14 @@
"requires": {
"faye-websocket": "^0.10.0",
"uuid": "^3.0.1"
},
"dependencies": {
"uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
"dev": true
}
}
},
"sockjs-client": {
......@@ -10098,10 +10111,9 @@
"dev": true
},
"uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
"dev": true
"version": "8.3.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.0.tgz",
"integrity": "sha512-fX6Z5o4m6XsXBdli9g7DtWgAx+osMsRRZFKma1mIUsLCz6vRvv+pz5VNbyu9UEDzpMWulZfvpgb/cmDXVulYFQ=="
},
"v8-compile-cache": {
"version": "2.0.3",
......@@ -10661,6 +10673,14 @@
"requires": {
"ansi-colors": "^3.0.0",
"uuid": "^3.3.2"
},
"dependencies": {
"uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
"dev": true
}
}
},
"webpack-merge": {
......
......@@ -3,9 +3,11 @@
"license": "UNLICENSED",
"dependencies": {
"@polymer/polymer": "3.2.0",
"@webcomponents/webcomponentsjs": "^2.2.10",
"@types/uuid": "^8.0.1",
"@vaadin/flow-deps": "./target/frontend",
"lit-element": "^2.2.0"
"@webcomponents/webcomponentsjs": "^2.2.10",
"lit-element": "^2.2.0",
"uuid": "^8.3.0"
},
"devDependencies": {
"copy-webpack-plugin": "5.1.0",
......
......@@ -159,6 +159,10 @@
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
</dependency>
</dependencies>
<build>
......
/*******************************************************************************
* Copyright (c) 2020- UT-Battelle, LLC.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Initial API and implementation and/or initial documentation -
* Jay Jay Billings
*******************************************************************************/
package gov.ornl.rse.renderer.client.test;
import org.eclipse.ice.renderer.DataElement;
/**
* @author Jay Jay Billings
*
*/
public class DataFile extends DataElement<String> {
}
/*******************************************************************************
* Copyright (c) 2020- UT-Battelle, LLC.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Initial API and implementation and/or initial documentation -
* Jay Jay Billings
*******************************************************************************/
package gov.ornl.rse.renderer.client.test;
import java.io.Serializable;
import org.springframework.stereotype.Service;
@Service
public class GreetService implements Serializable {