[qpid-proton] branch main updated: PROTON-2413: [Python] set PATH in example test runner

2021-08-05 Thread astitcher
This is an automated email from the ASF dual-hosted git repository.

astitcher pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git


The following commit(s) were added to refs/heads/main by this push:
 new 052cf28  PROTON-2413: [Python] set PATH in example test runner
052cf28 is described below

commit 052cf288e00f0220542e365dcaedd890420deb3d
Author: Andrew Stitcher 
AuthorDate: Thu Aug 5 17:47:15 2021 -0400

PROTON-2413: [Python] set PATH in example test runner

Previously the test runner assumed it could find the examples on the
path. This meant that the environment running the examples would have to
set up the path correctly. This is unnecessary as they are all in the
same directory as the test runner itself.
---
 python/examples/test_examples.py | 19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/python/examples/test_examples.py b/python/examples/test_examples.py
index 51974cc..5c566b1 100644
--- a/python/examples/test_examples.py
+++ b/python/examples/test_examples.py
@@ -17,7 +17,7 @@
 # under the License.
 #
 
-import re
+import os
 import subprocess
 import time
 import unittest
@@ -27,12 +27,16 @@ class Popen(subprocess.Popen):
 
 # We always use these options
 def __init__(self, args, **kwargs):
+# Add the module directory to the path to be able to find the examples
+path = f"{os.path.dirname(__file__)}{os.pathsep}{os.environ['PATH']}"
 super(Popen, self).\
 __init__(args,
  shell=False,
  stderr=subprocess.STDOUT,
  stdout=subprocess.PIPE,
- universal_newlines=True, **kwargs)
+ universal_newlines=True,
+ env={'PATH': path},
+ **kwargs)
 
 
 # Like subprocess.run with our defaults but returning the Popen object
@@ -41,6 +45,13 @@ def run(args, **kwargs):
 p.wait()
 return p
 
+
+def check_call(args, **kwargs):
+# Add the module directory to the path to be able to find the examples
+path = f"{os.path.dirname(__file__)}{os.pathsep}{os.environ['PATH']}"
+return subprocess.check_call(args, env={'PATH': path}, **kwargs)
+
+
 class ExamplesTest(unittest.TestCase):
 def test_helloworld(self, example="helloworld.py"):
 with run([example]) as p:
@@ -101,8 +112,8 @@ class ExamplesTest(unittest.TestCase):
 def test_db_send_recv(self):
 self.maxDiff = None
 # setup databases
-subprocess.check_call(['db_ctrl.py', 'init', './src_db'])
-subprocess.check_call(['db_ctrl.py', 'init', './dst_db'])
+check_call(['db_ctrl.py', 'init', './src_db'])
+check_call(['db_ctrl.py', 'init', './dst_db'])
 with Popen(['db_ctrl.py', 'insert', './src_db'], 
stdin=subprocess.PIPE) as fill:
 for i in range(100):
 fill.stdin.write("Message-%i\n" % (i + 1))

-
To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org
For additional commands, e-mail: commits-h...@qpid.apache.org



[qpid-proton] branch main updated: PROTON-2407 Introduce more optional typing annotations to Python binding (#326)

2021-08-05 Thread jdanek
This is an automated email from the ASF dual-hosted git repository.

jdanek pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git


The following commit(s) were added to refs/heads/main by this push:
 new 38e1768  PROTON-2407 Introduce more optional typing annotations to 
Python binding (#326)
38e1768 is described below

commit 38e176816c18de1b7490ec449fb71893e1287304
Author: Jiri Daněk 
AuthorDate: Thu Aug 5 21:12:49 2021 +0200

PROTON-2407 Introduce more optional typing annotations to Python binding 
(#326)
---
 python/proton/_condition.py  |  15 +++--
 python/proton/_data.py   |   8 ++-
 python/proton/_delivery.py   |   8 +--
 python/proton/_endpoints.py  |  29 +++--
 python/proton/_handlers.py   |  19 +++---
 python/proton/_io.py |   2 +-
 python/proton/_message.py|  13 ++--
 python/proton/_reactor.py| 141 ++-
 python/proton/_selectable.py |  14 +++--
 python/proton/_transport.py  |  23 ---
 python/proton/_utils.py  |  74 ---
 python/proton/_wrapper.py|  15 ++---
 12 files changed, 201 insertions(+), 160 deletions(-)

diff --git a/python/proton/_condition.py b/python/proton/_condition.py
index 445c912..ab390af 100644
--- a/python/proton/_condition.py
+++ b/python/proton/_condition.py
@@ -17,13 +17,16 @@
 # under the License.
 #
 
-from typing import Optional
+from typing import Optional, TYPE_CHECKING
 
 from cproton import pn_condition_clear, pn_condition_set_name, 
pn_condition_set_description, pn_condition_info, \
 pn_condition_is_set, pn_condition_get_name, pn_condition_get_description
 
 from ._data import Data, dat2obj
 
+if TYPE_CHECKING:
+from ._data import PythonAMQPData
+
 
 class Condition:
 """
@@ -48,16 +51,18 @@ class Condition:
 information relevant to the identified condition.
 
 :ivar ~.name: The name of the condition.
-:vartype ~.name: ``str``
 :ivar ~.description: A description of the condition.
-:vartype ~.description: ``str``
 :ivar ~.info: A data object that holds the additional information 
associated
 with the condition. The data object may be used both to access and to
 modify the additional information associated with the condition.
-:vartype ~.info: :class:`Data`
 """
 
-def __init__(self, name, description=None, info=None):
+def __init__(
+self,
+name: str,
+description: Optional[str] = None,
+info: Optional['PythonAMQPData'] = None
+) -> None:
 self.name = name
 self.description = description
 self.info = info
diff --git a/python/proton/_data.py b/python/proton/_data.py
index 6e91a37..f88cec5 100644
--- a/python/proton/_data.py
+++ b/python/proton/_data.py
@@ -22,10 +22,14 @@ from typing import Callable, List, Tuple, Union, Optional, 
Any, Dict, Iterable,
 try:
 from typing import Literal
 except ImportError:
-class Literal:
-def __class_getitem__(cls, item):
+# https://www.python.org/dev/peps/pep-0560/#class-getitem
+class GenericMeta(type):
+def __getitem__(self, item):
 pass
 
+class Literal(metaclass=GenericMeta):
+pass
+
 from cproton import PN_ARRAY, PN_BINARY, PN_BOOL, PN_BYTE, PN_CHAR, 
PN_DECIMAL128, PN_DECIMAL32, PN_DECIMAL64, \
 PN_DESCRIBED, PN_DOUBLE, PN_FLOAT, PN_INT, PN_LIST, PN_LONG, PN_MAP, 
PN_NULL, PN_OVERFLOW, PN_SHORT, PN_STRING, \
 PN_SYMBOL, PN_TIMESTAMP, PN_UBYTE, PN_UINT, PN_ULONG, PN_USHORT, PN_UUID, 
pn_data, pn_data_clear, pn_data_copy, \
diff --git a/python/proton/_delivery.py b/python/proton/_delivery.py
index 7104753..3fe9875 100644
--- a/python/proton/_delivery.py
+++ b/python/proton/_delivery.py
@@ -40,7 +40,7 @@ if TYPE_CHECKING:
 class NamedInt(int):
 values: Dict[int, str] = {}
 
-def __new__(cls, i, name):
+def __new__(cls: Type['DispositionType'], i: int, name: str) -> 
'DispositionType':
 ni = super(NamedInt, cls).__new__(cls, i)
 cls.values[i] = ni
 return ni
@@ -55,7 +55,7 @@ class NamedInt(int):
 return self.name
 
 @classmethod
-def get(cls, i):
+def get(cls, i: int) -> Union[int, 'DispositionType']:
 return cls.values.get(i, i)
 
 
@@ -320,11 +320,9 @@ class Delivery(Wrapper):
 self.remote = Disposition(pn_delivery_remote(self._impl), False)
 
 @property
-def tag(self):
+def tag(self) -> str:
 """
 The identifier for the delivery.
-
-:type: ``bytes``
 """
 return pn_delivery_tag(self._impl)
 
diff --git a/python/proton/_endpoints.py b/python/proton/_endpoints.py
index 9520d68..b27be28 100644
--- a/python/proton/_endpoints.py
+++ b/python/proton/_endpoints.py
@@ -63,7 +63,8 @@ from ._delivery import Delivery
 from ._exceptions import ConnectionException, EXCEPTIONS, LinkException, 
SessionException
 from ._transport import Transport
 from ._wrapper import 

[qpid-jms] branch main updated: QPIDJMS-546: update Mockito to 3.11.2

2021-08-05 Thread robbie
This is an automated email from the ASF dual-hosted git repository.

robbie pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-jms.git


The following commit(s) were added to refs/heads/main by this push:
 new a4b9d3c  QPIDJMS-546: update Mockito to 3.11.2
a4b9d3c is described below

commit a4b9d3c28962825822ea89819c34b5239c0aaaf3
Author: Robbie Gemmell 
AuthorDate: Thu Aug 5 16:32:24 2021 +0100

QPIDJMS-546: update Mockito to 3.11.2
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 231788e..e873411 100644
--- a/pom.xml
+++ b/pom.xml
@@ -51,7 +51,7 @@
 4.13.2
 1.0
 9.4.22.v20191022
-3.10.0
+3.11.2
 2.2
 3.3.0
 2.10.0

-
To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org
For additional commands, e-mail: commits-h...@qpid.apache.org



[qpid-broker-j] branch main updated: QPID-8553 - [Broker-J] Improve code with final keywords

2021-08-05 Thread orudyy
This is an automated email from the ASF dual-hosted git repository.

orudyy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-broker-j.git


The following commit(s) were added to refs/heads/main by this push:
 new 625  QPID-8553 - [Broker-J] Improve code with final keywords
625 is described below

commit 62564fbb9231b5db5d5831540bafaafbc40f
Author: dakirily 
AuthorDate: Tue Jul 20 12:55:32 2021 +0200

QPID-8553 - [Broker-J] Improve code with final keywords

This closes #104
---
 .../qpid/server/logging/AbstractMessageLogger.java | 20 +++
 .../org/apache/qpid/server/model/BrokerImpl.java   | 62 --
 .../apache/qpid/server/queue/AbstractQueue.java| 51 ++
 .../server/security/CompoundAccessControl.java |  2 +-
 .../access/config/RuleBasedAccessControl.java  |  4 +-
 .../protocol/v0_10/AMQPConnection_0_10Impl.java|  6 +--
 .../server/protocol/v0_10/ServerAssembler.java |  8 +--
 .../qpid/server/protocol/v0_8/AMQChannel.java  |  2 +-
 .../protocol/v0_8/AMQPConnection_0_8Impl.java  |  2 +-
 .../qpid/server/protocol/v0_8/BrokerDecoder.java   |  6 +--
 .../protocol/v1_0/AMQPConnection_1_0Impl.java  | 10 ++--
 .../logback/ConnectionAndUserPredicate.java| 10 ++--
 .../logging/logback/PrincipalLogEventFilter.java   |  4 +-
 .../management/amqp/ManagementAddressSpace.java| 12 ++---
 .../server/management/amqp/ProxyMessageSource.java | 24 -
 .../plugin/servlet/rest/SaslServlet.java   | 18 ---
 16 files changed, 128 insertions(+), 113 deletions(-)

diff --git 
a/broker-core/src/main/java/org/apache/qpid/server/logging/AbstractMessageLogger.java
 
b/broker-core/src/main/java/org/apache/qpid/server/logging/AbstractMessageLogger.java
index e511920..0e251ab 100644
--- 
a/broker-core/src/main/java/org/apache/qpid/server/logging/AbstractMessageLogger.java
+++ 
b/broker-core/src/main/java/org/apache/qpid/server/logging/AbstractMessageLogger.java
@@ -95,40 +95,40 @@ public abstract class AbstractMessageLogger implements 
MessageLogger
 abstract void rawMessage(String message, Throwable throwable, String 
logHierarchy);
 
 
-protected String getActor()
+protected final String getActor()
 {
 return getLogActor();
 }
 
 static String getLogActor()
 {
-Subject subject = Subject.getSubject(AccessController.getContext());
+final Subject subject = 
Subject.getSubject(AccessController.getContext());
 
-SessionPrincipal sessionPrincipal = getPrincipal(subject, 
SessionPrincipal.class);
+final SessionPrincipal sessionPrincipal = getPrincipal(subject, 
SessionPrincipal.class);
 String message;
-if(sessionPrincipal != null)
+if (sessionPrincipal != null)
 {
 message =  generateSessionActor(sessionPrincipal.getSession());
 }
 else
 {
-ConnectionPrincipal connPrincipal = getPrincipal(subject, 
ConnectionPrincipal.class);
+final ConnectionPrincipal connPrincipal = getPrincipal(subject, 
ConnectionPrincipal.class);
 
-if(connPrincipal != null)
+if (connPrincipal != null)
 {
 message = 
generateConnectionActor(connPrincipal.getConnection());
 }
 else
 {
-TaskPrincipal taskPrincipal = getPrincipal(subject, 
TaskPrincipal.class);
-if(taskPrincipal != null)
+final TaskPrincipal taskPrincipal = getPrincipal(subject, 
TaskPrincipal.class);
+if (taskPrincipal != null)
 {
 message = generateTaskMessage(taskPrincipal);
 }
 else
 {
-ManagementConnectionPrincipal managementConnection = 
getPrincipal(subject,ManagementConnectionPrincipal.class);
-if(managementConnection != null)
+final ManagementConnectionPrincipal managementConnection = 
getPrincipal(subject,ManagementConnectionPrincipal.class);
+if (managementConnection != null)
 {
 message = 
generateManagementConnectionMessage(managementConnection, getPrincipal(subject, 
AuthenticatedPrincipal.class));
 }
diff --git 
a/broker-core/src/main/java/org/apache/qpid/server/model/BrokerImpl.java 
b/broker-core/src/main/java/org/apache/qpid/server/model/BrokerImpl.java
index 7d0b77f..d2bd9d4 100644
--- a/broker-core/src/main/java/org/apache/qpid/server/model/BrokerImpl.java
+++ b/broker-core/src/main/java/org/apache/qpid/server/model/BrokerImpl.java
@@ -1021,38 +1021,13 @@ public class BrokerImpl extends 
AbstractContainer implements Broker<
 @Override
 public SocketConnectionMetaData getConnectionMetaData()
 {
-Subject subject = Subject.getSubject(AccessController.getContext());
-final