-
Notifications
You must be signed in to change notification settings - Fork 356
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
task #1992 Cleanup XML of action SNMP Trap
- Loading branch information
Showing
5 changed files
with
158 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
...s/snmptrap/src/test/java/org/apache/hop/workflow/actions/snmptrap/ActionSNMPTrapTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.hop.workflow.actions.snmptrap; | ||
|
||
import org.apache.hop.core.HopClientEnvironment; | ||
import org.apache.hop.core.logging.HopLogStore; | ||
import org.apache.hop.workflow.WorkflowMeta; | ||
import org.apache.hop.workflow.action.ActionMeta; | ||
import org.apache.hop.workflow.action.ActionSerializationTestUtil; | ||
import org.apache.hop.workflow.engine.IWorkflowEngine; | ||
import org.apache.hop.workflow.engines.local.LocalWorkflowEngine; | ||
import org.junit.AfterClass; | ||
import org.junit.Before; | ||
import org.junit.BeforeClass; | ||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
public class ActionSNMPTrapTest { | ||
|
||
private IWorkflowEngine<WorkflowMeta> workflow; | ||
private ActionSNMPTrap action; | ||
|
||
@BeforeClass | ||
public static void setUpBeforeClass() { | ||
HopLogStore.init(); | ||
} | ||
|
||
@AfterClass | ||
public static void tearDownAfterClass() {} | ||
|
||
@Before | ||
public void setUp() throws Exception { | ||
workflow = new LocalWorkflowEngine(new WorkflowMeta()); | ||
action = new ActionSNMPTrap(); | ||
workflow.getWorkflowMeta().addAction(new ActionMeta(action)); | ||
action.setParentWorkflow(workflow); | ||
workflow.setStopped(false); | ||
} | ||
|
||
@Test | ||
public void testSerialization() throws Exception { | ||
HopClientEnvironment.init(); | ||
|
||
ActionSNMPTrap action = | ||
ActionSerializationTestUtil. testSerialization( | ||
"/snmp-trap-action.xml", ActionSNMPTrap.class); | ||
|
||
assertEquals("awesomeserver", action.getServerName()); | ||
assertEquals("5000", action.getTimeout()); | ||
assertEquals("162", action.getPort()); | ||
assertEquals("2", action.getNrretry()); | ||
assertEquals("13131", action.getOid()); | ||
assertEquals("averynicemessage", action.getMessage()); | ||
assertEquals("community", action.getTargettype()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
plugins/actions/snmptrap/src/test/resources/snmp-trap-action.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- ~ Licensed to the Apache Software Foundation (ASF) under one or more | ||
~ | ||
contributor license agreements. See the NOTICE file distributed with ~ | ||
this | ||
work for additional information regarding copyright ownership. ~ The | ||
ASF | ||
licenses this file to You under the Apache License, Version 2.0 ~ (the | ||
"License"); you may not use this file except in compliance with ~ the License. | ||
You may obtain a copy of the License at ~ ~ | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
~ ~ Unless required by applicable | ||
law or agreed to in writing, software ~ | ||
distributed under the License is | ||
distributed on an "AS IS" BASIS, ~ WITHOUT | ||
WARRANTIES OR CONDITIONS OF ANY | ||
KIND, either express or implied. ~ See the | ||
License for the specific language | ||
governing permissions and ~ limitations | ||
under the License. ~ --> | ||
<action> | ||
<name>Send SNMP trap</name> | ||
<description>a</description> | ||
<type>SNMP_TRAP</type> | ||
<attributes/> | ||
<port>162</port> | ||
<servername>awesomeserver</servername> | ||
<oid>13131</oid> | ||
<comstring>public</comstring> | ||
<message>averynicemessage</message> | ||
<timeout>5000</timeout> | ||
<nrretry>2</nrretry> | ||
<targettype>community</targettype> | ||
<user/> | ||
<passphrase>Encrypted </passphrase> | ||
<engineid/> | ||
<parallel>N</parallel> | ||
<xloc>368</xloc> | ||
<yloc>208</yloc> | ||
<attributes_hac/> | ||
</action> |