[ 
https://issues.apache.org/jira/browse/METRON-1700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16564018#comment-16564018
 ] 

ASF GitHub Bot commented on METRON-1700:
----------------------------------------

Github user nickwallen commented on a diff in the pull request:

    https://github.com/apache/metron/pull/1135#discussion_r206611838
  
    --- Diff: 
metron-interface/metron-rest/src/test/java/org/apache/metron/rest/service/impl/PcapServiceImplTest.java
 ---
    @@ -639,4 +642,78 @@ public void getRawShouldThrowException() throws 
Exception {
         pcapService.getRawPcap("user", "jobId", 1);
       }
     
    +  @Test
    +  public void 
getConfigurationShouldProperlyReturnFixedFilterConfiguration() throws Exception 
{
    +    FixedPcapRequest fixedPcapRequest = new FixedPcapRequest();
    +    fixedPcapRequest.setBasePath("basePath");
    +    fixedPcapRequest.setBaseInterimResultPath("baseOutputPath");
    +    fixedPcapRequest.setFinalOutputPath("finalOutputPath");
    +    fixedPcapRequest.setStartTimeMs(1L);
    +    fixedPcapRequest.setEndTimeMs(2L);
    +    fixedPcapRequest.setNumReducers(2);
    +    fixedPcapRequest.setIpSrcAddr("ip_src_addr");
    +    fixedPcapRequest.setIpDstAddr("ip_dst_addr");
    +    fixedPcapRequest.setIpSrcPort(1000);
    +    fixedPcapRequest.setIpDstPort(2000);
    +    fixedPcapRequest.setProtocol("tcp");
    +    fixedPcapRequest.setPacketFilter("filter");
    +    fixedPcapRequest.setIncludeReverse(true);
    +    MockPcapJob mockPcapJob = new MockPcapJob();
    +    mockPcapJobSupplier.setMockPcapJob(mockPcapJob);
    +    JobManager jobManager = new InMemoryJobManager<>();
    +
    +    PcapServiceImpl pcapService = spy(new PcapServiceImpl(environment, 
configuration, mockPcapJobSupplier, jobManager, pcapToPdmlScriptWrapper));
    +    FileSystem fileSystem = mock(FileSystem.class);
    +    doReturn(fileSystem).when(pcapService).getFileSystem();
    +    mockPcapJob.setStatus(new JobStatus()
    +                    .withJobId("jobId"));
    +
    +    pcapService.submit("user", fixedPcapRequest);
    +
    +    Map<String, Object> configuration = 
pcapService.getConfiguration("user", "jobId");
    +    Assert.assertEquals("basePath", 
PcapOptions.BASE_PATH.get(configuration, String.class));
    +    Assert.assertEquals("finalOutputPath", 
PcapOptions.FINAL_OUTPUT_PATH.get(configuration, String.class));
    +    Assert.assertEquals(1L, PcapOptions.START_TIME_MS.get(configuration, 
Long.class).longValue());
    +    Assert.assertEquals(2L, PcapOptions.END_TIME_MS.get(configuration, 
Long.class).longValue());
    +    Assert.assertEquals(2, PcapOptions.NUM_REDUCERS.get(configuration, 
Integer.class).intValue());
    +    Assert.assertEquals("ip_src_addr", 
FixedPcapOptions.IP_SRC_ADDR.get(configuration, String.class));
    +    Assert.assertEquals("ip_dst_addr", 
FixedPcapOptions.IP_DST_ADDR.get(configuration, String.class));
    +    Assert.assertEquals(1000, 
FixedPcapOptions.IP_SRC_PORT.get(configuration, Integer.class).intValue());
    +    Assert.assertEquals(2000, 
FixedPcapOptions.IP_DST_PORT.get(configuration, Integer.class).intValue());
    +    Assert.assertEquals("tcp", 
FixedPcapOptions.PROTOCOL.get(configuration, String.class));
    +    Assert.assertEquals("filter", 
FixedPcapOptions.PACKET_FILTER.get(configuration, String.class));
    +    Assert.assertEquals(true, 
FixedPcapOptions.INCLUDE_REVERSE.get(configuration, Boolean.class));
    +  }
    +
    +  @Test
    +  public void 
getConfigurationShouldProperlyReturnQueryFilterConfiguration() throws Exception 
{
    --- End diff --
    
    Is there a test case for trying to get the configuration of a job ID that 
does not exist?


> Create REST endpoint to get job configuration
> ---------------------------------------------
>
>                 Key: METRON-1700
>                 URL: https://issues.apache.org/jira/browse/METRON-1700
>             Project: Metron
>          Issue Type: Sub-task
>            Reporter: Ryan Merriman
>            Priority: Major
>
> We need a REST endpoint that will allow us to retrieve the job configuration 
> properties.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to