http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestLibYarnServer/TestContainerManagementProtocol.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestLibYarnServer/TestContainerManagementProtocol.cpp b/depends/libyarn/test/unit/TestLibYarnServer/TestContainerManagementProtocol.cpp new file mode 100644 index 0000000..7fa3b5a --- /dev/null +++ b/depends/libyarn/test/unit/TestLibYarnServer/TestContainerManagementProtocol.cpp @@ -0,0 +1,101 @@ +/* + * 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 "rpc/RpcAuth.h" +#include "common/SessionConfig.h" +#include "common/Exception.h" + + +#include "protocolrecords/StartContainersRequest.h" +#include "protocolrecords/StartContainersResponse.h" +#include "protocolrecords/StopContainersRequest.h" +#include "protocolrecords/StopContainersResponse.h" +#include "protocolrecords/GetContainerStatusesRequest.h" +#include "protocolrecords/GetContainerStatusesResponse.h" + +#include "libyarnserver/ContainerManagementProtocol.h" +#include "MockContainerManagementProtocolInternal.h" + +using std::string; + +using Yarn::Internal::RpcAuth; +using Yarn::Internal::SessionConfig; +using Yarn::Config; +using namespace libyarn; +using namespace testing; +using namespace Mock; +using namespace Yarn; + +class TestContainerManagementProtocol: public ::testing::Test { +public: + TestContainerManagementProtocol(): + nmHost("localhost"), nmPort("8032"), tokenService(""), sc(conf){} + ~TestContainerManagementProtocol(){ + } +protected: + string nmHost; + string nmPort; + const string tokenService; + const RpcAuth ra; + const Config conf; + const SessionConfig sc; +}; + +TEST_F(TestContainerManagementProtocol,TestStartContainersException){ + MockContainerManagementProtocolInternal mcmp(nmHost, nmPort, tokenService, sc, ra); + + StartContainersRequest screq; + StartContainersResponse scres; + + EXPECT_CALL(mcmp, invoke(_)).Times(2).WillOnce(Throw(YarnRpcServerException("", __FILE__, __LINE__, Yarn::Internal::PrintStack(1, STACK_DEPTH).c_str()))) + .WillOnce(Throw(YarnException("", __FILE__, __LINE__, Yarn::Internal::PrintStack(1, STACK_DEPTH).c_str()))); + + EXPECT_THROW(scres = mcmp.startContainers(screq), YarnIOException); + EXPECT_THROW(scres = mcmp.startContainers(screq), YarnIOException); +} + +TEST_F(TestContainerManagementProtocol,TestStopContainersException){ + MockContainerManagementProtocolInternal mcmp(nmHost, nmPort, tokenService, sc, ra); + StopContainersRequest screq; + StopContainersResponse scres; + + EXPECT_CALL(mcmp, invoke(_)).Times(2).WillOnce(Throw(YarnRpcServerException("", __FILE__, __LINE__, Yarn::Internal::PrintStack(1, STACK_DEPTH).c_str()))) + .WillOnce(Throw(YarnException("", __FILE__, __LINE__, Yarn::Internal::PrintStack(1, STACK_DEPTH).c_str()))); + + EXPECT_THROW(scres = mcmp.stopContainers(screq), YarnIOException); + EXPECT_THROW(scres = mcmp.stopContainers(screq), YarnIOException); +} + + +TEST_F(TestContainerManagementProtocol,getContainerStatusesException){ + MockContainerManagementProtocolInternal mcmp(nmHost, nmPort, tokenService, sc, ra); + GetContainerStatusesRequest gcsreq; + GetContainerStatusesResponse gcsres; + + EXPECT_CALL(mcmp, invoke(_)).Times(2).WillOnce(Throw(YarnRpcServerException("", __FILE__, __LINE__, Yarn::Internal::PrintStack(1, STACK_DEPTH).c_str()))) + .WillOnce(Throw(YarnException("", __FILE__, __LINE__, Yarn::Internal::PrintStack(1, STACK_DEPTH).c_str()))); + + EXPECT_THROW(gcsres = mcmp.getContainerStatuses(gcsreq), YarnIOException); + EXPECT_THROW(gcsres = mcmp.getContainerStatuses(gcsreq), YarnIOException); +}
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestProtocolRecords/TestAllocateRequest.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestProtocolRecords/TestAllocateRequest.cpp b/depends/libyarn/test/unit/TestProtocolRecords/TestAllocateRequest.cpp new file mode 100644 index 0000000..7be8cff --- /dev/null +++ b/depends/libyarn/test/unit/TestProtocolRecords/TestAllocateRequest.cpp @@ -0,0 +1,104 @@ +/* + * Licensed to the Apache SoftwallocateRequeste Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regallocateRequestding 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, + * softwallocateRequeste 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 "gtest/gtest.h" +#include "gmock/gmock.h" + +#include "protocolrecords/AllocateRequest.h" + +using std::list; +using namespace libyarn; +using namespace testing; + +class TestAllocateRequest: public ::testing::Test { +protected: + AllocateRequest allocateRequest; +}; + +TEST_F(TestAllocateRequest, TestAddAsk) +{ + ResourceRequest ask; + + allocateRequest.addAsk(ask); + + SUCCEED(); +} + +TEST_F(TestAllocateRequest, TestGetAsks) +{ + ResourceRequest ask; + list<ResourceRequest> asks; + + allocateRequest.addAsk(ask); + asks = allocateRequest.getAsks(); + + SUCCEED(); +} + +TEST_F(TestAllocateRequest, TestAddRelease) +{ + ContainerId release; + + allocateRequest.addRelease(release); + + SUCCEED(); +} + +TEST_F(TestAllocateRequest, TestGetRelease) +{ + ContainerId release; + list<ContainerId> releases; + + allocateRequest.addRelease(release); + releases = allocateRequest.getReleases(); + + SUCCEED(); +} + +TEST_F(TestAllocateRequest, TestGetBlackListRequest) +{ + ResourceBlacklistRequest blacklistRequest; + + blacklistRequest = allocateRequest.getBlacklistRequest(); + + SUCCEED(); +} + +TEST_F(TestAllocateRequest, TestGetResponseId) +{ + int32_t responseId = -1; + int32_t retResponseId; + + allocateRequest.setResponseId(responseId); + retResponseId = allocateRequest.getResponseId(); + EXPECT_EQ(responseId, retResponseId); + +} + +TEST_F(TestAllocateRequest, TestGetProgress) +{ + float progress = 0.0; + float retProgress; + + allocateRequest.setProgress(progress); + retProgress = allocateRequest.getProgress(); + EXPECT_EQ(progress, retProgress); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestProtocolRecords/TestAllocateResponse.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestProtocolRecords/TestAllocateResponse.cpp b/depends/libyarn/test/unit/TestProtocolRecords/TestAllocateResponse.cpp new file mode 100644 index 0000000..bf00289 --- /dev/null +++ b/depends/libyarn/test/unit/TestProtocolRecords/TestAllocateResponse.cpp @@ -0,0 +1,67 @@ +/* + * 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 "gtest/gtest.h" +#include "gmock/gmock.h" + +#include "protocolrecords/AllocateResponse.h" + +using std::list; +using namespace libyarn; +using namespace testing; + +class TestAllocateResponse: public ::testing::Test { +protected: + AllocateResponse allocateResponse; +}; + +TEST_F(TestAllocateResponse, TestGetProto) +{ + AllocateResponseProto responseProto; + + responseProto = allocateResponse.getProto(); + + SUCCEED(); +} + +TEST_F(TestAllocateResponse, TestGetUpdaedNodes) +{ + list<NodeReport> updatedNodes; + NodeReport nodeReport; + list<NodeReport> retUpdatedNodes; + + updatedNodes.push_back(nodeReport); + + allocateResponse.setUpdatedNodes(updatedNodes); + retUpdatedNodes = allocateResponse.getUpdatedNodes(); + + SUCCEED(); +} + +TEST_F(TestAllocateResponse, TestGetPreemptionMessage) +{ + PreemptionMessage preempt; + PreemptionMessage retPreempt; + + allocateResponse.setPreemptionMessage(preempt); + retPreempt = allocateResponse.getPreemptionMessage(); + + SUCCEED(); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestProtocolRecords/TestFinishApplicationMasterRequest.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestProtocolRecords/TestFinishApplicationMasterRequest.cpp b/depends/libyarn/test/unit/TestProtocolRecords/TestFinishApplicationMasterRequest.cpp new file mode 100644 index 0000000..8fe2fd5 --- /dev/null +++ b/depends/libyarn/test/unit/TestProtocolRecords/TestFinishApplicationMasterRequest.cpp @@ -0,0 +1,70 @@ +/* + * 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 "protocolrecords/FinishApplicationMasterRequest.h" + +using std::string; +using namespace libyarn; +using namespace testing; + +class TestFinishApplicationMasterRequest: public ::testing::Test { +protected: + FinishApplicationMasterRequest finishRequest; +}; + +TEST_F(TestFinishApplicationMasterRequest, TestFinishApplicationMasterRequest) +{ + FinishApplicationMasterRequestProto finishRequestProto; + finishRequest = FinishApplicationMasterRequest(finishRequestProto); + + SUCCEED(); +} + +TEST_F(TestFinishApplicationMasterRequest, TestGetDiagnostics) +{ + string diagnostics("diagnostics"); + string retDiagnostics; + finishRequest.setDiagnostics(diagnostics); + retDiagnostics = finishRequest.getDiagnostics(); + + EXPECT_EQ(diagnostics, retDiagnostics); +} + +TEST_F(TestFinishApplicationMasterRequest, TestGetTrackingUrl) +{ + string trackingUrl("trackingUrl"); + string retTrackingUrl; + finishRequest.setTrackingUrl(trackingUrl); + retTrackingUrl = finishRequest.getTrackingUrl(); + + EXPECT_EQ(trackingUrl, retTrackingUrl); +} + +TEST_F(TestFinishApplicationMasterRequest, TestFinalApplicationStatus) +{ + FinalApplicationStatus finalStatus; + finalStatus = finishRequest.getFinalApplicationStatus(); + + SUCCEED(); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestProtocolRecords/TestFinishApplicationMasterResponse.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestProtocolRecords/TestFinishApplicationMasterResponse.cpp b/depends/libyarn/test/unit/TestProtocolRecords/TestFinishApplicationMasterResponse.cpp new file mode 100644 index 0000000..97f2461 --- /dev/null +++ b/depends/libyarn/test/unit/TestProtocolRecords/TestFinishApplicationMasterResponse.cpp @@ -0,0 +1,39 @@ +/* + * 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 "protocolrecords/FinishApplicationMasterResponse.h" + +using namespace libyarn; +using namespace testing; + +class TestFinishApplicationMasterResponse: public ::testing::Test { +protected: + FinishApplicationMasterResponse finishResponse; +}; + +TEST_F(TestFinishApplicationMasterResponse, TestGetProto) +{ + FinishApplicationMasterResponseProto finishResponseProto; + finishResponseProto = finishResponse.getProto(); + + SUCCEED(); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestProtocolRecords/TestGetApplicationReportRequest.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestProtocolRecords/TestGetApplicationReportRequest.cpp b/depends/libyarn/test/unit/TestProtocolRecords/TestGetApplicationReportRequest.cpp new file mode 100644 index 0000000..e8c92db --- /dev/null +++ b/depends/libyarn/test/unit/TestProtocolRecords/TestGetApplicationReportRequest.cpp @@ -0,0 +1,47 @@ +/* + * 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 "protocolrecords/GetApplicationReportRequest.h" + +using namespace libyarn; +using namespace testing; + +class TestGetApplicationReportRequest: public ::testing::Test { +protected: + GetApplicationReportRequest getRequest; +}; + +TEST_F(TestGetApplicationReportRequest, TestGetApplicationReportRequest) +{ + GetApplicationReportRequestProto getRequestProto; + getRequest = GetApplicationReportRequestProto(getRequestProto); + + SUCCEED(); +} + +TEST_F(TestGetApplicationReportRequest, TestGetApplicationId) +{ + ApplicationId applicationId; + applicationId = getRequest.getApplicationId(); + + SUCCEED(); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestProtocolRecords/TestGetApplicationReportResponse.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestProtocolRecords/TestGetApplicationReportResponse.cpp b/depends/libyarn/test/unit/TestProtocolRecords/TestGetApplicationReportResponse.cpp new file mode 100644 index 0000000..c25a605 --- /dev/null +++ b/depends/libyarn/test/unit/TestProtocolRecords/TestGetApplicationReportResponse.cpp @@ -0,0 +1,39 @@ +/* + * 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 "protocolrecords/GetApplicationReportResponse.h" + +using namespace libyarn; +using namespace testing; + +class TestGetApplicationReportResponse: public ::testing::Test { +protected: + GetApplicationReportResponse getResponse; +}; + +TEST_F(TestGetApplicationReportResponse, TestGetProto) +{ + GetApplicationReportResponseProto getResponseProto; + getResponseProto = getResponse.getProto(); + + SUCCEED(); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestProtocolRecords/TestGetApplicationsRequest.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestProtocolRecords/TestGetApplicationsRequest.cpp b/depends/libyarn/test/unit/TestProtocolRecords/TestGetApplicationsRequest.cpp new file mode 100644 index 0000000..088afa0 --- /dev/null +++ b/depends/libyarn/test/unit/TestProtocolRecords/TestGetApplicationsRequest.cpp @@ -0,0 +1,70 @@ +/* + * 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 "protocolrecords/GetApplicationsRequest.h" + +using std::list; +using std::string; +using namespace libyarn; +using namespace testing; + +class TestGetApplicationsRequest: public ::testing::Test { +protected: + GetApplicationsRequest getRequest; +}; + +TEST_F(TestGetApplicationsRequest, TestGetApplicationRequest) +{ + GetApplicationsRequestProto getRequestProto; + getRequest = GetApplicationsRequestProto(getRequestProto); + + SUCCEED(); +} + +TEST_F(TestGetApplicationsRequest, TestGetApplicationTypes) +{ + list<string> applicationTypes; + list<string> retApplicationTypes; + string type("type"); + applicationTypes.push_back(type); + + getRequest.setApplicationTypes(applicationTypes); + retApplicationTypes = getRequest.getApplicationTypes(); + + EXPECT_TRUE(applicationTypes == retApplicationTypes); +} + +TEST_F(TestGetApplicationsRequest, TestGetApplicationStatus) +{ + list<YarnApplicationState> applicationStates; + list<YarnApplicationState> retApplicationStates; + YarnApplicationState state; + applicationStates.push_back(state); + + getRequest.setApplicationStates(applicationStates); + retApplicationStates = getRequest.getApplicationStates(); + + EXPECT_TRUE(applicationStates == retApplicationStates); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestProtocolRecords/TestGetApplicationsResponse.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestProtocolRecords/TestGetApplicationsResponse.cpp b/depends/libyarn/test/unit/TestProtocolRecords/TestGetApplicationsResponse.cpp new file mode 100644 index 0000000..f910cd2 --- /dev/null +++ b/depends/libyarn/test/unit/TestProtocolRecords/TestGetApplicationsResponse.cpp @@ -0,0 +1,47 @@ +/* + * 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 "protocolrecords/GetApplicationsResponse.h" + +using namespace libyarn; +using namespace testing; + +class TestGetApplicationsResponse: public ::testing::Test { +protected: + GetApplicationsResponse getResponse; +}; + +TEST_F(TestGetApplicationsResponse, TestGetApplicationsResponse) +{ + GetApplicationsResponseProto getResponseProto; + getResponse = GetApplicationsResponse(getResponseProto); + + SUCCEED(); +} + +TEST_F(TestGetApplicationsResponse, TestGetProto) +{ + GetApplicationsResponseProto getResponseProto; + getResponseProto = getResponse.getProto(); + + SUCCEED(); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestProtocolRecords/TestGetClusterMetricsRequest.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestProtocolRecords/TestGetClusterMetricsRequest.cpp b/depends/libyarn/test/unit/TestProtocolRecords/TestGetClusterMetricsRequest.cpp new file mode 100644 index 0000000..9641d5f --- /dev/null +++ b/depends/libyarn/test/unit/TestProtocolRecords/TestGetClusterMetricsRequest.cpp @@ -0,0 +1,39 @@ +/* + * 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 "protocolrecords/GetClusterMetricsRequest.h" + +using namespace libyarn; +using namespace testing; + +class TestGetClusterMetricsRequest: public ::testing::Test { +protected: + GetClusterMetricsRequest getRequest; +}; + +TEST_F(TestGetClusterMetricsRequest, TestGetClusterMetricsRequest) +{ + GetClusterMetricsRequestProto getRequestProto; + getRequest = GetClusterMetricsRequest(getRequestProto); + + SUCCEED(); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestProtocolRecords/TestGetClusterMetricsResponse.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestProtocolRecords/TestGetClusterMetricsResponse.cpp b/depends/libyarn/test/unit/TestProtocolRecords/TestGetClusterMetricsResponse.cpp new file mode 100644 index 0000000..0031447 --- /dev/null +++ b/depends/libyarn/test/unit/TestProtocolRecords/TestGetClusterMetricsResponse.cpp @@ -0,0 +1,39 @@ +/* + * 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 "protocolrecords/GetClusterMetricsResponse.h" + +using namespace libyarn; +using namespace testing; + +class TestGetClusterMetricsResponse: public ::testing::Test { +protected: + GetClusterMetricsResponse getResponse; +}; + +TEST_F(TestGetClusterMetricsResponse, TestGetClusterMetricsResponse) +{ + GetClusterMetricsResponseProto getResponseProto; + getResponse = GetClusterMetricsResponse(getResponseProto); + + SUCCEED(); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestProtocolRecords/TestGetClusterNodesRequest.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestProtocolRecords/TestGetClusterNodesRequest.cpp b/depends/libyarn/test/unit/TestProtocolRecords/TestGetClusterNodesRequest.cpp new file mode 100644 index 0000000..8e22fd2 --- /dev/null +++ b/depends/libyarn/test/unit/TestProtocolRecords/TestGetClusterNodesRequest.cpp @@ -0,0 +1,55 @@ +/* + * 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 "gtest/gtest.h" +#include "gmock/gmock.h" + +#include "protocolrecords/GetClusterNodesRequest.h" + +using std::list; +using namespace libyarn; +using namespace testing; + +class TestGetClusterNodesRequest: public ::testing::Test { +protected: + GetClusterNodesRequest getRequest; +}; + +TEST_F(TestGetClusterNodesRequest, TestGetClusterMetricsRequest) +{ + GetClusterNodesRequestProto getRequestProto; + getRequest = GetClusterNodesRequest(getRequestProto); + + SUCCEED(); +} + +TEST_F(TestGetClusterNodesRequest, TestGetNodeStates) +{ + list<NodeState> states; + list<NodeState> retStates; + NodeState state; + states.push_back(state); + + getRequest.setNodeStates(states); + retStates = getRequest.getNodeStates(); + + EXPECT_TRUE(states == retStates); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestProtocolRecords/TestGetClusterNodesResponse.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestProtocolRecords/TestGetClusterNodesResponse.cpp b/depends/libyarn/test/unit/TestProtocolRecords/TestGetClusterNodesResponse.cpp new file mode 100644 index 0000000..b96471a --- /dev/null +++ b/depends/libyarn/test/unit/TestProtocolRecords/TestGetClusterNodesResponse.cpp @@ -0,0 +1,39 @@ +/* + * 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 "protocolrecords/GetClusterNodesResponse.h" + +using namespace libyarn; +using namespace testing; + +class TestGetClusterNodesResponse: public ::testing::Test { +protected: + GetClusterNodesResponse getResponse; +}; + +TEST_F(TestGetClusterNodesResponse, TestGetProto) +{ + GetClusterNodesResponseProto getResponseProto; + getResponse = getResponse.getProto(); + + SUCCEED(); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestProtocolRecords/TestGetContainerStatusesRequest.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestProtocolRecords/TestGetContainerStatusesRequest.cpp b/depends/libyarn/test/unit/TestProtocolRecords/TestGetContainerStatusesRequest.cpp new file mode 100644 index 0000000..0a1fd1e --- /dev/null +++ b/depends/libyarn/test/unit/TestProtocolRecords/TestGetContainerStatusesRequest.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 <list> +#include "gtest/gtest.h" +#include "gmock/gmock.h" + +#include "protocolrecords/GetContainerStatusesRequest.h" + +using std::list; +using namespace libyarn; +using namespace testing; + +class TestGetContainerStatusesRequest: public ::testing::Test { +protected: + GetContainerStatusesRequest getRequest; +}; + +TEST_F(TestGetContainerStatusesRequest, TestGetContainerStatusesRequest) +{ + GetContainerStatusesRequestProto getRequestProto; + getRequest = GetContainerStatusesRequest(getRequestProto); + + SUCCEED(); +} + +TEST_F(TestGetContainerStatusesRequest, TestGetContainerIds) +{ + list<ContainerId> idList; + list<ContainerId> retIdList; + ContainerId containerId; + idList.push_back(containerId); + + getRequest.setContainerIds(idList); + retIdList = getRequest.getContainerIds(); + + /* The operator '==' is not defined for class ContainerId, + so we can't compare idList and retIdList here. */ + SUCCEED(); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestProtocolRecords/TestGetContainerStatusesResponse.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestProtocolRecords/TestGetContainerStatusesResponse.cpp b/depends/libyarn/test/unit/TestProtocolRecords/TestGetContainerStatusesResponse.cpp new file mode 100644 index 0000000..20f7177 --- /dev/null +++ b/depends/libyarn/test/unit/TestProtocolRecords/TestGetContainerStatusesResponse.cpp @@ -0,0 +1,57 @@ +/* + * 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 "gtest/gtest.h" +#include "gmock/gmock.h" + +#include "protocolrecords/GetContainerStatusesResponse.h" + +using std::list; +using namespace libyarn; +using namespace testing; + +class TestGetContainerStatusesResponse: public ::testing::Test { +protected: + GetContainerStatusesResponse getResponse; +}; + +TEST_F(TestGetContainerStatusesResponse, TestGetProto) +{ + GetContainerStatusesResponseProto getResponseProto; + getResponseProto = getResponse.getProto(); + + SUCCEED(); +} + +TEST_F(TestGetContainerStatusesResponse, TestGetContainerIds) +{ + list<ContainerExceptionMap> mapList; + list<ContainerExceptionMap> retMapList; + ContainerExceptionMap map; + mapList.push_back(map); + + getResponse.setFailedRequests(mapList); + retMapList = getResponse.getFailedRequests(); + + /* The operator '==' is not defined for class ContainerExceptionMap, + so we can't compare mapList and retMapList here. */ + SUCCEED(); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestProtocolRecords/TestGetContainersRequest.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestProtocolRecords/TestGetContainersRequest.cpp b/depends/libyarn/test/unit/TestProtocolRecords/TestGetContainersRequest.cpp new file mode 100644 index 0000000..82e8345 --- /dev/null +++ b/depends/libyarn/test/unit/TestProtocolRecords/TestGetContainersRequest.cpp @@ -0,0 +1,52 @@ +/* + * 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 "protocolrecords/GetContainersRequest.h" + +using namespace libyarn; +using namespace testing; + +class TestGetContainersRequest: public ::testing::Test { +protected: + GetContainersRequest getRequest; +}; + +TEST_F(TestGetContainersRequest, TestGetContainersRequest) +{ + GetContainersRequestProto getRequestProto; + getRequest = GetContainersRequest(getRequestProto); + + SUCCEED(); +} + +TEST_F(TestGetContainersRequest, TestGetContainerIds) +{ + ApplicationAttemptId id; + ApplicationAttemptId retId; + + getRequest.setApplicationAttemptId(id); + retId = getRequest.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/TestProtocolRecords/TestGetContainersResponse.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestProtocolRecords/TestGetContainersResponse.cpp b/depends/libyarn/test/unit/TestProtocolRecords/TestGetContainersResponse.cpp new file mode 100644 index 0000000..bfb4e54 --- /dev/null +++ b/depends/libyarn/test/unit/TestProtocolRecords/TestGetContainersResponse.cpp @@ -0,0 +1,39 @@ +/* + * 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 "protocolrecords/GetContainersResponse.h" + +using namespace libyarn; +using namespace testing; + +class TestGetContainersResponse: public ::testing::Test { +protected: + GetContainersResponse getResponse; +}; + +TEST_F(TestGetContainersResponse, TestGetProto) +{ + GetContainersResponseProto getResponseProto; + getResponseProto = getResponse.getProto(); + + SUCCEED(); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestProtocolRecords/TestGetNewApplicationRequest.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestProtocolRecords/TestGetNewApplicationRequest.cpp b/depends/libyarn/test/unit/TestProtocolRecords/TestGetNewApplicationRequest.cpp new file mode 100644 index 0000000..b083921 --- /dev/null +++ b/depends/libyarn/test/unit/TestProtocolRecords/TestGetNewApplicationRequest.cpp @@ -0,0 +1,39 @@ +/* + * 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 "protocolrecords/GetNewApplicationRequest.h" + +using namespace libyarn; +using namespace testing; + +class TestGetNewApplicationRequest: public ::testing::Test { +protected: + GetNewApplicationRequest getRequest; +}; + +TEST_F(TestGetNewApplicationRequest, TestGetNewApplicationRequest) +{ + GetNewApplicationRequestProto getRequestProto; + getRequest = GetNewApplicationRequest(getRequestProto); + + SUCCEED(); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestProtocolRecords/TestGetNewApplicationResponse.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestProtocolRecords/TestGetNewApplicationResponse.cpp b/depends/libyarn/test/unit/TestProtocolRecords/TestGetNewApplicationResponse.cpp new file mode 100644 index 0000000..8ed61bb --- /dev/null +++ b/depends/libyarn/test/unit/TestProtocolRecords/TestGetNewApplicationResponse.cpp @@ -0,0 +1,44 @@ +/* + * 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 "protocolrecords/GetNewApplicationResponse.h" + +using namespace libyarn; +using namespace testing; + +class TestGetNewApplicationResponse: public ::testing::Test { +protected: + GetNewApplicationResponse getResponse; +}; + +TEST_F(TestGetNewApplicationResponse, TestGetNewApplicationResponse) +{ + Resource resource; + Resource retResource; + + getResponse.setResource(resource); + retResource = getResponse.getResource(); + + /* The operator '==' is not defined for class Resource, + 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/TestProtocolRecords/TestGetQueueInfoRequest.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestProtocolRecords/TestGetQueueInfoRequest.cpp b/depends/libyarn/test/unit/TestProtocolRecords/TestGetQueueInfoRequest.cpp new file mode 100644 index 0000000..f58bb4c --- /dev/null +++ b/depends/libyarn/test/unit/TestProtocolRecords/TestGetQueueInfoRequest.cpp @@ -0,0 +1,85 @@ +/* + * 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 "protocolrecords/GetQueueInfoRequest.h" + +using std::string; +using namespace libyarn; +using namespace testing; + +class TestGetQueueInfoRequest: public ::testing::Test { +protected: + GetQueueInfoRequest getRequest; +}; + +TEST_F(TestGetQueueInfoRequest, TestGetQueueInfoRequest) +{ + GetQueueInfoRequestProto getRequestProto; + getRequest = GetQueueInfoRequest(getRequestProto); + + SUCCEED(); +} + +TEST_F(TestGetQueueInfoRequest, TestGetQueueName) +{ + string queueName("queueName"); + string retQueueName; + + getRequest.setQueueName(queueName); + retQueueName = getRequest.getQueueName(); + + EXPECT_EQ(queueName, retQueueName); +} + +TEST_F(TestGetQueueInfoRequest, TestGetIncludeApplications) +{ + bool includeApplications = true; + bool retIncludeApplications; + + getRequest.setIncludeApplications(includeApplications); + retIncludeApplications = getRequest.getIncludeApplications(); + + EXPECT_EQ(includeApplications, retIncludeApplications); +} + +TEST_F(TestGetQueueInfoRequest, TestGetIncludeChildQueues) +{ + bool includeChildQueues = true; + bool retIncludeChildQueues; + + getRequest.setIncludeChildQueues(includeChildQueues); + retIncludeChildQueues = getRequest.getIncludeChildQueues(); + + EXPECT_EQ(includeChildQueues, retIncludeChildQueues); +} + +TEST_F(TestGetQueueInfoRequest, TestGetRecursive) +{ + bool recursive = true; + bool retRecursive; + + getRequest.setRecursive(recursive); + retRecursive = getRequest.getRecursive(); + + EXPECT_EQ(recursive, retRecursive); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestProtocolRecords/TestGetQueueInfoResponse.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestProtocolRecords/TestGetQueueInfoResponse.cpp b/depends/libyarn/test/unit/TestProtocolRecords/TestGetQueueInfoResponse.cpp new file mode 100644 index 0000000..ff3a946 --- /dev/null +++ b/depends/libyarn/test/unit/TestProtocolRecords/TestGetQueueInfoResponse.cpp @@ -0,0 +1,39 @@ +/* + * 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 "protocolrecords/GetQueueInfoResponse.h" + +using namespace libyarn; +using namespace testing; + +class TestGetQueueInfoResponse: public ::testing::Test { +protected: + GetQueueInfoResponse getResponse; +}; + +TEST_F(TestGetQueueInfoResponse, TestGetProto) +{ + GetQueueInfoResponseProto getResponseProto; + getResponseProto = getResponse.getProto(); + + SUCCEED(); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestProtocolRecords/TestGetQueueUserAclsInfoRequest.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestProtocolRecords/TestGetQueueUserAclsInfoRequest.cpp b/depends/libyarn/test/unit/TestProtocolRecords/TestGetQueueUserAclsInfoRequest.cpp new file mode 100644 index 0000000..a60e937 --- /dev/null +++ b/depends/libyarn/test/unit/TestProtocolRecords/TestGetQueueUserAclsInfoRequest.cpp @@ -0,0 +1,39 @@ +/* + * 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 "protocolrecords/GetQueueUserAclsInfoRequest.h" + +using namespace libyarn; +using namespace testing; + +class TestGetQueueUserAclsInfoRequest: public ::testing::Test { +protected: + GetQueueUserAclsInfoRequest getRequest; +}; + +TEST_F(TestGetQueueUserAclsInfoRequest, TestGetQueueUserAclsInfoRequest) +{ + GetQueueUserAclsInfoRequestProto getRequestProto; + getRequest = GetQueueUserAclsInfoRequest(getRequestProto); + + SUCCEED(); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestProtocolRecords/TestGetQueueUserAclsInfoResponse.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestProtocolRecords/TestGetQueueUserAclsInfoResponse.cpp b/depends/libyarn/test/unit/TestProtocolRecords/TestGetQueueUserAclsInfoResponse.cpp new file mode 100644 index 0000000..f0d4e4c --- /dev/null +++ b/depends/libyarn/test/unit/TestProtocolRecords/TestGetQueueUserAclsInfoResponse.cpp @@ -0,0 +1,47 @@ +/* + * 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 "protocolrecords/GetQueueUserAclsInfoResponse.h" + +using namespace libyarn; +using namespace testing; + +class TestGetQueueUserAclsInfoResponse: public ::testing::Test { +protected: + GetQueueUserAclsInfoResponse getResponse; +}; + +TEST_F(TestGetQueueUserAclsInfoResponse, TestGetQueueUserAclsInfoResponse) +{ + GetQueueUserAclsInfoResponseProto getResponseProto; + getResponse = GetQueueUserAclsInfoResponse(getResponseProto); + + SUCCEED(); +} + +TEST_F(TestGetQueueUserAclsInfoResponse, TestGetProto) +{ + GetQueueUserAclsInfoResponseProto getResponseProto; + getResponseProto = getResponse.getProto(); + + SUCCEED(); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestProtocolRecords/TestKillApplicationRequest.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestProtocolRecords/TestKillApplicationRequest.cpp b/depends/libyarn/test/unit/TestProtocolRecords/TestKillApplicationRequest.cpp new file mode 100644 index 0000000..c547605 --- /dev/null +++ b/depends/libyarn/test/unit/TestProtocolRecords/TestKillApplicationRequest.cpp @@ -0,0 +1,39 @@ +/* + * 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 "protocolrecords/KillApplicationRequest.h" + +using namespace libyarn; +using namespace testing; + +class TestKillApplicationRequest: public ::testing::Test { +protected: + KillApplicationRequest killRequest; +}; + +TEST_F(TestKillApplicationRequest, TestKillApplicationRequest) +{ + KillApplicationRequestProto killRequestProto; + killRequest = KillApplicationRequest(killRequestProto); + + SUCCEED(); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestProtocolRecords/TestKillApplicationResponse.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestProtocolRecords/TestKillApplicationResponse.cpp b/depends/libyarn/test/unit/TestProtocolRecords/TestKillApplicationResponse.cpp new file mode 100644 index 0000000..3d8fd35 --- /dev/null +++ b/depends/libyarn/test/unit/TestProtocolRecords/TestKillApplicationResponse.cpp @@ -0,0 +1,39 @@ +/* + * 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 "protocolrecords/KillApplicationResponse.h" + +using namespace libyarn; +using namespace testing; + +class TestKillApplicationResponse: public ::testing::Test { +protected: + KillApplicationResponse killResponse; +}; + +TEST_F(TestKillApplicationResponse, TestKillApplicationResponse) +{ + KillApplicationResponseProto killResponseProto; + killResponseProto = killResponse.getProto(); + + SUCCEED(); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestProtocolRecords/TestRegisterApplicationMasterRequest.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestProtocolRecords/TestRegisterApplicationMasterRequest.cpp b/depends/libyarn/test/unit/TestProtocolRecords/TestRegisterApplicationMasterRequest.cpp new file mode 100644 index 0000000..361817a --- /dev/null +++ b/depends/libyarn/test/unit/TestProtocolRecords/TestRegisterApplicationMasterRequest.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 <string> + +#include "gtest/gtest.h" +#include "gmock/gmock.h" + +#include "protocolrecords/RegisterApplicationMasterRequest.h" + +using std::string; +using namespace libyarn; +using namespace testing; + +class TestRegisterApplicationMasterRequest: public ::testing::Test { +protected: + RegisterApplicationMasterRequest registerRequest; +}; + +TEST_F(TestRegisterApplicationMasterRequest, TestRegisterApplicationMasterRequest) +{ + RegisterApplicationMasterRequestProto registerRequestProto; + registerRequest = RegisterApplicationMasterRequest(registerRequestProto); + + SUCCEED(); +} + +TEST_F(TestRegisterApplicationMasterRequest, TestGetHost) +{ + string host("host"); + string retHost; + + registerRequest.setHost(host); + retHost = registerRequest.getHost(); + + EXPECT_EQ(host, retHost); +} + +TEST_F(TestRegisterApplicationMasterRequest, TestGetRpcPort) +{ + int32_t rpcPort = -1; + int32_t retRpcPort; + + registerRequest.setRpcPort(rpcPort); + retRpcPort = registerRequest.getRpcPort(); + + EXPECT_EQ(rpcPort, retRpcPort); +} + +TEST_F(TestRegisterApplicationMasterRequest, TestGetTrackingUrl) +{ + string trackingUrl("trackingUrl"); + string retTrackingUrl; + + registerRequest.setTrackingUrl(trackingUrl); + retTrackingUrl = registerRequest.getTrackingUrl(); + + EXPECT_EQ(trackingUrl, retTrackingUrl); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestProtocolRecords/TestRegisterApplicationMasterResponse.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestProtocolRecords/TestRegisterApplicationMasterResponse.cpp b/depends/libyarn/test/unit/TestProtocolRecords/TestRegisterApplicationMasterResponse.cpp new file mode 100644 index 0000000..251e492 --- /dev/null +++ b/depends/libyarn/test/unit/TestProtocolRecords/TestRegisterApplicationMasterResponse.cpp @@ -0,0 +1,39 @@ +/* + * 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 "protocolrecords/RegisterApplicationMasterResponse.h" + +using namespace libyarn; +using namespace testing; + +class TestRegisterApplicationMasterResponse: public ::testing::Test { +protected: + RegisterApplicationMasterResponse registerResponse; +}; + +TEST_F(TestRegisterApplicationMasterResponse, TestGetProto) +{ + RegisterApplicationMasterResponseProto registerResponseProto; + registerResponseProto = registerResponse.getProto(); + + SUCCEED(); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestProtocolRecords/TestStartContainerRequest.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestProtocolRecords/TestStartContainerRequest.cpp b/depends/libyarn/test/unit/TestProtocolRecords/TestStartContainerRequest.cpp new file mode 100644 index 0000000..af4ddb3 --- /dev/null +++ b/depends/libyarn/test/unit/TestProtocolRecords/TestStartContainerRequest.cpp @@ -0,0 +1,65 @@ +/* + * 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 "protocolrecords/StartContainerRequest.h" + +using namespace libyarn; +using namespace testing; + +class TestStartContainerRequest: public ::testing::Test { +protected: + StartContainerRequest startRequest; +}; + +TEST_F(TestStartContainerRequest, TestStartContainerRequest) +{ + StartContainerRequestProto startRequestProto; + startRequest = StartContainerRequest(startRequestProto); + + SUCCEED(); +} + +TEST_F(TestStartContainerRequest, TestGetContainerLaunchCtx) +{ + ContainerLaunchContext ctx; + ContainerLaunchContext retCtx; + + startRequest.setContainerLaunchCtx(ctx); + retCtx = startRequest.getContainerLaunchCtx(); + + /* The operator '==' is not defined for class ContainerLaunchContext, + so we can't compare ctx and retCtx here. */ + SUCCEED(); +} + +TEST_F(TestStartContainerRequest, TestGetContainerToken) +{ + Token token; + Token retToken; + + startRequest.setContainerToken(token); + retToken = startRequest.getContainerToken(); + + /* The operator '==' is not defined for class Token, + so we can't compare token and retToken here. */ + SUCCEED(); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestProtocolRecords/TestStartContainerResponse.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestProtocolRecords/TestStartContainerResponse.cpp b/depends/libyarn/test/unit/TestProtocolRecords/TestStartContainerResponse.cpp new file mode 100644 index 0000000..d133c20 --- /dev/null +++ b/depends/libyarn/test/unit/TestProtocolRecords/TestStartContainerResponse.cpp @@ -0,0 +1,39 @@ +/* + * 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 "protocolrecords/StartContainerResponse.h" + +using namespace libyarn; +using namespace testing; + +class TestStartContainerResponse: public ::testing::Test { +protected: + StartContainerResponse startResponse; +}; + +TEST_F(TestStartContainerResponse, TestGetProto) +{ + StartContainerResponseProto startResponseProto; + startResponseProto = startResponse.getProto(); + + SUCCEED(); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestProtocolRecords/TestStartContainersRequest.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestProtocolRecords/TestStartContainersRequest.cpp b/depends/libyarn/test/unit/TestProtocolRecords/TestStartContainersRequest.cpp new file mode 100644 index 0000000..dddb449 --- /dev/null +++ b/depends/libyarn/test/unit/TestProtocolRecords/TestStartContainersRequest.cpp @@ -0,0 +1,57 @@ +/* + * 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 "gtest/gtest.h" +#include "gmock/gmock.h" + +#include "protocolrecords/StartContainersRequest.h" + +using std::list; +using namespace libyarn; +using namespace testing; + +class TestStartContainersRequest: public ::testing::Test { +protected: + StartContainersRequest startRequest; +}; + +TEST_F(TestStartContainersRequest, TestStartContainersRequest) +{ + StartContainersRequestProto startRequestProto; + startRequest = StartContainersRequest(startRequestProto); + + SUCCEED(); +} + +TEST_F(TestStartContainersRequest, TestGetStartContainerRequests) +{ + list<StartContainerRequest> requests; + list<StartContainerRequest> retRequests; + StartContainerRequest request; + requests.push_back(request); + + startRequest.setStartContainerRequests(requests); + retRequests = startRequest.getStartContainerRequests(); + + /* The operator '==' is not defined for class StartContainerRequest, + so we can't compare requests and retRequests here. */ + SUCCEED(); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestProtocolRecords/TestStartContainersResponse.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestProtocolRecords/TestStartContainersResponse.cpp b/depends/libyarn/test/unit/TestProtocolRecords/TestStartContainersResponse.cpp new file mode 100644 index 0000000..a5a2178 --- /dev/null +++ b/depends/libyarn/test/unit/TestProtocolRecords/TestStartContainersResponse.cpp @@ -0,0 +1,74 @@ +/* + * 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 "gtest/gtest.h" +#include "gmock/gmock.h" + +#include "protocolrecords/StartContainersResponse.h" + +using std::list; +using namespace libyarn; +using namespace testing; + +class TestStartContainersResponse: public ::testing::Test { +protected: + StartContainersResponse startResponse; +}; + +TEST_F(TestStartContainersResponse, TestStartContainersGetProto) +{ + StartContainersResponseProto startResponseProto; + startResponseProto = startResponse.getProto(); + + SUCCEED(); +} + +TEST_F(TestStartContainersResponse, TestGetSucceededRequests) +{ + list<ContainerId> requests; + list<ContainerId> retRequests; + ContainerId containerId; + requests.push_back(containerId); + + startResponse.setSucceededRequests(requests); + retRequests = startResponse.getSucceededRequests(); + + /* The operator '==' is not defined for class ContainerId, + so we can't compare requests and retRequests here. */ + + SUCCEED(); +} + +TEST_F(TestStartContainersResponse, TestGetFailedRequests) +{ + list<ContainerExceptionMap> requests; + list<ContainerExceptionMap> retRequests; + ContainerExceptionMap map; + requests.push_back(map); + + startResponse.setFailedRequests(requests); + retRequests = startResponse.getFailedRequests(); + + /* The operator '==' is not defined for class ContainerExceptionMap, + so we can't compare requests and retRequests here. */ + + SUCCEED(); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestProtocolRecords/TestStopContainersRequest.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestProtocolRecords/TestStopContainersRequest.cpp b/depends/libyarn/test/unit/TestProtocolRecords/TestStopContainersRequest.cpp new file mode 100644 index 0000000..f30bd2a --- /dev/null +++ b/depends/libyarn/test/unit/TestProtocolRecords/TestStopContainersRequest.cpp @@ -0,0 +1,57 @@ +/* + * 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 "gtest/gtest.h" +#include "gmock/gmock.h" + +#include "protocolrecords/StopContainersRequest.h" + +using std::list; +using namespace libyarn; +using namespace testing; + +class TestStopContainersRequest: public ::testing::Test { +protected: + StopContainersRequest stopRequest; +}; + +TEST_F(TestStopContainersRequest, TestStopContainersRequest) +{ + StopContainersRequestProto stopRequestProto; + stopRequest = StopContainersRequest(stopRequestProto); + + SUCCEED(); +} + +TEST_F(TestStopContainersRequest, TestGetContainerIds) +{ + list<ContainerId> cids; + list<ContainerId> retCids; + ContainerId cid; + cids.push_back(cid); + + stopRequest.setContainerIds(cids); + retCids = stopRequest.getContainerIds(); + + /* The operator '==' is not defined for class ContainerId, + so we can't compare cids and retCids here. */ + SUCCEED(); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestProtocolRecords/TestStopContainersResponse.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestProtocolRecords/TestStopContainersResponse.cpp b/depends/libyarn/test/unit/TestProtocolRecords/TestStopContainersResponse.cpp new file mode 100644 index 0000000..4e6f1ff --- /dev/null +++ b/depends/libyarn/test/unit/TestProtocolRecords/TestStopContainersResponse.cpp @@ -0,0 +1,74 @@ +/* + * 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 "gtest/gtest.h" +#include "gmock/gmock.h" + +#include "protocolrecords/StopContainersResponse.h" + +using std::list; +using namespace libyarn; +using namespace testing; + +class TestStopContainersResponse: public ::testing::Test { +protected: + StopContainersResponse stopResponse; +}; + +TEST_F(TestStopContainersResponse, TestStopContainersGetProto) +{ + StopContainersResponseProto stopResponseProto; + stopResponseProto = stopResponse.getProto(); + + SUCCEED(); +} + +TEST_F(TestStopContainersResponse, TestGetSucceededRequests) +{ + list<ContainerId> requests; + list<ContainerId> retRequests; + ContainerId containerId; + requests.push_back(containerId); + + stopResponse.setSucceededRequests(requests); + retRequests = stopResponse.getSucceededRequests(); + + /* The operator '==' is not defined for class ContainerId, + so we can't compare requests and retRequests here. */ + + SUCCEED(); +} + +TEST_F(TestStopContainersResponse, TestGetFailedRequests) +{ + list<ContainerExceptionMap> requests; + list<ContainerExceptionMap> retRequests; + ContainerExceptionMap map; + requests.push_back(map); + + stopResponse.setFailedRequests(requests); + retRequests = stopResponse.getFailedRequests(); + + /* The operator '==' is not defined for class ContainerExceptionMap, + so we can't compare requests and retRequests here. */ + + SUCCEED(); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestProtocolRecords/TestSubmitApplicationRequest.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestProtocolRecords/TestSubmitApplicationRequest.cpp b/depends/libyarn/test/unit/TestProtocolRecords/TestSubmitApplicationRequest.cpp new file mode 100644 index 0000000..b039d4f --- /dev/null +++ b/depends/libyarn/test/unit/TestProtocolRecords/TestSubmitApplicationRequest.cpp @@ -0,0 +1,52 @@ +/* + * 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 "protocolrecords/SubmitApplicationRequest.h" + +using namespace libyarn; +using namespace testing; + +class TestSubmitApplicationRequest: public ::testing::Test { +protected: + SubmitApplicationRequest submitRequest; +}; + +TEST_F(TestSubmitApplicationRequest, TestSubmitApplicationRequest) +{ + SubmitApplicationRequestProto submitRequestProto; + submitRequest = SubmitApplicationRequest(submitRequestProto); + + SUCCEED(); +} + +TEST_F(TestSubmitApplicationRequest, TestGetContainerIds) +{ + ApplicationSubmissionContext appCtx; + ApplicationSubmissionContext retAppCtx; + + submitRequest.setApplicationSubmissionContext(appCtx); + retAppCtx = submitRequest.getApplicationSubmissionContext(); + + /* The operator '==' is not defined for class ApplicationSubmissionContext, + so we can't compare appCtx and retAppCtx here. */ + SUCCEED(); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestProtocolRecords/TestSubmitApplicationResponse.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestProtocolRecords/TestSubmitApplicationResponse.cpp b/depends/libyarn/test/unit/TestProtocolRecords/TestSubmitApplicationResponse.cpp new file mode 100644 index 0000000..b7a20cb --- /dev/null +++ b/depends/libyarn/test/unit/TestProtocolRecords/TestSubmitApplicationResponse.cpp @@ -0,0 +1,48 @@ +/* + * 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 "protocolrecords/SubmitApplicationResponse.h" + +using namespace libyarn; +using namespace testing; + +class TestSubmitApplicationResponse: public ::testing::Test { +protected: + SubmitApplicationResponse submitResponse; +}; + +TEST_F(TestSubmitApplicationResponse, TestSubmitApplicationResponse) +{ + SubmitApplicationResponseProto submitResponseProto; + submitResponse = SubmitApplicationResponse(); + submitResponse = SubmitApplicationResponse(submitResponseProto); + + SUCCEED(); +} + +TEST_F(TestSubmitApplicationResponse, TestGetProto) +{ + SubmitApplicationResponseProto submitResponseProto; + submitResponseProto = submitResponse.getProto(); + + SUCCEED(); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestRecords/TestApplicationAttemptId.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestRecords/TestApplicationAttemptId.cpp b/depends/libyarn/test/unit/TestRecords/TestApplicationAttemptId.cpp new file mode 100644 index 0000000..67f809a --- /dev/null +++ b/depends/libyarn/test/unit/TestRecords/TestApplicationAttemptId.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 "gtest/gtest.h" +#include "gmock/gmock.h" + +#include "records/ApplicationAttemptId.h" + +using namespace libyarn; +using namespace testing; + +class TestApplicationAttemptId: public ::testing::Test { +protected: + ApplicationAttemptId applicationId; +}; + +TEST_F(TestApplicationAttemptId, TestGetApplicationId) +{ + ApplicationId id; + ApplicationId retId; + + applicationId.setApplicationId(id); + retId = applicationId.getApplicationId(); + + /* The operator '==' is not defined for class ApplicationId, + so we can't compare id and retId here. */ + + SUCCEED(); +} + +TEST_F(TestApplicationAttemptId, TestGetAttemptId) +{ + int32_t id = -1; + int32_t retId; + + applicationId.setAttemptId(id); + retId = applicationId.getAttemptId(); + + EXPECT_EQ(id, retId); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestRecords/TestApplicationReport.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestRecords/TestApplicationReport.cpp b/depends/libyarn/test/unit/TestRecords/TestApplicationReport.cpp new file mode 100644 index 0000000..75d1c61 --- /dev/null +++ b/depends/libyarn/test/unit/TestRecords/TestApplicationReport.cpp @@ -0,0 +1,152 @@ +/* + * 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/ApplicationReport.h" + +using std::string; +using namespace libyarn; +using namespace testing; + +class TestApplicationReport: public ::testing::Test { +protected: + ApplicationReport applicationReport; +}; + +TEST_F(TestApplicationReport, TestGetClientToAMToken) +{ + Token token; + Token retToken; + + applicationReport.setClientToAMToken(token); + retToken = applicationReport.getClientToAMToken(); + + /* The operator '==' is not defined for class Token, + so we can't compare token and retToken here. */ + + SUCCEED(); +} + +TEST_F(TestApplicationReport, TestGetTrackingUrl) +{ + string url("url"); + string retUrl; + + applicationReport.setTrackingUrl(url); + retUrl = applicationReport.getTrackingUrl(); + + EXPECT_EQ(url, retUrl); +} + +TEST_F(TestApplicationReport, TestGetDiagnostics) +{ + string diagnostics("diagnostics"); + string retDiagnostics; + + applicationReport.setDiagnostics(diagnostics); + retDiagnostics = applicationReport.getDiagnostics(); + + EXPECT_EQ(diagnostics, retDiagnostics); +} + +TEST_F(TestApplicationReport, TestGetStartTime) +{ + int64_t time = -1; + int64_t retTime; + + applicationReport.setStartTime(time); + retTime = applicationReport.getStartTime(); + + EXPECT_EQ(time, retTime); +} + +TEST_F(TestApplicationReport, TestGetFinishTime) +{ + int64_t time = -1; + int64_t retTime; + + applicationReport.setFinishTime(time); + retTime = applicationReport.getFinishTime(); + + EXPECT_EQ(time, retTime); +} + +TEST_F(TestApplicationReport, TestGetFinalApplicationStatus) +{ + FinalApplicationStatus status = FinalApplicationStatus::APP_SUCCEEDED; + FinalApplicationStatus retStatus; + + applicationReport.setFinalApplicationStatus(status); + retStatus = applicationReport.getFinalApplicationStatus(); + + EXPECT_EQ(status, retStatus); +} + +TEST_F(TestApplicationReport, TestGetApplicationResourceUsage) +{ + ApplicationResourceUsageReport usage; + ApplicationResourceUsageReport retUsage; + + applicationReport.setAppResourceUsage(usage); + retUsage = applicationReport.getAppResourceUsage(); + + /* The operator '==' is not defined for class ApplicationResourceUsageReport, + so we can't compare usage and retUsage here. */ + + SUCCEED(); +} + +TEST_F(TestApplicationReport, TestGetOriginalTrackingUrl) +{ + string url("url"); + string retUrl; + + applicationReport.setOriginalTrackingUrl(url); + retUrl = applicationReport.getOriginalTrackingUrl(); + + EXPECT_EQ(url, retUrl); +} + +TEST_F(TestApplicationReport, TestGetCurrentAppAttemptId) +{ + ApplicationAttemptId id; + ApplicationAttemptId retId; + + applicationReport.setCurrentAppAttemptId(id); + retId = applicationReport.getCurrentAppAttemptId(); + + /* The operator '==' is not defined for class ApplicationAttemptId, + so we can't compare id and retId here. */ + + SUCCEED(); +} + +TEST_F(TestApplicationReport, TestGetApplicationType) +{ + string type("type"); + string retType; + + applicationReport.setApplicationType(type); + retType = applicationReport.getApplicationType(); + + EXPECT_EQ(type, retType); +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/383818c2/depends/libyarn/test/unit/TestRecords/TestApplicationResourceUsageReport.cpp ---------------------------------------------------------------------- diff --git a/depends/libyarn/test/unit/TestRecords/TestApplicationResourceUsageReport.cpp b/depends/libyarn/test/unit/TestRecords/TestApplicationResourceUsageReport.cpp new file mode 100644 index 0000000..f172dec --- /dev/null +++ b/depends/libyarn/test/unit/TestRecords/TestApplicationResourceUsageReport.cpp @@ -0,0 +1,98 @@ +/* + * 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/ApplicationResourceUsageReport.h" + +using namespace libyarn; +using namespace testing; + +class TestApplicationResourceUsageReport: public ::testing::Test { +protected: + ApplicationResourceUsageReport applicationReport; +}; + +TEST_F(TestApplicationResourceUsageReport, TestGetNumUsedContainers) +{ + int32_t num = -1; + int32_t retNum; + + applicationReport.setNumUsedContainers(num); + retNum = applicationReport.getNumUsedContainers(); + + EXPECT_EQ(num, retNum); +} + +TEST_F(TestApplicationResourceUsageReport, TestGetNumReservedContainers) +{ + int32_t num = -1; + int32_t retNum; + + applicationReport.setNumReservedContainers(num); + retNum = applicationReport.getNumReservedContainers(); + + EXPECT_EQ(num, retNum); +} + +TEST_F(TestApplicationResourceUsageReport, TestGetUsedResources) +{ + Resource resource; + Resource retResource; + + applicationReport.setUsedResources(resource); + retResource = applicationReport.getUsedResources(); + + + /* The operator '==' is not defined for class Resource, + so we can't compare resource and retResource here. */ + + SUCCEED(); +} + +TEST_F(TestApplicationResourceUsageReport, TestGetReservedResources) +{ + Resource resource; + Resource retResource; + + applicationReport.setReservedResources(resource); + retResource = applicationReport.getReservedResources(); + + + /* The operator '==' is not defined for class Resource, + so we can't compare resource and retResource here. */ + + SUCCEED(); +} + +TEST_F(TestApplicationResourceUsageReport, TestGetNeededResources) +{ + Resource resource; + Resource retResource; + + applicationReport.setNeededResources(resource); + retResource = applicationReport.getNeededResources(); + + + /* The operator '==' is not defined for class Resource, + so we can't compare resource and retResource here. */ + + SUCCEED(); +}
