james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tellier Benoit (JIRA)" <server-...@james.apache.org>
Subject [jira] [Created] (JAMES-2376) HBASE RRT getAllMappings is buggy
Date Tue, 17 Apr 2018 08:18:00 GMT
Tellier Benoit created JAMES-2376:
-------------------------------------

             Summary: HBASE RRT getAllMappings is buggy
                 Key: JAMES-2376
                 URL: https://issues.apache.org/jira/browse/JAMES-2376
             Project: James Server
          Issue Type: Bug
          Components: hbase, RRT
    Affects Versions: master
            Reporter: Tellier Benoit


HBase does some weird RRT overrights:

Test:

{code:java}
    @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()));
    }
{code}

Result:


{code:java}
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}]}]]>
{code}

This behaviour was not tested.

I will disable the test.

Contribution welcomes to fix this.

(See HBaseRecipientRewriteTableTest)





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

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message