summaryrefslogtreecommitdiff
path: root/qpid/java/broker/src/test/java/org/apache/qpid/server/logging/messages/MessageStoreMessagesTest.java
blob: cc032a0430c1bd116756845db4356e723c8b4888 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/*
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 *
 */
package org.apache.qpid.server.logging.messages;

import java.util.List;

/**
 * Test MST Log Messages
 */
public class MessageStoreMessagesTest extends AbstractTestMessages
{
    public void testMessageStoreCreated()
    {
        String name = "DerbyMessageStore";

        _logMessage = MessageStoreMessages.CREATED(name);
        List<Object> log = performLog();

        String[] expected = {"Created :", name};

        validateLogMessage(log, "MST-1001", expected);
    }

    public void testMessageStoreStoreLocation()
    {
        String location = "/path/to/the/message/store.files";

        _logMessage = MessageStoreMessages.STORE_LOCATION(location);
        List<Object> log = performLog();

        String[] expected = {"Store location :", location};

        validateLogMessage(log, "MST-1002", expected);
    }

    public void testMessageStoreClosed()
    {
        _logMessage = MessageStoreMessages.CLOSED();
        List<Object> log = performLog();

        String[] expected = {"Closed"};

        validateLogMessage(log, "MST-1003", expected);
    }

  public void testMessageStoreRecoveryStart()
    {
        _logMessage = MessageStoreMessages.RECOVERY_START();
        List<Object> log = performLog();

        String[] expected = {"Recovery Start"};

        validateLogMessage(log, "MST-1004", expected);
    }
/*
    public void testMessageStoreRecoveryStart_withQueue()
    {
        String queueName = "testQueue";

        _logMessage = MessageStoreMessages.RECOVERY_START(queueName, true);
        List<Object> log = performLog();

        String[] expected = {"Recovery Start :", queueName};

        validateLogMessage(log, "MST-1004", expected);
    }

    public void testMessageStoreRecovered()
    {
        String queueName = "testQueue";
        Integer messasgeCount = 2000;

        _logMessage = MessageStoreMessages.MST_RECOVERED(messasgeCount, queueName);
        List<Object> log = performLog();

        // Here we use MessageFormat to ensure the messasgeCount of 2000 is
        // reformated for display as '2,000'
        String[] expected = {"Recovered ",
                             MessageFormat.format("{0,number}", messasgeCount),
                             "messages for queue", queueName};

        validateLogMessage(log, "MST-1005", expected);
    }

    public void testMessageStoreRecoveryComplete()
    {
        _logMessage = MessageStoreMessages.MST_RECOVERY_COMPLETE(null,false);
        List<Object> log = performLog();

        String[] expected = {"Recovery Complete"};

        validateLogMessage(log, "MST-1006", expected);
    }

    public void testMessageStoreRecoveryComplete_withQueue()
    {
        String queueName = "testQueue";

        _logMessage = MessageStoreMessages.MST_RECOVERY_COMPLETE(queueName, true);
        List<Object> log = performLog();

        String[] expected = {"Recovery Complete :", queueName};

        validateLogMessage(log, "MST-1006", expected);
    }
    */
}