Java Code Examples for junit.framework.TestCase

The following examples show how to use junit.framework.TestCase. These examples are extracted from open source projects. 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 Project: Concurnas   Source File: ConccCompileTests.java    License: MIT License 6 votes vote down vote up
@Test
public void localRootOverride() throws Throwable {
	ConccTestMockFileLoader mockFL = new ConccTestMockFileLoader();
	ConccTestMockFileWriter mockWriter = new ConccTestMockFileWriter(mockFL);
	
	Path root = mockFL.fs.getPath("/work/hg");
	Files.createDirectory(root);
	
	Path myClass = root.resolve("MyClass.conc"); 
	Files.write(myClass, ListMaker.make("def doings() => 'hi there'"), StandardCharsets.UTF_8);
	Concc concc = new Concc("/work[/hg]", mockFL, mockWriter);
	
	TestCase.assertEquals("", concc.doit());
	
	byte[] code = Files.readAllBytes(mockFL.fs.getPath("/work/hg/MyClass.class"));
	
	String res = new Executor().execute("hg.MyClass", code);
	
	TestCase.assertEquals("hi there", res);
}
 
Example 2
Source Project: Concurnas   Source File: ConccCompileTests.java    License: MIT License 6 votes vote down vote up
@Test
public void compileMultipleWithDependancies() throws Throwable {
	ConccTestMockFileLoader mockFL = new ConccTestMockFileLoader();
	ConccTestMockFileWriter mockWriter = new ConccTestMockFileWriter(mockFL);

	Path root = mockFL.fs.getPath("/work/com/myorg");
	Files.createDirectories(root);
	
	Path myClass = root.resolve("MyClass.conc"); 
	Files.write(myClass, ListMaker.make("from com.myorg.code2 import myfunc; def doings() => myfunc() "), StandardCharsets.UTF_8);
	
	Path code2 = root.resolve("code2.conc"); 
	Files.write(code2, ListMaker.make("def myfunc() => 'hi there' "), StandardCharsets.UTF_8);
	
	Concc concc = new Concc("/work/[com/myorg/MyClass.conc]", mockFL, mockWriter);
	
	TestCase.assertEquals("", concc.doit());
	
	byte[] code = Files.readAllBytes(mockFL.fs.getPath("/work/com/myorg/MyClass.class"));
	byte[] codeDep = Files.readAllBytes(mockFL.fs.getPath("/work/com/myorg/code2.class"));
	
	//String res = new Executor().addToExecute("hg.MyClass$MySubClass", codeDep).execute("hg.MyClass", code);
	String res = new Executor().addToExecute("com.myorg.code2", codeDep).execute("com.myorg.MyClass", code);
	
	TestCase.assertEquals("hi there", res);
}
 
Example 3
Source Project: Pydev   Source File: PercentToBraceConverterTest.java    License: Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Launch the test.
 *
 * @param args
 *            the command line arguments
 *
 * @generatedBy CodePro at 25.01.11 11:00
 */
public static void main(String[] args) {
    if (args.length == 0) {
        // Run all of the tests
        junit.textui.TestRunner.run(PercentToBraceConverterTest.class);
    } else {
        // Run only the named tests
        TestSuite suite = new TestSuite("Selected tests");
        for (int i = 0; i < args.length; i++) {
            TestCase test = new PercentToBraceConverterTest();
            test.setName(args[i]);
            suite.addTest(test);
        }
        junit.textui.TestRunner.run(suite);
    }
}
 
Example 4
Source Project: netbeans   Source File: Uninstaller.java    License: Apache License 2.0 6 votes vote down vote up
@org.junit.Test
public void testUninstaller() {
    TestData data = new TestData(Logger.getLogger("global"));

    try {
        String wd = System.getenv("WORKSPACE");
        TestCase.assertNotNull(wd);
        data.setWorkDir(new File(wd));
    } catch (IOException ex) {
        TestCase.fail("Can not get WorkDir");
    }


    System.setProperty("nbi.dont.use.system.exit", "true");
    System.setProperty("nbi.utils.log.to.console", "false");
    System.setProperty("servicetag.allow.register", "false");
    System.setProperty("show.uninstallation.survey", "false");
    System.setProperty("user.home", data.getWorkDirCanonicalPath());

    Utils.phaseFive(data);
}
 
Example 5
Source Project: datasync   Source File: MetadataJobTest.java    License: MIT License 6 votes vote down vote up
@Test
public void testValidation() {
	MetadataJob metadataJob = new MetadataJob();
	UserPreferencesJava prefs = setupUserPreferencesForTest();
	
	//Base Validation
	metadataJob.setDatasetID(UNITTEST_DATASET_ID);
	metadataJob.setTitle(RESET_TITLE);
	TestCase.assertEquals(JobStatus.VALID, metadataJob.validate(prefs.getConnectionInfo()));
	
	//Invalid Domain
	prefs.saveDomain(INVALID_DOMAIN);
	TestCase.assertEquals(JobStatus.INVALID_DOMAIN, metadataJob.validate(prefs.getConnectionInfo()));
	prefs.saveDomain(DOMAIN);
	
	//Invalid Dataset ID
	metadataJob.setDatasetID(INVALID_DATASET_ID);
	TestCase.assertEquals(JobStatus.INVALID_DATASET_ID, metadataJob.validate(prefs.getConnectionInfo()));
	metadataJob.setDatasetID(UNITTEST_DATASET_ID);
	
	//Invalid Title
	metadataJob.setTitle("");
	TestCase.assertEquals(JobStatus.MISSING_METADATA_TITLE, metadataJob.validate(prefs.getConnectionInfo()));
	metadataJob.setTitle(RESET_TITLE);
}
 
Example 6
Source Project: datasync   Source File: UserPreferencesTest.java    License: MIT License 6 votes vote down vote up
@Test
public void testLoadUserPreferencesFromFile() throws IOException {
    File configFile = new File(PATH_TO_PROD_CONFIG_FILE);
    ObjectMapper mapper = new ObjectMapper();
    UserPreferences userPrefs = mapper.readValue(configFile, UserPreferencesFile.class);
    TestCase.assertEquals("https://sandbox.demo.socrata.com", userPrefs.getDomain());
    TestCase.assertEquals("[email protected]", userPrefs.getUsername());
    TestCase.assertEquals("OpenData", userPrefs.getPassword());
    TestCase.assertEquals("D8Atrg62F2j017ZTdkMpuZ9vY", userPrefs.getAPIKey());
    TestCase.assertEquals("[email protected]", userPrefs.getAdminEmail());
    TestCase.assertEquals(false, userPrefs.emailUponError());
    TestCase.assertEquals("", userPrefs.getLogDatasetID());
    TestCase.assertEquals("smtp.something.com", userPrefs.getOutgoingMailServer());
    TestCase.assertEquals("21", userPrefs.getSmtpPort());
    TestCase.assertEquals("47", userPrefs.getSslPort());
    TestCase.assertEquals("[email protected]", userPrefs.getSmtpUsername());
    TestCase.assertEquals("smtppass", userPrefs.getSmtpPassword());
    TestCase.assertEquals("10", userPrefs.getFilesizeChunkingCutoffMB());
    TestCase.assertEquals("10000", userPrefs.getNumRowsPerChunk());
}
 
Example 7
public static void executeAll( final MasterReport report ) throws Exception {
  logger.debug( "   GRAPHICS2D .." );
  TestCase.assertTrue( DebugReportRunner.execGraphics2D( report ) );
  logger.debug( "   PDF .." );
  TestCase.assertTrue( DebugReportRunner.createPDF( report ) );
  logger.debug( "   CSV .." );
  DebugReportRunner.createCSV( report );
  logger.debug( "   PLAIN_TEXT .." );
  TestCase.assertTrue( DebugReportRunner.createPlainText( report ) );
  logger.debug( "   RTF .." );
  DebugReportRunner.createRTF( report );
  logger.debug( "   STREAM_HTML .." );
  DebugReportRunner.createStreamHTML( report );
  logger.debug( "   EXCEL .." );
  DebugReportRunner.createXLS( report );
  logger.debug( "   ZIP_HTML .." );
  DebugReportRunner.createZIPHTML( report );
}
 
Example 8
public void testErrorTearingDownDoesntMaskErrorRunning() {
	final Exception running= new Exception("Running");
	TestCase t= new TestCase() {
		protected void runTest() throws Throwable {
			throw running;
		}
		protected void tearDown() throws Exception {
			throw new Error("Tearing down");
		}
	};
	try {
		t.runBare();
	} catch (Throwable thrown) {
		assertSame(running, thrown);
	}
}
 
Example 9
public void testOFStatisticsRequestVendor() throws Exception {
    byte[] packet = new byte[] { 0x01, 0x10, 0x00, 0x50, 0x00, 0x00, 0x00,
            0x63, (byte) 0xff, (byte) 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x4c, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x01, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x20,
            (byte) 0xe0, 0x00, 0x11, 0x00, 0x0c, 0x29, (byte) 0xc5,
            (byte) 0x95, 0x57, 0x02, 0x25, 0x5c, (byte) 0xca, 0x00, 0x02,
            (byte) 0xff, (byte) 0xff, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x50, 0x04,
            0x00, 0x00, 0x00, 0x00, (byte) 0xff, 0x00, 0x00, 0x00,
            (byte) 0xff, (byte) 0xff, 0x4e, 0x20 };

    OFMessageFactory factory = BasicFactory.getInstance();
    ChannelBuffer packetBuf = ChannelBuffers.wrappedBuffer(packet);
    List<OFMessage> msg = factory.parseMessage(packetBuf);
    TestCase.assertNotNull(msg);
    TestCase.assertEquals(msg.size(), 1);
    TestCase.assertTrue(msg.get(0) instanceof OFStatisticsRequest);
    OFStatisticsRequest sr = (OFStatisticsRequest) msg.get(0);
    TestCase.assertEquals(OFStatisticsType.VENDOR, sr.getStatisticType());
    TestCase.assertEquals(1, sr.getStatistics().size());
    TestCase.assertTrue(sr.getStatistics().get(0) instanceof OFVendorStatistics);
    TestCase.assertEquals(68, ((OFVendorStatistics)sr.getStatistics().get(0)).getLength());
}
 
Example 10
Source Project: floodlight_with_topoguard   Source File: OFErrorTest.java    License: Apache License 2.0 6 votes vote down vote up
public void testGarbageAtEnd() throws MessageParseException {
    // This is a OFError msg (12 bytes), that encaps a OFVendor msg (24
    // bytes)
    // AND some zeros at the end (40 bytes) for a total of 76 bytes
    // THIS is what an NEC sends in reply to Nox's VENDOR request
    byte[] oferrorRaw = { 0x01, 0x01, 0x00, 0x4c, 0x00, 0x00, 0x10,
            (byte) 0xcc, 0x00, 0x01, 0x00, 0x01, 0x01, 0x04, 0x00, 0x18,
            0x00, 0x00, 0x10, (byte) 0xcc, 0x00, 0x00, 0x23, 0x20, 0x00,
            0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00 };
    OFMessageFactory factory = BasicFactory.getInstance();
    ChannelBuffer oferrorBuf = 
            ChannelBuffers.wrappedBuffer(oferrorRaw);
    List<OFMessage> msg = factory.parseMessage(oferrorBuf);
    TestCase.assertNotNull(msg);
    TestCase.assertEquals(msg.size(), 1);
    TestCase.assertEquals(76, msg.get(0).getLengthU());
    ChannelBuffer out = ChannelBuffers.dynamicBuffer();
    msg.get(0).writeTo(out);
    TestCase.assertEquals(76, out.readableBytes());
}
 
Example 11
Source Project: esigate   Source File: CacheStorageTestUtils.java    License: Apache License 2.0 6 votes vote down vote up
static void testBasicOperations(CacheStorage cacheStorage) throws Exception {
    String key = "foo";
    HttpCacheEntry entry = makeCacheEntry("entry");
    TestCase.assertNull("Cache should be empty", cacheStorage.getEntry(key));
    cacheStorage.putEntry(key, entry);
    TestCase.assertEquals("Now the entry should be in cache", getContent(entry),
            getContent(cacheStorage.getEntry(key)));
    final HttpCacheEntry newEntry = makeCacheEntry("new entry");
    HttpCacheUpdateCallback callback = new HttpCacheUpdateCallback() {
        @Override
        public HttpCacheEntry update(HttpCacheEntry existing) {
            return newEntry;
        }
    };
    cacheStorage.updateEntry(key, callback);
    TestCase.assertEquals("Entry should have been updated", getContent(newEntry),
            getContent(cacheStorage.getEntry(key)));
    cacheStorage.removeEntry(key);
    TestCase.assertNull("Entry should have been deleted", cacheStorage.getEntry(key));
}
 
Example 12
Source Project: spring-boot-seed   Source File: IUserServiceTest.java    License: MIT License 6 votes vote down vote up
@Test
public void addUser(){
    User user = new User();
    user.setUserName("admin_abc");
    user.setPassword("123456");
    user.setNickName("ADMINABC");
    user.setEmail("[email protected]");
    user.setStateCode(BooleanEnum.YES.getValue());
    user.setMobile("18912345678");
    userService.addUser(user);
    User result = userService.queryByIdOrName(null, "admin_abc");
    log.info("==========================================================================");
    log.info("查询结果 ==> {}", result);
    log.info("==========================================================================");
    TestCase.assertNotNull(user);
}
 
Example 13
Source Project: DataVec   Source File: TestTransforms.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testReplaceEmptyIntegerWithValueTransform() {
    Schema schema = getSchema(ColumnType.Integer);

    Transform transform = new ReplaceEmptyIntegerWithValueTransform("column", 1000);
    transform.setInputSchema(schema);
    Schema out = transform.transform(schema);

    assertEquals(1, out.getColumnMetaData().size());
    TestCase.assertEquals(ColumnType.Integer, out.getMetaData(0).getColumnType());

    assertEquals(Collections.singletonList((Writable) new IntWritable(0)),
            transform.map(Collections.singletonList((Writable) new IntWritable(0))));
    assertEquals(Collections.singletonList((Writable) new IntWritable(1)),
            transform.map(Collections.singletonList((Writable) new IntWritable(1))));
    assertEquals(Collections.singletonList((Writable) new IntWritable(1000)),
            transform.map(Collections.singletonList((Writable) new Text(""))));
}
 
Example 14
Source Project: datasync   Source File: IntegrationUtilityTest.java    License: MIT License 6 votes vote down vote up
@Test
public void testUpsertTSVFile() throws IOException, SodaError, InterruptedException, LongRunningQueryException {
    final Soda2Producer producer = createProducer();
    final SodaDdl ddl = createSodaDdl();

    // Ensures dataset is in known state (2 rows)
    File twoRowsFile = new File("src/test/resources/datasync_unit_test_two_rows.csv");
    Soda2Publisher.replaceNew(producer, ddl, UNITTEST_DATASET_ID, twoRowsFile, true);

    File threeRowsFile = new File("src/test/resources/datasync_unit_test_three_rows.tsv");
    UpsertResult result = Soda2Publisher.appendUpsert(producer, ddl, UNITTEST_DATASET_ID, threeRowsFile, 0, true);

    TestCase.assertEquals(0, result.errorCount());
    TestCase.assertEquals(2, result.getRowsUpdated());
    TestCase.assertEquals(1, result.getRowsCreated());
    TestCase.assertEquals(3, getTotalRows(UNITTEST_DATASET_ID));
}
 
Example 15
Source Project: DataVec   Source File: TestTransforms.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testTimeMathOpTransform() {
    Schema schema = new Schema.Builder().addColumnTime("column", DateTimeZone.UTC).build();

    Transform transform = new TimeMathOpTransform("column", MathOp.Add, 12, TimeUnit.HOURS); //12 hours: 43200000 milliseconds
    transform.setInputSchema(schema);

    Schema out = transform.transform(schema);
    assertEquals(1, out.getColumnMetaData().size());
    TestCase.assertEquals(ColumnType.Time, out.getType(0));

    assertEquals(Collections.singletonList((Writable) new LongWritable(1000 + 43200000)),
            transform.map(Collections.singletonList((Writable) new LongWritable(1000))));
    assertEquals(Collections.singletonList((Writable) new LongWritable(1452441600000L + 43200000)),
            transform.map(Collections.singletonList((Writable) new LongWritable(1452441600000L))));
}
 
Example 16
public void testGraphemeClusterGenerationUnix() {
  CodePointBuffer buffer = Utf16LE.getInstance().decodeString( "T\n\n\nT", null ); //$NON-NLS-1$
  final int[] data = buffer.getBuffer();
  final boolean[] result = new boolean[]
    {
      true, true, true, true, true
    };
  GraphemeClusterProducer prod = new GraphemeClusterProducer();

  for ( int i = 0; i < buffer.getLength(); i++ ) {
    final int codepoint = data[ i ];
    if ( prod.createGraphemeCluster( codepoint ) != result[ i ] ) {
      TestCase.fail();
    }
  }
}
 
Example 17
Source Project: Concurnas   Source File: ConcExeTests.java    License: MIT License 6 votes vote down vote up
@Test
public void concFromJarMainCmdLineArgs() throws Throwable {
	ConccTestMockFileLoader mockFL = new ConccTestMockFileLoader();
	ConccTestMockFileWriter mockWriter = new ConccTestMockFileWriter(mockFL);
	
	Path root = mockFL.fs.getPath("/work/hg");
	Files.createDirectory(root);

	Files.createDirectory(mockFL.fs.getPath("/bin"));
	
	Path myClass = root.resolve("MyClass.conc"); 
	Files.write(myClass, ListMaker.make("def main(args String[]) => System.err.println('got: ' + args)"), StandardCharsets.UTF_8);

	Concc concc = new Concc("-jar myJar[hg.MyClass] -d /bin -a /work", mockFL, mockWriter);
	
	TestCase.assertEquals("", concc.doit());
	TestCase.assertTrue(Files.exists(mockFL.fs.getPath("/bin/myJar.jar")));

	Conc conc = new Conc("/bin/myJar one two three", mockFL);//ok
	checkOutput(conc, "got: [one two three]");
}
 
Example 18
Source Project: Concurnas   Source File: ConccSemanticsTests.java    License: MIT License 6 votes vote down vote up
@Test
public void includeFriendsFromDirManyFriends() throws IOException {
	ConccTestMockFileLoader mockFL = new ConccTestMockFileLoader();
	ConccTestMockFileWriter mockWriter = new ConccTestMockFileWriter(mockFL);

	Path workDir = mockFL.fs.getPath("/work/com/thing/");
	Files.createDirectories(workDir);
	Files.createFile(workDir.resolve("MyFirstClass.conc"));
	Files.createFile(workDir.resolve("MyFirstClass2.conc"));
	
	Concc concc = new Concc("/work/[com/thing/MyFirstClass.conc com/thing/MyFirstClass2.conc]", mockFL, mockWriter);
	
	ValidationErrorsAndValidObject validAndVO = concc.validateConccInstance(concc.getConccInstance());
	//no filtering at this point
	TestCase.assertNull(validAndVO.validationErrs);
	String expect = "/work/com/thing/MyFirstClass.conc[com.thing true] /work/com/thing/MyFirstClass2.conc[com.thing false] /work/com/thing/MyFirstClass2.conc[com.thing true] /work/com/thing/MyFirstClass.conc[com.thing false]";
	TestCase.assertEquals(expect, validAndVO.validconcObject.toString());
}
 
Example 19
/**
 * Test the CompoundCurve conversion
 * 
 * @param converter
 * @param compoundCurve
 */
private static void convertCompoundCurve(GoogleMapShapeConverter converter,
		CompoundCurve compoundCurve) {

	MultiPolylineOptions polylines = converter.toPolylines(compoundCurve);
	TestCase.assertNotNull(polylines);
	TestCase.assertFalse(polylines.getPolylineOptions().isEmpty());

	List<LineString> lineStrings = compoundCurve.getLineStrings();
	compareLineStringsAndPolylines(converter, lineStrings,
			polylines.getPolylineOptions());

	CompoundCurve compoundCurve2 = converter
			.toCompoundCurveWithOptions(polylines);
	compareLineStrings(lineStrings, compoundCurve2.getLineStrings());
}
 
Example 20
Source Project: floodlight_with_topoguard   Source File: HexStringTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testToLongMSB() {
    String dpidStr = "ca:7c:5e:d1:64:7a:95:9b";
    long valid = -3856102927509056101L;
    long testLong = HexString.toLong(dpidStr);
    TestCase.assertEquals(valid, testLong);
}
 
Example 21
Source Project: netbeans   Source File: SimpleLexerIncTest.java    License: Apache License 2.0 5 votes vote down vote up
private static void checkText(CharSequence tokenText, String expectedText, boolean checkSub) {
    int len = tokenText.length();
    TestCase.assertEquals("Token text length", expectedText.length(), len);
    for (int j = 0; j < len; j++) {
        TestCase.assertEquals("tokenText.charAt(" + j + ")", expectedText.charAt(j), tokenText.charAt(j));
        if (checkSub) {
            checkText(tokenText.subSequence(0, j), expectedText.substring(0, j), false);
            checkText(tokenText.subSequence(j, len), expectedText.substring(j, len), false);
        }
    }
}
 
Example 22
Source Project: j2objc   Source File: SerializationTest.java    License: Apache License 2.0 5 votes vote down vote up
private static Serializable getObject(TestCase test, String toAppend) throws Exception {
    StringBuilder path = new StringBuilder("/serialization");
    path.append(File.separatorChar);
    path.append(test.getClass().getName().replace('.', File.separatorChar));
    path.append(toAppend);

    String pathString = path.toString();

    InputStream in = SerializationTest.class.getResourceAsStream(pathString);
    assertNotNull("Failed to load serialization resource file: " + path, in);
    return getObjectFromStream(in);
}
 
Example 23
Source Project: Concurnas   Source File: ConccSyntaxTests.java    License: MIT License 5 votes vote down vote up
@Test
public void testShowBasicUsage() {
	Concc concc2 = new Concc("-options ", null, null);
	String expect = Concc.genericErrorMsg;
	
	String got = concc2.doit();
	TestCase.assertEquals(expect, got);
	//System.err.println(got);
}
 
Example 24
Source Project: dubbo-2.6.5   Source File: AbstractConfigTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void checkMultiName() throws Exception {
    try {
        AbstractConfig.checkMultiName("hello", ",-._0123abcdABCD");
    } catch (Exception e) {
        TestCase.fail("the value should be legal.");
    }
}
 
Example 25
Source Project: evosql   Source File: TestSqlPersistent.java    License: Apache License 2.0 5 votes vote down vote up
public static void main(String[] argv) {

        TestResult result = new TestResult();
        TestCase   testC  = new TestSqlPersistent("testInsertObject");
        TestCase   testD  = new TestSqlPersistent("testSelectObject");

        testC.run(result);
        testD.run(result);
        System.out.println("TestSqlPersistent error count: "
                           + result.failureCount());
    }
 
Example 26
Source Project: oodt   Source File: TestQueueMuxMonitor.java    License: Apache License 2.0 5 votes vote down vote up
public void testReduceLoad() {
    try {
        TestCase.assertTrue(monitor.reduceLoad(map.get(mock1).get(2), 5));
        TestCase.assertTrue(monitor.reduceLoad(map.get(mock2).get(2), 3));
        TestCase.assertEquals(map.get(mock1).get(2).getCapacity(),25);
        TestCase.assertEquals(map.get(mock2).get(2).getCapacity(),27);
        try {
            monitor.reduceLoad(superfluous, 2);
            TestCase.fail("Exception not thrown for unknown queue.");
        } catch (MonitorException ignored) {}
    } catch(MonitorException e) {
        TestCase.fail("Unanticipated monitor exception caught: "+e.getMessage());
    }
}
 
Example 27
Source Project: netbeans   Source File: Utils.java    License: Apache License 2.0 5 votes vote down vote up
public static void phaseFive( TestData data )
{
  TestCase.assertEquals(
      "Extract uninstaller jar",
      OK,
      Utils.extractUninstallerJar( data )
    );
  TestCase.assertEquals("Load engine classes", OK, Utils.loadEngineClasses(data));
  TestCase.assertEquals("Run uninstaller main class", OK, Utils.runUninstaller(data));

  Utils.stepUninstall(data);

  Utils.stepFinish();

  Utils.waitSecond(data, 5);

  TestCase.assertEquals("Uninstaller Finshed", 0, ((Integer) System.getProperties().get("nbi.exit.code")).intValue());

  TestCase.assertFalse(
      "NetBeans dir deleted",
      Utils.dirExist( data.GetNetBeansInstallPath( ) ).equals( OK )
    );
  TestCase.assertFalse(
      "GlassFish2 dir deleted",
      Utils.dirExist( data.GetApplicationServerInstallPath( ) ).equals( OK )
    );
  if( data.m_bPreludePresents )
  {
    TestCase.assertFalse(
        "Prelude dir deleted",
        Utils.dirExist( data.GetApplicationServerPreludeInstallPath( ) ).equals( OK )
    );
  }
  TestCase.assertFalse(
      "Tomcat dir deleted",
      Utils.dirExist( data.GetTomcatInstallPath( ) ).equals( OK )
    );
  //TestCase.assertFalse("GlassFish3 dir deleted", Utils.dirExist(GF3_DIR_NAME, data).equals(OK));
}
 
Example 28
Source Project: oodt   Source File: TestQueueMuxMonitor.java    License: Apache License 2.0 5 votes vote down vote up
public void testAddNode() {
    try {
        ResourceNode node = new ResourceNode("a-new-node",null,2);
        qm.addNodeToQueue(node.getNodeId(), "queue-1");
        monitor.addNode(node);
        TestCase.assertEquals(node,mock1.getAdded());
    } catch(MonitorException e) {
        TestCase.fail("Unanticipated monitor exception caught: "+e.getMessage());
    } catch (QueueManagerException e1) {
        TestCase.fail("Unanticipated queue manager exception caught: "+e1.getMessage());
    }
}
 
Example 29
Source Project: geopackage-java   Source File: FeatureUtils.java    License: MIT License 5 votes vote down vote up
/**
 * Validate Multi Point
 * 
 * @param topGeometry
 * @param multiPoint
 */
private static void validateMultiPoint(Geometry topGeometry,
		MultiPoint multiPoint) {

	TestCase.assertEquals(GeometryType.MULTIPOINT,
			multiPoint.getGeometryType());

	validateZAndM(topGeometry, multiPoint);

	for (Point point : multiPoint.getPoints()) {
		validatePoint(topGeometry, point);
	}

}
 
Example 30
Source Project: garmadon   Source File: GarmadonMessageTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testToMapOnInfinityDoubleReturnMaxNegativeValue() {
    long timestampMillis = System.currentTimeMillis();
    EventHeaderProtos.Header header = EventHeaderProtos.Header.newBuilder().build();
    FlinkEventProtos.OperatorEvent.Builder operatorEvent = FlinkEventProtos.OperatorEvent.newBuilder()
        .setRecordsLagMax(Double.NEGATIVE_INFINITY);

    GarmadonMessage message = new GarmadonMessage(GarmadonSerialization.TypeMarker.FLINK_OPERATOR_EVENT, timestampMillis, header, operatorEvent.build(), null);

    Map<String, Object> map = message.toMap(true, true);

    TestCase.assertEquals(-Double.MAX_VALUE, map.get("records_lag_max"));
}