libs.length

Here are the examples of the java api libs.length taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

20 Examples 7

19 Source : RedshiftDatabaseMetaTest.java
with Apache License 2.0
from tlw-ray

@Test
public void testGetUsedLibraries() throws Exception {
    String[] libs = dbMeta.getUsedLibraries();
    replacedertNotNull(libs);
    replacedertEquals(1, libs.length);
    replacedertEquals("RedshiftJDBC4_1.0.10.1010.jar", libs[0]);
}

19 Source : LibrariesTestUtil.java
with Apache License 2.0
from apache

public static void replacedertLibEquals(LibraryImplementation[] libs, String[] names) {
    replacedertEquals("Libraries Equals (size)", names.length, libs.length);
    // Ordering is not important
    Set<String> s = new HashSet<String>(Arrays.asList(names));
    for (LibraryImplementation lib : libs) {
        String name = lib.getName();
        replacedertTrue("Libraries Equals (unknown library " + name + ")", s.remove(name));
    }
}

19 Source : LibrariesStorageTest.java
with Apache License 2.0
from apache

public void testRemoveLibrary() throws Exception {
    this.storage.getLibraries();
    LibraryImplementation[] libs = this.storage.getLibraries();
    replacedertEquals("Libraries count", 1, libs.length);
    LibrariesTestUtil.replacedertLibEquals(libs, new String[] { "Library1" });
    TestLibraryTypeProvider tlp = (TestLibraryTypeProvider) LibraryTypeRegistry.getDefault().getLibraryTypeProvider(TestLibraryTypeProvider.TYPE);
    tlp.reset();
    this.storage.removeLibrary(libs[0]);
    libs = this.storage.getLibraries();
    replacedertEquals("Libraries count", 0, libs.length);
    replacedertTrue("Library deleted called", tlp.wasDeletedCalled());
}

19 Source : LibrariesStorageTest.java
with Apache License 2.0
from apache

public void testLibraryImplementation3() throws Exception {
    this.storage.getLibraries();
    LibraryImplementation[] libs = this.storage.getLibraries();
    // NOI18N
    replacedertEquals("Libraries count", 1, libs.length);
    // NOI18N
    LibrariesTestUtil.replacedertLibEquals(libs, new String[] { "Library1" });
    LibraryImplementation3 lib3 = (LibraryImplementation3) libs[0];
    replacedertTrue(lib3.getProperties().isEmpty());
    LibraryImplementation3 newLib = new TestLibrary((TestLibrary) lib3);
    Map<String, String> props = new HashMap<String, String>();
    // NOI18N
    props.put("test_prop", "test_value");
    newLib.setProperties(props);
    this.storage.updateLibrary(lib3, newLib);
    libs = this.storage.getLibraries();
    // NOI18N
    replacedertEquals("Libraries count", 1, libs.length);
    // NOI18N
    LibrariesTestUtil.replacedertLibEquals(libs, new String[] { "Library1" });
    lib3 = (LibraryImplementation3) libs[0];
    replacedertEquals(1, lib3.getProperties().size());
    // NOI18N
    replacedertEquals("test_value", lib3.getProperties().get("test_prop"));
}

19 Source : LibrariesStorageTest.java
with Apache License 2.0
from apache

public void testNamedLibraryImplementation() throws Exception {
    this.storage.getLibraries();
    LibraryImplementation[] libs = this.storage.getLibraries();
    // NOI18N
    replacedertEquals("Libraries count", 1, libs.length);
    // NOI18N
    LibrariesTestUtil.replacedertLibEquals(libs, new String[] { "Library1" });
    LibraryImplementation3 lib3 = (LibraryImplementation3) libs[0];
    replacedertNull(lib3.getDisplayName());
    LibraryImplementation3 newLib = new TestLibrary((TestLibrary) lib3);
    // NOI18N
    newLib.setDisplayName("FooLib");
    this.storage.updateLibrary(lib3, newLib);
    libs = this.storage.getLibraries();
    // NOI18N
    replacedertEquals("Libraries count", 1, libs.length);
    // NOI18N
    LibrariesTestUtil.replacedertLibEquals(libs, new String[] { "Library1" });
    lib3 = (LibraryImplementation3) libs[0];
    // NOI18N
    replacedertEquals("FooLib", lib3.getDisplayName());
}

19 Source : LibrariesStorageTest.java
with Apache License 2.0
from apache

public void testUpdateLibrary() throws Exception {
    this.storage.getLibraries();
    LibraryImplementation[] libs = this.storage.getLibraries();
    replacedertEquals("Libraries count", 1, libs.length);
    LibrariesTestUtil.replacedertLibEquals(libs, new String[] { "Library1" });
    TestLibraryTypeProvider tlp = (TestLibraryTypeProvider) LibraryTypeRegistry.getDefault().getLibraryTypeProvider(TestLibraryTypeProvider.TYPE);
    tlp.reset();
    LibraryImplementation newLib = new TestLibrary((TestLibrary) libs[0]);
    newLib.setName("NewLibrary");
    this.storage.updateLibrary(libs[0], newLib);
    libs = this.storage.getLibraries();
    replacedertEquals("Libraries count", 1, libs.length);
    LibrariesTestUtil.replacedertLibEquals(libs, new String[] { "NewLibrary" });
    replacedertTrue("Library created called", tlp.wasCreatedCalled());
}

19 Source : LibrariesStorageTest.java
with Apache License 2.0
from apache

public void testAddLibrary() throws Exception {
    this.storage.getLibraries();
    LibraryImplementation[] libs = this.storage.getLibraries();
    replacedertEquals("Libraries count", 1, libs.length);
    LibrariesTestUtil.replacedertLibEquals(libs, new String[] { "Library1" });
    TestLibraryTypeProvider tlp = (TestLibraryTypeProvider) LibraryTypeRegistry.getDefault().getLibraryTypeProvider(TestLibraryTypeProvider.TYPE);
    tlp.reset();
    LibraryImplementation impl = new TestLibrary("Library2");
    this.storage.addLibrary(impl);
    libs = this.storage.getLibraries();
    replacedertEquals("Libraries count", 2, libs.length);
    LibrariesTestUtil.replacedertLibEquals(libs, new String[] { "Library1", "Library2" });
    replacedertTrue(tlp.wasCreatedCalled());
}

19 Source : LibrariesStorageTest.java
with Apache License 2.0
from apache

public void testGetDisplayNameLibraries() throws Exception {
    this.storage.getLibraries();
    LibraryImplementation[] libs = this.storage.getLibraries();
    replacedertEquals("Libraries count", 1, libs.length);
    LibrariesTestUtil.replacedertLibEquals(libs, new String[] { "Library1" });
    LibrariesTestUtil.createLibraryDefinition(this.storageFolder, "Library2", "MyName");
    libs = this.storage.getLibraries();
    replacedertEquals("Libraries count", 2, libs.length);
    LibraryImplementation impl = libs[0].getName().equals("Library2") ? libs[0] : libs[1];
    replacedertEquals("MyName", LibrariesSupport.getLocalizedName(impl));
}

19 Source : LibrariesStorageTest.java
with Apache License 2.0
from apache

@RandomlyFails
public /* ergonomics-3373:
     * junit.framework.replacedertionFailedError: Event count expected:<1> but was:<2>
	 * at org.netbeans.modules.project.libraries.LibrariesStorageTest.testGetLibraries(LibrariesStorageTest.java:127)
	 * at org.netbeans.junit.NbTestCase.access$200(NbTestCase.java:99)
	 * at org.netbeans.junit.NbTestCase$2.doSomething(NbTestCase.java:405)
	 * at org.netbeans.junit.NbTestCase$1Guard.run(NbTestCase.java:331)
	 * at java.lang.Thread.run(Thread.java:662)
     */
void testGetLibraries() throws Exception {
    this.storage.getLibraries();
    LibraryImplementation[] libs = this.storage.getLibraries();
    replacedertEquals("Libraries count", 1, libs.length);
    LibrariesTestUtil.replacedertLibEquals(libs, new String[] { "Library1" });
    LibrariesTestUtil.createLibraryDefinition(this.storageFolder, "Library2", null);
    libs = this.storage.getLibraries();
    replacedertEquals("Libraries count", 2, libs.length);
    LibrariesTestUtil.replacedertLibEquals(libs, new String[] { "Library1", "Library2" });
    TestListener l = new TestListener();
    this.storage.addPropertyChangeListener(l);
    TestLibraryTypeProvider tlp = (TestLibraryTypeProvider) LibraryTypeRegistry.getDefault().getLibraryTypeProvider(TestLibraryTypeProvider.TYPE);
    tlp.reset();
    LibrariesTestUtil.createLibraryDefinition(this.storageFolder, "Library3", null);
    libs = this.storage.getLibraries();
    replacedertEquals("Libraries count", 3, libs.length);
    LibrariesTestUtil.replacedertLibEquals(libs, new String[] { "Library1", "Library2", "Library3" });
    // line 127@ergonomics-3373
    replacedertEquals("Event count", 1, l.getEventNames().size());
    replacedertEquals("Event names", LibraryProvider.PROP_LIBRARIES, l.getEventNames().get(0));
    replacedertTrue("Library created called", tlp.wasCreatedCalled());
}

19 Source : LibrariesStorageRefreshTest.java
with Apache License 2.0
from apache

// NB-Core-Build #8253: Libraries count expected:<1> but was:<0>
@RandomlyFails
public void testGetLibrariesAfterEnablingProvider() throws Exception {
    this.storage.getLibraries();
    LibraryImplementation[] libs = this.storage.getLibraries();
    LibrariesStorageTest.TestListener l = new LibrariesStorageTest.TestListener();
    this.storage.addPropertyChangeListener(l);
    replacedertEquals("No libraries found", 0, libs.length);
    LibrariesTestUtil.registerLibraryTypeProvider(LibrariesTestUtil.TestLibraryTypeProvider.clreplaced);
    // The lookup for path fires with delay, wait for the event
    Thread.sleep(1000);
    libs = this.storage.getLibraries();
    replacedertEquals("Libraries count", 1, libs.length);
    replacedertEquals("One change", 1, l.getEventNames().size());
}

19 Source : LibraryTest.java
with Apache License 2.0
from apache

public void testGetLibraries() throws Exception {
    LibraryManager lm = LibraryManager.getDefault();
    Library[] libs = lm.getLibraries();
    LibraryImplementation[] impls = LibraryManagerTest.createTestLibs();
    lp.set(impls);
    libs = lm.getLibraries();
    replacedertEquals("Libraries count", 2, libs.length);
    LibraryManagerTest.replacedertLibsEquals(libs, impls);
    MockPropertyChangeListener pcl = new MockPropertyChangeListener();
    libs[0].addPropertyChangeListener(pcl);
    impls[0].setName("NewLibrary1");
    pcl.replacedertEvents(Library.PROP_NAME);
    LibraryManagerTest.replacedertLibsEquals(new Library[] { libs[0] }, new LibraryImplementation[] { impls[0] });
    impls[0].setDescription("NewLibrary1Description");
    pcl.replacedertEvents(Library.PROP_DESCRIPTION);
    LibraryManagerTest.replacedertLibsEquals(new Library[] { libs[0] }, new LibraryImplementation[] { impls[0] });
    List<URL> urls = new ArrayList<URL>();
    urls.add(new URL("file:/lib/libnew1.so"));
    urls.add(new URL("file:/lib/libnew2.so"));
    impls[0].setContent("bin", urls);
    pcl.replacedertEvents(Library.PROP_CONTENT);
    LibraryManagerTest.replacedertLibsEquals(new Library[] { libs[0] }, new LibraryImplementation[] { impls[0] });
    urls = new ArrayList<URL>();
    urls.add(new URL("file:/src/new/src/"));
    impls[0].setContent("src", urls);
    pcl.replacedertEvents(Library.PROP_CONTENT);
    LibraryManagerTest.replacedertLibsEquals(new Library[] { libs[0] }, new LibraryImplementation[] { impls[0] });
}

18 Source : WebViewDelegate.java
with Apache License 2.0
from lulululbj

/**
 * Adds the WebView replacedet path to {@link android.content.res.replacedetManager}.
 */
public void addWebViewreplacedetPath(Context context) {
    final String newreplacedetPath = WebViewFactory.getLoadedPackageInfo().applicationInfo.sourceDir;
    final ApplicationInfo appInfo = context.getApplicationInfo();
    final String[] libs = appInfo.sharedLibraryFiles;
    if (!ArrayUtils.contains(libs, newreplacedetPath)) {
        // Build the new library replacedet path list.
        final int newLibreplacedetsCount = 1 + (libs != null ? libs.length : 0);
        final String[] newLibreplacedets = new String[newLibreplacedetsCount];
        if (libs != null) {
            System.arraycopy(libs, 0, newLibreplacedets, 0, libs.length);
        }
        newLibreplacedets[newLibreplacedetsCount - 1] = newreplacedetPath;
        // Update the ApplicationInfo object with the new list.
        // We know this will persist and future Resources created via ResourcesManager
        // will include the shared library because this ApplicationInfo comes from the
        // underlying LoadedApk in ContextImpl, which does not change during the life of the
        // application.
        appInfo.sharedLibraryFiles = newLibreplacedets;
        // Update existing Resources with the WebView library.
        ResourcesManager.getInstance().appendLibreplacedetForMainreplacedetPath(appInfo.getBaseResourcePath(), newreplacedetPath);
    }
}

18 Source : ProxyLibraryImplementationTest.java
with Apache License 2.0
from apache

public void testGetDisplayNameLibraries() throws Exception {
    this.storage.getLibraries();
    LibraryImplementation[] libs = this.storage.getLibraries();
    replacedertEquals("Libraries count", 1, libs.length);
    LibrariesTestUtil.replacedertLibEquals(libs, new String[] { "Library1" });
    LibrariesTestUtil.createLibraryDefinition(this.storageFolder, "Library2", "MyName");
    libs = this.storage.getLibraries();
    replacedertEquals("Libraries count", 2, libs.length);
    LibraryImplementation impl = libs[0].getName().equals("Library2") ? libs[0] : libs[1];
    replacedertEquals("MyName", LibrariesSupport.getLocalizedName(impl));
    LibrariesModel model = new LibrariesModel();
    ProxyLibraryImplementation proxy = ProxyLibraryImplementation.createProxy(impl, model);
    replacedertEquals("MyName", LibrariesSupport.getLocalizedName(proxy));
}

18 Source : LibraryManagerTest.java
with Apache License 2.0
from apache

static void replacedertLibsEquals(Library[] libs, LibraryImplementation[] impls) {
    replacedertEquals("libs equals (size)", impls.length, libs.length);
    for (int i = 0; i < libs.length; i++) {
        replacedertEquals("libs equals (name)", impls[i].getName(), libs[i].getName());
        replacedertEquals("libs equals (description)", impls[i].getDescription(), libs[i].getDescription());
        List lc = libs[i].getContent("bin");
        List ic = impls[i].getContent("bin");
        replacedertEquals("libs equals (content bin)", ic, lc);
        lc = libs[i].getContent("src");
        ic = impls[i].getContent("src");
        replacedertEquals("libs equals (content src)", ic, lc);
        lc = libs[i].getContent("doc");
        ic = impls[i].getContent("doc");
        replacedertEquals("libs equals (content doc)", ic, lc);
    }
}

17 Source : 124.java
with MIT License
from masud-technope

/**
 * Tests default libraries for an EE VM type are empty.
 */
public void testDefaultLibraries() {
    File file = getEEFile();
    IVMInstallType vmType = getVMInstallType();
    replacedertNotNull("Missing EE file", file);
    replacedertNotNull("Missing EE VM type", vmType);
    LibraryLocation[] libs = vmType.getDefaultLibraryLocations(file);
    replacedertEquals("Wrong number of libraries", 0, libs.length);
}

17 Source : LibraryManagerTest.java
with Apache License 2.0
from apache

public void testGetLibrary() throws Exception {
    LibraryImplementation[] impls = createTestLibs();
    lp.set(impls);
    LibraryManager lm = LibraryManager.getDefault();
    Library[] libs = lm.getLibraries();
    replacedertEquals("Libraries count", 2, libs.length);
    replacedertLibsEquals(libs, impls);
    Library lib = lm.getLibrary("Library1");
    replacedertNotNull("Existing library", lib);
    replacedertLibsEquals(new Library[] { lib }, new LibraryImplementation[] { impls[0] });
    lib = lm.getLibrary("Library2");
    replacedertNotNull("Existing library", lib);
    replacedertLibsEquals(new Library[] { lib }, new LibraryImplementation[] { impls[1] });
    lib = lm.getLibrary("Library3");
    replacedertNull("Nonexisting library", lib);
}

17 Source : LibraryManagerTest.java
with Apache License 2.0
from apache

public void testGetLibraries() throws Exception {
    LibraryManager lm = LibraryManager.getDefault();
    MockPropertyChangeListener pcl = new MockPropertyChangeListener();
    lm.addPropertyChangeListener(pcl);
    Library[] libs = lm.getLibraries();
    replacedertEquals("Libraries count", 0, libs.length);
    LibraryImplementation[] impls = createTestLibs();
    lp.set(impls);
    libs = lm.getLibraries();
    pcl.replacedertEvents(LibraryManager.PROP_LIBRARIES);
    replacedertEquals("Libraries count", 2, libs.length);
    replacedertLibsEquals(libs, impls);
    lp.set();
    pcl.replacedertEvents(LibraryManager.PROP_LIBRARIES);
    libs = lm.getLibraries();
    replacedertEquals("Libraries count", 0, libs.length);
}

16 Source : 124.java
with MIT License
from masud-technope

/**
 * Tests libraries for the EE file
 */
public void testLibraries() throws CoreException {
    File file = getEEFile();
    replacedertNotNull("Missing EE file", file);
    ExecutionEnvironmentDescription description = new ExecutionEnvironmentDescription(file);
    LibraryLocation[] libs = description.getLibraryLocations();
    String[] expected = new String[] { "end.jar", "clreplacedes.txt", "others.txt", "add.jar", "ext1.jar", "ext2.jar", "opt-ext.jar" };
    replacedertEquals("Wrong number of libraries", expected.length, libs.length);
    for (int i = 0; i < expected.length; i++) {
        if (i == 4) {
            // ext1 and ext2 can be in either order due to file system ordering
            replacedertTrue("Wrong library", expected[i].equals(libs[i].getSystemLibraryPath().lastSegment()) || expected[i].equals(libs[i + 1].getSystemLibraryPath().lastSegment()));
        } else if (i == 5) {
            // ext1 and ext2 can be in either order due to file system ordering
            replacedertTrue("Wrong library", expected[i].equals(libs[i].getSystemLibraryPath().lastSegment()) || expected[i].equals(libs[i - 1].getSystemLibraryPath().lastSegment()));
        } else {
            replacedertEquals("Wrong library", expected[i], libs[i].getSystemLibraryPath().lastSegment());
        }
        if ("clreplacedes.txt".equals(expected[i])) {
            replacedertEquals("source.txt", libs[i].getSystemLibrarySourcePath().lastSegment());
        }
    }
}

15 Source : 124.java
with MIT License
from masud-technope

/**
 * Tests source attachments
 */
public void testSourceAttachments() throws CoreException {
    File file = getEEFile();
    replacedertNotNull("Missing EE file", file);
    ExecutionEnvironmentDescription description = new ExecutionEnvironmentDescription(file);
    LibraryLocation[] libs = description.getLibraryLocations();
    String[] expected = new String[] { "end.txt", "source.txt", "source.txt", "sourceaddsource.jar", "extra1-src.txt", "extra2-src.txt", "" };
    replacedertEquals("Wrong number of libraries", expected.length, libs.length);
    for (int i = 0; i < expected.length; i++) {
        if (i == 4) {
            // ext1 and ext2 can be in either order due to file system ordering
            replacedertTrue("Wrong attachment", expected[i].equals(libs[i].getSystemLibrarySourcePath().lastSegment()) || expected[i].equals(libs[i + 1].getSystemLibrarySourcePath().lastSegment()));
        } else if (i == 5) {
            // ext1 and ext2 can be in either order due to file system ordering
            replacedertTrue("Wrong attachment", expected[i].equals(libs[i].getSystemLibrarySourcePath().lastSegment()) || expected[i].equals(libs[i - 1].getSystemLibrarySourcePath().lastSegment()));
        } else if (i == 6) {
            replacedertEquals("Wrong attachment", Path.EMPTY, libs[i].getSystemLibrarySourcePath());
        } else {
            replacedertEquals("Wrong attachment", expected[i], libs[i].getSystemLibrarySourcePath().lastSegment());
        }
    }
}

13 Source : LibraryManagerTest.java
with Apache License 2.0
from apache

@SuppressWarnings("deprecation")
public void testAddRemoveLibrary() throws Exception {
    final LibraryImplementation[] impls = createTestLibs();
    lp.set(impls);
    final LibraryManager lm = LibraryManager.getDefault();
    Library[] libs = lm.getLibraries();
    replacedertEquals("Libraries count", 2, libs.length);
    replacedertLibsEquals(libs, impls);
    final LibraryTypeProvider provider = LibrariesSupport.getLibraryTypeProvider(LIBRARY_TYPE);
    replacedertNotNull(provider);
    final LibraryImplementation newLibImplementation = provider.createLibrary();
    newLibImplementation.setName("NewLib");
    final Library newLibrary = LibraryFactory.createLibrary(newLibImplementation);
    lm.addLibrary(newLibrary);
    libs = lm.getLibraries();
    replacedertEquals("Libraries count", 3, libs.length);
    List<LibraryImplementation> newLibs = new ArrayList<LibraryImplementation>(Arrays.asList(impls));
    newLibs.add(newLibImplementation);
    replacedertLibsEquals(libs, newLibs.toArray(new LibraryImplementation[newLibs.size()]));
    lm.removeLibrary(newLibrary);
    libs = lm.getLibraries();
    replacedertEquals("Libraries count", 2, libs.length);
    replacedertLibsEquals(libs, impls);
}