FileDocCategorySizeDatePackage
Test.javaAPI DocAzureus 3.0.3.45044Mon Jun 04 17:50:14 BST 2007com.aelitis.azureus.core.messenger

Test

public class Test extends Object
author
TuxPaper
created
Sep 26, 2006

Fields Summary
Constructors Summary
Methods Summary
public static voiddumpMap(java.util.Map map, java.lang.String indent)

		for (Iterator iterator = map.keySet().iterator(); iterator.hasNext();) {
			Object key = (Object) iterator.next();
			Object value = map.get(key);
			if (value instanceof Map) {
				System.out.println(key + " - " + ((Map) value).size());
				dumpMap((Map) value, indent + "  ");
			}
			System.out.println(indent + key + ": " + value);
		}
	
public voidinitialize(org.gudy.azureus2.plugins.PluginInterface pi)

		Constants.initialize(AzureusCoreFactory.getSingleton());
		System.out.println(Constants.URL_SUFFIX);

		PlatformMessenger.init();
		Map parameters = new HashMap();
		parameters.put("section-type", "browse");
		parameters.put("locale", Locale.getDefault().toString());
		System.out.println(SystemTime.getCurrentTime() + ": queueMessage 0");
		PlatformMessenger.queueMessage(new PlatformMessage("AZMSG", "config",
				"get-browse-sections", parameters, 150),
				new PlatformMessengerListener() {

					public void replyReceived(PlatformMessage message, String replyType,
							Map reply) {
						System.out.println(SystemTime.getCurrentTime() + ": replyRecieved "
								+ message + ";" + replyType + ";" + reply);
					}

					public void messageSent(PlatformMessage message) {
						System.out.println(SystemTime.getCurrentTime() + ": messageSent"
								+ message);
					}

				});

		parameters = new HashMap();
		parameters.put("section-type", "minibrowse");
		parameters.put("locale", Locale.getDefault().toString());
		System.out.println(SystemTime.getCurrentTime() + ": queueMessage 1");
		PlatformMessenger.queueMessage(new PlatformMessage("AZMSG", "config",
				"get-browse-sections", parameters, 550),
				new PlatformMessengerListener() {

					public void replyReceived(PlatformMessage message, String replyType,
							Map reply) {
						System.out.println(SystemTime.getCurrentTime() + ": replyRecieved "
								+ message + ";" + replyType + ";" + reply);
					}

					public void messageSent(PlatformMessage message) {
						System.out.println(SystemTime.getCurrentTime() + ": messageSent"
								+ message);
					}

				});

		System.out.println(SystemTime.getCurrentTime() + ": queueMessage gr");
		PlatformRatingMessenger.getUserRating(
				new String[] { PlatformRatingMessenger.RATE_TYPE_CONTENT
				}, new String[] { "11"
				}, 500, new GetRatingReplyListener() {

					public void messageSent() {
						System.out.println(SystemTime.getCurrentTime() + ": r messageSent");
					}

					public void replyReceived(String replyType, PlatformRatingMessenger.GetRatingReply reply) {
						System.out.println(SystemTime.getCurrentTime() + ": replyRecieved "
								+ ";" + replyType + ";" + reply.getMap().size());
						dumpMap(reply.getMap(), "");
					}

				});

		System.out.println(SystemTime.getCurrentTime() + ": queueMessage 3");
		PlatformRatingMessenger.setUserRating(
				"11", 1, 500, null);
	
public static voidmain(java.lang.String[] args)

		Display display = new Display();
		Shell shell = new Shell(display, SWT.DIALOG_TRIM);
		shell.open();

		int count = 0;
		try {
			AzureusCore core = AzureusCoreFactory.create();
			Test test = new Test();
			test.initialize(core.getPluginManager().getDefaultPluginInterface());

			while (!shell.isDisposed()) {
				if (!display.readAndDispatch()) {
					display.sleep();
				}
			}

		} catch (Throwable e) {

			Debug.printStackTrace(e);
		}