blob: b12144624d4390884b5f28ec9a86b53a7f289c02 [file] [log] [blame]
/*
* 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.
*/
#pragma once
#ifndef GEODE_INTEGRATION_TEST_THINCLIENTINTEREST2_H_
#define GEODE_INTEGRATION_TEST_THINCLIENTINTEREST2_H_
#include "fw_dunit.hpp"
#include "ThinClientHelper.hpp"
#define CLIENT1 s1p1
#define CLIENT2 s1p2
#define SERVER1 s2p1
bool isLocalServer = true;
static bool isLocator = false;
const char* locatorsG =
CacheHelper::getLocatorHostPort(isLocator, isLocalServer, 1);
#include "LocatorHelper.hpp"
DUNIT_TASK_DEFINITION(CLIENT1, SetupClient1_Pool_Locator)
{
initClient(true);
createPooledRegion(regionNames[0], false /*ack mode*/, locatorsG,
"__TEST_POOL1__", true /*client notification*/);
}
END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT2, setupClient2_Pool_Locator)
{
initClient(true);
createPooledRegion(regionNames[0], false /*ack mode*/, locatorsG,
"__TEST_POOL1__", true /*client notification*/);
auto regPtr = getHelper()->getRegion(regionNames[0]);
}
END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, populateServer)
{
auto regPtr = getHelper()->getRegion(regionNames[0]);
for (int i = 0; i < 5; i++) {
auto keyPtr = CacheableKey::create(keys[i]);
regPtr->create(keyPtr, vals[i]);
}
}
END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT2, verify)
{
auto regPtr = getHelper()->getRegion(regionNames[0]);
for (int i = 0; i < 5; i++) {
auto keyPtr1 = CacheableKey::create(keys[i]);
char buf[1024];
sprintf(buf, "key[%s] should not have been found", keys[i]);
ASSERT(!regPtr->containsKey(keyPtr1), buf);
auto checkPtr = regPtr->get(keyPtr1);
verifyEntry(regionNames[0], keys[i], vals[i]);
}
}
END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, StopClient1)
{
cleanProc();
LOG("CLIENT1 stopped");
}
END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT2, StopClient2)
{
cleanProc();
LOG("CLIENT2 stopped");
}
END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(SERVER1, StopServer)
{
if (isLocalServer) CacheHelper::closeServer(1);
LOG("SERVER stopped");
}
END_TASK_DEFINITION
#endif // GEODE_INTEGRATION_TEST_THINCLIENTINTEREST2_H_