Package com.unboundid.ldif

Examples of com.unboundid.ldif.LDIFReader


  }

  @Before
  public void init() throws Exception {
    ds.clear();
    ds.importFromLDIF(true, new LDIFReader(new FileInputStream(RESOURCE_DIR + "sampledata.ldif")));
    usersConf = folder.newFile("users.conf");
    FileUtils.copyFile(new File(RESOURCE_DIR + "users.conf"), usersConf);
    settings = getSettings();
    ldap = newLdapAuthentication(settings);
    auth = newAuthenticationManager(settings);
View Full Code Here


                server.importFromLDIF(false, ldifFile);
            } else {
                final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
                final InputStream inputStream = classLoader.getResourceAsStream(ldifFile);
                try {
                    final LDIFReader reader = new LDIFReader(inputStream);
                    server.importFromLDIF(false, reader);
                } finally {
                    inputStream.close();
                }
            }
View Full Code Here

          config.addAdditionalBindCredentials(bindUserName, bindPassword);
          config.setListenerConfigs(InMemoryListenerConfig.createLDAPConfig("default", port));
          config.setSchema(null);

          InMemoryDirectoryServer ds = new InMemoryDirectoryServer(config);
          ds.importFromLDIF(true, new LDIFReader(ldifFile));
          ds.startListening();

          logger.info("LDAP Server started at ldap://localhost:" + port);
        }
      }
View Full Code Here

          config.addAdditionalBindCredentials(bindUserName, bindPassword);
          config.setListenerConfigs(InMemoryListenerConfig.createLDAPConfig("default", port));
          config.setSchema(null);

          InMemoryDirectoryServer ds = new InMemoryDirectoryServer(config);
          ds.importFromLDIF(true, new LDIFReader(ldifFile));
          ds.startListening();

          logger.info("LDAP Server started at ldap://localhost:" + port);
        }
      }
View Full Code Here

  }

  @Before
  public void init() throws Exception {
    ds.clear();
    ds.importFromLDIF(true, new LDIFReader(new FileInputStream(RESOURCE_DIR + "sampledata.ldif")));
    usersConf = folder.newFile("users.conf");
    FileUtils.copyFile(new File(RESOURCE_DIR + "users.conf"), usersConf);
    settings = getSettings();
    ldap = newLdapAuthentication(settings);
    auth = newAuthenticationManager(settings);
View Full Code Here

                server.importFromLDIF(false, ldifFile);
            } else {
                final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
                final InputStream inputStream = classLoader.getResourceAsStream(ldifFile);
                try {
                    final LDIFReader reader = new LDIFReader(inputStream);
                    server.importFromLDIF(false, reader);
                } finally {
                    inputStream.close();
                }
            }
View Full Code Here

    private static void loadData(final LDAPConnection connection,
                                 final InputStream inputStream)
            throws LDIFException, LDAPException, IOException {
        try {
            final LDIFReader reader = new LDIFReader(inputStream);
            LDIFChangeRecord changeRecord = reader.readChangeRecord(true);
            while (changeRecord != null) {
                changeRecord.processChange(connection);
                changeRecord = reader.readChangeRecord(true);
            }
        } finally {
            inputStream.close();
        }
    }
View Full Code Here

     * will read and parse LDIF change records from the {@code inputStream}.
     *
     * @param inputStream The underlying input stream.
     */
    public LDIFFormatReader(final InputStream inputStream) {
        reader = new LDIFReader(inputStream);
    }
View Full Code Here

            server = new InMemoryDirectoryServer(config);
            server.add(new Entry(getRoot(), new Attribute("objectclass", "domain", "top")));
            if (getLdifFile() != null) {
                final InputStream in = new FileInputStream(getLdifFile());
                try {
                    final LDIFReader reader = new LDIFReader(in);
                    server.importFromLDIF(false, reader);
                } finally {
                    in.close();
                }
            }
View Full Code Here

TOP

Related Classes of com.unboundid.ldif.LDIFReader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.