@Test
  public void testContinueOnSomeDbDirectoriesMissing() throws Exception {
    File targetDir1 = new File(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString());
    File targetDir2 = new File(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString());

    try {
      assertTrue(targetDir1.mkdirs());
      assertTrue(targetDir2.mkdirs());

      if (!targetDir1.setWritable(false, false)) {
        System.err.println(
            "Cannot execute 'testContinueOnSomeDbDirectoriesMissing' because cannot mark directory non-writable");
        return;
      }

      RocksDBStateBackend rocksDbBackend = new RocksDBStateBackend(TEMP_URI);
      rocksDbBackend.setDbStoragePaths(targetDir1.getAbsolutePath(), targetDir2.getAbsolutePath());

      try {
        rocksDbBackend.initializeForJob(getMockEnvironment(), "foobar", IntSerializer.INSTANCE);
      } catch (Exception e) {
        e.printStackTrace();
        fail("Backend initialization failed even though some paths were available");
      }
    } finally {
      //noinspection ResultOfMethodCallIgnored
      targetDir1.setWritable(true, false);
      FileUtils.deleteDirectory(targetDir1);
      FileUtils.deleteDirectory(targetDir2);
    }
  }
 @Test
 public void testValidateEmailId() {
   String email = "*****@*****.**";
   boolean value = stringUtil.validateEmail(email);
   Assert.assertTrue(email.length() < 128);
   Assert.assertTrue(value);
 }
 @Test
 public void testAddReturnsTrueIfSuccessfullyAdded() throws Exception {
   final AppenderControlArraySet set = new AppenderControlArraySet();
   assertTrue(set.add(createControl("A")));
   assertTrue(set.add(createControl("B")));
   assertTrue(set.add(createControl("C")));
 }
예제 #4
0
  @Test
  public void testCompatibleArguments() throws Exception {

    assertTrue(QueryEvaluationUtil.compatibleArguments(arg1simple, arg2simple));
    assertFalse(QueryEvaluationUtil.compatibleArguments(arg1simple, arg2en));
    assertFalse(QueryEvaluationUtil.compatibleArguments(arg1simple, arg2cy));
    assertTrue(QueryEvaluationUtil.compatibleArguments(arg1simple, arg2string));
    assertFalse(QueryEvaluationUtil.compatibleArguments(arg1simple, arg2int));

    assertTrue(QueryEvaluationUtil.compatibleArguments(arg1en, arg2simple));
    assertTrue(QueryEvaluationUtil.compatibleArguments(arg1en, arg2en));
    assertFalse(QueryEvaluationUtil.compatibleArguments(arg2en, arg2cy));
    assertFalse(QueryEvaluationUtil.compatibleArguments(arg1en, arg2cy));
    assertTrue(QueryEvaluationUtil.compatibleArguments(arg1en, arg2string));
    assertFalse(QueryEvaluationUtil.compatibleArguments(arg1en, arg2int));

    assertTrue(QueryEvaluationUtil.compatibleArguments(arg1cy, arg2simple));
    assertFalse(QueryEvaluationUtil.compatibleArguments(arg1cy, arg2en));
    assertFalse(QueryEvaluationUtil.compatibleArguments(arg2cy, arg2en));
    assertTrue(QueryEvaluationUtil.compatibleArguments(arg1cy, arg2cy));
    assertTrue(QueryEvaluationUtil.compatibleArguments(arg1cy, arg2string));
    assertFalse(QueryEvaluationUtil.compatibleArguments(arg1cy, arg2int));

    assertTrue(QueryEvaluationUtil.compatibleArguments(arg1string, arg2simple));
    assertFalse(QueryEvaluationUtil.compatibleArguments(arg1string, arg2en));
    assertFalse(QueryEvaluationUtil.compatibleArguments(arg1string, arg2cy));
    assertTrue(QueryEvaluationUtil.compatibleArguments(arg1string, arg2string));
    assertFalse(QueryEvaluationUtil.compatibleArguments(arg1string, arg2int));

    assertFalse(QueryEvaluationUtil.compatibleArguments(arg1int, arg2simple));
    assertFalse(QueryEvaluationUtil.compatibleArguments(arg1int, arg2en));
    assertFalse(QueryEvaluationUtil.compatibleArguments(arg1int, arg2cy));
    assertFalse(QueryEvaluationUtil.compatibleArguments(arg1int, arg2string));
    assertFalse(QueryEvaluationUtil.compatibleArguments(arg1int, arg2int));
  }
    @Override
    public void join(
        IntPair rec1, Tuple2<Integer, String> rec2, Collector<Tuple2<Integer, String>> out)
        throws Exception {
      final int k = rec1.getKey();
      final int v = rec1.getValue();

      final Integer key = rec2.f0;
      final String value = rec2.f1;

      Assert.assertTrue("Key does not match for matching IntPair Tuple combination.", k == key);

      Collection<TupleIntPairMatch> matches = this.toRemoveFrom.get(key);
      if (matches == null) {
        Assert.fail("Match " + key + " - " + v + ":" + value + " is unexpected.");
      }

      Assert.assertTrue(
          "Produced match was not contained: " + key + " - " + v + ":" + value,
          matches.remove(new TupleIntPairMatch(v, value)));

      if (matches.isEmpty()) {
        this.toRemoveFrom.remove(key);
      }
    }
예제 #6
0
  @Test
  public void testCreateAndDropManyDatabases() throws Exception {
    List<String> createdDatabases = new ArrayList<>();
    InfoSchemaMetadataDictionary dictionary = new InfoSchemaMetadataDictionary();
    String namePrefix = "database_";
    final int NUM = 10;
    for (int i = 0; i < NUM; i++) {
      String databaseName = namePrefix + i;
      assertFalse(catalog.existDatabase(databaseName));
      catalog.createDatabase(databaseName, TajoConstants.DEFAULT_TABLESPACE_NAME);
      assertTrue(catalog.existDatabase(databaseName));
      createdDatabases.add(databaseName);
    }

    Collection<String> allDatabaseNames = catalog.getAllDatabaseNames();
    for (String databaseName : allDatabaseNames) {
      assertTrue(
          databaseName.equals(DEFAULT_DATABASE_NAME)
              || createdDatabases.contains(databaseName)
              || dictionary.isSystemDatabase(databaseName));
    }
    // additional ones are 'default' and 'system' databases.
    assertEquals(NUM + 2, allDatabaseNames.size());

    Collections.shuffle(createdDatabases);
    for (String tobeDropped : createdDatabases) {
      assertTrue(catalog.existDatabase(tobeDropped));
      catalog.dropDatabase(tobeDropped);
      assertFalse(catalog.existDatabase(tobeDropped));
    }
  }
예제 #7
0
  @Test
  public void testDropDatabaseWithAllTables() throws Exception {
    Map<String, List<String>> createdTablesMap = createBaseDatabaseAndTables();

    // Each time we drop one database, check all databases and their tables.
    for (String databaseName : new ArrayList<>(createdTablesMap.keySet())) {
      // drop one database
      assertTrue(catalog.existDatabase(databaseName));
      catalog.dropDatabase(databaseName);
      createdTablesMap.remove(databaseName);

      // check all tables which belong to other databases
      for (Map.Entry<String, List<String>> entry : createdTablesMap.entrySet()) {
        assertTrue(catalog.existDatabase(entry.getKey()));

        // checking all tables for this database
        Collection<String> tablesForThisDatabase = catalog.getAllTableNames(entry.getKey());
        assertEquals(createdTablesMap.get(entry.getKey()).size(), tablesForThisDatabase.size());
        for (String tableName : tablesForThisDatabase) {
          assertTrue(
              createdTablesMap
                  .get(entry.getKey())
                  .contains(IdentifierUtil.extractSimpleName(tableName)));
        }
      }
    }

    // Finally, default and system database will remain. So, its result is 1.
    assertEquals(2, catalog.getAllDatabaseNames().size());
  }
예제 #8
0
 @Test
 public void lahettiVoiSyodaVinoon() {
   assertTrue(
       ekaLahetti.mahdollisetSiirrot(lauta)[vihollisLahetti.sijaintiY][vihollisLahetti.sijaintiX]);
   assertTrue(
       vihollisLahetti.mahdollisetSiirrot(lauta)[ekaLahetti.sijaintiY][ekaLahetti.sijaintiX]);
 }
예제 #9
0
  /** End-to-end installation test. */
  private void doTestAutoInstallation(String id, String fullversion) throws Exception {
    Assume.assumeTrue(
        "this is a really time consuming test, so only run it when we really want",
        Boolean.getBoolean("jenkins.testJDKInstaller"));

    retrieveUpdateCenterData();

    JDKInstaller installer = new JDKInstaller(id, true);

    JDK jdk =
        new JDK(
            "test",
            tmp.getRoot().getAbsolutePath(),
            Arrays.asList(new InstallSourceProperty(Arrays.<ToolInstaller>asList(installer))));

    j.jenkins.getJDKs().add(jdk);

    FreeStyleProject p = j.createFreeStyleProject();
    p.setJDK(jdk);
    p.getBuildersList().add(new Shell("java -fullversion\necho $JAVA_HOME"));
    FreeStyleBuild b = j.buildAndAssertSuccess(p);
    @SuppressWarnings("deprecation")
    String log = b.getLog();
    System.out.println(log);
    // make sure it runs with the JDK that just got installed
    assertTrue(log.contains(fullversion));
    assertTrue(log.contains(tmp.getRoot().getAbsolutePath()));
  }
예제 #10
0
  @Test
  public void shouldGetVdbs() throws Exception {
    loadVdbs();

    // get
    URI uri = _uriBuilder.generateVdbsUri();
    this.response = request(uri).get();
    assertTrue(response.hasEntity());

    final String entities = response.readEntity(String.class);
    assertThat(entities, is(notNullValue()));

    // System.out.println("Response:\n" + entities);
    // make sure the VDB JSON document is returned for each vdb
    RestVdb[] vdbs = KomodoJsonMarshaller.unmarshallArray(entities, RestVdb[].class);
    assertEquals(4, vdbs.length);

    boolean foundPortfolio = false;
    for (RestVdb vdb : vdbs) {
      assertNotNull(vdb.getId());
      assertNotNull(vdb.getDataPath());
      assertNotNull(vdb.getkType());

      if (TestUtilities.PORTFOLIO_VDB_NAME.equals(vdb.getId())) {
        foundPortfolio = true;
        assertPortfolio(vdb);
      }
    }

    assertTrue(foundPortfolio);
  }
예제 #11
0
  /**
   * Tests that a service that fails in the constructor has the error passed to the error service
   */
  @Test
  public void testServiceFailsInConstructor() {
    ServiceLocator locator =
        LocatorHelper.getServiceLocator(
            RecordingErrorService.class, ServiceFailsInConstructor.class);

    ActiveDescriptor<?> serviceDescriptor =
        locator.getBestDescriptor(
            BuilderHelper.createContractFilter(ServiceFailsInConstructor.class.getName()));
    Assert.assertNotNull(serviceDescriptor);

    try {
      locator.getService(ServiceFailsInConstructor.class);
      Assert.fail("Should have failed");
    } catch (MultiException me) {
      Assert.assertTrue(me.getMessage().contains(ERROR_STRING));
    }

    List<ErrorInformation> errors =
        locator.getService(RecordingErrorService.class).getAndClearErrors();

    Assert.assertEquals(1, errors.size());

    ErrorInformation ei = errors.get(0);

    Assert.assertEquals(ErrorType.SERVICE_CREATION_FAILURE, ei.getErrorType());
    Assert.assertEquals(serviceDescriptor, ei.getDescriptor());
    Assert.assertNull(ei.getInjectee());

    Throwable associatedException = ei.getAssociatedException();
    Assert.assertTrue(associatedException.getMessage().contains(ERROR_STRING));
  }
 @Test
 public void testContains() {
   fem.persist(entity);
   fem.persist(entity2);
   assertTrue(fem.contains(entity));
   assertTrue(fem.contains(entity2));
 }
예제 #13
0
  @Test
  public void testServiceWithDSLLogger() throws Exception {
    final Logger logger = Logger.getLogger(BaseDslScript.class.getName());
    final DSLLoggerHandler handler = new DSLLoggerHandler();
    logger.addHandler(handler);

    final File dir = new File(TEST_PARSING_RESOURCE_BASE + "logger");
    final Service service = ServiceReader.getServiceFromDirectory(dir).getService();
    Assert.assertNotNull(service);

    Assert.assertTrue(
        "Println logger not found", handler.getMessages().contains("println logger call"));
    Assert.assertTrue(
        "Print logger not found", handler.getMessages().contains("print logger call"));
    Assert.assertTrue(
        "Class println not found", handler.getMessages().contains("Test Class println"));
    Assert.assertTrue("Class print not found", handler.getMessages().contains("Test Class print"));

    Assert.assertFalse(
        "preInstall event message appeared before expected",
        handler.getMessages().contains("This is the preInstall event"));

    final ExecutableDSLEntry preInstall = service.getLifecycle().getPreInstall();
    final ClosureExecutableEntry preInstallClosureEntry = (ClosureExecutableEntry) preInstall;
    preInstallClosureEntry.getCommand().call();

    Assert.assertTrue(
        "preInstall event message not found",
        handler.getMessages().contains("This is the preInstall event"));
  }
  @Test
  public void test_performance1() throws MatlabOutputException {
    String matlab_function = "return_cell_array_different_size";
    long tic = System.currentTimeMillis();
    int numout = 2;

    Object[] argsT = new Object[1];
    argsT[0] = 1;

    Object[] output = null;
    try {
      output = matlabClient.executeFeval(matlab_function, argsT, numout);
    } catch (MatlabRMIException e) {
      fail("Exception occurred: " + e.getMessage());
    }

    if (output == null || output[0] == null) {
      fail("Unexpected error occurred");
    }

    long toc = System.currentTimeMillis();
    long elapsed_time_long = toc - tic;
    double elapsed_time = (double) elapsed_time_long / 1000.0;

    Object[] result = (Object[]) output[0];
    double matlab_elapsed_time = ((double[]) output[1])[0];

    System.out.println(
        String.format(
            "Elapsed_time = %s Matlab_elapsed_time = %s", elapsed_time, matlab_elapsed_time));
    assertTrue(result.length == 10);
    assertTrue(elapsed_time < matlab_elapsed_time);
  }
  @Test
  public void testBuildWithServiceOverride() {
    StandardServiceRegistryImpl serviceRegistry =
        (StandardServiceRegistryImpl)
            new StandardServiceRegistryBuilder()
                .applySettings(ConnectionProviderBuilder.getConnectionProviderProperties())
                .buildServiceRegistry();
    JdbcServices jdbcServices = serviceRegistry.getService(JdbcServices.class);

    assertTrue(jdbcServices.getDialect() instanceof H2Dialect);
    assertTrue(
        jdbcServices
            .getConnectionProvider()
            .isUnwrappableAs(DriverManagerConnectionProviderImpl.class));

    Properties props = ConnectionProviderBuilder.getConnectionProviderProperties();
    props.setProperty(Environment.DIALECT, H2Dialect.class.getName());

    serviceRegistry =
        (StandardServiceRegistryImpl)
            new StandardServiceRegistryBuilder()
                .applySettings(props)
                .addService(ConnectionProvider.class, new UserSuppliedConnectionProviderImpl())
                .buildServiceRegistry();
    jdbcServices = serviceRegistry.getService(JdbcServices.class);

    assertTrue(jdbcServices.getDialect() instanceof H2Dialect);
    assertTrue(
        jdbcServices
            .getConnectionProvider()
            .isUnwrappableAs(UserSuppliedConnectionProviderImpl.class));

    serviceRegistry.destroy();
  }
  @Test
  public void testFullEmpty() throws Exception {
    ArrayQueue<String> queue = new ArrayQueue<String>(2);
    assertTrue(queue.offer("one"));
    assertTrue(queue.offer("two"));
    assertFalse(queue.offer("three"));

    try {
      queue.add("four");
      assertTrue(false);
    } catch (Exception e) {

    }

    assertEquals("one", queue.peek());
    assertEquals("one", queue.remove());
    assertEquals("two", queue.remove());
    try {
      assertEquals("three", queue.remove());
      assertTrue(false);
    } catch (Exception e) {

    }

    assertEquals(null, queue.poll());
  }
예제 #17
0
 @Test
 public final void testPositionDoubleDouble() {
   Position p = new Position(d1, d2);
   assertTrue(p != null);
   assertTrue(p.getX() == d1);
   assertTrue(p.getY() == d2);
 }
예제 #18
0
  @Test
  public void addSameApprovalRepeatedlyUpdatesExpiry() {
    assertTrue(
        dao.addApproval(
            new Approval()
                .setUserId("u2")
                .setClientId("c2")
                .setScope("dash.user")
                .setExpiresAt(Approval.timeFromNow(6000))
                .setStatus(APPROVED)));
    Approval app = dao.getApprovals("u2", "c2").iterator().next();
    assertEquals(
        Math.round(app.getExpiresAt().getTime() / 1000),
        Math.round((new Date().getTime() + 6000) / 1000));

    assertTrue(
        dao.addApproval(
            new Approval()
                .setUserId("u2")
                .setClientId("c2")
                .setScope("dash.user")
                .setExpiresAt(Approval.timeFromNow(8000))
                .setStatus(APPROVED)));
    app = dao.getApprovals("u2", "c2").iterator().next();
    assertEquals(
        Math.round(app.getExpiresAt().getTime() / 1000),
        Math.round((new Date().getTime() + 8000) / 1000));
  }
예제 #19
0
  @Test
  public void testCreateAndDropTable() throws Exception {
    catalog.createDatabase("tmpdb1", TajoConstants.DEFAULT_TABLESPACE_NAME);
    assertTrue(catalog.existDatabase("tmpdb1"));
    catalog.createDatabase("tmpdb2", TajoConstants.DEFAULT_TABLESPACE_NAME);
    assertTrue(catalog.existDatabase("tmpdb2"));

    TableDesc table1 = createMockupTable("tmpdb1", "table1");
    catalog.createTable(table1);

    TableDesc table2 = createMockupTable("tmpdb2", "table2");
    catalog.createTable(table2);

    Set<String> tmpdb1 = Sets.newHashSet(catalog.getAllTableNames("tmpdb1"));
    assertEquals(1, tmpdb1.size());
    assertTrue(tmpdb1.contains("table1"));

    Set<String> tmpdb2 = Sets.newHashSet(catalog.getAllTableNames("tmpdb2"));
    assertEquals(1, tmpdb2.size());
    assertTrue(tmpdb2.contains("table2"));

    catalog.dropDatabase("tmpdb1");
    assertFalse(catalog.existDatabase("tmpdb1"));

    tmpdb2 = Sets.newHashSet(catalog.getAllTableNames("tmpdb2"));
    assertEquals(1, tmpdb2.size());
    assertTrue(tmpdb2.contains("table2"));

    catalog.dropDatabase("tmpdb2");
    assertFalse(catalog.existDatabase("tmpdb2"));
  }
예제 #20
0
  @Test
  @Ignore // this test has issues
  public void addSameApprovalDifferentStatusRepeatedlyOnlyUpdatesStatus() {
    assertTrue(
        dao.addApproval(
            new Approval()
                .setUserId("u2")
                .setClientId("c2")
                .setScope("dash.user")
                .setExpiresAt(Approval.timeFromNow(6000))
                .setStatus(APPROVED)));
    Approval app = dao.getApprovals("u2", "c2").iterator().next();
    assertEquals(
        Math.round(app.getExpiresAt().getTime() / 1000),
        Math.round((new Date().getTime() + 6000) / 1000));

    assertTrue(
        dao.addApproval(
            new Approval()
                .setUserId("u2")
                .setClientId("c2")
                .setScope("dash.user")
                .setExpiresAt(Approval.timeFromNow(8000))
                .setStatus(DENIED)));
    app = dao.getApprovals("u2", "c2").iterator().next();
    assertEquals(
        Math.round(app.getExpiresAt().getTime() / 1000),
        Math.round((new Date().getTime() + 6000) / 1000));
    assertEquals(DENIED, app.getStatus());
  }
예제 #21
0
  @Test
  public final void testDropFunction() throws Exception {
    assertFalse(catalog.containFunction("test3", CatalogUtil.newSimpleDataTypeArray(Type.INT4)));
    FunctionDesc meta =
        new FunctionDesc(
            "test3",
            TestFunc1.class,
            FunctionType.UDF,
            CatalogUtil.newSimpleDataType(Type.INT4),
            CatalogUtil.newSimpleDataTypeArray(Type.INT4));
    catalog.createFunction(meta);
    assertTrue(catalog.containFunction("test3", CatalogUtil.newSimpleDataTypeArray(Type.INT4)));
    catalog.dropFunction("test3");
    assertFalse(catalog.containFunction("test3", CatalogUtil.newSimpleDataTypeArray(Type.INT4)));

    assertFalse(
        catalog.containFunction("test3", CatalogUtil.newSimpleDataTypeArray(Type.INT4, Type.BLOB)));
    FunctionDesc overload =
        new FunctionDesc(
            "test3",
            TestFunc2.class,
            FunctionType.GENERAL,
            CatalogUtil.newSimpleDataType(Type.INT4),
            CatalogUtil.newSimpleDataTypeArray(Type.INT4, Type.BLOB));
    catalog.createFunction(overload);
    assertTrue(
        catalog.containFunction("test3", CatalogUtil.newSimpleDataTypeArray(Type.INT4, Type.BLOB)));
  }
예제 #22
0
  /** Test de lecture du fichier d'historique simple */
  @Test
  public void testLectureFichierHistoriqueSimple() {

    construireHistoriqueSimple();

    Collection lesHistoriques = rHistoriqueSimple.getlisteHistoriques();
    Iterator it = lesHistoriques.iterator();
    Historique unHistoriqueLu;
    int nbHisto = 0;
    int nbVert = 0;
    int nbTestsTotaux = 0;
    long tempsExecutionTotal = 0;

    while (it.hasNext()) {

      unHistoriqueLu = (Historique) it.next();
      nbHisto++;

      if (unHistoriqueLu.getEtat().equalsIgnoreCase(Historique.ETAT_VERT)) nbVert++;

      nbTestsTotaux += unHistoriqueLu.getNombreTests();
      tempsExecutionTotal += unHistoriqueLu.getVitesse();
    }

    assertTrue(nbHisto == 3);
    assertTrue(nbVert == 2);
    assertTrue(nbTestsTotaux == 60); // 10+20+30
    assertTrue(tempsExecutionTotal == 360000); // 1 + 2 + 3 minutes
  }
  @Test
  public void testFailWhenNoLocalStorageDir() throws Exception {
    File targetDir = new File(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString());
    try {
      assertTrue(targetDir.mkdirs());

      if (!targetDir.setWritable(false, false)) {
        System.err.println(
            "Cannot execute 'testFailWhenNoLocalStorageDir' because cannot mark directory non-writable");
        return;
      }

      RocksDBStateBackend rocksDbBackend = new RocksDBStateBackend(TEMP_URI);
      rocksDbBackend.setDbStoragePath(targetDir.getAbsolutePath());

      try {
        rocksDbBackend.initializeForJob(getMockEnvironment(), "foobar", IntSerializer.INSTANCE);
      } catch (Exception e) {
        assertTrue(e.getMessage().contains("No local storage directories available"));
        assertTrue(e.getMessage().contains(targetDir.getAbsolutePath()));
      }
    } finally {
      //noinspection ResultOfMethodCallIgnored
      targetDir.setWritable(true, false);
      FileUtils.deleteDirectory(targetDir);
    }
  }
예제 #24
0
파일: New4.java 프로젝트: TKosmacki/CS1632
 @Test
 public void testEditProfile() throws Exception {
   driver.get(baseUrl + "/");
   driver.findElement(By.xpath("(//a[contains(text(),'log in')])[2]")).click();
   driver.findElement(By.xpath("(//a[contains(text(),'log in')])[2]")).click();
   driver.findElement(By.id("email")).click();
   driver.findElement(By.id("email")).clear();
   driver.findElement(By.id("email")).sendKeys("*****@*****.**");
   driver.findElement(By.id("password")).clear();
   driver.findElement(By.id("password")).sendKeys("Eliandtyler1");
   driver.findElement(By.id("submit-button")).click();
   driver.findElement(By.id("submit-button")).click();
   driver.findElement(By.cssSelector("img.avatar-me.js-avatar-me")).click();
   driver.findElement(By.cssSelector("img.avatar-me.js-avatar-me")).click();
   driver.findElement(By.linkText("Edit Profile & Settings")).click();
   driver.findElement(By.linkText("Edit Profile & Settings")).click();
   // Warning: assertTextPresent may require manual changes
   assertTrue(driver.findElement(By.cssSelector("BODY")).getText().matches("^[\\s\\S]*$"));
   // Warning: assertTextPresent may require manual changes
   assertTrue(driver.findElement(By.cssSelector("BODY")).getText().matches("^[\\s\\S]*$"));
   // Warning: assertTextPresent may require manual changes
   assertTrue(driver.findElement(By.cssSelector("BODY")).getText().matches("^[\\s\\S]*$"));
   // Warning: assertTextPresent may require manual changes
   assertTrue(driver.findElement(By.cssSelector("BODY")).getText().matches("^[\\s\\S]*$"));
   // Warning: assertTextPresent may require manual changes
   assertTrue(driver.findElement(By.cssSelector("BODY")).getText().matches("^[\\s\\S]*$"));
 }
  @Test
  public void testRunWindupTiny() throws Exception {
    try (GraphContext context = createGraphContext()) {
      super.runTest(
          context, "../test-files/jee-example-app-1.0.0.ear", false, Arrays.asList("com.acme"));

      Path graphDirectory = context.getGraphDirectory();
      Path reportsDirectory = graphDirectory.resolve("reports");
      Path indexPath = graphDirectory.resolve(Paths.get("index.html"));

      Path appReportPath =
          resolveChildPath(
              reportsDirectory,
              "ApplicationDetails_JEE_Example_App__org_windup_example_jee_example_app_1_0_0_\\.html");
      Path appNonClassifiedReportPath =
          resolveChildPath(
              reportsDirectory,
              "compatiblefiles_JEE_Example_App__org_windup_example_jee_example_app_1_0_0_\\.html");
      Path productCatalogBeanPath =
          resolveChildPath(reportsDirectory, "ProductCatalogBean_java\\.html");

      Assert.assertTrue(indexPath.toFile().exists());
      Assert.assertTrue(appReportPath.toFile().exists());
      Assert.assertTrue(appNonClassifiedReportPath.toFile().exists());
      Assert.assertTrue(productCatalogBeanPath.toFile().exists());

      String appReportContent = new String(Files.readAllBytes(appReportPath));

      Assert.assertTrue(appReportContent.contains("Used only to support migration activities."));
      allDecompiledFilesAreLinked(context);
    }
  }
예제 #26
0
  public void testForUpdate() {
    ResetBasicData.reset();

    Query<Order> query =
        Ebean.find(Order.class)
            .setAutofetch(false)
            .setForUpdate(false)
            .setMaxRows(1)
            .order()
            .asc("orderDate")
            .order()
            .desc("id");

    int rc = query.findList().size();
    Assert.assertTrue(rc > 0);
    Assert.assertTrue(!query.getGeneratedSql().toLowerCase().contains("for update"));

    query =
        Ebean.find(Order.class)
            .setAutofetch(false)
            .setForUpdate(true)
            .setMaxRows(1)
            .order()
            .asc("orderDate")
            .order()
            .desc("id");

    rc = query.findList().size();
    Assert.assertTrue(rc > 0);
    Assert.assertTrue(query.getGeneratedSql().toLowerCase().contains("for update"));
  }
예제 #27
0
  @Test
  public void testUpdateOffset() {
    OnmsVaadinContainer.Page p =
        new OnmsVaadinContainer.Page(
            30,
            new OnmsVaadinContainer.Size(
                new OnmsVaadinContainer.SizeReloadStrategy() {
                  @Override
                  public int reload() {
                    return 400;
                  }
                }));

    // first page
    Assert.assertFalse(p.updateOffset(0));
    Assert.assertEquals(30, p.length);
    Assert.assertEquals(0, p.offset);

    // somewhere in between
    Assert.assertTrue(p.updateOffset(210));
    Assert.assertEquals(30, p.length);
    Assert.assertEquals(210 / 30 * 30, p.offset);

    // last page
    Assert.assertTrue(p.updateOffset(399));
    Assert.assertEquals(30, p.length);
    Assert.assertEquals(399 / 30 * 30, p.offset);
  }
예제 #28
0
  @Test
  public void test() throws Exception {

    // **********************************************************************************//
    // Initialization
    // **********************************************************************************//

    ZComparator testZ = new ZComparator();

    UMLObject testO = new UMLObject();
    testO = testO.translate(100, 100);

    UMLRelation testR =
        new UMLRelation(
            new ImmutablePath(new ImmutablePoint(20, 70)).addLast(new ImmutablePoint(80, 150)),
            4,
            false);

    // **********************************************************************************//
    // Z Compare on Objects and Relations Tests
    // **********************************************************************************//

    assertTrue("ZComparator for Drawable A > B Failed!", testZ.compare(testO, testR) == 1);

    //		testO = testO.move(100, 100, 3);

    assertTrue("ZComparator for Drawable A < B Failed!", testZ.compare(testO, testR) == -1);

    //		testO = testO.move(100, 100, 4);

    assertTrue("ZComparator for Drawable A = B Failed!", testZ.compare(testO, testR) == 0);

    // **********************************************************************************//

  }
  @Test
  public void write_onPatchWithInnerObject_fullyWritesInnerObject() {
    TestData original = new TestData();
    TestData updated = new TestData();
    updated.setInnerData(new InnerTestData());

    Patch<TestData> patch =
        MakePatch.from(original).to(updated).with(new ReflectivePatchCalculator<>());
    JsonObject json = toJson(patch);

    assertTrue(json.has("innerData"));
    assertTrue(json.get("innerData").isJsonObject());

    JsonObject innerJson = json.get("innerData").getAsJsonObject();
    Collection<String[]> fields =
        Collections2.transform(
            innerJson.entrySet(),
            entry -> new String[] {entry.getKey(), entry.getValue().getAsString()});
    assertThat(
        fields,
        containsInAnyOrder(
            new String[] {"json-name-alias", "inner-named-value"},
            new String[] {"name1", "inner-value-1"},
            new String[] {"name2", "inner-value-2"}));
  }
예제 #30
0
  @Test
  public void completeBuilder() throws Exception {
    CacheControl cacheControl =
        new CacheControl.Builder()
            .noCache()
            .noStore()
            .maxAge(1, TimeUnit.SECONDS)
            .maxStale(2, TimeUnit.SECONDS)
            .minFresh(3, TimeUnit.SECONDS)
            .onlyIfCached()
            .noTransform()
            .build();
    assertEquals(
        "no-cache, no-store, max-age=1, max-stale=2, min-fresh=3, only-if-cached, "
            + "no-transform",
        cacheControl.toString());
    assertTrue(cacheControl.noCache());
    assertTrue(cacheControl.noStore());
    assertEquals(1, cacheControl.maxAgeSeconds());
    assertEquals(2, cacheControl.maxStaleSeconds());
    assertEquals(3, cacheControl.minFreshSeconds());
    assertTrue(cacheControl.onlyIfCached());

    // These members are accessible to response headers only.
    assertEquals(-1, cacheControl.sMaxAgeSeconds());
    assertFalse(cacheControl.isPublic());
    assertFalse(cacheControl.mustRevalidate());
  }