Repository: incubator-hawq Updated Branches: refs/heads/master 8b79e10fd -> 383818c28
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestRecords/TestApplicationSubmisionContext.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestRecords/TestApplicationSubmisionContext.cpp b/depends/libyarn/test/unit/TestRecords/TestApplicationSubmisionContext.cpp new file mode 100644 index 0000000..2f12bae --- /dev/null +++ b/depends/libyarn/test/unit/TestRecords/TestApplicationSubmisionContext.cpp @@ -0,0 +1,156 @@ +/* + * 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. + */ + +#include <string> + +#include "gtest/gtest.h" +#include "gmock/gmock.h" + +#include "records/ApplicationSubmissionContext.h" + +using std::string; +using namespace libyarn; +using namespace testing; + +class TestApplicationSubmissionContext: public ::testing::Test { +protected: + ApplicationSubmissionContext applicationContext; +}; + +TEST_F(TestApplicationSubmissionContext, TestGetApplicationId) +{ + ApplicationId id; + ApplicationId retId; + + applicationContext.setApplicationId(id); + retId = applicationContext.getApplicationId(); + + /* The operator '==' is not defined for class ApplicationId, + so we can't compare id and retId here. */ + + SUCCEED(); +} + +TEST_F(TestApplicationSubmissionContext, TestGetApplicationName) +{ + string name("name"); + string retName; + + applicationContext.setApplicationName(name); + retName = applicationContext.getApplicationName(); + + EXPECT_EQ(name, retName); +} + +TEST_F(TestApplicationSubmissionContext, TestGetQueue) +{ + string queue("queue"); + string retQueue; + + applicationContext.setQueue(queue); + retQueue = applicationContext.getQueue(); + + EXPECT_EQ(queue, retQueue); +} + +TEST_F(TestApplicationSubmissionContext, TestGetPriority) +{ + Priority priority; + Priority retPriority; + + applicationContext.setPriority(priority); + retPriority = applicationContext.getPriority(); + + /* The operator '==' is not defined for class Priority, + so we can't compare priority and retPriority here. */ + + SUCCEED(); +} + +TEST_F(TestApplicationSubmissionContext, TestGetAMContainerSpec) +{ + ContainerLaunchContext context; + ContainerLaunchContext retContext; + + applicationContext.setAMContainerSpec(context); + retContext = applicationContext.getAMContainerSpec(); + + /* The operator '==' is not defined for class ContainerLaunchContext, + so we can't compare context and retContext here. */ + + SUCCEED(); +} + +TEST_F(TestApplicationSubmissionContext, TestGetCancelTokensWhenComplete) +{ + bool flag = true; + bool retFlag; + + applicationContext.setCancelTokensWhenComplete(flag); + retFlag = applicationContext.getCancelTokensWhenComplete(); + + EXPECT_EQ(flag, retFlag); +} + +TEST_F(TestApplicationSubmissionContext, TestGetUnmanagedAM) +{ + bool flag = true; + bool retFlag; + + applicationContext.setUnmanagedAM(flag); + retFlag = applicationContext.getUnmanagedAM(); + + EXPECT_EQ(flag, retFlag); +} + +TEST_F(TestApplicationSubmissionContext, TestGetMaxAppAttempts) +{ + int32_t max = -1; + int32_t retMax; + + applicationContext.setMaxAppAttempts(max); + retMax = applicationContext.getMaxAppAttempts(); + + EXPECT_EQ(max, retMax); +} + +TEST_F(TestApplicationSubmissionContext, TestGetResource) +{ + Resource resource; + Resource retResource; + + applicationContext.setResource(resource); + retResource = applicationContext.getResource(); + + /* The operator '==' is not defined for class Resource, + so we can't compare resource and retResource here. */ + + SUCCEED(); +} + +TEST_F(TestApplicationSubmissionContext, TestGetApplicationType) +{ + string type("type"); + string retType; + + applicationContext.setApplicationType(type); + retType = applicationContext.getApplicationType(); + + EXPECT_EQ(type, retType); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestRecords/TestContainerExceptionMap.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestRecords/TestContainerExceptionMap.cpp b/depends/libyarn/test/unit/TestRecords/TestContainerExceptionMap.cpp new file mode 100644 index 0000000..ccfd28d --- /dev/null +++ b/depends/libyarn/test/unit/TestRecords/TestContainerExceptionMap.cpp @@ -0,0 +1,59 @@ +/* + * 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. + */ + +#include "gtest/gtest.h" +#include "gmock/gmock.h" + +#include "records/ContainerExceptionMap.h" + +using namespace libyarn; +using namespace testing; + +class TestContainerExceptionMap: public ::testing::Test { +protected: + ContainerExceptionMap containerMap; +}; + +TEST_F(TestContainerExceptionMap, TestGetContainerId) +{ + ContainerId id; + ContainerId retId; + + containerMap.setContainerId(id); + retId = containerMap.getContainerId(); + + /* The operator '==' is not defined for class ContainerId, + so we can't compare id and retId here. */ + + SUCCEED(); +} + +TEST_F(TestContainerExceptionMap, TestSerializedException) +{ + SerializedException exception; + SerializedException retException; + + containerMap.setSerializedException(exception); + retException = containerMap.getSerializedException(); + + /* The operator '==' is not defined for class SerializedException, + so we can't compare exception and retException here. */ + + SUCCEED(); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestRecords/TestContainerId.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestRecords/TestContainerId.cpp b/depends/libyarn/test/unit/TestRecords/TestContainerId.cpp new file mode 100644 index 0000000..4092801 --- /dev/null +++ b/depends/libyarn/test/unit/TestRecords/TestContainerId.cpp @@ -0,0 +1,59 @@ +/* + * 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. + */ + +#include "gtest/gtest.h" +#include "gmock/gmock.h" + +#include "records/ContainerId.h" + +using namespace libyarn; +using namespace testing; + +class TestContainerId: public ::testing::Test { +protected: + ContainerId containerId; +}; + +TEST_F(TestContainerId, TestGetApplicationId) +{ + ApplicationId id; + ApplicationId retId; + + containerId.setApplicationId(id); + retId = containerId.getApplicationId(); + + /* The operator '==' is not defined for class ApplicationId, + so we can't compare id and retId here. */ + + SUCCEED(); +} + +TEST_F(TestContainerId, TestGetApplicationAttemptId) +{ + ApplicationAttemptId id; + ApplicationAttemptId retId; + + containerId.setApplicationAttemptId(id); + retId = containerId.getApplicationAttemptId(); + + /* The operator '==' is not defined for class ApplicationAttemptId, + so we can't compare id and retId here. */ + + SUCCEED(); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestRecords/TestContainerLaunchContext.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestRecords/TestContainerLaunchContext.cpp b/depends/libyarn/test/unit/TestRecords/TestContainerLaunchContext.cpp new file mode 100644 index 0000000..98138df --- /dev/null +++ b/depends/libyarn/test/unit/TestRecords/TestContainerLaunchContext.cpp @@ -0,0 +1,124 @@ +/* + * 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. + */ + +#include <list> +#include <string> + +#include "gtest/gtest.h" +#include "gmock/gmock.h" + +#include "records/ContainerLaunchContext.h" + +using std::list; +using std::string; +using namespace libyarn; +using namespace testing; + +class TestContainerLaunchContext: public ::testing::Test { +protected: + ContainerLaunchContext containerContext; +}; + +TEST_F(TestContainerLaunchContext, TestGetLocalResources) +{ + list<StringLocalResourceMap> maps; + list<StringLocalResourceMap> retMaps; + StringLocalResourceMap map; + maps.push_back(map); + + containerContext.setLocalResources(maps); + retMaps = containerContext.getLocalResources(); + + /* The operator '==' is not defined for class StringLocalResrouceMap, + so we can't compare list and retMaps here. */ + + SUCCEED(); +} + +TEST_F(TestContainerLaunchContext, TestGetServiceData) +{ + list<StringBytesMap> maps; + list<StringBytesMap> retMaps; + StringBytesMap map; + maps.push_back(map); + + containerContext.setServiceData(maps); + retMaps = containerContext.getServiceData(); + + /* The operator '==' is not defined for class StringBytesMap, + so we can't compare list and retMaps here. */ + + SUCCEED(); +} + +TEST_F(TestContainerLaunchContext, TestGetEnvironment) +{ + list<StringStringMap> maps; + list<StringStringMap> retMaps; + StringStringMap map; + maps.push_back(map); + + containerContext.setEnvironment(maps); + retMaps = containerContext.getEnvironment(); + + /* The operator '==' is not defined for class StringStringMap, + so we can't compare list and retMaps here. */ + + SUCCEED(); +} + +TEST_F(TestContainerLaunchContext, TestGetApplicationACLs) +{ + list<ApplicationACLMap> maps; + list<ApplicationACLMap> retMaps; + ApplicationACLMap map; + maps.push_back(map); + + containerContext.setApplicationACLs(maps); + retMaps = containerContext.getApplicationACLs(); + + /* The operator '==' is not defined for class ApplicationACLMap, + so we can't compare list and retMaps here. */ + + SUCCEED(); +} + +TEST_F(TestContainerLaunchContext, TestGetTokens) +{ + string tokens("tokens"); + string retTokens; + + containerContext.setTokens(tokens); + retTokens = containerContext.getTokens(); + + EXPECT_EQ(tokens, retTokens); +} + +TEST_F(TestContainerLaunchContext, TestGetCommand) +{ + list<string> commands; + list<string> retCommands; + string command("command"); + commands.push_back(command); + + containerContext.setCommand(commands); + retCommands = containerContext.getCommand(); + + EXPECT_EQ(commands, retCommands); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestRecords/TestContainerReport.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestRecords/TestContainerReport.cpp b/depends/libyarn/test/unit/TestRecords/TestContainerReport.cpp new file mode 100644 index 0000000..419afa6 --- /dev/null +++ b/depends/libyarn/test/unit/TestRecords/TestContainerReport.cpp @@ -0,0 +1,114 @@ +/* + * 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. + */ + +#include <string> + +#include "gtest/gtest.h" +#include "gmock/gmock.h" + +#include "records/ContainerReport.h" + +using std::string; +using namespace libyarn; +using namespace testing; + +class TestContainerReport: public ::testing::Test { +protected: + ContainerReport containerReport; +}; + +TEST_F(TestContainerReport, TestGetNodeId) +{ + NodeId id; + NodeId retId; + + containerReport.setNodeId(id); + retId = containerReport.getNodeId(); + + /* The operator '==' is not defined for class StringLocalResrouceMap, + so we can't compare list and retMap here. */ + + SUCCEED(); +} + +TEST_F(TestContainerReport, TestGetCreationTime) +{ + int64_t time = -1; + int64_t retTime; + + containerReport.setCreationTime(time); + retTime = containerReport.getCreationTime(); + + EXPECT_EQ(time, retTime); +} + +TEST_F(TestContainerReport, TestGetFinishTime) +{ + int64_t time = -1; + int64_t retTime; + + containerReport.setFinishTime(time); + retTime = containerReport.getFinishTime(); + + EXPECT_EQ(time, retTime); +} + +TEST_F(TestContainerReport, TestGetContainerExitStatus) +{ + ContainerExitStatus status = ContainerExitStatus::ABORTED; + ContainerExitStatus retStatus; + + containerReport.setContainerExitStatus(status); + retStatus = containerReport.getContainerExitStatus(); + + EXPECT_EQ(status, retStatus); +} + +TEST_F(TestContainerReport, TestGetContainerState) +{ + ContainerState state = ContainerState::C_NEW; + ContainerState retState; + + containerReport.setContainerState(state); + retState = containerReport.getContainerState(); + + EXPECT_EQ(state, retState); +} + +TEST_F(TestContainerReport, TestGetDiagnostics) +{ + string diagnostics("diagnostics"); + string retDiagnostics; + + containerReport.setDiagnostics(diagnostics); + retDiagnostics = containerReport.getDiagnostics(); + + EXPECT_EQ(diagnostics, retDiagnostics); +} + +TEST_F(TestContainerReport, TestGetLogUrl) +{ + string url("url"); + string retUrl; + + containerReport.setLogUrl(url); + retUrl = containerReport.getLogUrl(); + + EXPECT_EQ(url, retUrl); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestRecords/TestLocalResource.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestRecords/TestLocalResource.cpp b/depends/libyarn/test/unit/TestRecords/TestLocalResource.cpp new file mode 100644 index 0000000..2ec942d --- /dev/null +++ b/depends/libyarn/test/unit/TestRecords/TestLocalResource.cpp @@ -0,0 +1,119 @@ +/* + * 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. + */ + +#include <string> + +#include "gtest/gtest.h" +#include "gmock/gmock.h" + +#include "records/LocalResource.h" + +using std::string; +using namespace libyarn; +using namespace testing; + +class TestLocalResource: public ::testing::Test { +protected: + LocalResource localResource; +}; + +TEST_F(TestLocalResource, TestLocalResource) +{ + LocalResourceProto proto; + localResource = LocalResource(proto); + + SUCCEED(); +} + +TEST_F(TestLocalResource, TestLocalGetProto) +{ + LocalResourceProto proto; + proto = localResource.getProto(); + + SUCCEED(); +} + +TEST_F(TestLocalResource, TestGetResource) +{ + URL resource; + URL retResource; + + localResource.setResource(resource); + retResource = localResource.getResource(); + + /* The operator '==' is not defined for class URL, + so we can't compare resource and retResource here. */ + + SUCCEED(); +} + +TEST_F(TestLocalResource, TestGetSize) +{ + long size = -1; + long retSize; + + localResource.setSize(size); + retSize = localResource.getSize(); + + EXPECT_EQ(size, retSize); +} + +TEST_F(TestLocalResource, TestGetTimeStamp) +{ + long timestamp = -1; + long retTimestamp; + + localResource.setTimestamp(timestamp); + retTimestamp = localResource.getTimestamp(); + + EXPECT_EQ(timestamp, retTimestamp); +} + +TEST_F(TestLocalResource, TestGetLocalResourceType) +{ + LocalResourceType type = LocalResourceType::ARCHIVE; + LocalResourceType retType; + + localResource.setType(type); + retType = localResource.getType(); + + EXPECT_EQ(type, retType); +} + +TEST_F(TestLocalResource, TestGetLocalResourceVisibility) +{ + LocalResourceVisibility visibility = LocalResourceVisibility::PUBLIC; + LocalResourceVisibility retVisibility; + + localResource.setVisibility(visibility); + retVisibility = localResource.getVisibility(); + + EXPECT_EQ(visibility, retVisibility); +} + +TEST_F(TestLocalResource, TestGetPattern) +{ + string pattern("pattern"); + string retPattern; + + localResource.setPattern(pattern); + retPattern = localResource.getPattern(); + + EXPECT_EQ(pattern, retPattern); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestRecords/TestNodeReport.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestRecords/TestNodeReport.cpp b/depends/libyarn/test/unit/TestRecords/TestNodeReport.cpp new file mode 100644 index 0000000..d172490 --- /dev/null +++ b/depends/libyarn/test/unit/TestRecords/TestNodeReport.cpp @@ -0,0 +1,81 @@ +/* + * 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. + */ + +#include <string> + +#include "gtest/gtest.h" +#include "gmock/gmock.h" + +#include "records/NodeReport.h" + +using std::string; +using namespace libyarn; +using namespace testing; + +class TestNodeReport: public ::testing::Test { +protected: + NodeReport nodeReport; +}; + +TEST_F(TestNodeReport, TestGetHttpAddress) +{ + string address("address"); + string retAddress; + + nodeReport.setHttpAddress(address); + retAddress = nodeReport.getHttpAddress(); + + EXPECT_EQ(address, retAddress); +} + +TEST_F(TestNodeReport, TestGetUsedResource) +{ + Resource resource; + Resource retResource; + + nodeReport.setUsedResource(resource); + retResource = nodeReport.getUsedResource(); + + /* The operator '==' is not defined for class Resource, + so we can't compare resource and retResource here. */ + + SUCCEED(); +} + +TEST_F(TestNodeReport, TestGetHealthReport) +{ + string report("report"); + string retReport; + + nodeReport.setHealthReport(report); + retReport = nodeReport.getHealthReport(); + + EXPECT_EQ(report, retReport); +} + +TEST_F(TestNodeReport, TestGetLastHealthReportTime) +{ + int64_t time = -1; + int64_t retTime; + + nodeReport.setLastHealthReportTime(time); + retTime = nodeReport.getLastHealthReportTime(); + + EXPECT_EQ(time, retTime); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestRecords/TestPreemptionContainer.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestRecords/TestPreemptionContainer.cpp b/depends/libyarn/test/unit/TestRecords/TestPreemptionContainer.cpp new file mode 100644 index 0000000..92b7281 --- /dev/null +++ b/depends/libyarn/test/unit/TestRecords/TestPreemptionContainer.cpp @@ -0,0 +1,82 @@ +/* + * 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. + */ + +#include "gtest/gtest.h" +#include "gmock/gmock.h" + +#include "records/PreemptionContainer.h" + +using namespace libyarn; +using namespace testing; + +class TestPreemptionContainer: public ::testing::Test { +protected: + PreemptionContainer preemptionContainer; +}; + +TEST_F(TestPreemptionContainer, TestPreemptionContainer) +{ + PreemptionContainerProto proto; + preemptionContainer = PreemptionContainer(proto); + + SUCCEED(); +} + +TEST_F(TestPreemptionContainer, TestLocalGetProto) +{ + PreemptionContainerProto proto; + proto = preemptionContainer.getProto(); + + SUCCEED(); +} + +TEST_F(TestPreemptionContainer, TestGetContainerId) +{ + ContainerId id; + ContainerId retId; + + preemptionContainer.setId(id); + retId = preemptionContainer.getId(); + + /* The operator '==' is not defined for class ContainerId, + so we can't compare id and retId here. */ + + SUCCEED(); +} + +TEST_F(TestPreemptionContainer, TestOperatorLessThan) +{ + int32_t id = -1; + ApplicationId appId; + appId.setId(id); + ContainerId containerId; + containerId.setApplicationId(appId); + preemptionContainer.setId(containerId); + + int32_t id2 = 1; + ApplicationId appId2; + appId2.setId(id2); + ContainerId containerId2; + containerId2.setApplicationId(appId2); + PreemptionContainer preemptionContainer2; + preemptionContainer2.setId(containerId2); + + EXPECT_TRUE(preemptionContainer < preemptionContainer2); + EXPECT_FALSE(preemptionContainer2 < preemptionContainer); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestRecords/TestPreemptionContract.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestRecords/TestPreemptionContract.cpp b/depends/libyarn/test/unit/TestRecords/TestPreemptionContract.cpp new file mode 100644 index 0000000..64690f8 --- /dev/null +++ b/depends/libyarn/test/unit/TestRecords/TestPreemptionContract.cpp @@ -0,0 +1,84 @@ +/* + * 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. + */ + +#include <list> +#include <set> + +#include "gtest/gtest.h" +#include "gmock/gmock.h" + +#include "records/PreemptionContract.h" + +using std::list; +using std::set; +using namespace libyarn; +using namespace testing; + +class TestPreemptionContract: public ::testing::Test { +protected: + PreemptionContract preemptionContract; +}; + +TEST_F(TestPreemptionContract, TestPreemptionContract) +{ + PreemptionContractProto proto; + preemptionContract = PreemptionContract(proto); + + SUCCEED(); +} + +TEST_F(TestPreemptionContract, TestLocalGetProto) +{ + PreemptionContractProto proto; + proto = preemptionContract.getProto(); + + SUCCEED(); +} + +TEST_F(TestPreemptionContract, TestGetContainers) +{ + set<PreemptionContainer> containers; + set<PreemptionContainer> retContainers; + PreemptionContainer container; + containers.insert(container); + + preemptionContract.setContainers(containers); + retContainers = preemptionContract.getContainers(); + + /* The operator '==' is not defined for class PreemptionContainer, + so we can't compare containers and retContainers here. */ + + SUCCEED(); +} + +TEST_F(TestPreemptionContract, TestGetResourceRequest) +{ + list<PreemptionResourceRequest> requests; + list<PreemptionResourceRequest> retRequests; + PreemptionResourceRequest request; + requests.push_back(request); + + preemptionContract.setResourceRequest(requests); + retRequests = preemptionContract.getResourceRequest(); + + /* The operator '==' is not defined for class PreemptionContainer, + so we can't compare containers and retContainers here. */ + + SUCCEED(); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestRecords/TestPreemptionMessage.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestRecords/TestPreemptionMessage.cpp b/depends/libyarn/test/unit/TestRecords/TestPreemptionMessage.cpp new file mode 100644 index 0000000..d9b0575 --- /dev/null +++ b/depends/libyarn/test/unit/TestRecords/TestPreemptionMessage.cpp @@ -0,0 +1,75 @@ +/* + * 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. + */ + +#include "gtest/gtest.h" +#include "gmock/gmock.h" + +#include "records/PreemptionMessage.h" + +using namespace libyarn; +using namespace testing; + +class TestPreemptionMessage: public ::testing::Test { +protected: + PreemptionMessage preemptionMessage; +}; + +TEST_F(TestPreemptionMessage, TestPreemptionMessage) +{ + PreemptionMessageProto proto; + preemptionMessage = PreemptionMessage(proto); + + SUCCEED(); +} + +TEST_F(TestPreemptionMessage, TestLocalGetProto) +{ + PreemptionMessageProto proto; + proto = preemptionMessage.getProto(); + + SUCCEED(); +} + +TEST_F(TestPreemptionMessage, TestGetStrictContract) +{ + StrictPreemptionContract contract; + StrictPreemptionContract retContract; + + preemptionMessage.setStrictContract(contract); + retContract = preemptionMessage.getStrictContract(); + + /* The operator '==' is not defined for class StricPreemptionContract, + so we can't compare contract and retContract here. */ + + SUCCEED(); +} + +TEST_F(TestPreemptionMessage, TestGetContract) +{ + PreemptionContract contract; + PreemptionContract retContract; + + preemptionMessage.setContract(contract); + retContract = preemptionMessage.getContract(); + + /* The operator '==' is not defined for class PreemptionContract, + so we can't compare contract and retContract here. */ + + SUCCEED(); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestRecords/TestPreemptionResourceRequest.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestRecords/TestPreemptionResourceRequest.cpp b/depends/libyarn/test/unit/TestRecords/TestPreemptionResourceRequest.cpp new file mode 100644 index 0000000..afd1d6e --- /dev/null +++ b/depends/libyarn/test/unit/TestRecords/TestPreemptionResourceRequest.cpp @@ -0,0 +1,45 @@ +/* + * 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. + */ + +#include "gtest/gtest.h" +#include "gmock/gmock.h" + +#include "records/PreemptionResourceRequest.h" + +using namespace libyarn; +using namespace testing; + +class TestPreemptionResourceRequest: public ::testing::Test { +protected: + PreemptionResourceRequest preemptionRequest; +}; + +TEST_F(TestPreemptionResourceRequest, TestGetResourceRequest) +{ + ResourceRequest request; + ResourceRequest retRequest; + + preemptionRequest.setResourceRequest(request); + retRequest = preemptionRequest.getResourceRequest(); + + /* The operator '==' is not defined for class ResourceRequest, + so we can't compare request and retRequest here. */ + + SUCCEED(); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestRecords/TestResourceBlacklistRequest.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestRecords/TestResourceBlacklistRequest.cpp b/depends/libyarn/test/unit/TestRecords/TestResourceBlacklistRequest.cpp new file mode 100644 index 0000000..d39144b --- /dev/null +++ b/depends/libyarn/test/unit/TestRecords/TestResourceBlacklistRequest.cpp @@ -0,0 +1,88 @@ +/* + * 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. + */ + +#include <list> +#include <string> + +#include "gtest/gtest.h" +#include "gmock/gmock.h" + +#include "records/ResourceBlacklistRequest.h" + +using std::list; +using std::string; +using namespace libyarn; +using namespace testing; + +class TestResourceBlacklistRequest: public ::testing::Test { +protected: + ResourceBlacklistRequest blacklistRequest; +}; + +TEST_F(TestResourceBlacklistRequest, TestSetBlacklistAdditions) +{ + list<string> additions; + list<string> retAdditions; + string addition("addition"); + additions.push_back(addition); + + blacklistRequest.setBlacklistAdditions(additions); + retAdditions = blacklistRequest.getBlacklistAdditions(); + + EXPECT_EQ(additions, retAdditions); +} + +TEST_F(TestResourceBlacklistRequest, TestAddBlacklistAdditions) +{ + list<string> additions; + list<string> retAdditions; + string addition("addition"); + additions.push_back(addition); + + blacklistRequest.addBlacklistAddition(addition); + retAdditions = blacklistRequest.getBlacklistAdditions(); + + EXPECT_EQ(additions, retAdditions); +} + +TEST_F(TestResourceBlacklistRequest, TestSetBlacklistRemovals) +{ + list<string> removals; + list<string> retRemovals; + string removal("removal"); + removals.push_back(removal); + + blacklistRequest.setBlacklistRemovals(removals); + retRemovals = blacklistRequest.getBlacklistRemovals(); + + EXPECT_EQ(removals, retRemovals); +} + +TEST_F(TestResourceBlacklistRequest, TestAddBlacklistRemovals) +{ + list<string> removals; + list<string> retRemovals; + string removal("removal"); + removals.push_back(removal); + + blacklistRequest.addBlacklistRemoval(removal); + retRemovals = blacklistRequest.getBlacklistRemovals(); + + EXPECT_EQ(removals, retRemovals); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestRecords/TestSerializedException.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestRecords/TestSerializedException.cpp b/depends/libyarn/test/unit/TestRecords/TestSerializedException.cpp new file mode 100644 index 0000000..248ed07 --- /dev/null +++ b/depends/libyarn/test/unit/TestRecords/TestSerializedException.cpp @@ -0,0 +1,81 @@ +/* + * 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. + */ + +#include <string> + +#include "gtest/gtest.h" +#include "gmock/gmock.h" + +#include "records/SerializedException.h" + +using std::string; +using namespace libyarn; +using namespace testing; + +class TestSerializedException: public ::testing::Test { +protected: + SerializedException serializedException; +}; + +TEST_F(TestSerializedException, TestGetMessage) +{ + string message("message"); + string retMessage; + + serializedException.setMessage(message); + retMessage = serializedException.getMessage(); + + EXPECT_EQ(message, retMessage); +} + +TEST_F(TestSerializedException, TestGetTrace) +{ + string trace("trace"); + string retTrace; + + serializedException.setTrace(trace); + retTrace = serializedException.getTrace(); + + EXPECT_EQ(trace, retTrace); +} + +TEST_F(TestSerializedException, TestGetClassName) +{ + string className("className"); + string retClassName; + + serializedException.setClassName(className); + retClassName = serializedException.getClassName(); + + EXPECT_EQ(className, retClassName); +} + +TEST_F(TestSerializedException, TestGetCause) +{ + SerializedException cause; + SerializedException retCause; + + serializedException.setCause(cause); + retCause = serializedException.getCause(); + + /* The operator '==' is not defined for class SerializedException, + so we can't compare cause and retCause here. */ + + SUCCEED(); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestRecords/TestStrictPreemptionContract.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestRecords/TestStrictPreemptionContract.cpp b/depends/libyarn/test/unit/TestRecords/TestStrictPreemptionContract.cpp new file mode 100644 index 0000000..ea02b28 --- /dev/null +++ b/depends/libyarn/test/unit/TestRecords/TestStrictPreemptionContract.cpp @@ -0,0 +1,50 @@ +/* + * 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. + */ + +#include <set> + +#include "gtest/gtest.h" +#include "gmock/gmock.h" + +#include "records/StrictPreemptionContract.h" + +using std::set; +using namespace libyarn; +using namespace testing; + +class TestStrictPreemptionContract: public ::testing::Test { +protected: + StrictPreemptionContract strictContract; +}; + +TEST_F(TestStrictPreemptionContract, TestGetContainers) +{ + set<PreemptionContainer> containers; + set<PreemptionContainer> retContainers; + PreemptionContainer container; + containers.insert(container); + + strictContract.setContainers(containers); + retContainers = strictContract.getContainers(); + + /* The operator '==' is not defined for class PreemptionContainer, + so we can't compare containers and retContainers here. */ + + SUCCEED(); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestRecords/TestStringBytesMap.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestRecords/TestStringBytesMap.cpp b/depends/libyarn/test/unit/TestRecords/TestStringBytesMap.cpp new file mode 100644 index 0000000..a450de8 --- /dev/null +++ b/depends/libyarn/test/unit/TestRecords/TestStringBytesMap.cpp @@ -0,0 +1,56 @@ +/* + * 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. + */ + +#include <string> + +#include "gtest/gtest.h" +#include "gmock/gmock.h" + +#include "records/StringBytesMap.h" + +using std::string; +using namespace libyarn; +using namespace testing; + +class TestStringBytesMap: public ::testing::Test { +protected: + StringBytesMap stringMap; +}; + +TEST_F(TestStringBytesMap, TestGetKey) +{ + string key("key"); + string retKey; + + stringMap.setKey(key); + retKey = stringMap.getKey(); + + EXPECT_EQ(key, retKey); +} + +TEST_F(TestStringBytesMap, TestGetValue) +{ + string value("value"); + string retValue; + + stringMap.setValue(value); + retValue = stringMap.getValue(); + + EXPECT_EQ(value, retValue); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestRecords/TestStringLocalResourceMap.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestRecords/TestStringLocalResourceMap.cpp b/depends/libyarn/test/unit/TestRecords/TestStringLocalResourceMap.cpp new file mode 100644 index 0000000..40d4a96 --- /dev/null +++ b/depends/libyarn/test/unit/TestRecords/TestStringLocalResourceMap.cpp @@ -0,0 +1,59 @@ +/* + * 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. + */ + +#include <string> + +#include "gtest/gtest.h" +#include "gmock/gmock.h" + +#include "records/StringLocalResourceMap.h" + +using std::string; +using namespace libyarn; +using namespace testing; + +class TestStringLocalResourceMap: public ::testing::Test { +protected: + StringLocalResourceMap stringMap; +}; + +TEST_F(TestStringLocalResourceMap, TestGetKey) +{ + string key("key"); + string retKey; + + stringMap.setKey(key); + retKey = stringMap.getKey(); + + EXPECT_EQ(key, retKey); +} + +TEST_F(TestStringLocalResourceMap, TestGetLocalResource) +{ + LocalResource resource; + LocalResource retResource; + + stringMap.setLocalResource(resource); + retResource = stringMap.getLocalResource(); + + /* The operator '==' is not defined for class LocalResource, + so we can't compare resource and retResource here. */ + + SUCCEED(); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestRecords/TestStringStringMap.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestRecords/TestStringStringMap.cpp b/depends/libyarn/test/unit/TestRecords/TestStringStringMap.cpp new file mode 100644 index 0000000..0e7f2c9 --- /dev/null +++ b/depends/libyarn/test/unit/TestRecords/TestStringStringMap.cpp @@ -0,0 +1,56 @@ +/* + * 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. + */ + +#include <string> + +#include "gtest/gtest.h" +#include "gmock/gmock.h" + +#include "records/StringStringMap.h" + +using std::string; +using namespace libyarn; +using namespace testing; + +class TestStringStringMap: public ::testing::Test { +protected: + StringStringMap stringMap; +}; + +TEST_F(TestStringStringMap, TestGetKey) +{ + string key("key"); + string retKey; + + stringMap.setKey(key); + retKey = stringMap.getKey(); + + EXPECT_EQ(key, retKey); +} + +TEST_F(TestStringStringMap, TestGetValue) +{ + string value("value"); + string retValue; + + stringMap.setValue(value); + retValue = stringMap.getValue(); + + EXPECT_EQ(value, retValue); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestRecords/TestURL.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestRecords/TestURL.cpp b/depends/libyarn/test/unit/TestRecords/TestURL.cpp new file mode 100644 index 0000000..cd7814e --- /dev/null +++ b/depends/libyarn/test/unit/TestRecords/TestURL.cpp @@ -0,0 +1,89 @@ +/* + * 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. + */ + +#include <string> + +#include "gtest/gtest.h" +#include "gmock/gmock.h" + +#include "records/URL.h" + +using std::string; +using namespace libyarn; +using namespace testing; + +class TestURL: public ::testing::Test { +protected: + URL url; +}; + +TEST_F(TestURL, TestGetScheme) +{ + string scheme("scheme"); + string retScheme; + + url.setScheme(scheme); + retScheme = url.getScheme(); + + EXPECT_EQ(scheme, retScheme); +} + +TEST_F(TestURL, TestGetHost) +{ + string host("host"); + string retHost; + + url.setHost(host); + retHost = url.getHost(); + + EXPECT_EQ(host, retHost); +} + +TEST_F(TestURL, TestGetPort) +{ + int32_t port = -1; + int32_t retPort; + + url.setPort(port); + retPort = url.getPort(); + + EXPECT_EQ(port, retPort); +} + +TEST_F(TestURL, TestGetFile) +{ + string file("file"); + string retFile; + + url.setFile(file); + retFile = url.getFile(); + + EXPECT_EQ(file, retFile); +} + +TEST_F(TestURL, TestGetUserInfo) +{ + string userInfo("userInfo"); + string retUserInfo; + + url.setUserInfo(userInfo); + retUserInfo = url.getUserInfo(); + + EXPECT_EQ(userInfo, retUserInfo); +}
