Use generics more

This commit is contained in:
Ville Skyttä 2016-02-28 01:06:59 +02:00
parent e202240ccc
commit 7c275cdb1a
65 changed files with 158 additions and 169 deletions

View File

@ -34,7 +34,7 @@ public class ConnectionFactoryObjectFactory implements ObjectFactory {
public Object getObjectInstance(final Object ref, public Object getObjectInstance(final Object ref,
final Name name, final Name name,
final Context ctx, final Context ctx,
final Hashtable props) throws Exception { final Hashtable<?, ?> props) throws Exception {
Reference r = (Reference) ref; Reference r = (Reference) ref;
byte[] bytes = (byte[]) r.get("ActiveMQ-CF").getContent(); byte[] bytes = (byte[]) r.get("ActiveMQ-CF").getContent();

View File

@ -34,7 +34,7 @@ public class DestinationObjectFactory implements ObjectFactory {
public Object getObjectInstance(final Object ref, public Object getObjectInstance(final Object ref,
final Name name, final Name name,
final Context ctx, final Context ctx,
final Hashtable props) throws Exception { final Hashtable<?, ?> props) throws Exception {
Reference r = (Reference) ref; Reference r = (Reference) ref;
byte[] bytes = (byte[]) r.get("ActiveMQ-DEST").getContent(); byte[] bytes = (byte[]) r.get("ActiveMQ-DEST").getContent();

View File

@ -23,7 +23,6 @@ import javax.naming.Context;
import javax.naming.NamingException; import javax.naming.NamingException;
import javax.naming.spi.InitialContextFactory; import javax.naming.spi.InitialContextFactory;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
@ -48,11 +47,10 @@ public class ActiveMQInitialContextFactory implements InitialContextFactory {
private String topicPrefix = "topic."; private String topicPrefix = "topic.";
@Override @Override
public Context getInitialContext(Hashtable environment) throws NamingException { public Context getInitialContext(Hashtable<?, ?> environment) throws NamingException {
// lets create a factory // lets create a factory
Map<String, Object> data = new ConcurrentHashMap<>(); Map<String, Object> data = new ConcurrentHashMap<>();
for (Iterator iter = environment.entrySet().iterator(); iter.hasNext(); ) { for (Map.Entry<?, ?> entry : environment.entrySet()) {
Map.Entry entry = (Map.Entry) iter.next();
String key = entry.getKey().toString(); String key = entry.getKey().toString();
if (key.startsWith(connectionFactoryPrefix)) { if (key.startsWith(connectionFactoryPrefix)) {
String jndiName = key.substring(connectionFactoryPrefix.length()); String jndiName = key.substring(connectionFactoryPrefix.length());
@ -111,13 +109,12 @@ public class ActiveMQInitialContextFactory implements InitialContextFactory {
// Implementation methods // Implementation methods
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
protected ReadOnlyContext createContext(Hashtable environment, Map<String, Object> data) { protected ReadOnlyContext createContext(Hashtable<?, ?> environment, Map<String, Object> data) {
return new ReadOnlyContext(environment, data); return new ReadOnlyContext(environment, data);
} }
protected void createQueues(Map<String, Object> data, Hashtable environment) { protected void createQueues(Map<String, Object> data, Hashtable<?, ?> environment) {
for (Iterator iter = environment.entrySet().iterator(); iter.hasNext(); ) { for (Map.Entry<?, ?> entry : environment.entrySet()) {
Map.Entry entry = (Map.Entry) iter.next();
String key = entry.getKey().toString(); String key = entry.getKey().toString();
if (key.startsWith(queuePrefix)) { if (key.startsWith(queuePrefix)) {
String jndiName = key.substring(queuePrefix.length()); String jndiName = key.substring(queuePrefix.length());
@ -126,9 +123,8 @@ public class ActiveMQInitialContextFactory implements InitialContextFactory {
} }
} }
protected void createTopics(Map<String, Object> data, Hashtable environment) { protected void createTopics(Map<String, Object> data, Hashtable<?, ?> environment) {
for (Iterator iter = environment.entrySet().iterator(); iter.hasNext(); ) { for (Map.Entry<?, ?> entry : environment.entrySet()) {
Map.Entry entry = (Map.Entry) iter.next();
String key = entry.getKey().toString(); String key = entry.getKey().toString();
if (key.startsWith(topicPrefix)) { if (key.startsWith(topicPrefix)) {
String jndiName = key.substring(topicPrefix.length()); String jndiName = key.substring(topicPrefix.length());

View File

@ -112,7 +112,7 @@ public class ReadOnlyContext implements Context, Serializable {
frozen = true; frozen = true;
} }
public ReadOnlyContext(Hashtable environment, Map bindings, String nameInNamespace) { public ReadOnlyContext(Hashtable environment, Map<String, Object> bindings, String nameInNamespace) {
this(environment, bindings); this(environment, bindings);
this.nameInNamespace = nameInNamespace; this.nameInNamespace = nameInNamespace;
} }
@ -181,9 +181,8 @@ public class ReadOnlyContext implements Context, Serializable {
ReadOnlyContext readOnlyContext = (ReadOnlyContext) o; ReadOnlyContext readOnlyContext = (ReadOnlyContext) o;
String remainder = name.substring(pos + 1); String remainder = name.substring(pos + 1);
Map<String, Object> subBindings = readOnlyContext.internalBind(remainder, value); Map<String, Object> subBindings = readOnlyContext.internalBind(remainder, value);
for (Iterator iterator = subBindings.entrySet().iterator(); iterator.hasNext(); ) { for (Map.Entry<String, Object> entry : subBindings.entrySet()) {
Map.Entry entry = (Map.Entry) iterator.next(); String subName = segment + "/" + entry.getKey();
String subName = segment + "/" + (String) entry.getKey();
Object bound = entry.getValue(); Object bound = entry.getValue();
treeBindings.put(subName, bound); treeBindings.put(subName, bound);
newBindings.put(subName, bound); newBindings.put(subName, bound);
@ -302,7 +301,7 @@ public class ReadOnlyContext implements Context, Serializable {
} }
@Override @Override
public NamingEnumeration list(String name) throws NamingException { public NamingEnumeration<NameClassPair> list(String name) throws NamingException {
Object o = lookup(name); Object o = lookup(name);
if (o == this) { if (o == this) {
return new ListEnumeration(); return new ListEnumeration();
@ -316,7 +315,7 @@ public class ReadOnlyContext implements Context, Serializable {
} }
@Override @Override
public NamingEnumeration listBindings(String name) throws NamingException { public NamingEnumeration<Binding> listBindings(String name) throws NamingException {
Object o = lookup(name); Object o = lookup(name);
if (o == this) { if (o == this) {
return new ListBindingEnumeration(); return new ListBindingEnumeration();
@ -335,12 +334,12 @@ public class ReadOnlyContext implements Context, Serializable {
} }
@Override @Override
public NamingEnumeration list(Name name) throws NamingException { public NamingEnumeration<NameClassPair> list(Name name) throws NamingException {
return list(name.toString()); return list(name.toString());
} }
@Override @Override
public NamingEnumeration listBindings(Name name) throws NamingException { public NamingEnumeration<Binding> listBindings(Name name) throws NamingException {
return listBindings(name.toString()); return listBindings(name.toString());
} }
@ -426,7 +425,7 @@ public class ReadOnlyContext implements Context, Serializable {
private abstract class LocalNamingEnumeration implements NamingEnumeration { private abstract class LocalNamingEnumeration implements NamingEnumeration {
private final Iterator i = bindings.entrySet().iterator(); private final Iterator<Map.Entry<String, Object>> i = bindings.entrySet().iterator();
@Override @Override
public boolean hasMore() throws NamingException { public boolean hasMore() throws NamingException {
@ -438,8 +437,8 @@ public class ReadOnlyContext implements Context, Serializable {
return i.hasNext(); return i.hasNext();
} }
protected Map.Entry getNext() { protected Map.Entry<String, Object> getNext() {
return (Map.Entry) i.next(); return i.next();
} }
@Override @Override
@ -459,8 +458,8 @@ public class ReadOnlyContext implements Context, Serializable {
@Override @Override
public Object nextElement() { public Object nextElement() {
Map.Entry entry = getNext(); Map.Entry<String, Object> entry = getNext();
return new NameClassPair((String) entry.getKey(), entry.getValue().getClass().getName()); return new NameClassPair(entry.getKey(), entry.getValue().getClass().getName());
} }
} }
@ -476,8 +475,8 @@ public class ReadOnlyContext implements Context, Serializable {
@Override @Override
public Object nextElement() { public Object nextElement() {
Map.Entry entry = getNext(); Map.Entry<String, Object> entry = getNext();
return new Binding((String) entry.getKey(), entry.getValue()); return new Binding(entry.getKey(), entry.getValue());
} }
} }
} }

View File

@ -22,7 +22,7 @@ import java.util.Hashtable;
public class JNDIConnectionFactoryFactory extends JNDIFactorySupport implements ConnectionFactoryFactory { public class JNDIConnectionFactoryFactory extends JNDIFactorySupport implements ConnectionFactoryFactory {
public JNDIConnectionFactoryFactory(final Hashtable jndiProperties, final String lookup) { public JNDIConnectionFactoryFactory(final Hashtable<?, ?> jndiProperties, final String lookup) {
super(jndiProperties, lookup); super(jndiProperties, lookup);
} }

View File

@ -24,7 +24,7 @@ import javax.jms.Destination;
public class JNDIDestinationFactory extends JNDIFactorySupport implements DestinationFactory { public class JNDIDestinationFactory extends JNDIFactorySupport implements DestinationFactory {
public JNDIDestinationFactory(final Hashtable jndiProperties, final String lookup) { public JNDIDestinationFactory(final Hashtable<?, ?> jndiProperties, final String lookup) {
super(jndiProperties, lookup); super(jndiProperties, lookup);
} }

View File

@ -22,11 +22,11 @@ import javax.naming.InitialContext;
public abstract class JNDIFactorySupport { public abstract class JNDIFactorySupport {
protected Hashtable jndiProperties; protected Hashtable<?, ?> jndiProperties;
protected String lookup; protected String lookup;
protected JNDIFactorySupport(final Hashtable jndiProperties, final String lookup) { protected JNDIFactorySupport(final Hashtable<?, ?> jndiProperties, final String lookup) {
this.jndiProperties = jndiProperties; this.jndiProperties = jndiProperties;
this.lookup = lookup; this.lookup = lookup;

View File

@ -320,7 +320,7 @@ public class JMSQueueControlImpl extends StandardMBean implements JMSQueueContro
} }
@Override @Override
public String sendTextMessage(Map headers, String body) throws Exception { public String sendTextMessage(Map<String, String> headers, String body) throws Exception {
return sendTextMessage(headers, body, null, null); return sendTextMessage(headers, body, null, null);
} }

View File

@ -25,11 +25,11 @@ public class DumbServer {
static ConcurrentMap<String, BlockingDeque<Object>> maps = new ConcurrentHashMap<>(); static ConcurrentMap<String, BlockingDeque<Object>> maps = new ConcurrentHashMap<>();
public static BlockingDeque getQueue(String name) { public static BlockingDeque<Object> getQueue(String name) {
BlockingDeque q = maps.get(name); BlockingDeque<Object> q = maps.get(name);
if (q == null) { if (q == null) {
q = new LinkedBlockingDeque(); q = new LinkedBlockingDeque<>();
BlockingDeque oldValue = maps.putIfAbsent(name, q); BlockingDeque<Object> oldValue = maps.putIfAbsent(name, q);
if (oldValue != null) { if (oldValue != null) {
q = oldValue; q = oldValue;
} }

View File

@ -1630,7 +1630,7 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable {
if (!knownConnectionFactories.keySet().contains(overrideProperties)) { if (!knownConnectionFactories.keySet().contains(overrideProperties)) {
cf = newConnectionFactory(overrideProperties); cf = newConnectionFactory(overrideProperties);
knownConnectionFactories.put(overrideProperties, new Pair(cf, new AtomicInteger(1))); knownConnectionFactories.put(overrideProperties, new Pair<>(cf, new AtomicInteger(1)));
} }
else { else {
Pair<ActiveMQConnectionFactory, AtomicInteger> pair = knownConnectionFactories.get(overrideProperties); Pair<ActiveMQConnectionFactory, AtomicInteger> pair = knownConnectionFactories.get(overrideProperties);
@ -1642,7 +1642,7 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable {
if (known && cf.getServerLocator().isClosed()) { if (known && cf.getServerLocator().isClosed()) {
knownConnectionFactories.remove(overrideProperties); knownConnectionFactories.remove(overrideProperties);
cf = newConnectionFactory(overrideProperties); cf = newConnectionFactory(overrideProperties);
knownConnectionFactories.put(overrideProperties, new Pair(cf, new AtomicInteger(1))); knownConnectionFactories.put(overrideProperties, new Pair<>(cf, new AtomicInteger(1)));
} }
return cf; return cf;

View File

@ -124,7 +124,7 @@ public class ActiveMQActivationSpec extends ConnectionFactoryProperties implemen
private String jndiParams = null; private String jndiParams = null;
private Hashtable parsedJndiParams; private Hashtable<String, String> parsedJndiParams;
/* use local tx instead of XA*/ /* use local tx instead of XA*/
private Boolean localTx; private Boolean localTx;

View File

@ -178,7 +178,7 @@ public abstract class ComparisonExpression extends BinaryExpression implements B
return UnaryExpression.createNOT(createLike(left, right, escape)); return UnaryExpression.createNOT(createLike(left, right, escape));
} }
public static BooleanExpression createInFilter(Expression left, List elements) { public static BooleanExpression createInFilter(Expression left, List<Object> elements) {
if (!(left instanceof PropertyExpression)) { if (!(left instanceof PropertyExpression)) {
throw new RuntimeException("Expected a property for In expression, got: " + left); throw new RuntimeException("Expected a property for In expression, got: " + left);
@ -187,7 +187,7 @@ public abstract class ComparisonExpression extends BinaryExpression implements B
} }
public static BooleanExpression createNotInFilter(Expression left, List elements) { public static BooleanExpression createNotInFilter(Expression left, List<Object> elements) {
if (!(left instanceof PropertyExpression)) { if (!(left instanceof PropertyExpression)) {
throw new RuntimeException("Expected a property for In expression, got: " + left); throw new RuntimeException("Expected a property for In expression, got: " + left);

View File

@ -28,7 +28,7 @@ import org.apache.activemq.artemis.selector.strict.StrictParser;
*/ */
public class SelectorParser { public class SelectorParser {
private static final LRUCache cache = new LRUCache(100); private static final LRUCache<String, Object> cache = new LRUCache<>(100);
private static final String CONVERT_STRING_EXPRESSIONS_PREFIX = "convert_string_expressions:"; private static final String CONVERT_STRING_EXPRESSIONS_PREFIX = "convert_string_expressions:";
private static final String HYPHENATED_PROPS_PREFIX = "hyphenated_props:"; private static final String HYPHENATED_PROPS_PREFIX = "hyphenated_props:";
private static final String NO_CONVERT_STRING_EXPRESSIONS_PREFIX = "no_convert_string_expressions:"; private static final String NO_CONVERT_STRING_EXPRESSIONS_PREFIX = "no_convert_string_expressions:";

View File

@ -107,7 +107,7 @@ public class RemotingServiceImpl implements RemotingService, ServerConnectionLif
private final ClusterManager clusterManager; private final ClusterManager clusterManager;
private final Map<String, ProtocolManagerFactory> protocolMap = new ConcurrentHashMap(); private final Map<String, ProtocolManagerFactory> protocolMap = new ConcurrentHashMap<>();
private ActiveMQPrincipal defaultInvmSecurityPrincipal; private ActiveMQPrincipal defaultInvmSecurityPrincipal;
@ -213,7 +213,7 @@ public class RemotingServiceImpl implements RemotingService, ServerConnectionLif
try { try {
AcceptorFactory factory = server.getServiceRegistry().getAcceptorFactory(info.getName(), info.getFactoryClassName()); AcceptorFactory factory = server.getServiceRegistry().getAcceptorFactory(info.getName(), info.getFactoryClassName());
Map<String, ProtocolManagerFactory> selectedProtocolFactories = new ConcurrentHashMap(); Map<String, ProtocolManagerFactory> selectedProtocolFactories = new ConcurrentHashMap<>();
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
String protocol = ConfigurationHelper.getStringProperty(TransportConstants.PROTOCOL_PROP_NAME, null, info.getParams()); String protocol = ConfigurationHelper.getStringProperty(TransportConstants.PROTOCOL_PROP_NAME, null, info.getParams());
@ -235,7 +235,7 @@ public class RemotingServiceImpl implements RemotingService, ServerConnectionLif
selectedProtocolFactories = protocolMap; selectedProtocolFactories = protocolMap;
} }
Map<String, ProtocolManager> selectedProtocols = new ConcurrentHashMap(); Map<String, ProtocolManager> selectedProtocols = new ConcurrentHashMap<>();
for (Map.Entry<String, ProtocolManagerFactory> entry: selectedProtocolFactories.entrySet()) { for (Map.Entry<String, ProtocolManagerFactory> entry: selectedProtocolFactories.entrySet()) {
selectedProtocols.put(entry.getKey(), entry.getValue().createProtocolManager(server, info.getExtraParams(), incomingInterceptors, outgoingInterceptors)); selectedProtocols.put(entry.getKey(), entry.getValue().createProtocolManager(server, info.getExtraParams(), incomingInterceptors, outgoingInterceptors));
} }

View File

@ -79,9 +79,9 @@ public final class ClusterManager implements ActiveMQComponent {
private HAManager haManager; private HAManager haManager;
private final Map<String, BroadcastGroup> broadcastGroups = new HashMap(); private final Map<String, BroadcastGroup> broadcastGroups = new HashMap<>();
private final Map<String, Bridge> bridges = new HashMap(); private final Map<String, Bridge> bridges = new HashMap<>();
private final ExecutorFactory executorFactory; private final ExecutorFactory executorFactory;

View File

@ -60,7 +60,7 @@ public final class RemoteGroupingHandler extends GroupHandlingAbstract {
private final ConcurrentMap<SimpleString, List<SimpleString>> groupMap = new ConcurrentHashMap<>(); private final ConcurrentMap<SimpleString, List<SimpleString>> groupMap = new ConcurrentHashMap<>();
private final ConcurrentHashSet<Notification> pendingNotifications = new ConcurrentHashSet(); private final ConcurrentHashSet<Notification> pendingNotifications = new ConcurrentHashSet<>();
private boolean started = false; private boolean started = false;

View File

@ -1807,15 +1807,15 @@ public class ActiveMQServerImpl implements ActiveMQServer {
JournalLoadInformation[] journalInfo = new JournalLoadInformation[2]; JournalLoadInformation[] journalInfo = new JournalLoadInformation[2];
List<QueueBindingInfo> queueBindingInfos = new ArrayList(); List<QueueBindingInfo> queueBindingInfos = new ArrayList<>();
List<GroupingInfo> groupingInfos = new ArrayList(); List<GroupingInfo> groupingInfos = new ArrayList<>();
journalInfo[0] = storageManager.loadBindingJournal(queueBindingInfos, groupingInfos); journalInfo[0] = storageManager.loadBindingJournal(queueBindingInfos, groupingInfos);
recoverStoredConfigs(); recoverStoredConfigs();
Map<Long, QueueBindingInfo> queueBindingInfosMap = new HashMap(); Map<Long, QueueBindingInfo> queueBindingInfosMap = new HashMap<>();
journalLoader.initQueues(queueBindingInfosMap, queueBindingInfos); journalLoader.initQueues(queueBindingInfosMap, queueBindingInfos);

View File

@ -427,14 +427,14 @@ public class PostOfficeJournalLoader implements JournalLoader {
Map<Long, Map<Long, List<PageCountPending>>> perPageMap = perAddressMap.get(address); Map<Long, Map<Long, List<PageCountPending>>> perPageMap = perAddressMap.get(address);
if (perPageMap == null) { if (perPageMap == null) {
perPageMap = new HashMap(); perPageMap = new HashMap<>();
perAddressMap.put(address, perPageMap); perAddressMap.put(address, perPageMap);
} }
Map<Long, List<PageCountPending>> perQueueMap = perPageMap.get(pageID); Map<Long, List<PageCountPending>> perQueueMap = perPageMap.get(pageID);
if (perQueueMap == null) { if (perQueueMap == null) {
perQueueMap = new HashMap(); perQueueMap = new HashMap<>();
perPageMap.put(pageID, perQueueMap); perPageMap.put(pageID, perQueueMap);
} }

View File

@ -39,7 +39,7 @@ public abstract class AbstractProtocolManagerFactory<P extends BaseInterceptor>
return Collections.emptyList(); return Collections.emptyList();
} }
else { else {
CopyOnWriteArrayList<P> listOut = new CopyOnWriteArrayList(); CopyOnWriteArrayList<P> listOut = new CopyOnWriteArrayList<>();
for (BaseInterceptor<?> in : listIn) { for (BaseInterceptor<?> in : listIn) {
if (type.isInstance(in)) { if (type.isInstance(in)) {
listOut.add((P) in); listOut.add((P) in);

View File

@ -51,7 +51,7 @@ public abstract class CertificateLoginModule extends PropertiesLoader implements
* Overriding to allow for proper initialization. Standard JAAS. * Overriding to allow for proper initialization. Standard JAAS.
*/ */
@Override @Override
public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options) { public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState, Map<String, ?> options) {
this.subject = subject; this.subject = subject;
this.callbackHandler = callbackHandler; this.callbackHandler = callbackHandler;

View File

@ -53,7 +53,7 @@ public class GuestLoginModule implements LoginModule {
private boolean loginSucceeded; private boolean loginSucceeded;
@Override @Override
public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options) { public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState, Map<String, ?> options) {
this.subject = subject; this.subject = subject;
this.callbackHandler = callbackHandler; this.callbackHandler = callbackHandler;
debug = "true".equalsIgnoreCase((String) options.get("debug")); debug = "true".equalsIgnoreCase((String) options.get("debug"));

View File

@ -46,7 +46,7 @@ public class InVMLoginModule implements LoginModule {
private boolean loginSucceeded; private boolean loginSucceeded;
@Override @Override
public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options) { public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState, Map<String, ?> options) {
this.subject = subject; this.subject = subject;
this.callbackHandler = callbackHandler; this.callbackHandler = callbackHandler;
this.configuration = (SecurityConfiguration) options.get(CONFIG_PROP_NAME); this.configuration = (SecurityConfiguration) options.get(CONFIG_PROP_NAME);

View File

@ -82,7 +82,7 @@ public class LDAPLoginModule implements LoginModule {
private Set<RolePrincipal> groups = new HashSet<>(); private Set<RolePrincipal> groups = new HashSet<>();
@Override @Override
public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options) { public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState, Map<String, ?> options) {
this.subject = subject; this.subject = subject;
this.handler = callbackHandler; this.handler = callbackHandler;

View File

@ -51,8 +51,8 @@ public class PropertiesLoginModule extends PropertiesLoader implements LoginModu
@Override @Override
public void initialize(Subject subject, public void initialize(Subject subject,
CallbackHandler callbackHandler, CallbackHandler callbackHandler,
Map sharedState, Map<String, ?> sharedState,
Map options) { Map<String, ?> options) {
this.subject = subject; this.subject = subject;
this.callbackHandler = callbackHandler; this.callbackHandler = callbackHandler;
loginSucceeded = false; loginSucceeded = false;

View File

@ -49,7 +49,7 @@ public class TextFileCertificateLoginModule extends CertificateLoginModule {
* Performs initialization of file paths. A standard JAAS override. * Performs initialization of file paths. A standard JAAS override.
*/ */
@Override @Override
public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options) { public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState, Map<String, ?> options) {
super.initialize(subject, callbackHandler, sharedState, options); super.initialize(subject, callbackHandler, sharedState, options);
usersByDn = load(USER_FILE_PROP_NAME, "", options).invertedPropertiesMap(); usersByDn = load(USER_FILE_PROP_NAME, "", options).invertedPropertiesMap();
roles = load(ROLE_FILE_PROP_NAME, "", options).getProps(); roles = load(ROLE_FILE_PROP_NAME, "", options).getProps();

View File

@ -22,7 +22,6 @@ import java.io.IOException;
import java.security.Principal; import java.security.Principal;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.Vector; import java.util.Vector;
@ -59,7 +58,7 @@ public class CertificateLoginModuleTest extends Assert {
loginModule = new StubCertificateLoginModule(userName, new HashSet<>(rolesNames)); loginModule = new StubCertificateLoginModule(userName, new HashSet<>(rolesNames));
JaasCallbackHandler callbackHandler = new JaasCallbackHandler(null, null, null); JaasCallbackHandler callbackHandler = new JaasCallbackHandler(null, null, null);
loginModule.initialize(subject, callbackHandler, null, new HashMap()); loginModule.initialize(subject, callbackHandler, null, new HashMap<String, Object>());
loginModule.login(); loginModule.login();
loginModule.commit(); loginModule.commit();
@ -72,9 +71,7 @@ public class CertificateLoginModuleTest extends Assert {
rolesFound[i] = false; rolesFound[i] = false;
} }
for (Iterator iter = subject.getPrincipals().iterator(); iter.hasNext(); ) { for (Principal currentPrincipal : subject.getPrincipals()) {
Principal currentPrincipal = (Principal) iter.next();
if (currentPrincipal instanceof UserPrincipal) { if (currentPrincipal instanceof UserPrincipal) {
if (currentPrincipal.getName().equals(USER_NAME)) { if (currentPrincipal.getName().equals(USER_NAME)) {
if (!nameFound) { if (!nameFound) {

View File

@ -70,11 +70,10 @@ public class LDAPLoginModuleTest extends AbstractLdapTestUnit {
} }
} }
@SuppressWarnings("unchecked")
@Test @Test
public void testRunning() throws Exception { public void testRunning() throws Exception {
Hashtable env = new Hashtable(); Hashtable<String, String> env = new Hashtable<>();
env.put(Context.PROVIDER_URL, "ldap://localhost:1024"); env.put(Context.PROVIDER_URL, "ldap://localhost:1024");
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.SECURITY_AUTHENTICATION, "simple"); env.put(Context.SECURITY_AUTHENTICATION, "simple");
@ -82,12 +81,12 @@ public class LDAPLoginModuleTest extends AbstractLdapTestUnit {
env.put(Context.SECURITY_CREDENTIALS, CREDENTIALS); env.put(Context.SECURITY_CREDENTIALS, CREDENTIALS);
DirContext ctx = new InitialDirContext(env); DirContext ctx = new InitialDirContext(env);
HashSet set = new HashSet(); HashSet<String> set = new HashSet<>();
NamingEnumeration list = ctx.list("ou=system"); NamingEnumeration<NameClassPair> list = ctx.list("ou=system");
while (list.hasMore()) { while (list.hasMore()) {
NameClassPair ncp = (NameClassPair) list.next(); NameClassPair ncp = list.next();
set.add(ncp.getName()); set.add(ncp.getName());
} }

View File

@ -70,11 +70,10 @@ public class LDAPModuleRoleExpansionTest extends AbstractLdapTestUnit {
} }
} }
@SuppressWarnings("unchecked")
@Test @Test
public void testRunning() throws Exception { public void testRunning() throws Exception {
Hashtable env = new Hashtable(); Hashtable<String, String> env = new Hashtable<>();
env.put(Context.PROVIDER_URL, "ldap://localhost:1024"); env.put(Context.PROVIDER_URL, "ldap://localhost:1024");
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.SECURITY_AUTHENTICATION, "simple"); env.put(Context.SECURITY_AUTHENTICATION, "simple");
@ -82,12 +81,12 @@ public class LDAPModuleRoleExpansionTest extends AbstractLdapTestUnit {
env.put(Context.SECURITY_CREDENTIALS, CREDENTIALS); env.put(Context.SECURITY_CREDENTIALS, CREDENTIALS);
DirContext ctx = new InitialDirContext(env); DirContext ctx = new InitialDirContext(env);
HashSet set = new HashSet(); HashSet<String> set = new HashSet<>();
NamingEnumeration list = ctx.list("ou=system"); NamingEnumeration<NameClassPair> list = ctx.list("ou=system");
while (list.hasMore()) { while (list.hasMore()) {
NameClassPair ncp = (NameClassPair) list.next(); NameClassPair ncp = list.next();
set.add(ncp.getName()); set.add(ncp.getName());
} }

View File

@ -93,7 +93,7 @@ public class PropertiesLoginModuleRaceConditionTest {
Subject subject = new Subject(); Subject subject = new Subject();
PropertiesLoginModule module = new PropertiesLoginModule(); PropertiesLoginModule module = new PropertiesLoginModule();
module.initialize(subject, callback, new HashMap<>(), options); module.initialize(subject, callback, new HashMap<String, Object>(), options);
module.login(); module.login();
module.commit(); module.commit();
} }

View File

@ -75,7 +75,7 @@ public class TextFileCertificateLoginModuleTest {
private void loginTest(String usersFiles, String groupsFile) throws LoginException { private void loginTest(String usersFiles, String groupsFile) throws LoginException {
HashMap options = new HashMap<String, String>(); HashMap<String, String> options = new HashMap<>();
options.put("org.apache.activemq.jaas.textfiledn.user", usersFiles); options.put("org.apache.activemq.jaas.textfiledn.user", usersFiles);
options.put("org.apache.activemq.jaas.textfiledn.role", groupsFile); options.put("org.apache.activemq.jaas.textfiledn.role", groupsFile);
options.put("reload", "true"); options.put("reload", "true");
@ -113,7 +113,7 @@ public class TextFileCertificateLoginModuleTest {
return new JaasCallbackHandler(null, null, new X509Certificate[]{cert}); return new JaasCallbackHandler(null, null, new X509Certificate[]{cert});
} }
private Subject doAuthenticate(HashMap options, JaasCallbackHandler callbackHandler) throws LoginException { private Subject doAuthenticate(HashMap<String, ?> options, JaasCallbackHandler callbackHandler) throws LoginException {
Subject mySubject = new Subject(); Subject mySubject = new Subject();
loginModule.initialize(mySubject, callbackHandler, null, options); loginModule.initialize(mySubject, callbackHandler, null, options);
loginModule.login(); loginModule.login();

View File

@ -20,6 +20,7 @@ import java.net.URI;
import java.util.Set; import java.util.Set;
import org.apache.activemq.EmbeddedBrokerTestSupport; import org.apache.activemq.EmbeddedBrokerTestSupport;
import org.apache.activemq.broker.region.Destination;
import org.apache.activemq.command.ActiveMQDestination; import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.ActiveMQQueue; import org.apache.activemq.command.ActiveMQQueue;
import org.apache.activemq.command.ActiveMQTopic; import org.apache.activemq.command.ActiveMQTopic;
@ -48,7 +49,7 @@ public class CreateDestinationsOnStartupViaXBeanTest extends EmbeddedBrokerTestS
} }
protected void assertDestinationCreated(ActiveMQDestination destination, boolean expected) throws Exception { protected void assertDestinationCreated(ActiveMQDestination destination, boolean expected) throws Exception {
Set answer = broker.getBroker().getDestinations(destination); Set<Destination> answer = broker.getBroker().getDestinations(destination);
int size = expected ? 1 : 0; int size = expected ? 1 : 0;
assertEquals("Could not find destination: " + destination + ". Size of found destinations: " + answer, size, answer.size()); assertEquals("Could not find destination: " + destination + ". Size of found destinations: " + answer, size, answer.size());
} }

View File

@ -18,9 +18,10 @@
package org.apache.activemq.broker; package org.apache.activemq.broker;
import java.io.File; import java.io.File;
import java.util.Iterator;
import java.util.List; import java.util.List;
import javax.jms.Message;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.apache.activemq.spring.SpringConsumer; import org.apache.activemq.spring.SpringConsumer;
@ -67,10 +68,9 @@ public class SpringTest extends TestCase {
consumer.waitForMessagesToArrive(producer.getMessageCount()); consumer.waitForMessagesToArrive(producer.getMessageCount());
// now lets check that the consumer has received some messages // now lets check that the consumer has received some messages
List messages = consumer.flushMessages(); List<Message> messages = consumer.flushMessages();
LOG.info("Consumer has received messages...."); LOG.info("Consumer has received messages....");
for (Iterator iter = messages.iterator(); iter.hasNext(); ) { for (Message message : messages) {
Object message = iter.next();
LOG.info("Received: " + message); LOG.info("Received: " + message);
} }

View File

@ -41,7 +41,7 @@ public class mKahaDbQueueMasterSlaveTest extends QueueMasterSlaveTestSupport {
master.setDeleteAllMessagesOnStartup(true); master.setDeleteAllMessagesOnStartup(true);
MultiKahaDBPersistenceAdapter mKahaDB = new MultiKahaDBPersistenceAdapter(); MultiKahaDBPersistenceAdapter mKahaDB = new MultiKahaDBPersistenceAdapter();
List adapters = new LinkedList<FilteredKahaDBPersistenceAdapter>(); List<FilteredKahaDBPersistenceAdapter> adapters = new LinkedList<>();
FilteredKahaDBPersistenceAdapter defaultEntry = new FilteredKahaDBPersistenceAdapter(); FilteredKahaDBPersistenceAdapter defaultEntry = new FilteredKahaDBPersistenceAdapter();
defaultEntry.setPersistenceAdapter(new KahaDBPersistenceAdapter()); defaultEntry.setPersistenceAdapter(new KahaDBPersistenceAdapter());
defaultEntry.setPerDestination(true); defaultEntry.setPerDestination(true);
@ -72,7 +72,7 @@ public class mKahaDbQueueMasterSlaveTest extends QueueMasterSlaveTestSupport {
broker.setPersistent(true); broker.setPersistent(true);
MultiKahaDBPersistenceAdapter mKahaDB = new MultiKahaDBPersistenceAdapter(); MultiKahaDBPersistenceAdapter mKahaDB = new MultiKahaDBPersistenceAdapter();
List adapters = new LinkedList<FilteredKahaDBPersistenceAdapter>(); List<FilteredKahaDBPersistenceAdapter> adapters = new LinkedList<>();
FilteredKahaDBPersistenceAdapter defaultEntry = new FilteredKahaDBPersistenceAdapter(); FilteredKahaDBPersistenceAdapter defaultEntry = new FilteredKahaDBPersistenceAdapter();
defaultEntry.setPersistenceAdapter(new KahaDBPersistenceAdapter()); defaultEntry.setPersistenceAdapter(new KahaDBPersistenceAdapter());
defaultEntry.setPerDestination(true); defaultEntry.setPerDestination(true);

View File

@ -1432,7 +1432,7 @@ public class MBeanTest extends EmbeddedBrokerTestSupport {
ObjectName brokerName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost"); ObjectName brokerName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost");
BrokerViewMBean brokerView = MBeanServerInvocationHandler.newProxyInstance(mbeanServer, brokerName, BrokerViewMBean.class, true); BrokerViewMBean brokerView = MBeanServerInvocationHandler.newProxyInstance(mbeanServer, brokerName, BrokerViewMBean.class, true);
Map connectors = brokerView.getTransportConnectors(); Map<String, String> connectors = brokerView.getTransportConnectors();
LOG.info("Connectors: " + connectors); LOG.info("Connectors: " + connectors);
assertEquals("one connector", 1, connectors.size()); assertEquals("one connector", 1, connectors.size());

View File

@ -34,7 +34,7 @@ public class mKahaDBXARecoveryBrokerTest extends XARecoveryBrokerTest {
super.configureBroker(broker); super.configureBroker(broker);
MultiKahaDBPersistenceAdapter mKahaDB = new MultiKahaDBPersistenceAdapter(); MultiKahaDBPersistenceAdapter mKahaDB = new MultiKahaDBPersistenceAdapter();
List adapters = new LinkedList<FilteredKahaDBPersistenceAdapter>(); List<FilteredKahaDBPersistenceAdapter> adapters = new LinkedList<>();
FilteredKahaDBPersistenceAdapter defaultEntry = new FilteredKahaDBPersistenceAdapter(); FilteredKahaDBPersistenceAdapter defaultEntry = new FilteredKahaDBPersistenceAdapter();
defaultEntry.setPersistenceAdapter(new KahaDBPersistenceAdapter()); defaultEntry.setPersistenceAdapter(new KahaDBPersistenceAdapter());
adapters.add(defaultEntry); adapters.add(defaultEntry);

View File

@ -34,7 +34,7 @@ public class mLevelDBXARecoveryBrokerTest extends XARecoveryBrokerTest {
super.configureBroker(broker); super.configureBroker(broker);
MultiKahaDBPersistenceAdapter mKahaDB = new MultiKahaDBPersistenceAdapter(); MultiKahaDBPersistenceAdapter mKahaDB = new MultiKahaDBPersistenceAdapter();
List adapters = new LinkedList<FilteredKahaDBPersistenceAdapter>(); List<FilteredKahaDBPersistenceAdapter> adapters = new LinkedList<>();
FilteredKahaDBPersistenceAdapter defaultEntry = new FilteredKahaDBPersistenceAdapter(); FilteredKahaDBPersistenceAdapter defaultEntry = new FilteredKahaDBPersistenceAdapter();
defaultEntry.setPersistenceAdapter(new LevelDBPersistenceAdapter()); defaultEntry.setPersistenceAdapter(new LevelDBPersistenceAdapter());
adapters.add(defaultEntry); adapters.add(defaultEntry);

View File

@ -175,8 +175,8 @@ public class AMQ5266SingleDestTest {
publisher.waitForCompletion(); publisher.waitForCompletion();
List publishedIds = publisher.getIDs(); List<String> publishedIds = publisher.getIDs();
distinctPublishedCount = new TreeSet(publishedIds).size(); distinctPublishedCount = new TreeSet<>(publishedIds).size();
LOG.info("Publisher Complete. Published: " + publishedIds.size() + ", Distinct IDs Published: " + distinctPublishedCount); LOG.info("Publisher Complete. Published: " + publishedIds.size() + ", Distinct IDs Published: " + distinctPublishedCount);
LOG.info("Publisher duration: {}", TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis() - totalStart)); LOG.info("Publisher duration: {}", TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis() - totalStart));

View File

@ -182,8 +182,8 @@ public class AMQ5266StarvedConsumerTest {
publisher.waitForCompletion(); publisher.waitForCompletion();
List publishedIds = publisher.getIDs(); List<String> publishedIds = publisher.getIDs();
distinctPublishedCount = new TreeSet(publishedIds).size(); distinctPublishedCount = new TreeSet<>(publishedIds).size();
LOG.info("Publisher Complete. Published: " + publishedIds.size() + ", Distinct IDs Published: " + distinctPublishedCount); LOG.info("Publisher Complete. Published: " + publishedIds.size() + ", Distinct IDs Published: " + distinctPublishedCount);

View File

@ -166,8 +166,8 @@ public class AMQ5266Test {
publisher.waitForCompletion(); publisher.waitForCompletion();
List publishedIds = publisher.getIDs(); List<String> publishedIds = publisher.getIDs();
distinctPublishedCount = new TreeSet(publishedIds).size(); distinctPublishedCount = new TreeSet<>(publishedIds).size();
LOG.info("Publisher Complete. Published: " + publishedIds.size() + ", Distinct IDs Published: " + distinctPublishedCount); LOG.info("Publisher Complete. Published: " + publishedIds.size() + ", Distinct IDs Published: " + distinctPublishedCount);

View File

@ -53,7 +53,7 @@ public class AMQ5450Test {
private final static String[] DESTS = new String[]{DESTINATION_NAME, DESTINATION_NAME_2, DESTINATION_NAME_3, DESTINATION_NAME, DESTINATION_NAME}; private final static String[] DESTS = new String[]{DESTINATION_NAME, DESTINATION_NAME_2, DESTINATION_NAME_3, DESTINATION_NAME, DESTINATION_NAME};
BrokerService broker; BrokerService broker;
private HashMap<Object, PersistenceAdapter> adapters = new HashMap(); private HashMap<Object, PersistenceAdapter> adapters = new HashMap<>();
@After @After
public void tearDown() throws Exception { public void tearDown() throws Exception {
@ -98,7 +98,7 @@ public class AMQ5450Test {
assertEquals(1, destination2.getMessageStore().getMessageCount()); assertEquals(1, destination2.getMessageStore().getMessageCount());
} }
HashMap numDests = new HashMap(); HashMap<Integer, PersistenceAdapter> numDests = new HashMap<>();
for (PersistenceAdapter pa : adapters.values()) { for (PersistenceAdapter pa : adapters.values()) {
numDests.put(pa.getDestinations().size(), pa); numDests.put(pa.getDestinations().size(), pa);
} }

View File

@ -49,7 +49,7 @@ public class ActiveMQDestinationTest extends DataStructureTestSupport {
} }
public void testDestinationOptions() throws IOException { public void testDestinationOptions() throws IOException {
Map options = destination.getOptions(); Map<String, String> options = destination.getOptions();
assertNotNull(options); assertNotNull(options);
assertEquals("v1", options.get("k1")); assertEquals("v1", options.get("k1"));
assertEquals("v2", options.get("k2")); assertEquals("v2", options.get("k2"));

View File

@ -62,7 +62,7 @@ public abstract class MessageTestSupport extends BaseCommandTestSupport {
} }
{ {
Map map = new HashMap(); Map<String, Object> map = new HashMap<>();
map.put("MarshalledProperties", 12); map.put("MarshalledProperties", 12);
ByteArrayOutputStream baos = new ByteArrayOutputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream os = new DataOutputStream(baos); DataOutputStream os = new DataOutputStream(baos);

View File

@ -61,7 +61,7 @@ public abstract class MessageTestSupport extends BaseCommandTestSupport {
info.setContent(baos.toByteSequence()); info.setContent(baos.toByteSequence());
} }
{ {
Map map = new HashMap(); Map<String, Object> map = new HashMap<>();
map.put("MarshalledProperties", 12); map.put("MarshalledProperties", 12);
ByteArrayOutputStream baos = new ByteArrayOutputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream os = new DataOutputStream(baos); DataOutputStream os = new DataOutputStream(baos);

View File

@ -104,8 +104,8 @@ public class ReliableTransportTest extends TestCase {
transport.onCommand(info); transport.onCommand(info);
} }
Queue exceptions = listener.getExceptions(); Queue<Object> exceptions = listener.getExceptions();
Queue commands = listener.getCommands(); Queue<Object> commands = listener.getCommands();
if (expected) { if (expected) {
if (!exceptions.isEmpty()) { if (!exceptions.isEmpty()) {
Exception e = (Exception) exceptions.remove(); Exception e = (Exception) exceptions.remove();

View File

@ -71,7 +71,7 @@ public class AeroGearBasicServerTest extends ActiveMQTestBase {
connector0.setHost("localhost"); connector0.setHost("localhost");
jetty.addConnector(connector0); jetty.addConnector(connector0);
jetty.start(); jetty.start();
HashMap<String, Object> params = new HashMap(); HashMap<String, Object> params = new HashMap<>();
params.put(AeroGearConstants.QUEUE_NAME, "testQueue"); params.put(AeroGearConstants.QUEUE_NAME, "testQueue");
params.put(AeroGearConstants.ENDPOINT_NAME, "http://localhost:8080"); params.put(AeroGearConstants.ENDPOINT_NAME, "http://localhost:8080");
params.put(AeroGearConstants.APPLICATION_ID_NAME, "9d646a12-e601-4452-9e05-efb0fccdfd08"); params.put(AeroGearConstants.APPLICATION_ID_NAME, "9d646a12-e601-4452-9e05-efb0fccdfd08");

View File

@ -82,7 +82,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase {
@Test @Test
public void testVMCF0() throws NamingException, JMSException { public void testVMCF0() throws NamingException, JMSException {
Hashtable props = new Hashtable<>(); Hashtable<String, String> props = new Hashtable<>();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory");
props.put("connectionFactory.ConnectionFactory", "vm://0"); props.put("connectionFactory.ConnectionFactory", "vm://0");
Context ctx = new InitialContext(props); Context ctx = new InitialContext(props);
@ -94,7 +94,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase {
@Test @Test
public void testVMCF1() throws NamingException, JMSException { public void testVMCF1() throws NamingException, JMSException {
Hashtable props = new Hashtable<>(); Hashtable<String, String> props = new Hashtable<>();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory");
props.put("connectionFactory.ConnectionFactory", "vm://1"); props.put("connectionFactory.ConnectionFactory", "vm://1");
Context ctx = new InitialContext(props); Context ctx = new InitialContext(props);
@ -106,7 +106,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase {
@Test @Test
public void testXACF() throws NamingException, JMSException { public void testXACF() throws NamingException, JMSException {
Hashtable props = new Hashtable<>(); Hashtable<String, String> props = new Hashtable<>();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory");
props.put("connectionFactory.myConnectionFactory", "vm://0?type=XA_CF"); props.put("connectionFactory.myConnectionFactory", "vm://0?type=XA_CF");
Context ctx = new InitialContext(props); Context ctx = new InitialContext(props);
@ -118,7 +118,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase {
@Test @Test
public void testQueueCF() throws NamingException, JMSException { public void testQueueCF() throws NamingException, JMSException {
Hashtable props = new Hashtable<>(); Hashtable<String, String> props = new Hashtable<>();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory");
props.put("connectionFactory.myConnectionFactory", "vm://0?type=QUEUE_CF"); props.put("connectionFactory.myConnectionFactory", "vm://0?type=QUEUE_CF");
Context ctx = new InitialContext(props); Context ctx = new InitialContext(props);
@ -130,7 +130,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase {
@Test @Test
public void testQueueXACF() throws NamingException, JMSException { public void testQueueXACF() throws NamingException, JMSException {
Hashtable props = new Hashtable<>(); Hashtable<String, String> props = new Hashtable<>();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory");
props.put("connectionFactory.myConnectionFactory", "vm://0?type=QUEUE_XA_CF"); props.put("connectionFactory.myConnectionFactory", "vm://0?type=QUEUE_XA_CF");
Context ctx = new InitialContext(props); Context ctx = new InitialContext(props);
@ -142,7 +142,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase {
@Test @Test
public void testTopicCF() throws NamingException, JMSException { public void testTopicCF() throws NamingException, JMSException {
Hashtable props = new Hashtable<>(); Hashtable<String, String> props = new Hashtable<>();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory");
props.put("connectionFactory.myConnectionFactory", "vm://0?type=TOPIC_CF"); props.put("connectionFactory.myConnectionFactory", "vm://0?type=TOPIC_CF");
Context ctx = new InitialContext(props); Context ctx = new InitialContext(props);
@ -154,7 +154,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase {
@Test @Test
public void testTopicXACF() throws NamingException, JMSException { public void testTopicXACF() throws NamingException, JMSException {
Hashtable props = new Hashtable<>(); Hashtable<String, String> props = new Hashtable<>();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory");
props.put("connectionFactory.myConnectionFactory", "vm://0?type=TOPIC_XA_CF"); props.put("connectionFactory.myConnectionFactory", "vm://0?type=TOPIC_XA_CF");
Context ctx = new InitialContext(props); Context ctx = new InitialContext(props);
@ -166,7 +166,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase {
@Test @Test
public void testRemoteCFWithTCP() throws NamingException, JMSException { public void testRemoteCFWithTCP() throws NamingException, JMSException {
Hashtable props = new Hashtable<>(); Hashtable<String, String> props = new Hashtable<>();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory");
props.put("connectionFactory.myConnectionFactory", "tcp://127.0.0.1:61616"); props.put("connectionFactory.myConnectionFactory", "tcp://127.0.0.1:61616");
Context ctx = new InitialContext(props); Context ctx = new InitialContext(props);
@ -178,7 +178,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase {
@Test @Test
public void testRemoteCFWithTCPandHA() throws NamingException, JMSException { public void testRemoteCFWithTCPandHA() throws NamingException, JMSException {
Hashtable props = new Hashtable<>(); Hashtable<String, String> props = new Hashtable<>();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory");
props.put("connectionFactory.myConnectionFactory", "tcp://127.0.0.1:61616?ha=true"); props.put("connectionFactory.myConnectionFactory", "tcp://127.0.0.1:61616?ha=true");
Context ctx = new InitialContext(props); Context ctx = new InitialContext(props);
@ -190,7 +190,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase {
@Test @Test
public void testRemoteCFWithJGroups() throws Exception { public void testRemoteCFWithJGroups() throws Exception {
Hashtable props = new Hashtable<>(); Hashtable<String, String> props = new Hashtable<>();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory");
props.put("connectionFactory.myConnectionFactory", "jgroups://mychannelid?file=test-jgroups-file_ping.xml"); props.put("connectionFactory.myConnectionFactory", "jgroups://mychannelid?file=test-jgroups-file_ping.xml");
Context ctx = new InitialContext(props); Context ctx = new InitialContext(props);
@ -201,7 +201,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase {
@Test @Test
public void testRemoteCFWithJgroupsWithTransportConfigFile() throws Exception { public void testRemoteCFWithJgroupsWithTransportConfigFile() throws Exception {
Hashtable props = new Hashtable<>(); Hashtable<String, String> props = new Hashtable<>();
props.put(Context.INITIAL_CONTEXT_FACTORY, org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory.class.getCanonicalName()); props.put(Context.INITIAL_CONTEXT_FACTORY, org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory.class.getCanonicalName());
props.put("connectionFactory.myConnectionFactory", "jgroups://testChannelName?file=test-jgroups-file_ping.xml&" + props.put("connectionFactory.myConnectionFactory", "jgroups://testChannelName?file=test-jgroups-file_ping.xml&" +
ActiveMQInitialContextFactory.REFRESH_TIMEOUT + "=5000&" + ActiveMQInitialContextFactory.REFRESH_TIMEOUT + "=5000&" +
@ -221,7 +221,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase {
@Test @Test
public void testRemoteCFWithJgroupsWithTransportConfigProps() throws Exception { public void testRemoteCFWithJgroupsWithTransportConfigProps() throws Exception {
Hashtable props = new Hashtable<>(); Hashtable<String, String> props = new Hashtable<>();
props.put(Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getCanonicalName()); props.put(Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getCanonicalName());
props.put("connectionFactory.ConnectionFactory", "jgroups://testChannelName?properties=param=value&" + props.put("connectionFactory.ConnectionFactory", "jgroups://testChannelName?properties=param=value&" +
ActiveMQInitialContextFactory.REFRESH_TIMEOUT + "=5000&" + ActiveMQInitialContextFactory.REFRESH_TIMEOUT + "=5000&" +
@ -243,7 +243,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase {
@Test @Test
public void testRemoteCFWithJgroupsWithTransportConfigNullProps() throws Exception { public void testRemoteCFWithJgroupsWithTransportConfigNullProps() throws Exception {
Hashtable props = new Hashtable<>(); Hashtable<String, String> props = new Hashtable<>();
props.put(Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getCanonicalName()); props.put(Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getCanonicalName());
props.put("connectionFactory.ConnectionFactory", "jgroups://testChannelName?" + props.put("connectionFactory.ConnectionFactory", "jgroups://testChannelName?" +
ActiveMQInitialContextFactory.REFRESH_TIMEOUT + "=5000&" + ActiveMQInitialContextFactory.REFRESH_TIMEOUT + "=5000&" +
@ -265,7 +265,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase {
@Test @Test
public void testRemoteCFWithUDP() throws NamingException, JMSException { public void testRemoteCFWithUDP() throws NamingException, JMSException {
Hashtable props = new Hashtable<>(); Hashtable<String, String> props = new Hashtable<>();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory");
props.put("connectionFactory.myConnectionFactory", "udp://" + getUDPDiscoveryAddress() + ":" + getUDPDiscoveryPort()); props.put("connectionFactory.myConnectionFactory", "udp://" + getUDPDiscoveryAddress() + ":" + getUDPDiscoveryPort());
Context ctx = new InitialContext(props); Context ctx = new InitialContext(props);
@ -277,7 +277,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase {
@Test @Test
public void testRemoteCFWithUDPWithTransportConfig() throws NamingException, JMSException { public void testRemoteCFWithUDPWithTransportConfig() throws NamingException, JMSException {
Hashtable props = new Hashtable<>(); Hashtable<String, String> props = new Hashtable<>();
props.put(Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getCanonicalName()); props.put(Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getCanonicalName());
props.put("connectionFactory.myConnectionFactory", "udp://" + getUDPDiscoveryAddress() + ":" + getUDPDiscoveryPort() + "?" + props.put("connectionFactory.myConnectionFactory", "udp://" + getUDPDiscoveryAddress() + ":" + getUDPDiscoveryPort() + "?" +
TransportConstants.LOCAL_ADDRESS_PROP_NAME + "=Server1&" + TransportConstants.LOCAL_ADDRESS_PROP_NAME + "=Server1&" +
@ -302,7 +302,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase {
@Test @Test
public void testRemoteCFWithMultipleHosts() throws NamingException, JMSException { public void testRemoteCFWithMultipleHosts() throws NamingException, JMSException {
Hashtable props = new Hashtable<>(); Hashtable<String, String> props = new Hashtable<>();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory");
props.put("connectionFactory.myConnectionFactory", "tcp://127.0.0.1:61616/httpEnabled=true&foo=bar,tcp://127.0.0.2:61617?httpEnabled=false?clientID=myClientID"); props.put("connectionFactory.myConnectionFactory", "tcp://127.0.0.1:61616/httpEnabled=true&foo=bar,tcp://127.0.0.2:61617?httpEnabled=false?clientID=myClientID");
Context ctx = new InitialContext(props); Context ctx = new InitialContext(props);
@ -314,7 +314,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase {
@Test @Test
public void testRemoteCFWithTransportConfig() throws NamingException, JMSException { public void testRemoteCFWithTransportConfig() throws NamingException, JMSException {
Hashtable props = new Hashtable<>(); Hashtable<String, String> props = new Hashtable<>();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory");
props.put("connectionFactory.myConnectionFactory", "tcp://127.0.0.1:61616?" + props.put("connectionFactory.myConnectionFactory", "tcp://127.0.0.1:61616?" +
TransportConstants.SSL_ENABLED_PROP_NAME + "=mySSLEnabledPropValue&" + TransportConstants.SSL_ENABLED_PROP_NAME + "=mySSLEnabledPropValue&" +
@ -350,7 +350,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase {
ActiveMQConnectionFactory cf = (ActiveMQConnectionFactory) ctx.lookup("myConnectionFactory"); ActiveMQConnectionFactory cf = (ActiveMQConnectionFactory) ctx.lookup("myConnectionFactory");
Map parametersFromJNDI = cf.getServerLocator().getStaticTransportConfigurations()[0].getParams(); Map<String, Object> parametersFromJNDI = cf.getServerLocator().getStaticTransportConfigurations()[0].getParams();
Assert.assertEquals(parametersFromJNDI.get(TransportConstants.SSL_ENABLED_PROP_NAME), "mySSLEnabledPropValue"); Assert.assertEquals(parametersFromJNDI.get(TransportConstants.SSL_ENABLED_PROP_NAME), "mySSLEnabledPropValue");
Assert.assertEquals(parametersFromJNDI.get(TransportConstants.HTTP_ENABLED_PROP_NAME), "myHTTPEnabledPropValue"); Assert.assertEquals(parametersFromJNDI.get(TransportConstants.HTTP_ENABLED_PROP_NAME), "myHTTPEnabledPropValue");
@ -398,7 +398,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase {
List<String> connectorNames = new ArrayList<>(); List<String> connectorNames = new ArrayList<>();
connectorNames.add(liveTC.getName()); connectorNames.add(liveTC.getName());
Map params = new HashMap(); Map<String, Object> params = new HashMap<>();
params.put(org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME, 1); params.put(org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME, 1);
Configuration liveConf = createBasicConfig().addAcceptorConfiguration(new TransportConfiguration(INVM_ACCEPTOR_FACTORY)).addAcceptorConfiguration(new TransportConfiguration(INVM_ACCEPTOR_FACTORY, params)).addAcceptorConfiguration(new TransportConfiguration(NETTY_ACCEPTOR_FACTORY)).setConnectorConfigurations(connectors).setHAPolicyConfiguration(new SharedStoreMasterPolicyConfiguration()); Configuration liveConf = createBasicConfig().addAcceptorConfiguration(new TransportConfiguration(INVM_ACCEPTOR_FACTORY)).addAcceptorConfiguration(new TransportConfiguration(INVM_ACCEPTOR_FACTORY, params)).addAcceptorConfiguration(new TransportConfiguration(NETTY_ACCEPTOR_FACTORY)).setConnectorConfigurations(connectors).setHAPolicyConfiguration(new SharedStoreMasterPolicyConfiguration());
@ -421,7 +421,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase {
@Test @Test
public void testQueue() throws NamingException, JMSException { public void testQueue() throws NamingException, JMSException {
Hashtable props = new Hashtable<>(); Hashtable<String, String> props = new Hashtable<>();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory");
props.put("queue.myQueue", "myQueue"); props.put("queue.myQueue", "myQueue");
props.put("queue.queues/myQueue", "myQueue"); props.put("queue.queues/myQueue", "myQueue");
@ -436,7 +436,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase {
@Test @Test
public void testDynamicQueue() throws NamingException, JMSException { public void testDynamicQueue() throws NamingException, JMSException {
Hashtable props = new Hashtable<>(); Hashtable<String, String> props = new Hashtable<>();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory");
Context ctx = new InitialContext(props); Context ctx = new InitialContext(props);
@ -446,7 +446,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase {
@Test @Test
public void testTopic() throws NamingException, JMSException { public void testTopic() throws NamingException, JMSException {
Hashtable props = new Hashtable<>(); Hashtable<String, String> props = new Hashtable<>();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory");
props.put("topic.myTopic", "myTopic"); props.put("topic.myTopic", "myTopic");
props.put("topic.topics/myTopic", "myTopic"); props.put("topic.topics/myTopic", "myTopic");
@ -461,7 +461,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase {
@Test @Test
public void testDynamicTopic() throws NamingException, JMSException { public void testDynamicTopic() throws NamingException, JMSException {
Hashtable props = new Hashtable<>(); Hashtable<String, String> props = new Hashtable<>();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory");
Context ctx = new InitialContext(props); Context ctx = new InitialContext(props);

View File

@ -54,7 +54,7 @@ public class InvalidDestinationTest extends JMSTestBase {
Topic invalidTopic = null; Topic invalidTopic = null;
String message = "hello world"; String message = "hello world";
byte[] bytesMsgSend = message.getBytes(); byte[] bytesMsgSend = message.getBytes();
Map<String, Object> mapMsgSend = new HashMap(); Map<String, Object> mapMsgSend = new HashMap<>();
mapMsgSend.put("s", "foo"); mapMsgSend.put("s", "foo");
mapMsgSend.put("b", true); mapMsgSend.put("b", true);
mapMsgSend.put("i", 1); mapMsgSend.put("i", 1);

View File

@ -380,7 +380,7 @@ public class XmlImportExportTest extends ActiveMQTestBase {
final String jndi_binding2 = name + "Binding2"; final String jndi_binding2 = name + "Binding2";
final JMSFactoryType type = JMSFactoryType.CF; final JMSFactoryType type = JMSFactoryType.CF;
final boolean ha = true; final boolean ha = true;
final List connectors = Arrays.asList("in-vm1", "in-vm2"); final List<String> connectors = Arrays.asList("in-vm1", "in-vm2");
ClientSession session = basicSetUp(); ClientSession session = basicSetUp();

View File

@ -41,7 +41,7 @@ public class ActiveMQRAClusteredTestBase extends ActiveMQRATestBase {
super.setUp(); super.setUp();
primaryConnector = new TransportConfiguration(INVM_CONNECTOR_FACTORY); primaryConnector = new TransportConfiguration(INVM_CONNECTOR_FACTORY);
HashMap<String, Object> params = new HashMap(); HashMap<String, Object> params = new HashMap<>();
params.put(TransportConstants.SERVER_ID_PROP_NAME, "1"); params.put(TransportConstants.SERVER_ID_PROP_NAME, "1");
secondaryConnector = new TransportConfiguration(INVM_CONNECTOR_FACTORY, params); secondaryConnector = new TransportConfiguration(INVM_CONNECTOR_FACTORY, params);
@ -59,8 +59,8 @@ public class ActiveMQRAClusteredTestBase extends ActiveMQRATestBase {
} }
protected Configuration createSecondaryDefaultConfig(boolean secondary) throws Exception { protected Configuration createSecondaryDefaultConfig(boolean secondary) throws Exception {
HashMap invmMap = new HashMap(); HashMap<String, Object> invmMap = new HashMap<>();
HashMap nettyMap = new HashMap(); HashMap<String, Object> nettyMap = new HashMap<>();
String primaryConnectorName = "invm2"; String primaryConnectorName = "invm2";
String secondaryConnectorName = "invm"; String secondaryConnectorName = "invm";
int index = 0; int index = 0;

View File

@ -97,10 +97,9 @@ public class LDAPSecurityTest extends AbstractLdapTestUnit {
testDir = temporaryFolder.getRoot().getAbsolutePath(); testDir = temporaryFolder.getRoot().getAbsolutePath();
} }
@SuppressWarnings("unchecked")
@Test @Test
public void testRunning() throws Exception { public void testRunning() throws Exception {
Hashtable env = new Hashtable(); Hashtable<String, String> env = new Hashtable<>();
env.put(Context.PROVIDER_URL, "ldap://localhost:1024"); env.put(Context.PROVIDER_URL, "ldap://localhost:1024");
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.SECURITY_AUTHENTICATION, "simple"); env.put(Context.SECURITY_AUTHENTICATION, "simple");
@ -108,12 +107,12 @@ public class LDAPSecurityTest extends AbstractLdapTestUnit {
env.put(Context.SECURITY_CREDENTIALS, CREDENTIALS); env.put(Context.SECURITY_CREDENTIALS, CREDENTIALS);
DirContext ctx = new InitialDirContext(env); DirContext ctx = new InitialDirContext(env);
HashSet set = new HashSet(); HashSet<String> set = new HashSet<>();
NamingEnumeration list = ctx.list("ou=system"); NamingEnumeration<NameClassPair> list = ctx.list("ou=system");
while (list.hasMore()) { while (list.hasMore()) {
NameClassPair ncp = (NameClassPair) list.next(); NameClassPair ncp = list.next();
set.add(ncp.getName()); set.add(ncp.getName());
} }

View File

@ -102,17 +102,16 @@ public class LegacyLDAPSecuritySettingPluginListenerTest extends AbstractLdapTes
testDir = temporaryFolder.getRoot().getAbsolutePath(); testDir = temporaryFolder.getRoot().getAbsolutePath();
} }
@SuppressWarnings("unchecked")
@Test @Test
public void testRunning() throws Exception { public void testRunning() throws Exception {
DirContext ctx = getContext(); DirContext ctx = getContext();
HashSet set = new HashSet(); HashSet<String> set = new HashSet<>();
NamingEnumeration list = ctx.list("ou=system"); NamingEnumeration<NameClassPair> list = ctx.list("ou=system");
while (list.hasMore()) { while (list.hasMore()) {
NameClassPair ncp = (NameClassPair) list.next(); NameClassPair ncp = list.next();
set.add(ncp.getName()); set.add(ncp.getName());
} }
@ -124,7 +123,7 @@ public class LegacyLDAPSecuritySettingPluginListenerTest extends AbstractLdapTes
} }
private DirContext getContext() throws NamingException { private DirContext getContext() throws NamingException {
Hashtable env = new Hashtable(); Hashtable<String, String> env = new Hashtable<>();
env.put(Context.PROVIDER_URL, "ldap://localhost:1024"); env.put(Context.PROVIDER_URL, "ldap://localhost:1024");
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.SECURITY_AUTHENTICATION, "simple"); env.put(Context.SECURITY_AUTHENTICATION, "simple");

View File

@ -96,10 +96,9 @@ public class LegacyLDAPSecuritySettingPluginTest extends AbstractLdapTestUnit {
testDir = temporaryFolder.getRoot().getAbsolutePath(); testDir = temporaryFolder.getRoot().getAbsolutePath();
} }
@SuppressWarnings("unchecked")
@Test @Test
public void testRunning() throws Exception { public void testRunning() throws Exception {
Hashtable env = new Hashtable(); Hashtable<String, String> env = new Hashtable<>();
env.put(Context.PROVIDER_URL, "ldap://localhost:1024"); env.put(Context.PROVIDER_URL, "ldap://localhost:1024");
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.SECURITY_AUTHENTICATION, "simple"); env.put(Context.SECURITY_AUTHENTICATION, "simple");
@ -107,12 +106,12 @@ public class LegacyLDAPSecuritySettingPluginTest extends AbstractLdapTestUnit {
env.put(Context.SECURITY_CREDENTIALS, CREDENTIALS); env.put(Context.SECURITY_CREDENTIALS, CREDENTIALS);
DirContext ctx = new InitialDirContext(env); DirContext ctx = new InitialDirContext(env);
HashSet set = new HashSet(); HashSet<String> set = new HashSet<>();
NamingEnumeration list = ctx.list("ou=system"); NamingEnumeration<NameClassPair> list = ctx.list("ou=system");
while (list.hasMore()) { while (list.hasMore()) {
NameClassPair ncp = (NameClassPair) list.next(); NameClassPair ncp = list.next();
set.add(ncp.getName()); set.add(ncp.getName());
} }

View File

@ -42,10 +42,10 @@ public class ConnectionLimitTest extends ActiveMQTestBase {
public void setUp() throws Exception { public void setUp() throws Exception {
super.setUp(); super.setUp();
Map nettyParams = new HashMap(); Map<String, Object> nettyParams = new HashMap<>();
nettyParams.put(TransportConstants.CONNECTIONS_ALLOWED, 1); nettyParams.put(TransportConstants.CONNECTIONS_ALLOWED, 1);
Map invmParams = new HashMap(); Map<String, Object> invmParams = new HashMap<>();
invmParams.put(org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants.CONNECTIONS_ALLOWED, 1); invmParams.put(org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants.CONNECTIONS_ALLOWED, 1);
Configuration configuration = createBasicConfig().addAcceptorConfiguration(new TransportConfiguration(NETTY_ACCEPTOR_FACTORY, nettyParams)).addAcceptorConfiguration(new TransportConfiguration(INVM_ACCEPTOR_FACTORY, invmParams)); Configuration configuration = createBasicConfig().addAcceptorConfiguration(new TransportConfiguration(NETTY_ACCEPTOR_FACTORY, nettyParams)).addAcceptorConfiguration(new TransportConfiguration(INVM_ACCEPTOR_FACTORY, invmParams));

View File

@ -98,7 +98,7 @@ public abstract class StompTestBase extends ActiveMQTestBase {
private Channel channel; private Channel channel;
private BlockingQueue priorityQueue; private BlockingQueue<String> priorityQueue;
private EventLoopGroup group; private EventLoopGroup group;
@ -108,7 +108,7 @@ public abstract class StompTestBase extends ActiveMQTestBase {
@Before @Before
public void setUp() throws Exception { public void setUp() throws Exception {
super.setUp(); super.setUp();
priorityQueue = new ArrayBlockingQueue(1000); priorityQueue = new ArrayBlockingQueue<>(1000);
if (autoCreateServer) { if (autoCreateServer) {
server = createServer(); server = createServer();
addServer(server.getActiveMQServer()); addServer(server.getActiveMQServer());
@ -271,7 +271,7 @@ public abstract class StompTestBase extends ActiveMQTestBase {
} }
public String receiveFrame(long timeOut) throws Exception { public String receiveFrame(long timeOut) throws Exception {
String msg = (String) priorityQueue.poll(timeOut, TimeUnit.MILLISECONDS); String msg = priorityQueue.poll(timeOut, TimeUnit.MILLISECONDS);
return msg; return msg;
} }

View File

@ -31,7 +31,7 @@ public class SimpleJMSMapMessage extends SimpleJMSMessage implements MapMessage
// Attributes ---------------------------------------------------- // Attributes ----------------------------------------------------
protected Map content; protected Map<String, Object> content;
protected boolean bodyReadOnly = false; protected boolean bodyReadOnly = false;
@ -40,7 +40,7 @@ public class SimpleJMSMapMessage extends SimpleJMSMessage implements MapMessage
// Constructors -------------------------------------------------- // Constructors --------------------------------------------------
public SimpleJMSMapMessage() { public SimpleJMSMapMessage() {
content = new HashMap(); content = new HashMap<>();
} }
// MapMessage implementation ------------------------------------- // MapMessage implementation -------------------------------------
@ -472,7 +472,7 @@ public class SimpleJMSMapMessage extends SimpleJMSMessage implements MapMessage
@Override @Override
public Enumeration getMapNames() throws JMSException { public Enumeration getMapNames() throws JMSException {
return Collections.enumeration(new HashMap(content).keySet()); return Collections.enumeration(new HashMap<>(content).keySet());
} }

View File

@ -29,6 +29,7 @@ import javax.naming.Binding;
import javax.naming.Context; import javax.naming.Context;
import javax.naming.Name; import javax.naming.Name;
import javax.naming.NameAlreadyBoundException; import javax.naming.NameAlreadyBoundException;
import javax.naming.NameClassPair;
import javax.naming.NameNotFoundException; import javax.naming.NameNotFoundException;
import javax.naming.NameParser; import javax.naming.NameParser;
import javax.naming.NamingEnumeration; import javax.naming.NamingEnumeration;
@ -152,17 +153,17 @@ public class InVMContext implements Context, Serializable {
} }
@Override @Override
public NamingEnumeration list(final Name name) throws NamingException { public NamingEnumeration<NameClassPair> list(final Name name) throws NamingException {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override @Override
public NamingEnumeration list(final String name) throws NamingException { public NamingEnumeration<NameClassPair> list(final String name) throws NamingException {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override @Override
public NamingEnumeration listBindings(final Name name) throws NamingException { public NamingEnumeration<Binding> listBindings(final Name name) throws NamingException {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }

View File

@ -32,7 +32,7 @@ public class InVMInitialContextFactory implements InitialContextFactory {
// Static -------------------------------------------------------- // Static --------------------------------------------------------
private static Map initialContexts; private static Map<Integer, Context> initialContexts;
static { static {
InVMInitialContextFactory.reset(); InVMInitialContextFactory.reset();
@ -59,7 +59,7 @@ public class InVMInitialContextFactory implements InitialContextFactory {
// Public -------------------------------------------------------- // Public --------------------------------------------------------
@Override @Override
public Context getInitialContext(final Hashtable environment) throws NamingException { public Context getInitialContext(final Hashtable<?, ?> environment) throws NamingException {
// try first in the environment passed as argument ... // try first in the environment passed as argument ...
String s = (String) environment.get(Constants.SERVER_INDEX_PROPERTY_NAME); String s = (String) environment.get(Constants.SERVER_INDEX_PROPERTY_NAME);
@ -107,7 +107,7 @@ public class InVMInitialContextFactory implements InitialContextFactory {
} }
public static void reset() { public static void reset() {
InVMInitialContextFactory.initialContexts = new HashMap(); InVMInitialContextFactory.initialContexts = new HashMap<>();
} }
// Package protected --------------------------------------------- // Package protected ---------------------------------------------

View File

@ -41,7 +41,7 @@ public class InVMInitialContextFactoryBuilder implements InitialContextFactoryBu
// InitialContextFactoryBuilder implementation -------------------------------------------------- // InitialContextFactoryBuilder implementation --------------------------------------------------
@Override @Override
public InitialContextFactory createInitialContextFactory(final Hashtable environment) throws NamingException { public InitialContextFactory createInitialContextFactory(final Hashtable<?, ?> environment) throws NamingException {
InitialContextFactory icf = null; InitialContextFactory icf = null;

View File

@ -89,7 +89,7 @@ public final class NonSerializableFactory implements ObjectFactory {
public Object getObjectInstance(final Object obj, public Object getObjectInstance(final Object obj,
final Name name, final Name name,
final Context nameCtx, final Context nameCtx,
final Hashtable env) throws Exception { final Hashtable<?, ?> env) throws Exception {
Reference ref = (Reference) obj; Reference ref = (Reference) obj;
RefAddr addr = ref.get("nns"); RefAddr addr = ref.get("nns");
String key = (String) addr.getContent(); String key = (String) addr.getContent();

View File

@ -235,7 +235,7 @@ public class MessageTypeTest extends PTPTestCase {
@Test @Test
public void testObjectMessage_2() { public void testObjectMessage_2() {
try { try {
Vector vector = new Vector(); Vector<Object> vector = new Vector<>();
vector.add("pi"); vector.add("pi");
vector.add(new Double(3.14159)); vector.add(new Double(3.14159));

View File

@ -171,7 +171,7 @@ public class MessageHeaderTest extends PTPTestCase {
try { try {
admin.createQueue("anotherQueue"); admin.createQueue("anotherQueue");
Hashtable props = new Hashtable<>(); Hashtable<String, String> props = new Hashtable<>();
props.put(Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getName()); props.put(Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getName());
props.put("queue.anotherQueue", "anotherQueue"); props.put("queue.anotherQueue", "anotherQueue");

View File

@ -115,7 +115,7 @@ public abstract class PTPTestCase extends JMSTestCase {
admin.createQueueConnectionFactory(PTPTestCase.QCF_NAME); admin.createQueueConnectionFactory(PTPTestCase.QCF_NAME);
admin.createQueue(PTPTestCase.QUEUE_NAME); admin.createQueue(PTPTestCase.QUEUE_NAME);
Hashtable props = new Hashtable<>(); Hashtable<String, String> props = new Hashtable<>();
props.put(Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getCanonicalName()); props.put(Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getCanonicalName());
props.put("connectionFactory." + PTPTestCase.QCF_NAME, "tcp://127.0.0.1:61616?type=QUEUE_CF"); props.put("connectionFactory." + PTPTestCase.QCF_NAME, "tcp://127.0.0.1:61616?type=QUEUE_CF");
props.put("queue." + PTPTestCase.QUEUE_NAME, PTPTestCase.QUEUE_NAME); props.put("queue." + PTPTestCase.QUEUE_NAME, PTPTestCase.QUEUE_NAME);

View File

@ -115,7 +115,7 @@ public abstract class PubSubTestCase extends JMSTestCase {
admin.createTopicConnectionFactory(PubSubTestCase.TCF_NAME); admin.createTopicConnectionFactory(PubSubTestCase.TCF_NAME);
admin.createTopic(PubSubTestCase.TOPIC_NAME); admin.createTopic(PubSubTestCase.TOPIC_NAME);
Hashtable props = new Hashtable<>(); Hashtable<String, String> props = new Hashtable<>();
props.put(Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getCanonicalName()); props.put(Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getCanonicalName());
props.put("connectionFactory." + PubSubTestCase.TCF_NAME, "tcp://127.0.0.1:61616?type=TOPIC_CF"); props.put("connectionFactory." + PubSubTestCase.TCF_NAME, "tcp://127.0.0.1:61616?type=TOPIC_CF");
props.put("topic." + PubSubTestCase.TOPIC_NAME, PubSubTestCase.TOPIC_NAME); props.put("topic." + PubSubTestCase.TOPIC_NAME, PubSubTestCase.TOPIC_NAME);

View File

@ -165,7 +165,7 @@ public abstract class UnifiedTestCase extends JMSTestCase {
admin.createQueue(UnifiedTestCase.QUEUE_NAME); admin.createQueue(UnifiedTestCase.QUEUE_NAME);
admin.createTopic(UnifiedTestCase.TOPIC_NAME); admin.createTopic(UnifiedTestCase.TOPIC_NAME);
Hashtable props = new Hashtable<>(); Hashtable<String, String> props = new Hashtable<>();
props.put(Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getCanonicalName()); props.put(Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getCanonicalName());
props.put("connectionFactory." + UnifiedTestCase.CF_NAME, "tcp://127.0.0.1:61616"); props.put("connectionFactory." + UnifiedTestCase.CF_NAME, "tcp://127.0.0.1:61616");
props.put("connectionFactory." + UnifiedTestCase.QCF_NAME, "tcp://127.0.0.1:61616?type=QUEUE_CF"); props.put("connectionFactory." + UnifiedTestCase.QCF_NAME, "tcp://127.0.0.1:61616?type=QUEUE_CF");

View File

@ -66,7 +66,7 @@ public abstract class SequentialFileFactoryTestBase extends ActiveMQTestBase {
@Test @Test
public void listFilesOnNonExistentFolder() throws Exception { public void listFilesOnNonExistentFolder() throws Exception {
SequentialFileFactory fileFactory = createFactory("./target/dontexist"); SequentialFileFactory fileFactory = createFactory("./target/dontexist");
List list = fileFactory.listFiles("tmp"); List<String> list = fileFactory.listFiles("tmp");
Assert.assertNotNull(list); Assert.assertNotNull(list);
Assert.assertEquals(0, list.size()); Assert.assertEquals(0, list.size());
} }