You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@etch.apache.org by fi...@apache.org on 2012/06/01 14:12:00 UTC

svn commit: r1345098 - in /incubator/etch/trunk/binding-cpp/runtime: include/common/ src/main/ src/main/common/ src/test/ src/test/common/

Author: fitzner
Date: Fri Jun  1 12:11:59 2012
New Revision: 1345098

URL: http://svn.apache.org/viewvc?rev=1345098&view=rev
Log:
ETCH-184 Implementation of EtchAuthenticationException

EtchAuthenticationException has been implemented

Change-Id: I5dac9912a4106376fe1fc4250f686b49746ff42e

Added:
    incubator/etch/trunk/binding-cpp/runtime/include/common/EtchAuthenticationException.h
    incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchAuthenticationException.cpp
    incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchAuthenticationExceptionTest.cpp
Modified:
    incubator/etch/trunk/binding-cpp/runtime/include/common/EtchObjectType.h
    incubator/etch/trunk/binding-cpp/runtime/src/main/CMakeLists.txt
    incubator/etch/trunk/binding-cpp/runtime/src/test/CMakeLists.txt

Added: incubator/etch/trunk/binding-cpp/runtime/include/common/EtchAuthenticationException.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/common/EtchAuthenticationException.h?rev=1345098&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/common/EtchAuthenticationException.h (added)
+++ incubator/etch/trunk/binding-cpp/runtime/include/common/EtchAuthenticationException.h Fri Jun  1 12:11:59 2012
@@ -0,0 +1,42 @@
+/* $Id$
+ *
+ * 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.
+ */
+
+#ifndef __ETCHAUTHENTICATIONEXCEPTION_H__
+#define __ETCHAUTHENTICATIONEXCEPTION_H__
+#include "common/EtchException.h"
+
+class EtchAuthenticationException : public EtchException {
+public:
+
+  static const EtchObjectType* TYPE();
+
+  //Default Constructor
+  EtchAuthenticationException(EtchString &msg);
+
+  /**
+   * Destructor
+   */
+  virtual ~EtchAuthenticationException();
+
+  //Overridden
+  capu::bool_t equals(const EtchObject* other);
+
+};
+
+#endif /* ETCHAUTHENTICATIONEXCEPTION_H */
+

Modified: incubator/etch/trunk/binding-cpp/runtime/include/common/EtchObjectType.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/common/EtchObjectType.h?rev=1345098&r1=1345097&r2=1345098&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/common/EtchObjectType.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/common/EtchObjectType.h Fri Jun  1 12:11:59 2012
@@ -58,6 +58,7 @@ enum EtchObjectTypeIds {
   EOTID_TYPE,
   EOTID_STRUCT_VALUE,
   EOTID_EXCEPTION,
+  EOTID_AUTH_EXCEPTION,
 
   EOTID_NATIVE_INT8,
   EOTID_NATIVE_INT16,

Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/CMakeLists.txt?rev=1345098&r1=1345097&r2=1345098&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/CMakeLists.txt (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/CMakeLists.txt Fri Jun  1 12:11:59 2012
@@ -59,6 +59,7 @@ SET(MAIN_INCLUDES
     ${PROJECT_SOURCE_DIR}/include/transport/EtchTransportMessage.h
     ${PROJECT_SOURCE_DIR}/include/transport/EtchTransportPacket.h
     ${PROJECT_SOURCE_DIR}/include/common/EtchException.h
+    ${PROJECT_SOURCE_DIR}/include/common/EtchAuthenticationException.h
     ${PROJECT_SOURCE_DIR}/include/transport/EtchTcpConnection.h
     ${PROJECT_SOURCE_DIR}/include/transport/EtchTcpListener.h
     ${PROJECT_SOURCE_DIR}/include/transport/EtchTcpOption.h
@@ -103,6 +104,7 @@ SET(MAIN_SOURCES
     common/EtchSocket.cpp
     common/EtchServerSocket.cpp
     common/EtchException.cpp
+    common/EtchAuthenticationException.cpp
     util/EtchURL.cpp
     util/EtchResources.cpp
     transport/EtchFlexBuffer.cpp

Added: incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchAuthenticationException.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchAuthenticationException.cpp?rev=1345098&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchAuthenticationException.cpp (added)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchAuthenticationException.cpp Fri Jun  1 12:11:59 2012
@@ -0,0 +1,44 @@
+/* $Id$
+ *
+ * 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 "common/EtchAuthenticationException.h"
+
+const EtchObjectType* EtchAuthenticationException::TYPE() {
+  const static EtchObjectType TYPE(EOTID_AUTH_EXCEPTION, NULL);
+  return &TYPE;
+}
+
+EtchAuthenticationException::EtchAuthenticationException(EtchString& msg)
+: EtchException(msg, ETCH_ERROR, EXCPTYPE_BUILTIN, EtchAuthenticationException::TYPE()) {
+
+}
+
+EtchAuthenticationException::~EtchAuthenticationException() {
+
+}
+
+capu::bool_t EtchAuthenticationException::equals(const EtchObject* other) {
+  if (other == NULL)
+    return false;
+  else if (other->getObjectType() != EtchAuthenticationException::TYPE())
+    return false;
+  EtchAuthenticationException * ptr = (EtchAuthenticationException*) other;
+  return ((ptr->mErrorcode == this->mErrorcode)
+          && (ptr->mExcptype == this->mExcptype)
+          && (ptr->mErrorMessage.equals(&this->mErrorMessage)));
+}
+

Modified: incubator/etch/trunk/binding-cpp/runtime/src/test/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/CMakeLists.txt?rev=1345098&r1=1345097&r2=1345098&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/CMakeLists.txt (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/CMakeLists.txt Fri Jun  1 12:11:59 2012
@@ -43,6 +43,7 @@ add_executable (etch-cpp-test
     common/EtchHashTableTest.cpp
     common/EtchHashSetTest.cpp
     common/EtchExceptionTest.cpp
+    common/EtchAuthenticationExceptionTest.cpp
     util/EtchURLTest.cpp
     util/EtchResourcesTest.cpp
     transport/EtchFlexBufferTest.cpp

Added: incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchAuthenticationExceptionTest.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchAuthenticationExceptionTest.cpp?rev=1345098&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchAuthenticationExceptionTest.cpp (added)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchAuthenticationExceptionTest.cpp Fri Jun  1 12:11:59 2012
@@ -0,0 +1,61 @@
+/* $Id$
+ *
+ * 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 "common/EtchAuthenticationException.h"
+
+TEST(EtchAuthenticationExceptionTest, createTest) {
+  EtchString str("test message");
+  EtchAuthenticationException *test = NULL;
+  test = new EtchAuthenticationException(str);
+  EXPECT_TRUE(test != NULL);
+  delete test;
+}
+
+TEST(EtchAuthenticationExceptionTest, getTests) {
+  EtchString str("test message");
+  EtchAuthenticationException *test = NULL;
+  test = new EtchAuthenticationException(str);
+  EXPECT_TRUE(test != NULL);
+  EXPECT_TRUE(test->getErrorMessage().equals(&str));
+  EXPECT_TRUE(test->getErrorCode() == ETCH_ERROR);
+  EXPECT_TRUE(test->getExceptionType() == EtchException::EXCPTYPE_BUILTIN);
+  delete test;
+}
+
+TEST(EtchAuthenticationExceptionTest, equalsTest) {
+  EtchString str("test message");
+  EtchString str2("test2 message");
+  EtchAuthenticationException *test = NULL;
+  test = new EtchAuthenticationException(str);
+  EtchAuthenticationException *test2 = NULL;
+  test2 = new EtchAuthenticationException(str2);
+  EtchAuthenticationException *test3 = NULL;
+  test3 = new EtchAuthenticationException(str);
+
+  EXPECT_TRUE(test != NULL);
+  EXPECT_TRUE(test2 != NULL);
+  EXPECT_TRUE(test3 != NULL);
+
+  EXPECT_TRUE(test->equals(test3));
+  EXPECT_FALSE(test->equals(test2));
+
+  delete test;
+  delete test2;
+  delete test3;
+}