org.apache.log4j.SimpleLayout Java Examples

The following examples show how to use org.apache.log4j.SimpleLayout. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TmfAlignTimeAxisTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Initialization, creates a temp trace
 *
 * @throws IOException
 *             should not happen
 */
@BeforeClass
public static void init() throws IOException {
    SWTBotUtils.initialize();
    Thread.currentThread().setName("SWTBot Thread"); // for the debugger
    /* set up for swtbot */
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout()));
    SWTWorkbenchBot bot = new SWTWorkbenchBot();

    /* finish waiting for eclipse to load */
    WaitUtils.waitForJobs();
    fLocation = File.createTempFile("sample", ".xml");
    try (BufferedRandomAccessFile braf = new BufferedRandomAccessFile(fLocation, "rw")) {
        braf.writeBytes(TRACE_START);
        for (int i = 0; i < NUM_EVENTS; i++) {
            braf.writeBytes(makeEvent(i * 100, i % 4));
        }
        braf.writeBytes(TRACE_END);
    }
    SWTBotUtils.createProject(PROJET_NAME);
    SWTBotUtils.selectTracesFolder(bot, PROJET_NAME);
}
 
Example #2
Source File: TestInvalidCtfTrace.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Initialization
 */
@BeforeClass
public static void beforeClass() {
    SWTBotUtils.initialize();
    Thread.currentThread().setName("SWTBot Thread"); // for the debugger
    /* set up for swtbot */
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout()));
    fBot = new SWTWorkbenchBot();

    /* finish waiting for eclipse to load */
    WaitUtils.waitForJobs();
    SWTBotUtils.createProject(PROJET_NAME);

}
 
Example #3
Source File: RdfSClassGenerator.java    From semweb4j with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void generateCode() throws MojoExecutionException, MojoFailureException {
	try {
	    // make sure that directory for log file exists.
	    rdfReactorLogfile.getParentFile().mkdirs();
		
	    // configure logging infrastructure for RDFReactor
	    FileAppender logFileAppender = new FileAppender(new SimpleLayout(), rdfReactorLogfile.getAbsolutePath());
		BasicConfigurator.configure(logFileAppender);

	} catch (IOException ioe) {
		throw new MojoExecutionException("Cannot open log file for writing RDFReactor log messages", ioe);
	}

	getLog().info("Generating code from RDF schema file " + schemaFile + " into dir " + outputDirectory
			+ ". Classes will be in package " + packageName + " and with method prefix " + methodPrefix +". skipBuiltins is " + skipBuiltins + ".");
	getLog().info("RDFReactor's log messages are written to " + rdfReactorLogfile);


	try {
		CodeGenerator.generate(schemaFile.getAbsolutePath(), outputDirectory.getAbsolutePath(), packageName, Reasoning.rdfs, skipBuiltins, methodPrefix);
	} catch (Exception e) {
		e.printStackTrace();
	    throw new MojoFailureException(e, "RDFS processing error", "Could not generate code from the specified RDF schema file.");
	}
}
 
Example #4
Source File: MovableColumnEventsEditorTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Test Class setup
 */
@BeforeClass
public static void init() {
    SWTBotUtils.initialize();

    /* set up test trace */
    URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(COLUMN_TRACE_PATH), null);
    URI uri;
    try {
        uri = FileLocator.toFileURL(location).toURI();
        fTestFile = new File(uri);
    } catch (URISyntaxException | IOException e) {
        fail(e.getMessage());
    }

    assumeTrue(fTestFile.exists());

    /* Set up for swtbot */
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT));
    fBot = new SWTWorkbenchBot();

    /* Finish waiting for eclipse to load */
    WaitUtils.waitForJobs();
}
 
Example #5
Source File: TestAutoLocalMode.java    From spork with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() throws Exception{
    pigServer = new PigServer(ExecType.MAPREDUCE, cluster.getProperties());
    pigServer.getPigContext().getExecutionEngine().setProperty(PigConfiguration.PIG_OPT_FETCH, "false");
    pigServer.getPigContext().getExecutionEngine().setProperty(PigConfiguration.PIG_AUTO_LOCAL_ENABLED, String.valueOf("true"));
    pigServer.getPigContext().getExecutionEngine().setProperty(PigConfiguration.PIG_AUTO_LOCAL_INPUT_MAXBYTES, "200");

    Logger logger = Logger.getLogger(JobControlCompiler.class);
    logger.removeAllAppenders();
    logger.setLevel(Level.INFO);
    SimpleLayout layout = new SimpleLayout();
    logFile = File.createTempFile("log", "");
    FileAppender appender = new FileAppender(layout, logFile.toString(), false, false, 0);
    logger.addAppender(appender);

    miniFileName = createInputFile("miniFile", 10).getAbsolutePath();
    smallFileName = createInputFile("smallFile", 100).getAbsolutePath();
    bigFileName = createInputFile("bigFile", 1000).getAbsolutePath();
}
 
Example #6
Source File: FilterViewerTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Initialization, creates a temp trace
 *
 * @throws IOException
 *             should not happen
 */
@BeforeClass
public static void init() throws IOException {
    IEclipsePreferences defaultPreferences = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID);
    defaultPreferences.put(ITmfTimePreferencesConstants.TIME_ZONE, "GMT-05:00");
    TmfTimestampFormat.updateDefaultFormats();

    SWTBotUtils.initialize();
    Thread.currentThread().setName("SWTBot Thread"); // for the debugger
    /* set up for swtbot */
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout()));
    fBot = new SWTWorkbenchBot();

    /* finish waiting for eclipse to load */
    WaitUtils.waitForJobs();
    fFileLocation = File.createTempFile("sample", ".xml");
    try (BufferedRandomAccessFile braf = new BufferedRandomAccessFile(fFileLocation, "rw")) {
        braf.writeBytes(TRACE_START);
        for (int i = 0; i < 100; i++) {
            braf.writeBytes(makeEvent(i * 100, i % 4));
        }
        braf.writeBytes(TRACE_END);
    }
}
 
Example #7
Source File: Main.java    From systemsgenetics with GNU General Public License v3.0 6 votes vote down vote up
private static void startLogging(File logFile, boolean debugMode) {

        try {
            FileAppender logAppender = new FileAppender(new SimpleLayout(), logFile.getCanonicalPath(), false);
            Logger.getRootLogger().removeAllAppenders();
            Logger.getRootLogger().addAppender(logAppender);
            if (debugMode) {
                LOGGER.setLevel(Level.DEBUG);
            } else {
                LOGGER.setLevel(Level.INFO);
            }
        } catch (IOException e) {
            System.err.println("Failed to create logger: " + e.getMessage());
            System.exit(1);
        }

        LOGGER.info(
                "\n" + HEADER);
        LOGGER.info("Version: " + VERSION);
        LOGGER.info("Current date and time: " + DATE_TIME_FORMAT.format(currentDataTime));
        LOGGER.info("Log level: " + LOGGER.getLevel());

        System.out.println("Started logging");
        System.out.println();
    }
 
Example #8
Source File: Ase.java    From systemsgenetics with GNU General Public License v3.0 6 votes vote down vote up
private static void startLogging(File logFile, boolean debugMode) {

		try {
			FileAppender logAppender = new FileAppender(new SimpleLayout(), logFile.getCanonicalPath(), false);
			Logger.getRootLogger().removeAllAppenders();
			Logger.getRootLogger().addAppender(logAppender);
			if (debugMode) {
				LOGGER.setLevel(Level.DEBUG);
			} else {
				LOGGER.setLevel(Level.INFO);
			}
		} catch (IOException e) {
			System.err.println("Failed to create logger: " + e.getMessage());
			System.exit(1);
		}

		LOGGER.info(
				"\n" + HEADER);
		LOGGER.info("Version: " + VERSION);
		LOGGER.info("Current date and time: " + DATE_TIME_FORMAT.format(currentDataTime));
		LOGGER.info("Log level: " + LOGGER.getLevel());

		System.out.println("Started logging");
		System.out.println();
	}
 
Example #9
Source File: ProjectExplorerRefreshTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Test Class setup
 *
 * @throws Exception
 *             on error
 */
@BeforeClass
public static void init() throws Exception {
    TestDirectoryStructureUtil.generateTraceStructure(TEST_TRACES_PATH);

    SWTBotUtils.initialize();

    /* Set up for SWTBot */
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT));
    fBot = new SWTWorkbenchBot();

    /* Finish waiting for eclipse to load */
    WaitUtils.waitForJobs();

    SWTBotUtils.createProject(TRACE_PROJECT_NAME);
    IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(TRACE_PROJECT_NAME);
    fTracesFolder = new File(Objects.requireNonNull(TmfProjectRegistry.getProject(project, true).getTracesFolder()).getResource().getLocation().toOSString());

    createCProject(C_PROJECT_NAME);
    setTracingNature(C_PROJECT_NAME);
    IProject cProject = ResourcesPlugin.getWorkspace().getRoot().getProject(C_PROJECT_NAME);
    fCProjectFolder = cProject.getLocation().toFile();
}
 
Example #10
Source File: TestExprLookup.java    From commons-configuration with Apache License 2.0 6 votes vote down vote up
@Test
public void testLookup() throws Exception
{
    final ConsoleAppender app = new ConsoleAppender(new SimpleLayout());
    final Log log = LogFactory.getLog("TestLogger");
    final Logger logger = ((Log4JLogger)log).getLogger();
    logger.addAppender(app);
    logger.setLevel(Level.DEBUG);
    logger.setAdditivity(false);
    final ExprLookup.Variables vars = new ExprLookup.Variables();
    vars.add(new ExprLookup.Variable("String", org.apache.commons.lang3.StringUtils.class));
    vars.add(new ExprLookup.Variable("Util", new Utility("Hello")));
    vars.add(new ExprLookup.Variable("System", "Class:java.lang.System"));
    final XMLConfiguration config = loadConfig();
    final ConfigurationLogger testLogger = new ConfigurationLogger("TestLogger");
    config.setLogger(testLogger);
    final ExprLookup lookup = new ExprLookup(vars);
    lookup.setInterpolator(config.getInterpolator());
    lookup.setLogger(testLogger);
    String str = lookup.lookup(PATTERN1);
    assertTrue(str.startsWith("Goodbye"));
    str = lookup.lookup(PATTERN2);
    assertTrue("Incorrect value: " + str, str.equals("value Some text"));
    logger.removeAppender(app);
}
 
Example #11
Source File: ProjectExplorerTracesFolderTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Test Class setup
 *
 * @throws IOException
 */
@BeforeClass
public static void init() throws IOException {
    TestDirectoryStructureUtil.generateTraceStructure(TEST_TRACES_PATH);

    SWTBotUtils.initialize();

    /* Set up for swtbot */
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT));
    fBot = new SWTWorkbenchBot();

    /* Finish waiting for eclipse to load */
    WaitUtils.waitForJobs();
    SWTBotUtils.createProject(TRACE_PROJECT_NAME);
    importCustomParsers();
}
 
Example #12
Source File: ImportAndReadPcapTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Test Class setup
 */
@BeforeClass
public static void init() {

    SWTBotUtils.initialize();

    /* set up for swtbot */
    SWTBotPreferences.TIMEOUT = 300000; /* 300 second timeout */
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT));
    fBot = new SWTWorkbenchBot();

    SWTBotUtils.closeView("welcome", fBot);
    /* Switch perspectives */
    SWTBotUtils.switchToPerspective(NETWORK_PERSPECTIVE_ID);
    /* Finish waiting for eclipse to load */
    WaitUtils.waitForJobs();
}
 
Example #13
Source File: PatternLatencyViewTestBase.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Things to setup
 */
@BeforeClass
public static void beforeClass() {

    SWTBotUtils.initialize();
    Thread.currentThread().setName("SWTBotTest");
    /* set up for swtbot */
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT));
    /* Finish waiting for eclipse to load */
    WaitUtils.waitForJobs();

    fBot = new SWTWorkbenchBot();

    loadXmlFile();
    openTrace();
}
 
Example #14
Source File: TestTraceOffsetting.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Initialization, creates a temp trace
 *
 * @throws IOException
 *             should not happen
 */
@Before
public void init() throws IOException {
    SWTBotUtils.initialize();
    Thread.currentThread().setName("SWTBot Thread"); // for the debugger
    /* set up for swtbot */
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout()));
    fBot = new SWTWorkbenchBot();

    IEclipsePreferences defaultPreferences = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID);
    defaultPreferences.put(ITmfTimePreferencesConstants.TIME_ZONE, "GMT-05:00");
    TmfTimestampFormat.updateDefaultFormats();

    /* finish waiting for eclipse to load */
    WaitUtils.waitForJobs();
    fLocation = File.createTempFile("sample", ".xml");
    try (BufferedRandomAccessFile braf = new BufferedRandomAccessFile(fLocation, "rw")) {
        braf.writeBytes(TRACE_START);
        for (int i = 0; i < NUM_EVENTS; i++) {
            braf.writeBytes(makeEvent(i * 100, i % 4));
        }
        braf.writeBytes(TRACE_END);
    }
}
 
Example #15
Source File: ControlViewTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Initialization
 */
@BeforeClass
public static void init() {
    SWTBotUtils.initialize();

    Thread.currentThread().setName("SWTBot Thread"); // for the debugger
    /* set up for swtbot */
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout()));
    fBot = new SWTWorkbenchBot();

    SWTBotUtils.closeView("welcome", fBot);

    /* finish waiting for eclipse to load */
    WaitUtils.waitForJobs();

    SWTBotUtils.switchToPerspective(PERSPECTIVE_ID);
}
 
Example #16
Source File: TimeGraphViewUiContextTestBase.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Before Class
 *
 * @throws IOException
 *             If the traces can not be found
 */
@BeforeClass
public static void beforeClass() throws IOException {
    SWTBotUtils.initialize();

    /* set up for swtbot */
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT));
    fBot = new SWTWorkbenchBot();
    SWTBotUtils.closeView("welcome", fBot);
    /* Switch perspectives */
    SWTBotUtils.switchToPerspective(KERNEL_PERSPECTIVE_ID);
    /* Create the trace project */
    SWTBotUtils.createProject(TRACE_PROJECT_NAME);
    /* Finish waiting for eclipse to load */
    WaitUtils.waitForJobs();
}
 
Example #17
Source File: KernelTestBase.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Before Class
 */
@BeforeClass
public static void beforeClass() {
    SWTBotUtils.initialize();

    /* set up for swtbot */
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT));
    fBot = new SWTWorkbenchBot();
    SWTBotUtils.closeView("welcome", fBot);
    /* Switch perspectives */
    SWTBotUtils.switchToPerspective(KERNEL_PERSPECTIVE_ID);
    /* Create the trace project */
    SWTBotUtils.createProject(TRACE_PROJECT_NAME);
    /* Finish waiting for eclipse to load */
    WaitUtils.waitForJobs();
}
 
Example #18
Source File: FindDialogTestBase.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Before Class
 *
 * @throws IOException
 *             When the trace could not be opened
 */
@BeforeClass
public static void beforeClass() throws IOException {
    SWTBotUtils.initialize();

    /* set up for swtbot */
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT));
    fBot = new SWTWorkbenchBot();
    SWTBotUtils.closeView("welcome", fBot);
    /* Switch perspectives */
    SWTBotUtils.switchToPerspective(KERNEL_PERSPECTIVE_ID);
    /* Create the trace project */
    SWTBotUtils.createProject(TRACE_PROJECT_NAME);
    /* Open the trace */
    String tracePath = FileUtils.toFile(FileLocator.toFileURL(CtfTestTrace.ARM_64_BIT_HEADER.getTraceURL())).getAbsolutePath();
    SWTBotUtils.openTrace(TRACE_PROJECT_NAME, tracePath, KERNEL_TRACE_TYPE);
    /* Finish waiting for eclipse to load */
    SWTBotUtils.activateEditor(fBot, CtfTestTrace.ARM_64_BIT_HEADER.getTraceURL().getPath().replaceAll("/", ""));
}
 
Example #19
Source File: XYDataProviderBaseTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Before Class
 */
@BeforeClass
public static void beforeClass() {
    SWTBotUtils.initialize();

    /* set up for swtbot */
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT));
    fBot = new SWTWorkbenchBot();
    SWTBotUtils.closeView("welcome", fBot);
    /* Create the trace project */
    SWTBotUtils.createProject(TRACE_PROJECT_NAME);
    /* Finish waiting for eclipse to load */
    WaitUtils.waitForJobs();
}
 
Example #20
Source File: FlameChartViewTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Initialization
 */
@BeforeClass
public static void init() {
    SWTBotUtils.initialize();

    Thread.currentThread().setName("SWTBot Thread"); // for the debugger
    /* set up for swtbot */
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    sfLogger.removeAllAppenders();
    sfLogger.addAppender(new ConsoleAppender(new SimpleLayout()));
    sfBot = new SWTWorkbenchBot();

    SWTBotUtils.closeView("Statistics", sfBot);
    /* finish waiting for eclipse to load */
    WaitUtils.waitForJobs();
}
 
Example #21
Source File: TraceTypePreferencePageTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Before Class
 */
@BeforeClass
public static void beforeClass() {
    SWTBotUtils.initialize();

    /* set up for swtbot */
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT));
    fBot = new SWTWorkbenchBot();
    /* Create the trace project */
    SWTBotUtils.createProject(TRACE_PROJECT_NAME);
    /* Finish waiting for eclipse to load */
    WaitUtils.waitForJobs();

    /* set up test trace */
    setUpTrace();

}
 
Example #22
Source File: XYDataProviderBaseTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Before Class
 */
@BeforeClass
public static void beforeClass() {
    SWTBotUtils.initialize();

    /* set up for swtbot */
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT));
    fBot = new SWTWorkbenchBot();
    SWTBotUtils.closeView("welcome", fBot);
    /* Create the trace project */
    SWTBotUtils.createProject(TRACE_PROJECT_NAME);
    /* Finish waiting for eclipse to load */
    WaitUtils.waitForJobs();
}
 
Example #23
Source File: SystemCallLatencyDensityViewTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Things to setup
 */
@BeforeClass
public static void beforeClass() {

    SWTBotUtils.initialize();
    Thread.currentThread().setName("SWTBotTest");
    /* set up for swtbot */
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT));
    fBot = new SWTWorkbenchBot();
    /* Finish waiting for eclipse to load */
    WaitUtils.waitForJobs();

}
 
Example #24
Source File: TestImportExportPackageWizard.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/** Test Class setup */
@BeforeClass
public static void init() {
    SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
    SWTBotUtils.initialize();
    Thread.currentThread().setName(SWT_BOT_THREAD_NAME); // for the debugger
    /* set up for swtbot */
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout()));
    fBot = new SWTWorkbenchBot();

    /* finish waiting for eclipse to load */
    WaitUtils.waitForJobs();

}
 
Example #25
Source File: LamiChartViewerTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Start the SWT bot test, register the LAMI analyses and open a trace (any
 * trace) on a new project
 */
@BeforeClass
public static void beforeClass() {

    SWTBotUtils.initialize();
    Thread.currentThread().setName("SWTBotTest");
    /* set up for swtbot */
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT));
    /* Finish waiting for eclipse to load */
    WaitUtils.waitForJobs();

    OnDemandAnalysisManager.getInstance().registerAnalysis(LamiAnalyses.MULTIPLE_ROW.getAnalysis());
    OnDemandAnalysisManager.getInstance().registerAnalysis(LamiAnalyses.MULTIPLE_SIMILAR_ROW.getAnalysis());

    // Create the project and open the trace
    String tracePath = TRACE.getFullPath();

    SWTBotUtils.createProject(PROJECT_NAME);
    SWTBotUtils.openTrace(PROJECT_NAME, tracePath, TRACE_TYPE);
    WaitUtils.waitForJobs();
}
 
Example #26
Source File: FontEventEditorTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Test Class setup
 */
@BeforeClass
public static void init() {
    SWTBotUtils.initialize();

    /* set up test trace */
    URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(COLUMN_TRACE_PATH), null);
    URI uri;
    try {
        uri = FileLocator.toFileURL(location).toURI();
        fTestFile = new File(uri);
    } catch (URISyntaxException | IOException e) {
        fail(e.getMessage());
    }

    assumeTrue(fTestFile.exists());

    /* Set up for swtbot */
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT));
    fBot = new SWTWorkbenchBot();

    /* Finish waiting for eclipse to load */
    WaitUtils.waitForJobs();
}
 
Example #27
Source File: ChartMakerDialogTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Things to setup
 */
@BeforeClass
public static void beforeClass() {

    SWTBotUtils.initialize();
    Thread.currentThread().setName("SWTBotTest");
    /* set up for swtbot */
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT));
    /* Finish waiting for eclipse to load */
    WaitUtils.waitForJobs();
    SWTBotUtils.openView(CustomChartStubView.ID);
    CustomChartStubView.setChartProvider(CHART_PROVIDER);
}
 
Example #28
Source File: PropertiesHelper.java    From wings with Apache License 2.0 5 votes vote down vote up
private static void addFileAppender(Logger logger, String id) {
	if (logger.getAppender(id) != null)
		return;

	String filename = getProposedLogFileName(id);
	try {
		FileAppender fileappender = new FileAppender(new SimpleLayout(), filename);
		fileappender.setAppend(false);
		fileappender.setName(id);
		logger.addAppender(fileappender);
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
Example #29
Source File: ProjectExplorerTraceActionsTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Test Class setup
 *
 * @throws IOException
 *             on error
 */
@BeforeClass
public static void init() throws IOException {
    TestDirectoryStructureUtil.generateTraceStructure(TEST_TRACES_PATH);

    SWTBotUtils.initialize();

    /*
     * FIXME: We can't use Manage Custom Parsers > Import because it uses a native
     * dialog. We'll still check that they show up in the dialog
     */
    CustomTxtTraceDefinition[] txtDefinitions = CustomTxtTraceDefinition.loadAll(getPath("customParsers/ExampleCustomTxtParser.xml"));
    txtDefinitions[0].save();
    /* set up test trace */
    fTestFile = new File(getPath(new Path("import").append(CUSTOM_TEXT_LOG.getTracePath()).toString()));

    assertTrue(fTestFile.exists());

    /* Set up for swtbot */
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT));
    fBot = new SWTWorkbenchBot();

    /* Finish waiting for eclipse to load */
    WaitUtils.waitForJobs();
    SWTBotUtils.createProject(TRACE_PROJECT_NAME);
}
 
Example #30
Source File: CallGraphDensityViewTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Initialization
 */
@BeforeClass
public static void beforeClass() {

    SWTBotUtils.initialize();
    Thread.currentThread().setName("SWTBotTest");
    /* set up for swtbot */
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT));
    /* Finish waiting for eclipse to load */
    WaitUtils.waitForJobs();
}