<commit_before>/*
 * Tigase Jabber/XMPP Server
 * Copyright (C) 2004-2008 "<NAME>" <<EMAIL>>
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, version 3 of the License.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program. Look for COPYING file in the top folder.
 * If not, see http://www.gnu.org/licenses/.
 * 
 * $Rev$
 * Last modified by $Author$
 * $Date$
 */

package tigase.server.sreceiver;

import java.lang.management.ManagementFactory;
import java.lang.management.MemoryUsage;
import java.util.Map;
import java.util.Queue;
import tigase.server.Packet;
import tigase.xml.Element;
import tigase.xmpp.StanzaType;
import static tigase.server.sreceiver.PropertyConstants.*;

/**
 * Created: Jan 22, 2009 11:02:59 AM
 *
 * @author <a href="mailto:<EMAIL>"><NAME></a>
 * @version $Rev$
 */
public class PubSubTestsTask extends RepoRosterTask {

	private static final String TASK_TYPE = "PubSub tests";
	private static final String TASK_HELP = 
					"This is a PubSub component testing task." +
					" Only for testing and only to be run by an admnistrator.";

	private long delay = 2000;
	private Element conf = new Element("x",
					new Element[]{
						new Element("field",
						new Element[]{new Element("value",
							"http://jabber.org/protocol/pubsub#node_config")},
						new String[]{"var", "type"},
						new String[]{"FORM_TYPE", "hidden"}),
						new Element("field",
						new Element[]{new Element("value", "0")},
						new String[]{"var"},
						new String[]{"pubsub#notify_sub_aff_state"})},
					new String[]{"xmlns", "type"},
					new String[]{"jabber:x:data", "submit"});
	private boolean stop = false;


	private boolean memoryLow() {
		MemoryUsage heap = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
		return new Long(heap.getUsed()).doubleValue()/new Long(heap.getMax()).doubleValue() > 0.7;
	}

	private enum command {
		help(" - Displays help info."),
		newnodes(" N - Create N nodes in the pubsub."),
		newsubscr(" node-name N - create N subscriptions for a given node name."),
		newnodessubscr(" N M -  create N nodes with M subscriptions each."),
		setdelay(" N - set the delay between sending node creation packet."),
		stop(" - Stops the current packets generation.");

		private String helpText = null;

		private command(String helpText) {
			this.helpText = helpText;
		}

		public String getHelp() {
			return helpText;
		}

	};

	@Override
	public String getType() {
		return TASK_TYPE;
	}<commit_msg>Changed threshold to 0.6<commit_after>/*
 * Tigase Jabber/XMPP Server
 * Copyright (C) 2004-2008 "<NAME>" <<EMAIL>>
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, version 3 of the License.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program. Look for COPYING file in the top folder.
 * If not, see http://www.gnu.org/licenses/.
 * 
 * $Rev$
 * Last modified by $Author$
 * $Date$
 */

package tigase.server.sreceiver;

import java.lang.management.ManagementFactory;
import java.lang.management.MemoryUsage;
import java.util.Map;
import java.util.Queue;
import tigase.server.Packet;
import tigase.xml.Element;
import tigase.xmpp.StanzaType;
import static tigase.server.sreceiver.PropertyConstants.*;

/**
 * Created: Jan 22, 2009 11:02:59 AM
 *
 * @author <a href="mailto:<EMAIL>"><NAME></a>
 * @version $Rev$
 */
public class PubSubTestsTask extends RepoRosterTask {

	private static final String TASK_TYPE = "PubSub tests";
	private static final String TASK_HELP = 
					"This is a PubSub component testing task." +
					" Only for testing and only to be run by an admnistrator.";

	private long delay = 2000;
	private Element conf = new Element("x",
					new Element[]{
						new Element("field",
						new Element[]{new Element("value",
							"http://jabber.org/protocol/pubsub#node_config")},
						new String[]{"var", "type"},
						new String[]{"FORM_TYPE", "hidden"}),
						new Element("field",
						new Element[]{new Element("value", "0")},
						new String[]{"var"},
						new String[]{"pubsub#notify_sub_aff_state"})},
					new String[]{"xmlns", "type"},
					new String[]{"jabber:x:data", "submit"});
	private boolean stop = false;


	private boolean memoryLow() {
		MemoryUsage heap = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
		return new Long(heap.getUsed()).doubleValue()/new Long(heap.getMax()).doubleValue() > 0.6;
	}

	private enum command {
		help(" - Displays help info."),
		newnodes(" N - Create N nodes in the pubsub."),
		newsubscr(" node-name N - create N subscriptions for a given node name."),
		newnodessubscr(" N M -  create N nodes with M subscriptions each."),
		setdelay(" N - set the delay between sending node creation packet."),
		stop(" - Stops the current packets generation.");

		private String helpText = null;

		private command(String helpText) {
			this.helpText = helpText;
		}

		public String getHelp() {
			return helpText;
		}

	};

	@Override
	public String getType() {
		return TASK_TYPE;
	}
{'fraction_non_alphanumeric': 0.12108089381604019, 'fraction_numerical': 0.010046769443963278, 'mean_word_length': 3.791701244813278, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4737915', 'n_tokens_mistral': 1947, 'n_tokens_neox': 1692, 'n_words': 613}