• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

leonchen83 / redis-replicator / #2260

08 Jun 2025 10:09AM UTC coverage: 71.805% (-0.2%) from 71.988%
#2260

push

leonchen83
redis-8.0

0 of 26 new or added lines in 1 file covered. (0.0%)

7062 of 9835 relevant lines covered (71.8%)

0.72 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

3.7
/src/main/java/com/moilioncircle/redis/replicator/cmd/parser/HPExpireAtParser.java
1
/*
2
 * Copyright 2016-2017 Leon Chen
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16

17
package com.moilioncircle.redis.replicator.cmd.parser;
18

19
import static com.moilioncircle.redis.replicator.cmd.CommandParsers.toBytes;
20
import static com.moilioncircle.redis.replicator.cmd.CommandParsers.toLong;
21
import static com.moilioncircle.redis.replicator.cmd.CommandParsers.toRune;
22
import static com.moilioncircle.redis.replicator.util.Strings.isEquals;
23

24
import com.moilioncircle.redis.replicator.cmd.CommandParser;
25
import com.moilioncircle.redis.replicator.cmd.impl.CompareType;
26
import com.moilioncircle.redis.replicator.cmd.impl.ExistType;
27
import com.moilioncircle.redis.replicator.cmd.impl.HPExpireAtCommand;
28

29
/**
30
 * @author Leon Chen
31
 * @since 3.9.0
32
 */
33
public class HPExpireAtParser implements CommandParser<HPExpireAtCommand> {
1✔
34
    
35
    @Override
36
    public HPExpireAtCommand parse(Object[] command) {
NEW
37
        int idx = 1;
×
NEW
38
        byte[] key = toBytes(command[idx]);
×
NEW
39
        idx++;
×
NEW
40
        long ex = toLong(command[idx++]);
×
41
        
NEW
42
        ExistType existType = ExistType.NONE;
×
NEW
43
        CompareType compareType = CompareType.NONE;
×
NEW
44
        while (idx < command.length) {
×
NEW
45
            String param = toRune(command[idx]);
×
NEW
46
            if (isEquals(param, "NX")) {
×
NEW
47
                existType = ExistType.NX;
×
NEW
48
            } else if (isEquals(param, "XX")) {
×
NEW
49
                existType = ExistType.XX;
×
NEW
50
            } else if (isEquals(param, "GT")) {
×
NEW
51
                compareType = CompareType.GT;
×
NEW
52
            } else if (isEquals(param, "LT")) {
×
NEW
53
                compareType = CompareType.LT;
×
NEW
54
            } else if (isEquals(param, "FIELDS")) {
×
NEW
55
                break;
×
56
            }
NEW
57
            idx++;
×
NEW
58
        }
×
59
        
NEW
60
        idx += 2; // skip FIELDS numFields
×
NEW
61
        byte[][] fields = new byte[command.length - idx][];
×
NEW
62
        System.out.println(fields.length);
×
NEW
63
        for (int i = idx, j = 0; i < command.length; i++, j++) {
×
NEW
64
            fields[j] = toBytes(command[i]);
×
65
        }
NEW
66
        return new HPExpireAtCommand(key, fields, ex, existType, compareType);
×
67
    }
68
    
69
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc