Search in sources :

Example 1 with HibernateSearchEnabledPropertyTester

use of org.jboss.tools.hibernate.search.property.testers.HibernateSearchEnabledPropertyTester in project jbosstools-hibernate by jbosstools.

the class HibernateSearchEnabledPropertyTesterTest method containsHibernateSearchLib.

@Test
public void containsHibernateSearchLib() throws MalformedURLException {
    ConsoleConfiguration consoleConfiguration = mock(ConsoleConfiguration.class);
    ConsoleConfigurationPreferences prefs = mock(ConsoleConfigurationPreferences.class);
    when(consoleConfiguration.getPreferences()).thenReturn(prefs);
    when(prefs.getCustomClassPathURLS()).thenReturn(new URL[] { new URL("file", "", "hibernate-search-orm-version") });
    TreePath treePath = new TreePath(new Object[] { consoleConfiguration });
    ITreeSelection receiver = new TreeSelection(treePath);
    HibernateSearchEnabledPropertyTester tester = new HibernateSearchEnabledPropertyTester();
    assertTrue(tester.test(receiver, "doesn't matter", null, null));
}
Also used : ConsoleConfiguration(org.hibernate.console.ConsoleConfiguration) ITreeSelection(org.eclipse.jface.viewers.ITreeSelection) TreePath(org.eclipse.jface.viewers.TreePath) ConsoleConfigurationPreferences(org.hibernate.console.preferences.ConsoleConfigurationPreferences) ITreeSelection(org.eclipse.jface.viewers.ITreeSelection) TreeSelection(org.eclipse.jface.viewers.TreeSelection) URL(java.net.URL) HibernateSearchEnabledPropertyTester(org.jboss.tools.hibernate.search.property.testers.HibernateSearchEnabledPropertyTester) Test(org.junit.Test)

Example 2 with HibernateSearchEnabledPropertyTester

use of org.jboss.tools.hibernate.search.property.testers.HibernateSearchEnabledPropertyTester in project jbosstools-hibernate by jbosstools.

the class HibernateSearchEnabledPropertyTesterTest method allMustContainHibernateSearchLib.

@Test
public void allMustContainHibernateSearchLib() throws MalformedURLException {
    ConsoleConfiguration consoleConfiguration1 = mock(ConsoleConfiguration.class);
    ConsoleConfiguration consoleConfiguration2 = mock(ConsoleConfiguration.class);
    ConsoleConfigurationPreferences prefs1 = mock(ConsoleConfigurationPreferences.class);
    ConsoleConfigurationPreferences prefs2 = mock(ConsoleConfigurationPreferences.class);
    when(consoleConfiguration1.getPreferences()).thenReturn(prefs1);
    when(consoleConfiguration2.getPreferences()).thenReturn(prefs2);
    when(prefs1.getCustomClassPathURLS()).thenReturn(new URL[] { new URL("file", "", "hibernate-search-orm-version") });
    when(prefs1.getCustomClassPathURLS()).thenReturn(new URL[] { new URL("file", "", "something"), new URL("file", "", "dont-we-need") });
    TreePath treePath = new TreePath(new Object[] { consoleConfiguration1, consoleConfiguration2 });
    ITreeSelection receiver = new TreeSelection(treePath);
    HibernateSearchEnabledPropertyTester tester = new HibernateSearchEnabledPropertyTester();
    assertFalse(tester.test(receiver, "doesn't matter", null, null));
}
Also used : ConsoleConfiguration(org.hibernate.console.ConsoleConfiguration) ITreeSelection(org.eclipse.jface.viewers.ITreeSelection) TreePath(org.eclipse.jface.viewers.TreePath) ConsoleConfigurationPreferences(org.hibernate.console.preferences.ConsoleConfigurationPreferences) ITreeSelection(org.eclipse.jface.viewers.ITreeSelection) TreeSelection(org.eclipse.jface.viewers.TreeSelection) URL(java.net.URL) HibernateSearchEnabledPropertyTester(org.jboss.tools.hibernate.search.property.testers.HibernateSearchEnabledPropertyTester) Test(org.junit.Test)

Aggregations

URL (java.net.URL)2 ITreeSelection (org.eclipse.jface.viewers.ITreeSelection)2 TreePath (org.eclipse.jface.viewers.TreePath)2 TreeSelection (org.eclipse.jface.viewers.TreeSelection)2 ConsoleConfiguration (org.hibernate.console.ConsoleConfiguration)2 ConsoleConfigurationPreferences (org.hibernate.console.preferences.ConsoleConfigurationPreferences)2 HibernateSearchEnabledPropertyTester (org.jboss.tools.hibernate.search.property.testers.HibernateSearchEnabledPropertyTester)2 Test (org.junit.Test)2