Skip to content

CAMEL-13979 - create camel-robotframework component - #3172

Merged
onderson merged 1 commit into
apache:masterfrom
onderson:camel-robotframework2
Sep 18, 2019
Merged

CAMEL-13979 - create camel-robotframework component#3172
onderson merged 1 commit into
apache:masterfrom
onderson:camel-robotframework2

Conversation

@onderson

Copy link
Copy Markdown
Contributor

camel-robotframework component: rebase and polish
add karaf feature for robotframework component
docs and cleanup
Fix CS

@onderson onderson changed the title create camel-robotframework component CAMEL-13979 - create camel-robotframework component Sep 15, 2019

@oscerd oscerd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you please add a Spring Boot Integration test too? LGTM, just minor things.

Comment thread apache-camel/pom.xml
<artifactId>camel-ribbon</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Here you are missing the stater

### Options

// component options: START

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this must be populated anyway.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i ran full build but those were not populated. doing it again. let me see if they will get populated. will update soon.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is not going to work I guess, I think there is a bug in the maven plugin, when it checks for the for the Schema JSON file that is generated from the schema endpoint parameter, it checks with case sensitivity, since your schema is scheme = "RobotFramework", it failed to load the json file since it was expecting the name to be without uppercase robotframework.json. To workaround it, can you please change the schema name to robotframework and run the full build again? I will fix that small bug later

@omarsmak omarsmak Sep 17, 2019

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Update: I was wrong here, in fact your schema name should be in small case

@UriParams
public class RobotFrameworkCamelConfiguration implements Cloneable {

/**

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This can be moved to getter/setter section, same for all the javadoc


public interface RobotFrameworkCamelConstants {

public final String ROBOT_CAMEL_EXCHANGE_NAME = "exchange";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It doesn't seem generic enough as name, same for the others ROBOT_VAR

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

moved them into utils and left what's used to set headers and whatnot..

# limitations under the License.
#

class=org.apache.camel.component.robotframework.RobotFrameworkComponent

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In camel 3 this is not needed anymore, it will be autogenerated during the build

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

removed that bit.


if (configuration.getXunitFile() == null) {
String testCasesFolderName = path;
configuration.setXunitFile(new File("TEST-" + testCasesFolderName.replace(' ', '_') + ".xml"));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I was wondering, wouldn't be better to have test files created under target folder?

@omarsmak omarsmak Sep 16, 2019

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also I saw some other files being created when I ran the tests:

Output:  /Users/oalsafi/Work/Apache/camel/components/camel-robotframework/output.xml
XUnit:   /Users/oalsafi/Work/Apache/camel/components/camel-robotframework/TEST-src/test/resources/org/apache/camel/component/robotframework/set_variable_camel_exchange.robot.xml
Log:     /Users/oalsafi/Work/Apache/camel/components/camel-robotframework/log.html
Report:  /Users/oalsafi/Work/Apache/camel/components/camel-robotframework/report.html

So I was wondering as well for these files if they should be created under target?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

not neccessary. that option can be user-configured. for unit tests, i set that option to get them generated in target folder.

if (variablesToAdd == null) {
return;
}
String[] splittedVariabledToAdd = variablesToAdd.split(",");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: I think you meant here splitVariablesToAdd?

Suggested change
String[] splittedVariabledToAdd = variablesToAdd.split(",");
String[] splitVariablesToAdd = variablesToAdd.split(",");

}

public void add(String... values) {
for (String value : values) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do you think is better to replace it with Collection.addAll?

Suggested change
for (String value : values) {
arguments.addAll(Arrays.asList(values));

}

public boolean isSingleton() {
return true;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think you don't need to override since is by default set to true

generatedArguments.addFileToArguments(configuration.getXunitFile(), "-x");
generatedArguments.addFlagToArguments(true, "--xunitskipnoncritical");

generatedArguments.add(path);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do you think it would make sense to have the code responsible path creation separated into a different function:

Suggested change
generatedArguments.add(path);
generatedArguments.add(createPath());

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

not really imho.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The purpose is here to just decompose the function and give more readability and make the code more conscious. However, if you think it doesn't make sense, then is fine


if (configuration.getXunitFile() == null) {
String testCasesFolderName = path;
configuration.setXunitFile(new File("TEST-" + testCasesFolderName.replace(' ', '_') + ".xml"));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we just do like this?:

Suggested change
configuration.setXunitFile(new File("TEST-" + testCasesFolderName.replace(' ', '_') + ".xml"));
configuration.setXunitFile(new File("TEST-" + path.replace(' ', '_') + ".xml"));

and remove testCasesFolderName?

@onderson

Copy link
Copy Markdown
Contributor Author

@oscerd @omarsmak , thanks for the reviews. updated. could you please have another look? thanks

/**
* Represents a RobotFramework endpoint.
*/
@UriEndpoint(firstVersion = "3.0.0-SNAPSHOT", scheme = "RobotFramework", title = "RobotFramework", syntax = "robotframework:resourceUri", label = "test execution")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Remove -SNAPSHOT

/**
* Represents a RobotFramework endpoint.
*/
@UriEndpoint(firstVersion = "3.0.0-SNAPSHOT", scheme = "RobotFramework", title = "RobotFramework", syntax = "robotframework:resourceUri", label = "test execution")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

label = "testing"

// either from a directory or from a file
String path = getResourceUri();
ObjectHelper.notNull(path, "resourceUri");
log.info("RobotFrameworkEndpoint resourceUri:{}", path);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reduce to DEBUG level

@onderson
onderson force-pushed the camel-robotframework2 branch from 0937055 to 2b13243 Compare September 17, 2019 10:32
@onderson

onderson commented Sep 17, 2019

Copy link
Copy Markdown
Contributor Author

updated as per comments. @oscerd @omarsmak @davsclaus , could you have a look?

@omarsmak omarsmak left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM! Thanks

@davsclaus

Copy link
Copy Markdown
Contributor

I would prefer robot-framework as the schema/component name. And set the title attribute to Robot Framework so there is a nice human readable title.

@onderson

Copy link
Copy Markdown
Contributor Author

@davsclaus robotframework is kind of popular with robotframework name. not robot-framework. so even though i agree, it might be good to keep robotframework name as it is. for title, you are right, i will update it.

camel-robotframework component: rebase and polish
add karaf feature for robotframework component
docs and cleanup
Fix CS

CR changes
@onderson
onderson force-pushed the camel-robotframework2 branch from 2b13243 to 009fc03 Compare September 17, 2019 20:54
@davsclaus

Copy link
Copy Markdown
Contributor

@onderson ah okay about the naming then

@onderson

Copy link
Copy Markdown
Contributor Author

Thanks guys. merging and closing.

@onderson
onderson merged commit ccf1337 into apache:master Sep 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants