Uploaded image for project: 'James Server'
  1. James Server
  2. JAMES-2376

HBASE RRT getAllMappings is buggy

    XMLWordPrintableJSON

    Details

      Description

      HBase does some weird RRT overrights:

      Test:

          @Test
          public void getAllMappingsShouldListAllEntries() throws ErrorMappingException, RecipientRewriteTableException {
              String user = "test";
              String user2 = "test2";
              Domain domain = Domain.LOCALHOST;
              // String regex = "(.*):{$1}@localhost";
              // String regex2 = "(.+):{$1}@test";
              String regex = "(.*)@localhost";
              String regex2 = "(.+)@test";
      
              assertThat(virtualUserTable.getMappings(user, domain)).describedAs("No mapping").isNull();
      
              addMapping(user, domain, regex, Type.Regex);
              addMapping(user, domain, regex2, Type.Regex);
              addMapping(user2, domain, user + "@" + domain.asString(), Type.Address);
      
              assertThat(virtualUserTable.getAllMappings())
                  .describedAs("One mappingline")
                  .containsOnly(
                      Pair.of(user + "@" + domain.asString(), MappingsImpl.builder()
                          .add(MappingImpl.regex(regex))
                          .add(MappingImpl.regex(regex2))
                          .build()),
                      Pair.of(user2 + "@" + domain.asString(), MappingsImpl.builder()
                          .add(MappingImpl.address(user + "@" + domain.asString()))
                          .build()));
          }
      

      Result:

      java.lang.AssertionError: [One mappingline] 
      Expecting:
        <{"test2@localhost"=MappingsImpl{mappings=[MappingImpl{type=Address mapping=test2@localhost}]}, "test@localhost"=MappingsImpl{mappings=[MappingImpl{type=Address mapping=test@localhost}]}}>
      to contain only:
        <[(test@localhost,MappingsImpl{mappings=[MappingImpl{type=Regex mapping=(.*)@localhost}, MappingImpl{type=Regex mapping=(.+)@test}]}),
          (test2@localhost,MappingsImpl{mappings=[MappingImpl{type=Address mapping=test@localhost}]})]>
      elements not found:
        <[MapEntry[key="test@localhost", value=MappingsImpl{mappings=[MappingImpl{type=Regex mapping=(.*)@localhost}, MappingImpl{type=Regex mapping=(.+)@test}]}],
          MapEntry[key="test2@localhost", value=MappingsImpl{mappings=[MappingImpl{type=Address mapping=test@localhost}]}]]>
      and elements not expected:
        <[MapEntry[key="test2@localhost", value=MappingsImpl{mappings=[MappingImpl{type=Address mapping=test2@localhost}]}],
          MapEntry[key="test@localhost", value=MappingsImpl{mappings=[MappingImpl{type=Address mapping=test@localhost}]}]]>
      

      This behaviour was not tested.

      I will disable the test.

      Contribution welcomes to fix this.

      (See HBaseRecipientRewriteTableTest)

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              btellier Benoit Tellier
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: