test_class.file: src/modules/rest/auditing/src/test/java/it/geosolutions/geostore/services/rest/auditing/AuditInfoExtractorTest.java
test_class.identifier: AuditInfoExtractorTest
test_class.superclass: extends AuditingTestsBase
test_case.body: @Test
      public void testFaultExecution() {
          Message message = Mockito.mock(Message.class);
          Exchange exchange = Mockito.mock(Exchange.class);
          Message inMessage = getInMessage();
          Mockito.when(message.getExchange()).thenReturn(exchange);
          Mockito.when(exchange.getInMessage()).thenReturn(inMessage);
          Message outFaultMessage = getOutFaultMessage();
          Mockito.when(exchange.getOutFaultMessage()).thenReturn(outFaultMessage);
          Mockito.when(exchange.get(AuditInfo.START_TIME.getKey())).thenReturn(1000l);
          Map<String, String> auditInfo = AuditInfoExtractor.extract(message);
          assertEquals(auditInfo.size(), 20);
          assertEquals(auditInfo.get(AuditInfo.HOST.getKey()), "localhost");
          assertEquals(auditInfo.get(AuditInfo.RESPONSE_CONTENT_TYPE.getKey()), "application/octet-stream");
          assertEquals(auditInfo.get(AuditInfo.HTTP_METHOD.getKey()), "GET");
          assertEquals(auditInfo.get(AuditInfo.BODY_AS_STRING.getKey()), "body-content");
          assertEquals(auditInfo.get(AuditInfo.USER_ROLE.getKey()), "ADMIN");
          assertEquals(auditInfo.get(AuditInfo.REMOTE_HOST.getKey()), "127.0.0.1");
          assertEquals(auditInfo.get(AuditInfo.START_TIME.getKey()), "1000");
          assertEquals(auditInfo.get(AuditInfo.RESPONSE_LENGTH.getKey()), "100");
          assertEquals(auditInfo.get(AuditInfo.BASE_PATH.getKey()), "users");
          assertEquals(auditInfo.get(AuditInfo.QUERY_STRING.getKey()), "");
          assertEquals(auditInfo.get(AuditInfo.USER_GROUPS.getKey()), "everyone");
          assertEquals(auditInfo.get(AuditInfo.RESPONSE_STATUS_CODE.getKey()), "500");
          assertEquals(auditInfo.get(AuditInfo.PATH.getKey()), "users/user/15");
          assertEquals(auditInfo.get(AuditInfo.USER_NAME.getKey()), "admin");
          assertEquals(auditInfo.get(AuditInfo.REMOTE_ADDR.getKey()), "127.0.0.1");
          assertEquals(auditInfo.get(AuditInfo.REMOTE_USER.getKey()),
                  "User[id=2, name=admin, group=[UserGroup[id=1, groupName=everyone]], role=ADMIN]");
          assertEquals(auditInfo.get(AuditInfo.ERROR_MESSAGE.getKey()), "exception-message");
          assertEquals(auditInfo.get(AuditInfo.FAILED.getKey()), "true");
          assertNotNull(auditInfo.get(AuditInfo.END_TIME.getKey()));
          assertEquals(Long.parseLong(auditInfo.get(AuditInfo.TOTAL_TIME.getKey())),
                  Long.parseLong(auditInfo.get(AuditInfo.END_TIME.getKey())) - 1000);
      }
test_case.class_method_signature: AuditInfoExtractorTest.testFaultExecution()
test_case.full_signature: @Test public void testFaultExecution()
test_case.identifier: testFaultExecution
test_case.invocations: mock mock getInMessage thenReturn when getExchange thenReturn when getInMessage getOutFaultMessage thenReturn when getOutFaultMessage thenReturn when get getKey extract assertEquals size assertEquals get getKey assertEquals get getKey assertEquals get getKey assertEquals get getKey assertEquals get getKey assertEquals get getKey assertEquals get getKey assertEquals get getKey assertEquals get getKey assertEquals get getKey assertEquals get getKey assertEquals get getKey assertEquals get getKey assertEquals get getKey assertEquals get getKey assertEquals get getKey assertEquals get getKey assertEquals get getKey assertNotNull get getKey assertEquals parseLong get getKey parseLong get getKey
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testFaultExecution()
focal_class.declarator: LOGGER = Logger.getLogger(AuditInfoExtractor.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = Logger.getLogger(AuditInfoExtractor.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: geoStorePath = Pattern.compile("/geostore/(.*)")
focal_class.modifier: private static final
focal_class.original_string: private static final Pattern geoStorePath = Pattern.compile("/geostore/(.*)");
focal_class.type: Pattern
focal_class.var_name: geoStorePath
focal_class.file: src/modules/rest/auditing/src/main/java/it/geosolutions/geostore/services/rest/auditing/AuditInfoExtractor.java
focal_class.identifier: AuditInfoExtractor
focal_class.class_method_signature: AuditInfoExtractor.AuditInfoExtractor()
focal_class.full_signature: private  AuditInfoExtractor()
focal_class.identifier: AuditInfoExtractor
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.signature:  AuditInfoExtractor()
focal_class.class_method_signature: AuditInfoExtractor.extract(Message message)
focal_class.full_signature: static Map<String, String> extract(Message message)
focal_class.identifier: extract
focal_class.modifiers: static
focal_class.parameters: (Message message)
focal_class.return: Map<String, String>
focal_class.signature: Map<String, String> extract(Message message)
focal_class.class_method_signature: AuditInfoExtractor.getResponseLength(Message message)
focal_class.full_signature: static Integer getResponseLength(Message message)
focal_class.identifier: getResponseLength
focal_class.modifiers: static
focal_class.parameters: (Message message)
focal_class.return: Integer
focal_class.signature: Integer getResponseLength(Message message)
focal_class.class_method_signature: AuditInfoExtractor.handleInMessage(Map<String, String> auditInfo, Message message)
focal_class.full_signature: private static void handleInMessage(Map<String, String> auditInfo, Message message)
focal_class.identifier: handleInMessage
focal_class.modifiers: private static
focal_class.parameters: (Map<String, String> auditInfo, Message message)
focal_class.return: void
focal_class.signature: void handleInMessage(Map<String, String> auditInfo, Message message)
focal_class.class_method_signature: AuditInfoExtractor.handleOutSuccessMessage(Map<String, String> auditInfo, Message message)
focal_class.full_signature: private static void handleOutSuccessMessage(Map<String, String> auditInfo, Message message)
focal_class.identifier: handleOutSuccessMessage
focal_class.modifiers: private static
focal_class.parameters: (Map<String, String> auditInfo, Message message)
focal_class.return: void
focal_class.signature: void handleOutSuccessMessage(Map<String, String> auditInfo, Message message)
focal_class.class_method_signature: AuditInfoExtractor.handleOutFaultMessage(Map<String, String> auditInfo, Message message)
focal_class.full_signature: private static void handleOutFaultMessage(Map<String, String> auditInfo, Message message)
focal_class.identifier: handleOutFaultMessage
focal_class.modifiers: private static
focal_class.parameters: (Map<String, String> auditInfo, Message message)
focal_class.return: void
focal_class.signature: void handleOutFaultMessage(Map<String, String> auditInfo, Message message)
focal_class.class_method_signature: AuditInfoExtractor.handleTime(Map<String, String> auditInfo, Object startTimeObject)
focal_class.full_signature: private static void handleTime(Map<String, String> auditInfo, Object startTimeObject)
focal_class.identifier: handleTime
focal_class.modifiers: private static
focal_class.parameters: (Map<String, String> auditInfo, Object startTimeObject)
focal_class.return: void
focal_class.signature: void handleTime(Map<String, String> auditInfo, Object startTimeObject)
focal_class.class_method_signature: AuditInfoExtractor.safeToString(Object value)
focal_class.full_signature: private static String safeToString(Object value)
focal_class.identifier: safeToString
focal_class.modifiers: private static
focal_class.parameters: (Object value)
focal_class.return: String
focal_class.signature: String safeToString(Object value)
focal_class.class_method_signature: AuditInfoExtractor.getPaylod(Message message)
focal_class.full_signature: private static String getPaylod(Message message)
focal_class.identifier: getPaylod
focal_class.modifiers: private static
focal_class.parameters: (Message message)
focal_class.return: String
focal_class.signature: String getPaylod(Message message)
focal_class.class_method_signature: AuditInfoExtractor.fillAuthInfo(Map<String, String> info, HttpServletRequest httpServletRequest)
focal_class.full_signature: private static void fillAuthInfo(Map<String, String> info, HttpServletRequest httpServletRequest)
focal_class.identifier: fillAuthInfo
focal_class.modifiers: private static
focal_class.parameters: (Map<String, String> info, HttpServletRequest httpServletRequest)
focal_class.return: void
focal_class.signature: void fillAuthInfo(Map<String, String> info, HttpServletRequest httpServletRequest)
focal_class.class_method_signature: AuditInfoExtractor.groupsToString(Set<UserGroup> groups)
focal_class.full_signature: private static String groupsToString(Set<UserGroup> groups)
focal_class.identifier: groupsToString
focal_class.modifiers: private static
focal_class.parameters: (Set<UserGroup> groups)
focal_class.return: String
focal_class.signature: String groupsToString(Set<UserGroup> groups)
focal_class.class_method_signature: AuditInfoExtractor.removeGeoStore(String path)
focal_class.full_signature: private static String removeGeoStore(String path)
focal_class.identifier: removeGeoStore
focal_class.modifiers: private static
focal_class.parameters: (String path)
focal_class.return: String
focal_class.signature: String removeGeoStore(String path)
focal_method.body: static Map<String, String> extract(Message message) {
          Map<String, String> auditInfo = new HashMap<String, String>();
          try {
              handleInMessage(auditInfo, message.getExchange().getInMessage());
              handleOutSuccessMessage(auditInfo, message.getExchange().getOutMessage());
              handleOutFaultMessage(auditInfo, message.getExchange().getOutFaultMessage());
              handleTime(auditInfo, message.getExchange().get(AuditInfo.START_TIME.getKey()));
          } catch (Exception exception) {
              LogUtils.error(LOGGER, exception, "Error obtaining auditing information.");
          }
          return auditInfo;
      }
focal_method.class_method_signature: AuditInfoExtractor.extract(Message message)
focal_method.full_signature: static Map<String, String> extract(Message message)
focal_method.identifier: extract
focal_method.invocations: handleInMessage getInMessage getExchange handleOutSuccessMessage getOutMessage getExchange handleOutFaultMessage getOutFaultMessage getExchange handleTime get getExchange getKey error
focal_method.modifiers: static
focal_method.parameters: (Message message)
focal_method.return: Map<String, String>
focal_method.signature: Map<String, String> extract(Message message)