Tabnine Logo
RoutingService.performModification
Code IndexAdd Tabnine to your IDE (free)

How to use
performModification
method
in
com.epam.wilma.router.RoutingService

Best Java code snippets using com.epam.wilma.router.RoutingService.performModification (Showing top 16 results out of 315)

origin: epam/Wilma

  /**
   * Modify the ordering in the stubDescriptors of routingService.
   * @param direction is the way where we want to move the selected stub descriptor
   * @param groupName is the groupname of selected stub descriptor
   * @param request is only needed for {@link UrlAccessLogMessageAssembler}
   * @throws ClassNotFoundException in case of problem
   */
  public void doChange(final int direction, final String groupName, final HttpServletRequest request) throws ClassNotFoundException {
    routingService.performModification(new ChangeOrderCommand(direction, groupName, request, urlAccessLogMessageAssembler));
  }
}
origin: epam/Wilma

  /**
   * Call the changeStubConfigurationStatus what set the enabled/disabled status at the selected stub descriptor and then applies the change at {@link RoutingService}.
   * @param nextStatus is the new status of the selected stub descriptor
   * @param groupName is the groupname of selected stub descriptor
   * @param request is only needed for {@link UrlAccessLogMessageAssembler}
   * @throws ClassNotFoundException in case of problem
   */
  public void changeStatus(final boolean nextStatus, final String groupName, final HttpServletRequest request) throws ClassNotFoundException {
    routingService.performModification(new ChangeStatusCommand(nextStatus, groupName, request, urlAccessLogMessageAssembler));
  }
}
origin: epam/Wilma

private void createStubDescriptor(final String jsonFilePath) {
  try {
    StubDescriptorModificationCommand command;
    command = newStubDescriptorJsonCommandFactory.create(jsonFilePath, stubConfigurationJsonBuilder, sequenceDescriptorHolder);
    routingService.performModification(command);
  } catch (ClassNotFoundException | FileNotFoundException e) {
    throw new DescriptorCannotBeParsedException("One of the stub descriptor files cannot be found!", e);
  }
}
origin: epam/Wilma

@Override
protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
  PrintWriter writer = response.getWriter();
  if (request.getContentLength() > 0) {
    ServletInputStream inputStream = request.getInputStream();
    try {
      routingService.performModification(new NewStubDescriptorCommand(inputStream, stubDescriptorJsonFactory, sequenceDescriptorHolder));
      serviceMap.detectServices();
      LOGGER.info(urlAccessLogMessageAssembler.assembleMessage(request, "New stub configuration was uploaded to Wilma."));
    } catch (ClassNotFoundException | NoClassDefFoundError | SystemException e) {
      response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
      writer.write("Stub config uploading failed: " + e.getMessage());
      LOGGER.warn(urlAccessLogMessageAssembler.assembleMessage(request, "Stub config uploading failed: " + e.getMessage()), e);
    }
  } else {
    response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
    writer.write("Please provide a non-empty stub configuration!");
  }
}
origin: epam/Wilma

  /**
   * Call the changeStubConfigurationDropper drop method and then applies this changes.
   * @param groupName is the groupname of selected stub descriptor
   * @param request is only needed for {@link UrlAccessLogMessageAssembler}
   * @throws ClassNotFoundException in case of problem
   */
  public void dropSelectedStubConfiguration(final String groupName, final HttpServletRequest request) throws ClassNotFoundException {
    sequenceManager.removeSequenceDescriptors(groupName);
    routingService.performModification(new DropCommand(groupName, request, urlAccessLogMessageAssembler));
    serviceMap.detectServices();
  }
}
origin: epam/Wilma

@Test
public void testProcessUploadedFileShouldReturnWhenStubConfigIsValid() throws ClassNotFoundException {
  //GIVEN in setUp
  //WHEN
  String actual = underTest.processUploadedFile(resource, JSON_CONTENT_TYPE, "stub-configuration", FILE_PATH);
  //THEN
  verify(routingService).performModification(Mockito.any(NewStubDescriptorCommand.class));
  assertEquals(actual, "New stub configuration was uploaded to Wilma.");
}
origin: epam/Wilma

  @Test
  public void testChangeStatusShouldCallTheTwoMethod() throws ClassNotFoundException {
    //GIVEN in setUp
    //WHEN
    underTest.changeStatus(false, GROUPNAME_FIRST, request);
    //THEN
    ArgumentCaptor<ChangeStatusCommand> argument = ArgumentCaptor.forClass(ChangeStatusCommand.class);
    verify(routingService, times(1)).performModification(argument.capture());
    Assert.assertEquals(argument.getValue().isNextStatus(), false);
    Assert.assertEquals(argument.getValue().getGroupName(), GROUPNAME_FIRST);
    Assert.assertEquals(argument.getValue().getRequest(), request);
  }
}
origin: epam/Wilma

  @Test
  public void testDoChangeShouldCallTheTwoMethod() throws ClassNotFoundException {
    //GIVEN in setUp
    //WHEN
    underTest.doChange(1, GROUPNAME_FIRST, request);
    //THEN
    ArgumentCaptor<ChangeOrderCommand> argument = ArgumentCaptor.forClass(ChangeOrderCommand.class);
    verify(routingService, times(1)).performModification(argument.capture());
    Assert.assertEquals(argument.getValue().getDirection(), 1);
    Assert.assertEquals(argument.getValue().getGroupName(), GROUPNAME_FIRST);
    Assert.assertEquals(argument.getValue().getRequest(), request);
  }
}
origin: epam/Wilma

  @Test
  public void testDropSelectedStubConfigurationShouldCallTheTwoMethod() throws ClassNotFoundException {
    //GIVEN in setUp
    //WHEN
    underTest.dropSelectedStubConfiguration(GROUPNAME_FIRST, request);
    //THEN
    ArgumentCaptor<DropCommand> argument = ArgumentCaptor.forClass(DropCommand.class);
    verify(sequenceManager).removeSequenceDescriptors(GROUPNAME_FIRST);
    verify(routingService, times(1)).performModification(argument.capture());
    Assert.assertEquals(argument.getValue().getGroupName(), GROUPNAME_FIRST);
    Assert.assertEquals(argument.getValue().getRequest(), request);
  }
}
origin: epam/Wilma

@Test
public void testDoGetShouldCallStubDescriptorConstructor() throws ServletException, IOException, ClassNotFoundException {
  //GIVEN
  given(request.getContentLength()).willReturn(1);
  //WHEN
  underTest.doGet(request, response);
  //THEN
  verify(routingService).performModification(Mockito.any(NewStubDescriptorCommand.class));
}
origin: epam/Wilma

  @Test
  public void testDoPostShouldCallDoGet() throws ServletException, IOException, ClassNotFoundException {
    //GIVEN
    given(request.getContentLength()).willReturn(1);
    //WHEN
    underTest.doPost(request, response);
    //THEN
    verify(routingService).performModification(Mockito.any(NewStubDescriptorCommand.class));
  }
}
origin: epam/Wilma

  @Test
  public void testLoadSpecificStubDescriptors() throws FileNotFoundException, ClassNotFoundException {
    //GIVEN
    List<String> paths = new ArrayList<>();
    paths.add("test");
    given(newStubDescriptorJsonCommandFactory.create("test", stubConfigurationJsonBuilder, sequenceDescriptorHolder)).willReturn(command);
    //WHEN
    underTest.loadSpecificStubDescriptors(paths);
    //THEN
    verify(routingService, times(1)).performModification(command);
  }
}
origin: epam/Wilma

@Test
public void testDoGetWhenExceptionShouldWriteErrorToResponse() throws ServletException, IOException, ClassNotFoundException {
  //GIVEN
  given(request.getContentLength()).willReturn(1);
  willThrow(new DescriptorCannotBeParsedException(EXCEPTION_MESSAGE, new Throwable())).given(routingService).performModification(
      Mockito.any(NewStubDescriptorCommand.class));
  //WHEN
  underTest.doGet(request, response);
  //THEN
  verify(writer).write(Mockito.anyString());
}
origin: epam/Wilma

if ("stub-configuration".equals(fieldName) && JSON_CONTENT_TYPE.equals(contentType)) {
  try {
    routingService.performModification(new NewStubDescriptorCommand(resource, stubConfigurationJsonBuilder, sequenceDescriptorHolder));
    serviceMap.detectServices();
  } catch (ClassNotFoundException e) {
origin: epam/Wilma

@SuppressWarnings("unchecked")
@Test
public void testInitStubDescriptorWhenOperationModeIsStubShouldSwitchOnStubMode() throws ClassNotFoundException {
  //GIVEN
  operationMode = OperationMode.STUB;
  given(configurationAccess.getProperties()).willReturn(properties);
  given(properties.getOperationMode()).willReturn(operationMode);
  given(command.modify(stubDescriptors)).willReturn(stubDescriptors);
  //WHEN
  underTest.performModification(command);
  //THEN
  Map<String, StubDescriptor> actual = (Map<String, StubDescriptor>) Whitebox.getInternalState(underTest, "stubDescriptors");
  assertEquals(actual, stubDescriptors);
  OperationMode result = (OperationMode) Whitebox.getInternalState(underTest, "operationMode");
  Assert.assertEquals(result, operationMode);
}
origin: epam/Wilma

@SuppressWarnings("unchecked")
@Test
public void testInitStubDescriptorWhenOperationModeIsNotStubShouldDoNothing() throws ClassNotFoundException {
  //GIVEN
  operationMode = OperationMode.WILMA;
  given(configurationAccess.getProperties()).willReturn(properties);
  given(properties.getOperationMode()).willReturn(operationMode);
  given(command.modify(stubDescriptors)).willReturn(stubDescriptors);
  //WHEN
  underTest.performModification(command);
  //THEN
  Map<String, StubDescriptor> actual = (Map<String, StubDescriptor>) Whitebox.getInternalState(underTest, "stubDescriptors");
  assertEquals(actual, stubDescriptors);
  OperationMode result = (OperationMode) Whitebox.getInternalState(underTest, "operationMode");
  Assert.assertEquals(result, operationMode);
}
com.epam.wilma.routerRoutingServiceperformModification

Javadoc

This method execute the given command. The given command is any operation which works with the stubDescriptors collection.

Popular methods of RoutingService

  • getStubDescriptors
  • getResponseDescriptorDTOAndRemove
    Reads a value matched to a key from the response descriptor map and if the value is found it deletes
  • setOperationMode
    Sets the new operation mode.
  • isStubModeOn
  • redirectRequestToStub
    Redirects requests based on their content. If a request needs to be redirected to the stub, it will
  • getOperationMode
  • saveInResponseDescriptorMap

Popular in Java

  • Making http post requests using okhttp
  • putExtra (Intent)
  • addToBackStack (FragmentTransaction)
  • onRequestPermissionsResult (Fragment)
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • JFrame (javax.swing)
  • JTable (javax.swing)
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now