Skip to main content
summaryrefslogtreecommitdiffstats
blob: fa12a3466c36e6710e33442be076b1dacd945614 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*******************************************************************************
 * Copyright (c) 2011 Boeing.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Boeing - initial API and implementation
 *******************************************************************************/
package org.eclipse.osee.ats.util;

import java.util.Collection;
import org.eclipse.osee.framework.logging.SevereLoggingMonitor;
import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateItem;
import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
import org.eclipse.osee.framework.ui.skynet.blam.AbstractBlam;
import org.eclipse.osee.framework.ui.skynet.blam.BlamContributionManager;
import org.eclipse.osee.framework.ui.skynet.widgets.xnavigate.XNavigateItemBlam;
import org.eclipse.osee.support.test.util.TestUtil;
import org.junit.Assert;

/**
 * @author Karol M. Wilk
 */
public class AtsXWidgetsExampleBlamTest {

   private static final String NAME_OF_ATS_ITEM = "XWidgets Example";

   /**
    * Load NAME_OF_ATS_ITEM blam, log any exceptions and report them as test failures. Purpose of this test is to serve
    * as a regression test to various widgets loaded in XWidgetExampleBlam.
    */
   @org.junit.Test
   public void testXWidgetsExampleBlam() throws Exception {
      SevereLoggingMonitor monitorLog = TestUtil.severeLoggingStart();

      XNavigateItemBlam item = null;
      Collection<AbstractBlam> blams = BlamContributionManager.getBlamOperations();
      boolean foundBlam = false;
      for (AbstractBlam blam : blams) {
         if (blam.getName().equals(NAME_OF_ATS_ITEM)) {
            item = new XNavigateItemBlam(new XNavigateItem(null, "Blam Operations", FrameworkImage.BLAM), blam);
            foundBlam = true;
            break;
         }
      }

      Assert.assertTrue(String.format("%s not found from list of provided Blams.", NAME_OF_ATS_ITEM), foundBlam);
      item.run(TableLoadOption.ForcePend, TableLoadOption.NoUI);

      Assert.assertTrue(
         "Exceptions were thrown during AtsXWidgetsExampleBlamTest (gui test of XWidgetExampleBlam) should be none.",
         monitorLog.getSevereLogs().isEmpty());

      TestUtil.severeLoggingEnd(monitorLog);
   }
}

Back to the top