target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test(expected=UnsupportedOperationException.class) public void testSetValueNotSupported() { new ListMinimumSizeModel(new ArrayListModel<String>(), 2).setValue(true); } | public void setValue(Object value) { throw new UnsupportedOperationException(); } | ListMinimumSizeModel extends AbstractValueModel { public void setValue(Object value) { throw new UnsupportedOperationException(); } } | ListMinimumSizeModel extends AbstractValueModel { public void setValue(Object value) { throw new UnsupportedOperationException(); } ListMinimumSizeModel(ListModel list, int minSize); } | ListMinimumSizeModel extends AbstractValueModel { public void setValue(Object value) { throw new UnsupportedOperationException(); } ListMinimumSizeModel(ListModel list, int minSize); Boolean getValue(); void setValue(Object value); } | ListMinimumSizeModel extends AbstractValueModel { public void setValue(Object value) { throw new UnsupportedOperationException(); } ListMinimumSizeModel(ListModel list, int minSize); Boolean getValue(); void setValue(Object value); } |
@Test public void testRemoving() { assertTrue(d_filledList.remove("Daan")); assertEquals(Arrays.asList("Gert", "Margreth"), d_filledList); assertEquals("Gert", d_filledList.remove(0)); assertEquals(Arrays.asList("Margreth"), d_filledList); resetFilledList(); d_filledList.clear(); assertEquals(Collections.emptyList(), d... | @Override public E remove(int index) { if (index >= 0 && index < size()) { E e = get(index); d_set.remove(e); d_listenerManager.fireIntervalRemoved(index, index); return e; } throw new IndexOutOfBoundsException(); } | SortedSetModel extends AbstractList<E> implements ObservableList<E> { @Override public E remove(int index) { if (index >= 0 && index < size()) { E e = get(index); d_set.remove(e); d_listenerManager.fireIntervalRemoved(index, index); return e; } throw new IndexOutOfBoundsException(); } } | SortedSetModel extends AbstractList<E> implements ObservableList<E> { @Override public E remove(int index) { if (index >= 0 && index < size()) { E e = get(index); d_set.remove(e); d_listenerManager.fireIntervalRemoved(index, index); return e; } throw new IndexOutOfBoundsException(); } SortedSetModel(); SortedSetModel(... | SortedSetModel extends AbstractList<E> implements ObservableList<E> { @Override public E remove(int index) { if (index >= 0 && index < size()) { E e = get(index); d_set.remove(e); d_listenerManager.fireIntervalRemoved(index, index); return e; } throw new IndexOutOfBoundsException(); } SortedSetModel(); SortedSetModel(... | SortedSetModel extends AbstractList<E> implements ObservableList<E> { @Override public E remove(int index) { if (index >= 0 && index < size()) { E e = get(index); d_set.remove(e); d_listenerManager.fireIntervalRemoved(index, index); return e; } throw new IndexOutOfBoundsException(); } SortedSetModel(); SortedSetModel(... |
@Test public void testAdding() { SortedSetModel<String> ssm = new SortedSetModel<String>(); ssm.add(0, "Gert"); assertEquals(Arrays.asList("Gert"), ssm); ssm.add(0, "Margreth"); assertEquals(Arrays.asList("Gert", "Margreth"), ssm); } | @Override public void add(int index, E element) { if (!d_set.contains(element)) { d_set.add(element); int idx = indexOf(element); d_listenerManager.fireIntervalAdded(idx, idx); } } | SortedSetModel extends AbstractList<E> implements ObservableList<E> { @Override public void add(int index, E element) { if (!d_set.contains(element)) { d_set.add(element); int idx = indexOf(element); d_listenerManager.fireIntervalAdded(idx, idx); } } } | SortedSetModel extends AbstractList<E> implements ObservableList<E> { @Override public void add(int index, E element) { if (!d_set.contains(element)) { d_set.add(element); int idx = indexOf(element); d_listenerManager.fireIntervalAdded(idx, idx); } } SortedSetModel(); SortedSetModel(Comparator<? super E> comparator); ... | SortedSetModel extends AbstractList<E> implements ObservableList<E> { @Override public void add(int index, E element) { if (!d_set.contains(element)) { d_set.add(element); int idx = indexOf(element); d_listenerManager.fireIntervalAdded(idx, idx); } } SortedSetModel(); SortedSetModel(Comparator<? super E> comparator); ... | SortedSetModel extends AbstractList<E> implements ObservableList<E> { @Override public void add(int index, E element) { if (!d_set.contains(element)) { d_set.add(element); int idx = indexOf(element); d_listenerManager.fireIntervalAdded(idx, idx); } } SortedSetModel(); SortedSetModel(Comparator<? super E> comparator); ... |
@Test public void testGetSet() { assertEquals(new TreeSet<String>(d_filledList), d_filledList.getSet()); } | public SortedSet<E> getSet() { return new TreeSet<E>(d_set); } | SortedSetModel extends AbstractList<E> implements ObservableList<E> { public SortedSet<E> getSet() { return new TreeSet<E>(d_set); } } | SortedSetModel extends AbstractList<E> implements ObservableList<E> { public SortedSet<E> getSet() { return new TreeSet<E>(d_set); } SortedSetModel(); SortedSetModel(Comparator<? super E> comparator); SortedSetModel(Collection<? extends E> c); } | SortedSetModel extends AbstractList<E> implements ObservableList<E> { public SortedSet<E> getSet() { return new TreeSet<E>(d_set); } SortedSetModel(); SortedSetModel(Comparator<? super E> comparator); SortedSetModel(Collection<? extends E> c); @Override int size(); @Override E get(int index); @Override void add(int i... | SortedSetModel extends AbstractList<E> implements ObservableList<E> { public SortedSet<E> getSet() { return new TreeSet<E>(d_set); } SortedSetModel(); SortedSetModel(Comparator<? super E> comparator); SortedSetModel(Collection<? extends E> c); @Override int size(); @Override E get(int index); @Override void add(int i... |
@Test public void testEqualsExpected() { ValueHolder valueModel = new ValueHolder("name"); ValueEqualsModel equalsModel = new ValueEqualsModel(valueModel, "name"); assertEquals(Boolean.TRUE, equalsModel.getValue()); PropertyChangeListener listener = EasyMock.createStrictMock(PropertyChangeListener.class); listener.prop... | public void setValue(final Object newValue) { throw new UnsupportedOperationException(getClass().getSimpleName() + " is read-only"); } | ValueEqualsModel extends AbstractConverter { public void setValue(final Object newValue) { throw new UnsupportedOperationException(getClass().getSimpleName() + " is read-only"); } } | ValueEqualsModel extends AbstractConverter { public void setValue(final Object newValue) { throw new UnsupportedOperationException(getClass().getSimpleName() + " is read-only"); } ValueEqualsModel(final ValueModel model, final Object expectedValue); } | ValueEqualsModel extends AbstractConverter { public void setValue(final Object newValue) { throw new UnsupportedOperationException(getClass().getSimpleName() + " is read-only"); } ValueEqualsModel(final ValueModel model, final Object expectedValue); void setValue(final Object newValue); Object convertFromSubject(final ... | ValueEqualsModel extends AbstractConverter { public void setValue(final Object newValue) { throw new UnsupportedOperationException(getClass().getSimpleName() + " is read-only"); } ValueEqualsModel(final ValueModel model, final Object expectedValue); void setValue(final Object newValue); Object convertFromSubject(final ... |
@Test public void testChangeExpected() { ValueHolder valueModel = new ValueHolder("name"); ValueEqualsModel equalsModel = new ValueEqualsModel(valueModel, "name"); assertEquals(Boolean.TRUE, equalsModel.getValue()); PropertyChangeListener listener = EasyMock.createStrictMock(PropertyChangeListener.class); listener.prop... | public void setExpected(Object expectedValue) { Object oldVal = getValue(); d_expectedValue = expectedValue; firePropertyChange("value", oldVal, getValue()); } | ValueEqualsModel extends AbstractConverter { public void setExpected(Object expectedValue) { Object oldVal = getValue(); d_expectedValue = expectedValue; firePropertyChange("value", oldVal, getValue()); } } | ValueEqualsModel extends AbstractConverter { public void setExpected(Object expectedValue) { Object oldVal = getValue(); d_expectedValue = expectedValue; firePropertyChange("value", oldVal, getValue()); } ValueEqualsModel(final ValueModel model, final Object expectedValue); } | ValueEqualsModel extends AbstractConverter { public void setExpected(Object expectedValue) { Object oldVal = getValue(); d_expectedValue = expectedValue; firePropertyChange("value", oldVal, getValue()); } ValueEqualsModel(final ValueModel model, final Object expectedValue); void setValue(final Object newValue); Object ... | ValueEqualsModel extends AbstractConverter { public void setExpected(Object expectedValue) { Object oldVal = getValue(); d_expectedValue = expectedValue; firePropertyChange("value", oldVal, getValue()); } ValueEqualsModel(final ValueModel model, final Object expectedValue); void setValue(final Object newValue); Object ... |
@SuppressWarnings("deprecation") @Test public void testGetCurrentDateWithoutTime() { Date now = new Date(); Date woTime = DateUtil.getCurrentDateWithoutTime(); assertEquals(now.getYear(), woTime.getYear()); assertEquals(now.getMonth(), woTime.getMonth()); assertEquals(now.getDay(), woTime.getDay()); assertEquals(0, woT... | public static Date getCurrentDateWithoutTime() { Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); cal.set(Calendar.AM_PM, Calendar.AM); Date date = cal.getTime(); return date; } | DateUtil { public static Date getCurrentDateWithoutTime() { Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); cal.set(Calendar.AM_PM, Calendar.AM); Date date = cal.getTime(); return date; } } | DateUtil { public static Date getCurrentDateWithoutTime() { Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); cal.set(Calendar.AM_PM, Calendar.AM); Date date = cal.getTime(); return date; } } | DateUtil { public static Date getCurrentDateWithoutTime() { Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); cal.set(Calendar.AM_PM, Calendar.AM); Date date = cal.getTime(); return date; } static Date getCurren... | DateUtil { public static Date getCurrentDateWithoutTime() { Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); cal.set(Calendar.AM_PM, Calendar.AM); Date date = cal.getTime(); return date; } static Date getCurren... |
@Test public void testMeanDifference() { EstimateWithPrecision e = Statistics.meanDifference( -2.5, 1.6, 177, -2.6, 1.5, 176); assertEquals(-0.1, e.getPointEstimate(), EPSILON); assertEquals(0.1650678, e.getStandardError(), EPSILON); } | public static EstimateWithPrecision meanDifference( double m0, double s0, double n0, double m1, double s1, double n1) { double md = m1 - m0; double se = Math.sqrt((s0 * s0) / n0 + (s1 * s1) / n1); return new EstimateWithPrecision(md, se); } | Statistics { public static EstimateWithPrecision meanDifference( double m0, double s0, double n0, double m1, double s1, double n1) { double md = m1 - m0; double se = Math.sqrt((s0 * s0) / n0 + (s1 * s1) / n1); return new EstimateWithPrecision(md, se); } } | Statistics { public static EstimateWithPrecision meanDifference( double m0, double s0, double n0, double m1, double s1, double n1) { double md = m1 - m0; double se = Math.sqrt((s0 * s0) / n0 + (s1 * s1) / n1); return new EstimateWithPrecision(md, se); } private Statistics(); } | Statistics { public static EstimateWithPrecision meanDifference( double m0, double s0, double n0, double m1, double s1, double n1) { double md = m1 - m0; double se = Math.sqrt((s0 * s0) / n0 + (s1 * s1) / n1); return new EstimateWithPrecision(md, se); } private Statistics(); static double logit(double p); static doubl... | Statistics { public static EstimateWithPrecision meanDifference( double m0, double s0, double n0, double m1, double s1, double n1) { double md = m1 - m0; double se = Math.sqrt((s0 * s0) / n0 + (s1 * s1) / n1); return new EstimateWithPrecision(md, se); } private Statistics(); static double logit(double p); static doubl... |
@Test public void wakeUpWakesNested() { Suspendable mockSuspendable = createStrictMock(Suspendable.class); expect(mockSuspendable.wakeUp()).andReturn(true); replay(mockSuspendable); SimpleTask task = new SimpleSuspendableTask(mockSuspendable); task.wakeUp(); verify(mockSuspendable); } | public boolean wakeUp() { return d_suspendable.wakeUp(); } | SimpleSuspendableTask implements SimpleTask { public boolean wakeUp() { return d_suspendable.wakeUp(); } } | SimpleSuspendableTask implements SimpleTask { public boolean wakeUp() { return d_suspendable.wakeUp(); } SimpleSuspendableTask(Suspendable suspendable, String str); SimpleSuspendableTask(Runnable runnable, String str); SimpleSuspendableTask(Runnable runnable); SimpleSuspendableTask(Suspendable suspendable); } | SimpleSuspendableTask implements SimpleTask { public boolean wakeUp() { return d_suspendable.wakeUp(); } SimpleSuspendableTask(Suspendable suspendable, String str); SimpleSuspendableTask(Runnable runnable, String str); SimpleSuspendableTask(Runnable runnable); SimpleSuspendableTask(Suspendable suspendable); void add... | SimpleSuspendableTask implements SimpleTask { public boolean wakeUp() { return d_suspendable.wakeUp(); } SimpleSuspendableTask(Suspendable suspendable, String str); SimpleSuspendableTask(Runnable runnable, String str); SimpleSuspendableTask(Runnable runnable); SimpleSuspendableTask(Suspendable suspendable); void add... |
@Test public void wakeUpAbortsNested() { Suspendable mockSuspendable = createStrictMock(Suspendable.class); expect(mockSuspendable.abort()).andReturn(true); replay(mockSuspendable); SimpleTask task = new SimpleSuspendableTask(mockSuspendable); task.abort(); verify(mockSuspendable); } | public boolean abort() { return d_suspendable.abort(); } | SimpleSuspendableTask implements SimpleTask { public boolean abort() { return d_suspendable.abort(); } } | SimpleSuspendableTask implements SimpleTask { public boolean abort() { return d_suspendable.abort(); } SimpleSuspendableTask(Suspendable suspendable, String str); SimpleSuspendableTask(Runnable runnable, String str); SimpleSuspendableTask(Runnable runnable); SimpleSuspendableTask(Suspendable suspendable); } | SimpleSuspendableTask implements SimpleTask { public boolean abort() { return d_suspendable.abort(); } SimpleSuspendableTask(Suspendable suspendable, String str); SimpleSuspendableTask(Runnable runnable, String str); SimpleSuspendableTask(Runnable runnable); SimpleSuspendableTask(Suspendable suspendable); void addTa... | SimpleSuspendableTask implements SimpleTask { public boolean abort() { return d_suspendable.abort(); } SimpleSuspendableTask(Suspendable suspendable, String str); SimpleSuspendableTask(Runnable runnable, String str); SimpleSuspendableTask(Runnable runnable); SimpleSuspendableTask(Suspendable suspendable); void addTa... |
@Test public void testTrueCondition() { MockTask source = new MockTask(); Task ifTask = new MockTask(); Task elTask = new MockTask(); Condition condition = createStrictMock(Condition.class); expect(condition.evaluate()).andReturn(true); replay(condition); Transition trans = new DecisionTransition(source, ifTask, elTask... | public List<Task> transition() { if (!isReady()) { throw new RuntimeException("Not ready for transition."); } if (d_condition.evaluate()) { return Collections.singletonList(d_ifTask); } else { return Collections.singletonList(d_elTask); } } | DecisionTransition implements Transition { public List<Task> transition() { if (!isReady()) { throw new RuntimeException("Not ready for transition."); } if (d_condition.evaluate()) { return Collections.singletonList(d_ifTask); } else { return Collections.singletonList(d_elTask); } } } | DecisionTransition implements Transition { public List<Task> transition() { if (!isReady()) { throw new RuntimeException("Not ready for transition."); } if (d_condition.evaluate()) { return Collections.singletonList(d_ifTask); } else { return Collections.singletonList(d_elTask); } } DecisionTransition(Task source, Task... | DecisionTransition implements Transition { public List<Task> transition() { if (!isReady()) { throw new RuntimeException("Not ready for transition."); } if (d_condition.evaluate()) { return Collections.singletonList(d_ifTask); } else { return Collections.singletonList(d_elTask); } } DecisionTransition(Task source, Task... | DecisionTransition implements Transition { public List<Task> transition() { if (!isReady()) { throw new RuntimeException("Not ready for transition."); } if (d_condition.evaluate()) { return Collections.singletonList(d_ifTask); } else { return Collections.singletonList(d_elTask); } } DecisionTransition(Task source, Task... |
@Test public void testInitialValues() { assertFalse(new StringNotEmptyModel(new ValueHolder(null)).getValue()); assertFalse(new StringNotEmptyModel(new ValueHolder(new Object())).getValue()); assertFalse(new StringNotEmptyModel(new ValueHolder("")).getValue()); assertTrue(new StringNotEmptyModel(new ValueHolder("Test")... | public Boolean getValue() { return d_val; } | StringNotEmptyModel extends AbstractValueModel { public Boolean getValue() { return d_val; } } | StringNotEmptyModel extends AbstractValueModel { public Boolean getValue() { return d_val; } StringNotEmptyModel(ValueModel nested); } | StringNotEmptyModel extends AbstractValueModel { public Boolean getValue() { return d_val; } StringNotEmptyModel(ValueModel nested); Boolean getValue(); void setValue(Object value); } | StringNotEmptyModel extends AbstractValueModel { public Boolean getValue() { return d_val; } StringNotEmptyModel(ValueModel nested); Boolean getValue(); void setValue(Object value); } |
@Test public void testFalseCondition() { MockTask source = new MockTask(); Task ifTask = new MockTask(); Task elTask = new MockTask(); Condition condition = createStrictMock(Condition.class); expect(condition.evaluate()).andReturn(false); replay(condition); Transition trans = new DecisionTransition(source, ifTask, elTa... | public List<Task> transition() { if (!isReady()) { throw new RuntimeException("Not ready for transition."); } if (d_condition.evaluate()) { return Collections.singletonList(d_ifTask); } else { return Collections.singletonList(d_elTask); } } | DecisionTransition implements Transition { public List<Task> transition() { if (!isReady()) { throw new RuntimeException("Not ready for transition."); } if (d_condition.evaluate()) { return Collections.singletonList(d_ifTask); } else { return Collections.singletonList(d_elTask); } } } | DecisionTransition implements Transition { public List<Task> transition() { if (!isReady()) { throw new RuntimeException("Not ready for transition."); } if (d_condition.evaluate()) { return Collections.singletonList(d_ifTask); } else { return Collections.singletonList(d_elTask); } } DecisionTransition(Task source, Task... | DecisionTransition implements Transition { public List<Task> transition() { if (!isReady()) { throw new RuntimeException("Not ready for transition."); } if (d_condition.evaluate()) { return Collections.singletonList(d_ifTask); } else { return Collections.singletonList(d_elTask); } } DecisionTransition(Task source, Task... | DecisionTransition implements Transition { public List<Task> transition() { if (!isReady()) { throw new RuntimeException("Not ready for transition."); } if (d_condition.evaluate()) { return Collections.singletonList(d_ifTask); } else { return Collections.singletonList(d_elTask); } } DecisionTransition(Task source, Task... |
@Test public void testInitialState() { MockTask start = new MockTask(); start.start(); MockTask end = new MockTask(); Transition trans = new DirectTransition(start, end); ActivityModel model = new ActivityModel(start, end, Collections.singleton(trans)); assertEquals(Collections.singleton(start), model.getNextStates());... | public Set<Task> getNextStates() { if (isFinished()) { return Collections.emptySet(); } return findAccessibleStates(d_start); } | ActivityModel { public Set<Task> getNextStates() { if (isFinished()) { return Collections.emptySet(); } return findAccessibleStates(d_start); } } | ActivityModel { public Set<Task> getNextStates() { if (isFinished()) { return Collections.emptySet(); } return findAccessibleStates(d_start); } ActivityModel(Task start, Task end, Collection<? extends Transition> transitions); } | ActivityModel { public Set<Task> getNextStates() { if (isFinished()) { return Collections.emptySet(); } return findAccessibleStates(d_start); } ActivityModel(Task start, Task end, Collection<? extends Transition> transitions); Set<Task> getNextStates(); boolean isFinished(); Task getStartState(); Task getEndState(); Se... | ActivityModel { public Set<Task> getNextStates() { if (isFinished()) { return Collections.emptySet(); } return findAccessibleStates(d_start); } ActivityModel(Task start, Task end, Collection<? extends Transition> transitions); Set<Task> getNextStates(); boolean isFinished(); Task getStartState(); Task getEndState(); Se... |
@Test public void testSimpleTransition() { MockTask start = new MockTask(); start.start(); MockTask end = new MockTask(); Transition trans = new DirectTransition(start, end); ActivityModel model = new ActivityModel(start, end, Collections.singleton(trans)); start.finish(); assertEquals(Collections.singleton(end), model... | public Set<Task> getNextStates() { if (isFinished()) { return Collections.emptySet(); } return findAccessibleStates(d_start); } | ActivityModel { public Set<Task> getNextStates() { if (isFinished()) { return Collections.emptySet(); } return findAccessibleStates(d_start); } } | ActivityModel { public Set<Task> getNextStates() { if (isFinished()) { return Collections.emptySet(); } return findAccessibleStates(d_start); } ActivityModel(Task start, Task end, Collection<? extends Transition> transitions); } | ActivityModel { public Set<Task> getNextStates() { if (isFinished()) { return Collections.emptySet(); } return findAccessibleStates(d_start); } ActivityModel(Task start, Task end, Collection<? extends Transition> transitions); Set<Task> getNextStates(); boolean isFinished(); Task getStartState(); Task getEndState(); Se... | ActivityModel { public Set<Task> getNextStates() { if (isFinished()) { return Collections.emptySet(); } return findAccessibleStates(d_start); } ActivityModel(Task start, Task end, Collection<? extends Transition> transitions); Set<Task> getNextStates(); boolean isFinished(); Task getStartState(); Task getEndState(); Se... |
@Test public void testIsFinished() { MockTask start = new MockTask(); start.start(); MockTask end = new MockTask(); Transition trans = new DirectTransition(start, end); ActivityModel model = new ActivityModel(start, end, Collections.singleton(trans)); start.finish(); end.start(); end.finish(); assertTrue(model.isFinish... | public boolean isFinished() { return d_end.isFinished(); } | ActivityModel { public boolean isFinished() { return d_end.isFinished(); } } | ActivityModel { public boolean isFinished() { return d_end.isFinished(); } ActivityModel(Task start, Task end, Collection<? extends Transition> transitions); } | ActivityModel { public boolean isFinished() { return d_end.isFinished(); } ActivityModel(Task start, Task end, Collection<? extends Transition> transitions); Set<Task> getNextStates(); boolean isFinished(); Task getStartState(); Task getEndState(); Set<Task> getStates(); Task getStateByName(String name); Set<Transition... | ActivityModel { public boolean isFinished() { return d_end.isFinished(); } ActivityModel(Task start, Task end, Collection<? extends Transition> transitions); Set<Task> getNextStates(); boolean isFinished(); Task getStartState(); Task getEndState(); Set<Task> getStates(); Task getStateByName(String name); Set<Transition... |
@Test public void testNotifyProgress() { IterativeComputation comp = new ShortComputation(10); IterativeTask task = new IterativeTask(comp); task.setReportingInterval(3); TaskListener listener = createStrictMock(TaskListener.class); listener.taskEvent(new TaskStartedEvent(task)); listener.taskEvent(new TaskProgressEven... | public void setReportingInterval(int interval) { ((IterativeSuspendable)d_suspendable).setReportingInterval(interval); } | IterativeTask extends SimpleSuspendableTask { public void setReportingInterval(int interval) { ((IterativeSuspendable)d_suspendable).setReportingInterval(interval); } } | IterativeTask extends SimpleSuspendableTask { public void setReportingInterval(int interval) { ((IterativeSuspendable)d_suspendable).setReportingInterval(interval); } IterativeTask(IterativeComputation computation, String str); IterativeTask(IterativeComputation computation); } | IterativeTask extends SimpleSuspendableTask { public void setReportingInterval(int interval) { ((IterativeSuspendable)d_suspendable).setReportingInterval(interval); } IterativeTask(IterativeComputation computation, String str); IterativeTask(IterativeComputation computation); void setReportingInterval(int interval); @... | IterativeTask extends SimpleSuspendableTask { public void setReportingInterval(int interval) { ((IterativeSuspendable)d_suspendable).setReportingInterval(interval); } IterativeTask(IterativeComputation computation, String str); IterativeTask(IterativeComputation computation); void setReportingInterval(int interval); @... |
@Test public void testNotifyProgress2() { IterativeComputation comp = new ShortComputation(9); IterativeTask task = new IterativeTask(comp); task.setReportingInterval(3); TaskListener listener = createStrictMock(TaskListener.class); listener.taskEvent(new TaskStartedEvent(task)); listener.taskEvent(new TaskProgressEven... | public void setReportingInterval(int interval) { ((IterativeSuspendable)d_suspendable).setReportingInterval(interval); } | IterativeTask extends SimpleSuspendableTask { public void setReportingInterval(int interval) { ((IterativeSuspendable)d_suspendable).setReportingInterval(interval); } } | IterativeTask extends SimpleSuspendableTask { public void setReportingInterval(int interval) { ((IterativeSuspendable)d_suspendable).setReportingInterval(interval); } IterativeTask(IterativeComputation computation, String str); IterativeTask(IterativeComputation computation); } | IterativeTask extends SimpleSuspendableTask { public void setReportingInterval(int interval) { ((IterativeSuspendable)d_suspendable).setReportingInterval(interval); } IterativeTask(IterativeComputation computation, String str); IterativeTask(IterativeComputation computation); void setReportingInterval(int interval); @... | IterativeTask extends SimpleSuspendableTask { public void setReportingInterval(int interval) { ((IterativeSuspendable)d_suspendable).setReportingInterval(interval); } IterativeTask(IterativeComputation computation, String str); IterativeTask(IterativeComputation computation); void setReportingInterval(int interval); @... |
@Test(expected=UnsupportedOperationException.class) public void testSetValueNotSupported() { new StringNotEmptyModel(new ValueHolder(null)).setValue(true); } | public void setValue(Object value) { throw new UnsupportedOperationException(); } | StringNotEmptyModel extends AbstractValueModel { public void setValue(Object value) { throw new UnsupportedOperationException(); } } | StringNotEmptyModel extends AbstractValueModel { public void setValue(Object value) { throw new UnsupportedOperationException(); } StringNotEmptyModel(ValueModel nested); } | StringNotEmptyModel extends AbstractValueModel { public void setValue(Object value) { throw new UnsupportedOperationException(); } StringNotEmptyModel(ValueModel nested); Boolean getValue(); void setValue(Object value); } | StringNotEmptyModel extends AbstractValueModel { public void setValue(Object value) { throw new UnsupportedOperationException(); } StringNotEmptyModel(ValueModel nested); Boolean getValue(); void setValue(Object value); } |
@Test public void testEventChaining() { ValueHolder holder = new ValueHolder(null); StringNotEmptyModel model = new StringNotEmptyModel(holder); PropertyChangeListener mock = JUnitUtil.mockStrictListener(model, "value", false, true); model.addValueChangeListener(mock); holder.setValue("test"); holder.setValue("test2");... | public void setValue(Object value) { throw new UnsupportedOperationException(); } | StringNotEmptyModel extends AbstractValueModel { public void setValue(Object value) { throw new UnsupportedOperationException(); } } | StringNotEmptyModel extends AbstractValueModel { public void setValue(Object value) { throw new UnsupportedOperationException(); } StringNotEmptyModel(ValueModel nested); } | StringNotEmptyModel extends AbstractValueModel { public void setValue(Object value) { throw new UnsupportedOperationException(); } StringNotEmptyModel(ValueModel nested); Boolean getValue(); void setValue(Object value); } | StringNotEmptyModel extends AbstractValueModel { public void setValue(Object value) { throw new UnsupportedOperationException(); } StringNotEmptyModel(ValueModel nested); Boolean getValue(); void setValue(Object value); } |
@Test public void testTable() { assertEquals(12.706, StudentTTable.getT(1), 0.001); assertEquals(1.998, StudentTTable.getT(63), 0.001); assertEquals(1.96, StudentTTable.getT(1000), 0.01); assertEquals(1.96, StudentTTable.getT(2000), 0.01); assertEquals(StudentTTable.getT(160) / 2 + StudentTTable.getT(140) / 2, StudentT... | public static double getT(int v) { if (v < 1) { throw new IllegalArgumentException("student T distribution defined only for positive degrees of freedom"); } TDistribution dist = new TDistribution(v); return dist.inverseCumulativeProbability(0.975); } | StudentTTable { public static double getT(int v) { if (v < 1) { throw new IllegalArgumentException("student T distribution defined only for positive degrees of freedom"); } TDistribution dist = new TDistribution(v); return dist.inverseCumulativeProbability(0.975); } } | StudentTTable { public static double getT(int v) { if (v < 1) { throw new IllegalArgumentException("student T distribution defined only for positive degrees of freedom"); } TDistribution dist = new TDistribution(v); return dist.inverseCumulativeProbability(0.975); } } | StudentTTable { public static double getT(int v) { if (v < 1) { throw new IllegalArgumentException("student T distribution defined only for positive degrees of freedom"); } TDistribution dist = new TDistribution(v); return dist.inverseCumulativeProbability(0.975); } static double getT(int v); } | StudentTTable { public static double getT(int v) { if (v < 1) { throw new IllegalArgumentException("student T distribution defined only for positive degrees of freedom"); } TDistribution dist = new TDistribution(v); return dist.inverseCumulativeProbability(0.975); } static double getT(int v); } |
@Test public void testGetLength() { Interval<Double> in = new Interval<Double>(1.0, 6.0); assertEquals(5.0, in.getLength(), 0.00001); } | public double getLength() { return d_upperBound.doubleValue() - d_lowerBound.doubleValue(); } | Interval { public double getLength() { return d_upperBound.doubleValue() - d_lowerBound.doubleValue(); } } | Interval { public double getLength() { return d_upperBound.doubleValue() - d_lowerBound.doubleValue(); } Interval(N lowerBound, N upperBound); } | Interval { public double getLength() { return d_upperBound.doubleValue() - d_lowerBound.doubleValue(); } Interval(N lowerBound, N upperBound); N getLowerBound(); N getUpperBound(); double getLength(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); } | Interval { public double getLength() { return d_upperBound.doubleValue() - d_lowerBound.doubleValue(); } Interval(N lowerBound, N upperBound); N getLowerBound(); N getUpperBound(); double getLength(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); } |
@Test public void testEquals() { Interval<Double> in = new Interval<Double>(1.0, 6.0); Interval<Integer> in2 = new Interval<Integer>(1, 6); assertNotEquals(in, in2); Double d = new Double(1.0); Integer i = new Integer(6); assertNotEquals(d, in); assertNotEquals(i, in2); Interval<Double> in3 = new Interval<Double>(1.0, ... | @Override public boolean equals(Object o) { if (o instanceof Interval<?>) { Interval<?> other = (Interval<?>) o; if (other.canEqual(this)) { if (other.getLowerBound().getClass().equals(getLowerBound().getClass())) { return ((getLowerBound().equals(other.getLowerBound())) && (getUpperBound().equals(other.getUpperBound()... | Interval { @Override public boolean equals(Object o) { if (o instanceof Interval<?>) { Interval<?> other = (Interval<?>) o; if (other.canEqual(this)) { if (other.getLowerBound().getClass().equals(getLowerBound().getClass())) { return ((getLowerBound().equals(other.getLowerBound())) && (getUpperBound().equals(other.getU... | Interval { @Override public boolean equals(Object o) { if (o instanceof Interval<?>) { Interval<?> other = (Interval<?>) o; if (other.canEqual(this)) { if (other.getLowerBound().getClass().equals(getLowerBound().getClass())) { return ((getLowerBound().equals(other.getLowerBound())) && (getUpperBound().equals(other.getU... | Interval { @Override public boolean equals(Object o) { if (o instanceof Interval<?>) { Interval<?> other = (Interval<?>) o; if (other.canEqual(this)) { if (other.getLowerBound().getClass().equals(getLowerBound().getClass())) { return ((getLowerBound().equals(other.getLowerBound())) && (getUpperBound().equals(other.getU... | Interval { @Override public boolean equals(Object o) { if (o instanceof Interval<?>) { Interval<?> other = (Interval<?>) o; if (other.canEqual(this)) { if (other.getLowerBound().getClass().equals(getLowerBound().getClass())) { return ((getLowerBound().equals(other.getLowerBound())) && (getUpperBound().equals(other.getU... |
@Test public void testToString() { Interval<Double> in = new Interval<Double>(1.0, 6.0); assertEquals("1.0-6.0", in.toString()); } | @Override public String toString() { return getLowerBound().toString() + "-" + getUpperBound().toString(); } | Interval { @Override public String toString() { return getLowerBound().toString() + "-" + getUpperBound().toString(); } } | Interval { @Override public String toString() { return getLowerBound().toString() + "-" + getUpperBound().toString(); } Interval(N lowerBound, N upperBound); } | Interval { @Override public String toString() { return getLowerBound().toString() + "-" + getUpperBound().toString(); } Interval(N lowerBound, N upperBound); N getLowerBound(); N getUpperBound(); double getLength(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); } | Interval { @Override public String toString() { return getLowerBound().toString() + "-" + getUpperBound().toString(); } Interval(N lowerBound, N upperBound); N getLowerBound(); N getUpperBound(); double getLength(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); } |
@Test public void test_lineSeparator_suffix() { SimpleMessage message = new SimpleMessage("Hello, World!"); LogEvent logEvent = Log4jLogEvent .newBuilder() .setLoggerName(LogstashLayoutTest.class.getSimpleName()) .setLevel(Level.INFO) .setMessage(message) .build(); test_lineSeparator_suffix(logEvent, true); test_lineSe... | @PluginBuilderFactory @SuppressWarnings("WeakerAccess") public static Builder newBuilder() { return new Builder(); } | LogstashLayout implements Layout<String> { @PluginBuilderFactory @SuppressWarnings("WeakerAccess") public static Builder newBuilder() { return new Builder(); } } | LogstashLayout implements Layout<String> { @PluginBuilderFactory @SuppressWarnings("WeakerAccess") public static Builder newBuilder() { return new Builder(); } private LogstashLayout(Builder builder); } | LogstashLayout implements Layout<String> { @PluginBuilderFactory @SuppressWarnings("WeakerAccess") public static Builder newBuilder() { return new Builder(); } private LogstashLayout(Builder builder); @Override String toSerializable(LogEvent event); @Override byte[] toByteArray(LogEvent event); @Override void encode(L... | LogstashLayout implements Layout<String> { @PluginBuilderFactory @SuppressWarnings("WeakerAccess") public static Builder newBuilder() { return new Builder(); } private LogstashLayout(Builder builder); @Override String toSerializable(LogEvent event); @Override byte[] toByteArray(LogEvent event); @Override void encode(L... |
@Test public void initViews를호출하면버튼의Listener가설정된다() { EditText weightText = mock(EditText.class); EditText heightText = mock(EditText.class); TextView resultText = mock(TextView.class); Button resultButton = mock(Button.class); View.OnClickListener buttonListener = mock(View.OnClickListener.class); MainActivity activity... | @VisibleForTesting void initViews() { EditText weightText = (EditText)findViewById(R.id.text_weight); EditText heightText = (EditText)findViewById(R.id.text_height); TextView resultText = (TextView)findViewById(R.id.text_result); mCalcButton = (Button)findViewById(R.id.button_calculate); View.OnClickListener buttonList... | MainActivity extends AppCompatActivity { @VisibleForTesting void initViews() { EditText weightText = (EditText)findViewById(R.id.text_weight); EditText heightText = (EditText)findViewById(R.id.text_height); TextView resultText = (TextView)findViewById(R.id.text_result); mCalcButton = (Button)findViewById(R.id.button_ca... | MainActivity extends AppCompatActivity { @VisibleForTesting void initViews() { EditText weightText = (EditText)findViewById(R.id.text_weight); EditText heightText = (EditText)findViewById(R.id.text_height); TextView resultText = (TextView)findViewById(R.id.text_result); mCalcButton = (Button)findViewById(R.id.button_ca... | MainActivity extends AppCompatActivity { @VisibleForTesting void initViews() { EditText weightText = (EditText)findViewById(R.id.text_weight); EditText heightText = (EditText)findViewById(R.id.text_height); TextView resultText = (TextView)findViewById(R.id.text_result); mCalcButton = (Button)findViewById(R.id.button_ca... | MainActivity extends AppCompatActivity { @VisibleForTesting void initViews() { EditText weightText = (EditText)findViewById(R.id.text_weight); EditText heightText = (EditText)findViewById(R.id.text_height); TextView resultText = (TextView)findViewById(R.id.text_result); mCalcButton = (Button)findViewById(R.id.button_ca... |
@Test public void static인start메소드를호출하면startService된다() { Context context = mock(Context.class); SaveBmiService.start(context, mock(BmiValue.class)); verify(context, times(1)).startService((Intent) any()); } | public static void start(Context context, BmiValue bmiValue) { Intent intent = new Intent(context, SaveBmiService.class); intent.putExtra(PARAM_KEY_BMI_VALUE, bmiValue); context.startService(intent); } | SaveBmiService extends IntentService { public static void start(Context context, BmiValue bmiValue) { Intent intent = new Intent(context, SaveBmiService.class); intent.putExtra(PARAM_KEY_BMI_VALUE, bmiValue); context.startService(intent); } } | SaveBmiService extends IntentService { public static void start(Context context, BmiValue bmiValue) { Intent intent = new Intent(context, SaveBmiService.class); intent.putExtra(PARAM_KEY_BMI_VALUE, bmiValue); context.startService(intent); } SaveBmiService(); } | SaveBmiService extends IntentService { public static void start(Context context, BmiValue bmiValue) { Intent intent = new Intent(context, SaveBmiService.class); intent.putExtra(PARAM_KEY_BMI_VALUE, bmiValue); context.startService(intent); } SaveBmiService(); @Override void onCreate(); static void start(Context context,... | SaveBmiService extends IntentService { public static void start(Context context, BmiValue bmiValue) { Intent intent = new Intent(context, SaveBmiService.class); intent.putExtra(PARAM_KEY_BMI_VALUE, bmiValue); context.startService(intent); } SaveBmiService(); @Override void onCreate(); static void start(Context context,... |
@Test public void onHandleIntentにnull을전달하면아무것도하지않는다() { SaveBmiService service = spy(new SaveBmiService()); service.onHandleIntent(null); verify(service, never()).sendLocalBroadcast(anyBoolean()); verify(service, never()).saveToRemoteServer((BmiValue) any()); } | @Override protected void onHandleIntent(Intent intent) { if (intent == null) { return; } Serializable extra = intent.getSerializableExtra(PARAM_KEY_BMI_VALUE); if (extra == null || !(extra instanceof BmiValue)) { return; } BmiValue bmiValue = (BmiValue)extra; boolean result = saveToRemoteServer(bmiValue); sendLocalBroa... | SaveBmiService extends IntentService { @Override protected void onHandleIntent(Intent intent) { if (intent == null) { return; } Serializable extra = intent.getSerializableExtra(PARAM_KEY_BMI_VALUE); if (extra == null || !(extra instanceof BmiValue)) { return; } BmiValue bmiValue = (BmiValue)extra; boolean result = save... | SaveBmiService extends IntentService { @Override protected void onHandleIntent(Intent intent) { if (intent == null) { return; } Serializable extra = intent.getSerializableExtra(PARAM_KEY_BMI_VALUE); if (extra == null || !(extra instanceof BmiValue)) { return; } BmiValue bmiValue = (BmiValue)extra; boolean result = save... | SaveBmiService extends IntentService { @Override protected void onHandleIntent(Intent intent) { if (intent == null) { return; } Serializable extra = intent.getSerializableExtra(PARAM_KEY_BMI_VALUE); if (extra == null || !(extra instanceof BmiValue)) { return; } BmiValue bmiValue = (BmiValue)extra; boolean result = save... | SaveBmiService extends IntentService { @Override protected void onHandleIntent(Intent intent) { if (intent == null) { return; } Serializable extra = intent.getSerializableExtra(PARAM_KEY_BMI_VALUE); if (extra == null || !(extra instanceof BmiValue)) { return; } BmiValue bmiValue = (BmiValue)extra; boolean result = save... |
@Test public void onHandleIntent에파라미터없는Intent를전달하면아무것도하지않는다() { SaveBmiService service = spy(new SaveBmiService()); service.onHandleIntent(mock(Intent.class)); verify(service, never()).sendLocalBroadcast(anyBoolean()); verify(service, never()).saveToRemoteServer((BmiValue)any()); } | @Override protected void onHandleIntent(Intent intent) { if (intent == null) { return; } Serializable extra = intent.getSerializableExtra(PARAM_KEY_BMI_VALUE); if (extra == null || !(extra instanceof BmiValue)) { return; } BmiValue bmiValue = (BmiValue)extra; boolean result = saveToRemoteServer(bmiValue); sendLocalBroa... | SaveBmiService extends IntentService { @Override protected void onHandleIntent(Intent intent) { if (intent == null) { return; } Serializable extra = intent.getSerializableExtra(PARAM_KEY_BMI_VALUE); if (extra == null || !(extra instanceof BmiValue)) { return; } BmiValue bmiValue = (BmiValue)extra; boolean result = save... | SaveBmiService extends IntentService { @Override protected void onHandleIntent(Intent intent) { if (intent == null) { return; } Serializable extra = intent.getSerializableExtra(PARAM_KEY_BMI_VALUE); if (extra == null || !(extra instanceof BmiValue)) { return; } BmiValue bmiValue = (BmiValue)extra; boolean result = save... | SaveBmiService extends IntentService { @Override protected void onHandleIntent(Intent intent) { if (intent == null) { return; } Serializable extra = intent.getSerializableExtra(PARAM_KEY_BMI_VALUE); if (extra == null || !(extra instanceof BmiValue)) { return; } BmiValue bmiValue = (BmiValue)extra; boolean result = save... | SaveBmiService extends IntentService { @Override protected void onHandleIntent(Intent intent) { if (intent == null) { return; } Serializable extra = intent.getSerializableExtra(PARAM_KEY_BMI_VALUE); if (extra == null || !(extra instanceof BmiValue)) { return; } BmiValue bmiValue = (BmiValue)extra; boolean result = save... |
@Test public void onHandleIntent에BmiValue형이외의데이터가들어간Intent를전달하면아무것도하지않는다() { Intent intent = mock(Intent.class); when(intent.getSerializableExtra(SaveBmiService.PARAM_KEY_BMI_VALUE)).thenReturn("hoge"); SaveBmiService service = spy(new SaveBmiService()); service.onHandleIntent(intent); verify(service, never()).sendLoca... | @Override protected void onHandleIntent(Intent intent) { if (intent == null) { return; } Serializable extra = intent.getSerializableExtra(PARAM_KEY_BMI_VALUE); if (extra == null || !(extra instanceof BmiValue)) { return; } BmiValue bmiValue = (BmiValue)extra; boolean result = saveToRemoteServer(bmiValue); sendLocalBroa... | SaveBmiService extends IntentService { @Override protected void onHandleIntent(Intent intent) { if (intent == null) { return; } Serializable extra = intent.getSerializableExtra(PARAM_KEY_BMI_VALUE); if (extra == null || !(extra instanceof BmiValue)) { return; } BmiValue bmiValue = (BmiValue)extra; boolean result = save... | SaveBmiService extends IntentService { @Override protected void onHandleIntent(Intent intent) { if (intent == null) { return; } Serializable extra = intent.getSerializableExtra(PARAM_KEY_BMI_VALUE); if (extra == null || !(extra instanceof BmiValue)) { return; } BmiValue bmiValue = (BmiValue)extra; boolean result = save... | SaveBmiService extends IntentService { @Override protected void onHandleIntent(Intent intent) { if (intent == null) { return; } Serializable extra = intent.getSerializableExtra(PARAM_KEY_BMI_VALUE); if (extra == null || !(extra instanceof BmiValue)) { return; } BmiValue bmiValue = (BmiValue)extra; boolean result = save... | SaveBmiService extends IntentService { @Override protected void onHandleIntent(Intent intent) { if (intent == null) { return; } Serializable extra = intent.getSerializableExtra(PARAM_KEY_BMI_VALUE); if (extra == null || !(extra instanceof BmiValue)) { return; } BmiValue bmiValue = (BmiValue)extra; boolean result = save... |
@Test public void onHandleIntent에바르게데이터가들어간Intent를전달하면데이터저장과Broadcast가이루어진다() { BmiValue bmiValue = mock(BmiValue.class); Intent intent = mock(Intent.class); when(intent.getSerializableExtra(SaveBmiService.PARAM_KEY_BMI_VALUE)).thenReturn(bmiValue); SaveBmiService service = spy(new SaveBmiService()); doReturn(false).wh... | @Override protected void onHandleIntent(Intent intent) { if (intent == null) { return; } Serializable extra = intent.getSerializableExtra(PARAM_KEY_BMI_VALUE); if (extra == null || !(extra instanceof BmiValue)) { return; } BmiValue bmiValue = (BmiValue)extra; boolean result = saveToRemoteServer(bmiValue); sendLocalBroa... | SaveBmiService extends IntentService { @Override protected void onHandleIntent(Intent intent) { if (intent == null) { return; } Serializable extra = intent.getSerializableExtra(PARAM_KEY_BMI_VALUE); if (extra == null || !(extra instanceof BmiValue)) { return; } BmiValue bmiValue = (BmiValue)extra; boolean result = save... | SaveBmiService extends IntentService { @Override protected void onHandleIntent(Intent intent) { if (intent == null) { return; } Serializable extra = intent.getSerializableExtra(PARAM_KEY_BMI_VALUE); if (extra == null || !(extra instanceof BmiValue)) { return; } BmiValue bmiValue = (BmiValue)extra; boolean result = save... | SaveBmiService extends IntentService { @Override protected void onHandleIntent(Intent intent) { if (intent == null) { return; } Serializable extra = intent.getSerializableExtra(PARAM_KEY_BMI_VALUE); if (extra == null || !(extra instanceof BmiValue)) { return; } BmiValue bmiValue = (BmiValue)extra; boolean result = save... | SaveBmiService extends IntentService { @Override protected void onHandleIntent(Intent intent) { if (intent == null) { return; } Serializable extra = intent.getSerializableExtra(PARAM_KEY_BMI_VALUE); if (extra == null || !(extra instanceof BmiValue)) { return; } BmiValue bmiValue = (BmiValue)extra; boolean result = save... |
@Test(expected = RuntimeException.class) public void 신장에음수값을넘기면예외가발생한다() { calculator.calculate(-1f, 60.0f); | public BmiValue calculate(float heightInMeter, float weightInKg) { if (heightInMeter < 0 || weightInKg < 0) { throw new RuntimeException("키와 몸무게는 양수로 지정해주세요"); } float bmiValue = weightInKg / (heightInMeter * heightInMeter); return createValueObj(bmiValue); } | BmiCalculator { public BmiValue calculate(float heightInMeter, float weightInKg) { if (heightInMeter < 0 || weightInKg < 0) { throw new RuntimeException("키와 몸무게는 양수로 지정해주세요"); } float bmiValue = weightInKg / (heightInMeter * heightInMeter); return createValueObj(bmiValue); } } | BmiCalculator { public BmiValue calculate(float heightInMeter, float weightInKg) { if (heightInMeter < 0 || weightInKg < 0) { throw new RuntimeException("키와 몸무게는 양수로 지정해주세요"); } float bmiValue = weightInKg / (heightInMeter * heightInMeter); return createValueObj(bmiValue); } } | BmiCalculator { public BmiValue calculate(float heightInMeter, float weightInKg) { if (heightInMeter < 0 || weightInKg < 0) { throw new RuntimeException("키와 몸무게는 양수로 지정해주세요"); } float bmiValue = weightInKg / (heightInMeter * heightInMeter); return createValueObj(bmiValue); } BmiValue calculate(float heightInMeter, flo... | BmiCalculator { public BmiValue calculate(float heightInMeter, float weightInKg) { if (heightInMeter < 0 || weightInKg < 0) { throw new RuntimeException("키와 몸무게는 양수로 지정해주세요"); } float bmiValue = weightInKg / (heightInMeter * heightInMeter); return createValueObj(bmiValue); } BmiValue calculate(float heightInMeter, flo... |
@Test public void 생성시에전달한Float값을소수점2자리까지반올림해반환한다() { BmiValue bmiValue = new BmiValue(20.00511f); Assert.assertEquals(20.01f, bmiValue.toFloat()); } | public float toFloat() { int rounded = Math.round(mValue * 100); return rounded / 100f; } | BmiValue implements Serializable { public float toFloat() { int rounded = Math.round(mValue * 100); return rounded / 100f; } } | BmiValue implements Serializable { public float toFloat() { int rounded = Math.round(mValue * 100); return rounded / 100f; } BmiValue(float value); } | BmiValue implements Serializable { public float toFloat() { int rounded = Math.round(mValue * 100); return rounded / 100f; } BmiValue(float value); float toFloat(); String getMessage(); } | BmiValue implements Serializable { public float toFloat() { int rounded = Math.round(mValue * 100); return rounded / 100f; } BmiValue(float value); float toFloat(); String getMessage(); } |
@Test public void 생성시에전달한Float값을소수점2자리까지버림해반환한다() { BmiValue bmiValue = new BmiValue(20.00499f); Assert.assertEquals(20.00f, bmiValue.toFloat()); } | public float toFloat() { int rounded = Math.round(mValue * 100); return rounded / 100f; } | BmiValue implements Serializable { public float toFloat() { int rounded = Math.round(mValue * 100); return rounded / 100f; } } | BmiValue implements Serializable { public float toFloat() { int rounded = Math.round(mValue * 100); return rounded / 100f; } BmiValue(float value); } | BmiValue implements Serializable { public float toFloat() { int rounded = Math.round(mValue * 100); return rounded / 100f; } BmiValue(float value); float toFloat(); String getMessage(); } | BmiValue implements Serializable { public float toFloat() { int rounded = Math.round(mValue * 100); return rounded / 100f; } BmiValue(float value); float toFloat(); String getMessage(); } |
@Test public void testGetGeckcoDriverPath() { String expResult; if (isWin) { expResult = "./lib/Drivers/geckodriver.exe"; } else { expResult = "./lib/Drivers/geckodriver"; } String result = ds.getGeckcoDriverPath(); assertEquals(result, expResult); } | public String getGeckcoDriverPath() { return getProperty("GeckoDriverPath", geckoDriverPath); } | DriverSettings extends AbstractPropSettings { public String getGeckcoDriverPath() { return getProperty("GeckoDriverPath", geckoDriverPath); } } | DriverSettings extends AbstractPropSettings { public String getGeckcoDriverPath() { return getProperty("GeckoDriverPath", geckoDriverPath); } DriverSettings(String location); } | DriverSettings extends AbstractPropSettings { public String getGeckcoDriverPath() { return getProperty("GeckoDriverPath", geckoDriverPath); } DriverSettings(String location); void setFirefoxBinaryPath(String path); void setGeckcoDriverPath(String path); void setChromeDriverPath(String path); void setIEDriverPath(String... | DriverSettings extends AbstractPropSettings { public String getGeckcoDriverPath() { return getProperty("GeckoDriverPath", geckoDriverPath); } DriverSettings(String location); void setFirefoxBinaryPath(String path); void setGeckcoDriverPath(String path); void setChromeDriverPath(String path); void setIEDriverPath(String... |
@Test public void testEval_DateTest() { System.out.println("eval date fn"); String s; Object result; s = "Date(0,\"MM-dd-yy\")"; result = FParser.eval(s); assertTrue(result.toString().matches("(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])-\\d{2}"), "date " + result); s = "Date(0,\"MM dd yyyy\")"; result = FParser.eval(s); a... | public static Object eval(String s) { String func = FN(s); s = s.replaceFirst(func, ""); String[] params = {}; if (s.length() >= 2) { String param = s.substring(1, s.lastIndexOf(")")); params = param.split(RX, -1); } return String.valueOf(EXE(func, params)); } | FParser { public static Object eval(String s) { String func = FN(s); s = s.replaceFirst(func, ""); String[] params = {}; if (s.length() >= 2) { String param = s.substring(1, s.lastIndexOf(")")); params = param.split(RX, -1); } return String.valueOf(EXE(func, params)); } } | FParser { public static Object eval(String s) { String func = FN(s); s = s.replaceFirst(func, ""); String[] params = {}; if (s.length() >= 2) { String param = s.substring(1, s.lastIndexOf(")")); params = param.split(RX, -1); } return String.valueOf(EXE(func, params)); } } | FParser { public static Object eval(String s) { String func = FN(s); s = s.replaceFirst(func, ""); String[] params = {}; if (s.length() >= 2) { String param = s.substring(1, s.lastIndexOf(")")); params = param.split(RX, -1); } return String.valueOf(EXE(func, params)); } static List<String> getFuncList(); static Object... | FParser { public static Object eval(String s) { String func = FN(s); s = s.replaceFirst(func, ""); String[] params = {}; if (s.length() >= 2) { String param = s.substring(1, s.lastIndexOf(")")); params = param.split(RX, -1); } return String.valueOf(EXE(func, params)); } static List<String> getFuncList(); static Object... |
@Test(invocationCount = 10) public void testEvaljs() { System.out.println("Evaljs"); String script = "floor(100 + random() * 900)"; String result = FParser.evaljs(script); assertTrue(result.matches("[0-9]{3}"), "Test random "); script = "'test'+ floor(100 + random() * 900)+'vt@gmail.com'"; result = (String) JSONValue.p... | public static String evaljs(String script) { try { return JS.eval("JSON.stringify(" + script + ")").toString(); } catch (ScriptException ex) { LOG.log(Level.SEVERE, ex.getMessage(), ex); } return "undefined"; } | FParser { public static String evaljs(String script) { try { return JS.eval("JSON.stringify(" + script + ")").toString(); } catch (ScriptException ex) { LOG.log(Level.SEVERE, ex.getMessage(), ex); } return "undefined"; } } | FParser { public static String evaljs(String script) { try { return JS.eval("JSON.stringify(" + script + ")").toString(); } catch (ScriptException ex) { LOG.log(Level.SEVERE, ex.getMessage(), ex); } return "undefined"; } } | FParser { public static String evaljs(String script) { try { return JS.eval("JSON.stringify(" + script + ")").toString(); } catch (ScriptException ex) { LOG.log(Level.SEVERE, ex.getMessage(), ex); } return "undefined"; } static List<String> getFuncList(); static Object eval(String s); static String evaljs(String scrip... | FParser { public static String evaljs(String script) { try { return JS.eval("JSON.stringify(" + script + ")").toString(); } catch (ScriptException ex) { LOG.log(Level.SEVERE, ex.getMessage(), ex); } return "undefined"; } static List<String> getFuncList(); static Object eval(String s); static String evaljs(String scrip... |
@Test public void testResolveContextVars() { System.out.println("resolveContextVars"); String in = "this is a {scenario}/{testset} -> {testset}/{release} for {project}.{release}.{testcase} "; String expResult = "this is a myscn/ts -> ts/rel for pro.rel.tc "; String result = KeyMap.resolveContextVars(in, vMap); assertEq... | public static String resolveContextVars(String in, Map<?,?> vMap) { return replaceKeys(in, CONTEXT_VARS, true, 1, vMap); } | KeyMap { public static String resolveContextVars(String in, Map<?,?> vMap) { return replaceKeys(in, CONTEXT_VARS, true, 1, vMap); } } | KeyMap { public static String resolveContextVars(String in, Map<?,?> vMap) { return replaceKeys(in, CONTEXT_VARS, true, 1, vMap); } } | KeyMap { public static String resolveContextVars(String in, Map<?,?> vMap) { return replaceKeys(in, CONTEXT_VARS, true, 1, vMap); } static Map<Object, Object> getSystemVars(); static String resolveContextVars(String in, Map<?,?> vMap); static String resolveEnvVars(String in); static String replaceKeys(String in, Patte... | KeyMap { public static String resolveContextVars(String in, Map<?,?> vMap) { return replaceKeys(in, CONTEXT_VARS, true, 1, vMap); } static Map<Object, Object> getSystemVars(); static String resolveContextVars(String in, Map<?,?> vMap); static String resolveEnvVars(String in); static String replaceKeys(String in, Patte... |
@Test public void testResolveEnvVars() { System.out.println("resolveEnvVars"); String in = "${val.1}-${var.1}-${val.2}-${val.1}-${val.3}-${val.4}-${var.4}-${var.1}-${var.2}-"; String expResult = "1-x-b-1-c-val.4-var.4-x-y-"; String result = KeyMap.resolveEnvVars(in); assertEquals(expResult, result); } | public static String resolveEnvVars(String in) { return replaceKeys(in, ENV_VARS); } | KeyMap { public static String resolveEnvVars(String in) { return replaceKeys(in, ENV_VARS); } } | KeyMap { public static String resolveEnvVars(String in) { return replaceKeys(in, ENV_VARS); } } | KeyMap { public static String resolveEnvVars(String in) { return replaceKeys(in, ENV_VARS); } static Map<Object, Object> getSystemVars(); static String resolveContextVars(String in, Map<?,?> vMap); static String resolveEnvVars(String in); static String replaceKeys(String in, Pattern pattern, boolean preserveKeys, int ... | KeyMap { public static String resolveEnvVars(String in) { return replaceKeys(in, ENV_VARS); } static Map<Object, Object> getSystemVars(); static String resolveContextVars(String in, Map<?,?> vMap); static String resolveEnvVars(String in); static String replaceKeys(String in, Pattern pattern, boolean preserveKeys, int ... |
@Test public void testReplaceKeysUserVariables() { System.out.println("replaceKeys"); String in = "this is a %scenario%/%testset% -> %testset%/%release% for %project%.%testcase%/%%release%%. "; boolean preserveKeys = true; String result; String expResult = "this is a myscn/ts -> ts/rel for pro.tc/%rel%. "; result = Key... | public static String replaceKeys(String in, Pattern pattern, boolean preserveKeys, int passes, Map<?,?>... maps) { String out = in; for (int pass = 1; pass <= passes; pass++) { Matcher m = pattern.matcher(in); String match, key; while (m.find()) { match = m.group(); key = m.group(1); Boolean resolved = false; if (maps ... | KeyMap { public static String replaceKeys(String in, Pattern pattern, boolean preserveKeys, int passes, Map<?,?>... maps) { String out = in; for (int pass = 1; pass <= passes; pass++) { Matcher m = pattern.matcher(in); String match, key; while (m.find()) { match = m.group(); key = m.group(1); Boolean resolved = false; ... | KeyMap { public static String replaceKeys(String in, Pattern pattern, boolean preserveKeys, int passes, Map<?,?>... maps) { String out = in; for (int pass = 1; pass <= passes; pass++) { Matcher m = pattern.matcher(in); String match, key; while (m.find()) { match = m.group(); key = m.group(1); Boolean resolved = false; ... | KeyMap { public static String replaceKeys(String in, Pattern pattern, boolean preserveKeys, int passes, Map<?,?>... maps) { String out = in; for (int pass = 1; pass <= passes; pass++) { Matcher m = pattern.matcher(in); String match, key; while (m.find()) { match = m.group(); key = m.group(1); Boolean resolved = false; ... | KeyMap { public static String replaceKeys(String in, Pattern pattern, boolean preserveKeys, int passes, Map<?,?>... maps) { String out = in; for (int pass = 1; pass <= passes; pass++) { Matcher m = pattern.matcher(in); String match, key; while (m.find()) { match = m.group(); key = m.group(1); Boolean resolved = false; ... |
@Test public void testReplaceKeys_String_Pattern() { System.out.println("replaceKeys"); String in = "${val.1}-${var.1}-${val.2}-${val.1}-${val.3}-${val.4}-${var.4}-${var.1}-${var.2}-"; String expResult = "1-x-b-1-c-val.4-var.4-x-y-"; String result = KeyMap.replaceKeys(in, KeyMap.ENV_VARS); assertEquals(expResult, resul... | public static String replaceKeys(String in, Pattern pattern, boolean preserveKeys, int passes, Map<?,?>... maps) { String out = in; for (int pass = 1; pass <= passes; pass++) { Matcher m = pattern.matcher(in); String match, key; while (m.find()) { match = m.group(); key = m.group(1); Boolean resolved = false; if (maps ... | KeyMap { public static String replaceKeys(String in, Pattern pattern, boolean preserveKeys, int passes, Map<?,?>... maps) { String out = in; for (int pass = 1; pass <= passes; pass++) { Matcher m = pattern.matcher(in); String match, key; while (m.find()) { match = m.group(); key = m.group(1); Boolean resolved = false; ... | KeyMap { public static String replaceKeys(String in, Pattern pattern, boolean preserveKeys, int passes, Map<?,?>... maps) { String out = in; for (int pass = 1; pass <= passes; pass++) { Matcher m = pattern.matcher(in); String match, key; while (m.find()) { match = m.group(); key = m.group(1); Boolean resolved = false; ... | KeyMap { public static String replaceKeys(String in, Pattern pattern, boolean preserveKeys, int passes, Map<?,?>... maps) { String out = in; for (int pass = 1; pass <= passes; pass++) { Matcher m = pattern.matcher(in); String match, key; while (m.find()) { match = m.group(); key = m.group(1); Boolean resolved = false; ... | KeyMap { public static String replaceKeys(String in, Pattern pattern, boolean preserveKeys, int passes, Map<?,?>... maps) { String out = in; for (int pass = 1; pass <= passes; pass++) { Matcher m = pattern.matcher(in); String match, key; while (m.find()) { match = m.group(); key = m.group(1); Boolean resolved = false; ... |
@Test(enabled = false) public void testGetPrefLocation() { System.out.println("getPrefLocation"); File file = new File(ChromeEmulators.getPrefLocation(), "Preferences"); if (!file.exists()) { System.out.println(file.getAbsolutePath()); System.out.println("------------------------"); Stream.of(file.listFiles()) .map(Fil... | public static String getPrefLocation() { if (SystemUtils.IS_OS_WINDOWS) { return SystemUtils.getUserHome().getAbsolutePath() + "/AppData/Local/Google/Chrome/User Data/Default"; } if (SystemUtils.IS_OS_MAC_OSX) { return SystemUtils.getUserHome().getAbsolutePath()+"/Library/Application Support/Google/Chrome/Default"; } i... | ChromeEmulators { public static String getPrefLocation() { if (SystemUtils.IS_OS_WINDOWS) { return SystemUtils.getUserHome().getAbsolutePath() + "/AppData/Local/Google/Chrome/User Data/Default"; } if (SystemUtils.IS_OS_MAC_OSX) { return SystemUtils.getUserHome().getAbsolutePath()+"/Library/Application Support/Google/Ch... | ChromeEmulators { public static String getPrefLocation() { if (SystemUtils.IS_OS_WINDOWS) { return SystemUtils.getUserHome().getAbsolutePath() + "/AppData/Local/Google/Chrome/User Data/Default"; } if (SystemUtils.IS_OS_MAC_OSX) { return SystemUtils.getUserHome().getAbsolutePath()+"/Library/Application Support/Google/Ch... | ChromeEmulators { public static String getPrefLocation() { if (SystemUtils.IS_OS_WINDOWS) { return SystemUtils.getUserHome().getAbsolutePath() + "/AppData/Local/Google/Chrome/User Data/Default"; } if (SystemUtils.IS_OS_MAC_OSX) { return SystemUtils.getUserHome().getAbsolutePath()+"/Library/Application Support/Google/Ch... | ChromeEmulators { public static String getPrefLocation() { if (SystemUtils.IS_OS_WINDOWS) { return SystemUtils.getUserHome().getAbsolutePath() + "/AppData/Local/Google/Chrome/User Data/Default"; } if (SystemUtils.IS_OS_MAC_OSX) { return SystemUtils.getUserHome().getAbsolutePath()+"/Library/Application Support/Google/Ch... |
@Test(enabled = false) public void testSync() { System.out.println("sync"); ChromeEmulators.sync(); assertTrue(!ChromeEmulators.getEmulatorsList().isEmpty(), "EmulatorsList is Empty"); } | public static void sync() { try { LOG.info("Trying to load emulators from Chrome Installation"); File file = new File(getPrefLocation(), "Preferences"); if (file.exists()) { Map map = MAPPER.readValue(file, Map.class); Map devtools = (Map) map.get("devtools"); Map prefs = (Map) devtools.get("preferences"); String stdem... | ChromeEmulators { public static void sync() { try { LOG.info("Trying to load emulators from Chrome Installation"); File file = new File(getPrefLocation(), "Preferences"); if (file.exists()) { Map map = MAPPER.readValue(file, Map.class); Map devtools = (Map) map.get("devtools"); Map prefs = (Map) devtools.get("preferenc... | ChromeEmulators { public static void sync() { try { LOG.info("Trying to load emulators from Chrome Installation"); File file = new File(getPrefLocation(), "Preferences"); if (file.exists()) { Map map = MAPPER.readValue(file, Map.class); Map devtools = (Map) map.get("devtools"); Map prefs = (Map) devtools.get("preferenc... | ChromeEmulators { public static void sync() { try { LOG.info("Trying to load emulators from Chrome Installation"); File file = new File(getPrefLocation(), "Preferences"); if (file.exists()) { Map map = MAPPER.readValue(file, Map.class); Map devtools = (Map) map.get("devtools"); Map prefs = (Map) devtools.get("preferenc... | ChromeEmulators { public static void sync() { try { LOG.info("Trying to load emulators from Chrome Installation"); File file = new File(getPrefLocation(), "Preferences"); if (file.exists()) { Map map = MAPPER.readValue(file, Map.class); Map devtools = (Map) map.get("devtools"); Map prefs = (Map) devtools.get("preferenc... |
@Test(enabled = false) public void testGetEmulatorsList() { System.out.println("getEmulatorsList"); List<String> result = ChromeEmulators.getEmulatorsList(); assertTrue(Stream.of("Nexus 5", "Galaxy S5", "Nexus 6P", "iPhone 5", "iPhone 6 Plus") .allMatch(result::contains), "Some/all emulators missing in the EmulatorsLis... | public static List<String> getEmulatorsList() { load(); return EMULATORS; } | ChromeEmulators { public static List<String> getEmulatorsList() { load(); return EMULATORS; } } | ChromeEmulators { public static List<String> getEmulatorsList() { load(); return EMULATORS; } } | ChromeEmulators { public static List<String> getEmulatorsList() { load(); return EMULATORS; } static void sync(); static String getPrefLocation(); static List<String> getEmulatorsList(); } | ChromeEmulators { public static List<String> getEmulatorsList() { load(); return EMULATORS; } static void sync(); static String getPrefLocation(); static List<String> getEmulatorsList(); } |
@Test(enabled = false,description = "http-get of remote address") public void testGetHttp() throws Exception { System.out.println("Get-http"); URL targetUrl = new URL("http: BasicHttpClient instance = new BasicHttpClient(targetUrl, "anon", "anon"); JSONObject result = instance.Get(targetUrl, getArgs.toJSONString()); as... | public JSONObject Get(URL targetUrl) throws Exception { return Get(targetUrl.toURI()); } | BasicHttpClient extends AbstractHttpClient { public JSONObject Get(URL targetUrl) throws Exception { return Get(targetUrl.toURI()); } } | BasicHttpClient extends AbstractHttpClient { public JSONObject Get(URL targetUrl) throws Exception { return Get(targetUrl.toURI()); } BasicHttpClient(URL url, String userName, String password); BasicHttpClient(URL url, String userName, String password, Map<String, String> config); } | BasicHttpClient extends AbstractHttpClient { public JSONObject Get(URL targetUrl) throws Exception { return Get(targetUrl.toURI()); } BasicHttpClient(URL url, String userName, String password); BasicHttpClient(URL url, String userName, String password, Map<String, String> config); void auth(HttpRequest req); @Override... | BasicHttpClient extends AbstractHttpClient { public JSONObject Get(URL targetUrl) throws Exception { return Get(targetUrl.toURI()); } BasicHttpClient(URL url, String userName, String password); BasicHttpClient(URL url, String userName, String password, Map<String, String> config); void auth(HttpRequest req); @Override... |
@Test public void testGetChromeDriverPath() { String expResult; if (isWin) { expResult = "./lib/Drivers/chromedriver.exe"; } else { expResult = "./lib/Drivers/chromedriver"; } String result = ds.getChromeDriverPath(); assertEquals(result, expResult); } | public String getChromeDriverPath() { return getProperty("ChromeDriverPath", chromeDriverPath); } | DriverSettings extends AbstractPropSettings { public String getChromeDriverPath() { return getProperty("ChromeDriverPath", chromeDriverPath); } } | DriverSettings extends AbstractPropSettings { public String getChromeDriverPath() { return getProperty("ChromeDriverPath", chromeDriverPath); } DriverSettings(String location); } | DriverSettings extends AbstractPropSettings { public String getChromeDriverPath() { return getProperty("ChromeDriverPath", chromeDriverPath); } DriverSettings(String location); void setFirefoxBinaryPath(String path); void setGeckcoDriverPath(String path); void setChromeDriverPath(String path); void setIEDriverPath(Stri... | DriverSettings extends AbstractPropSettings { public String getChromeDriverPath() { return getProperty("ChromeDriverPath", chromeDriverPath); } DriverSettings(String location); void setFirefoxBinaryPath(String path); void setGeckcoDriverPath(String path); void setChromeDriverPath(String path); void setIEDriverPath(Stri... |
@Test(enabled = false,description = "https-get of remote address") public void testGetHttps() throws Exception { System.out.println("Get-https"); URL targetUrl = new URL("https: BasicHttpClient instance = new BasicHttpClient(targetUrl, "anon", "anon"); JSONObject result = instance.Get(targetUrl, getArgs.toJSONString())... | public JSONObject Get(URL targetUrl) throws Exception { return Get(targetUrl.toURI()); } | BasicHttpClient extends AbstractHttpClient { public JSONObject Get(URL targetUrl) throws Exception { return Get(targetUrl.toURI()); } } | BasicHttpClient extends AbstractHttpClient { public JSONObject Get(URL targetUrl) throws Exception { return Get(targetUrl.toURI()); } BasicHttpClient(URL url, String userName, String password); BasicHttpClient(URL url, String userName, String password, Map<String, String> config); } | BasicHttpClient extends AbstractHttpClient { public JSONObject Get(URL targetUrl) throws Exception { return Get(targetUrl.toURI()); } BasicHttpClient(URL url, String userName, String password); BasicHttpClient(URL url, String userName, String password, Map<String, String> config); void auth(HttpRequest req); @Override... | BasicHttpClient extends AbstractHttpClient { public JSONObject Get(URL targetUrl) throws Exception { return Get(targetUrl.toURI()); } BasicHttpClient(URL url, String userName, String password); BasicHttpClient(URL url, String userName, String password, Map<String, String> config); void auth(HttpRequest req); @Override... |
@Test(enabled = false,description = "http-get of local address") public void testGetHttpLocal() throws Exception { System.out.println("Get-http-local"); URL targetUrl = new URL("http: BasicHttpClient instance = new BasicHttpClient(targetUrl, "anon", "anon"); JSONObject result = instance.Get(targetUrl, "data", "vola"); ... | public JSONObject Get(URL targetUrl) throws Exception { return Get(targetUrl.toURI()); } | BasicHttpClient extends AbstractHttpClient { public JSONObject Get(URL targetUrl) throws Exception { return Get(targetUrl.toURI()); } } | BasicHttpClient extends AbstractHttpClient { public JSONObject Get(URL targetUrl) throws Exception { return Get(targetUrl.toURI()); } BasicHttpClient(URL url, String userName, String password); BasicHttpClient(URL url, String userName, String password, Map<String, String> config); } | BasicHttpClient extends AbstractHttpClient { public JSONObject Get(URL targetUrl) throws Exception { return Get(targetUrl.toURI()); } BasicHttpClient(URL url, String userName, String password); BasicHttpClient(URL url, String userName, String password, Map<String, String> config); void auth(HttpRequest req); @Override... | BasicHttpClient extends AbstractHttpClient { public JSONObject Get(URL targetUrl) throws Exception { return Get(targetUrl.toURI()); } BasicHttpClient(URL url, String userName, String password); BasicHttpClient(URL url, String userName, String password, Map<String, String> config); void auth(HttpRequest req); @Override... |
@Test(enabled = false) public void testConnection() throws MalformedURLException { JIRASync sync = new JIRASync(Data.server, Data.uname, Data.pass, Data.project); Assert.assertTrue(sync.isConnected()); } | public boolean isConnected() { try { DLogger.Log(client.Get(new URL(client.url + PROJECT)).toString()); return true; } catch (Exception ex) { LOG.log(Level.SEVERE, ex.getMessage(), ex); return false; } } | JIRAClient { public boolean isConnected() { try { DLogger.Log(client.Get(new URL(client.url + PROJECT)).toString()); return true; } catch (Exception ex) { LOG.log(Level.SEVERE, ex.getMessage(), ex); return false; } } } | JIRAClient { public boolean isConnected() { try { DLogger.Log(client.Get(new URL(client.url + PROJECT)).toString()); return true; } catch (Exception ex) { LOG.log(Level.SEVERE, ex.getMessage(), ex); return false; } } JIRAClient(String urlStr, String userName, String password, Map options); } | JIRAClient { public boolean isConnected() { try { DLogger.Log(client.Get(new URL(client.url + PROJECT)).toString()); return true; } catch (Exception ex) { LOG.log(Level.SEVERE, ex.getMessage(), ex); return false; } } JIRAClient(String urlStr, String userName, String password, Map options); int updateResult(int status, ... | JIRAClient { public boolean isConnected() { try { DLogger.Log(client.Get(new URL(client.url + PROJECT)).toString()); return true; } catch (Exception ex) { LOG.log(Level.SEVERE, ex.getMessage(), ex); return false; } } JIRAClient(String urlStr, String userName, String password, Map options); int updateResult(int status, ... |
@Test(enabled = false) public void testCreateIssue_JSONObject_List() throws MalformedURLException { JSONObject res = null; JIRAClient jc = new JIRAClient(Data.server, Data.uname, Data.pass, null); Map issue = getIssue(Data.project); List<File> attach = null; res = jc.createIssue((JSONObject) issue, attach); } | @SuppressWarnings("unchecked") public JSONObject createIssue(JSONObject issue, List<File> attachments) { JSONObject res = null; try { res = client.post(new URL(client.url + ISSUE), issue.toString()); String restAttach = ISSUE_ATTACHMENTS.replace("issuekey", (String) res.get("id")); if (attachments != null && !attachmen... | JIRAClient { @SuppressWarnings("unchecked") public JSONObject createIssue(JSONObject issue, List<File> attachments) { JSONObject res = null; try { res = client.post(new URL(client.url + ISSUE), issue.toString()); String restAttach = ISSUE_ATTACHMENTS.replace("issuekey", (String) res.get("id")); if (attachments != null ... | JIRAClient { @SuppressWarnings("unchecked") public JSONObject createIssue(JSONObject issue, List<File> attachments) { JSONObject res = null; try { res = client.post(new URL(client.url + ISSUE), issue.toString()); String restAttach = ISSUE_ATTACHMENTS.replace("issuekey", (String) res.get("id")); if (attachments != null ... | JIRAClient { @SuppressWarnings("unchecked") public JSONObject createIssue(JSONObject issue, List<File> attachments) { JSONObject res = null; try { res = client.post(new URL(client.url + ISSUE), issue.toString()); String restAttach = ISSUE_ATTACHMENTS.replace("issuekey", (String) res.get("id")); if (attachments != null ... | JIRAClient { @SuppressWarnings("unchecked") public JSONObject createIssue(JSONObject issue, List<File> attachments) { JSONObject res = null; try { res = client.post(new URL(client.url + ISSUE), issue.toString()); String restAttach = ISSUE_ATTACHMENTS.replace("issuekey", (String) res.get("id")); if (attachments != null ... |
@Test public void testGetIEDriverPath() { String expResult = "./lib/Drivers/IEDriverServer.exe"; String result = ds.getIEDriverPath(); assertEquals(result, expResult); } | public String getIEDriverPath() { return getProperty("IEDriverPath", "./lib/Drivers/IEDriverServer.exe"); } | DriverSettings extends AbstractPropSettings { public String getIEDriverPath() { return getProperty("IEDriverPath", "./lib/Drivers/IEDriverServer.exe"); } } | DriverSettings extends AbstractPropSettings { public String getIEDriverPath() { return getProperty("IEDriverPath", "./lib/Drivers/IEDriverServer.exe"); } DriverSettings(String location); } | DriverSettings extends AbstractPropSettings { public String getIEDriverPath() { return getProperty("IEDriverPath", "./lib/Drivers/IEDriverServer.exe"); } DriverSettings(String location); void setFirefoxBinaryPath(String path); void setGeckcoDriverPath(String path); void setChromeDriverPath(String path); void setIEDrive... | DriverSettings extends AbstractPropSettings { public String getIEDriverPath() { return getProperty("IEDriverPath", "./lib/Drivers/IEDriverServer.exe"); } DriverSettings(String location); void setFirefoxBinaryPath(String path); void setGeckcoDriverPath(String path); void setChromeDriverPath(String path); void setIEDrive... |
@Test public void testGetEdgeDriverPath() { String expResult = "./lib/Drivers/MicrosoftWebDriver.exe"; String result = ds.getEdgeDriverPath(); assertEquals(result, expResult); } | public String getEdgeDriverPath() { return getProperty("EdgeDriverPath", "./lib/Drivers/MicrosoftWebDriver.exe"); } | DriverSettings extends AbstractPropSettings { public String getEdgeDriverPath() { return getProperty("EdgeDriverPath", "./lib/Drivers/MicrosoftWebDriver.exe"); } } | DriverSettings extends AbstractPropSettings { public String getEdgeDriverPath() { return getProperty("EdgeDriverPath", "./lib/Drivers/MicrosoftWebDriver.exe"); } DriverSettings(String location); } | DriverSettings extends AbstractPropSettings { public String getEdgeDriverPath() { return getProperty("EdgeDriverPath", "./lib/Drivers/MicrosoftWebDriver.exe"); } DriverSettings(String location); void setFirefoxBinaryPath(String path); void setGeckcoDriverPath(String path); void setChromeDriverPath(String path); void se... | DriverSettings extends AbstractPropSettings { public String getEdgeDriverPath() { return getProperty("EdgeDriverPath", "./lib/Drivers/MicrosoftWebDriver.exe"); } DriverSettings(String location); void setFirefoxBinaryPath(String path); void setGeckcoDriverPath(String path); void setChromeDriverPath(String path); void se... |
@Test public void testSetGeckcoDriverPath() { String path = "./lib/gk"; ds.setGeckcoDriverPath(path); assertEquals(ds.getGeckcoDriverPath(), path); } | public void setGeckcoDriverPath(String path) { setProperty("GeckoDriverPath", path); } | DriverSettings extends AbstractPropSettings { public void setGeckcoDriverPath(String path) { setProperty("GeckoDriverPath", path); } } | DriverSettings extends AbstractPropSettings { public void setGeckcoDriverPath(String path) { setProperty("GeckoDriverPath", path); } DriverSettings(String location); } | DriverSettings extends AbstractPropSettings { public void setGeckcoDriverPath(String path) { setProperty("GeckoDriverPath", path); } DriverSettings(String location); void setFirefoxBinaryPath(String path); void setGeckcoDriverPath(String path); void setChromeDriverPath(String path); void setIEDriverPath(String path); v... | DriverSettings extends AbstractPropSettings { public void setGeckcoDriverPath(String path) { setProperty("GeckoDriverPath", path); } DriverSettings(String location); void setFirefoxBinaryPath(String path); void setGeckcoDriverPath(String path); void setChromeDriverPath(String path); void setIEDriverPath(String path); v... |
@Test public void testSetChromeDriverPath() { String path = "./lib/chrome"; ds.setChromeDriverPath(path); assertEquals(ds.getChromeDriverPath(), path); } | public void setChromeDriverPath(String path) { setProperty("ChromeDriverPath", path); } | DriverSettings extends AbstractPropSettings { public void setChromeDriverPath(String path) { setProperty("ChromeDriverPath", path); } } | DriverSettings extends AbstractPropSettings { public void setChromeDriverPath(String path) { setProperty("ChromeDriverPath", path); } DriverSettings(String location); } | DriverSettings extends AbstractPropSettings { public void setChromeDriverPath(String path) { setProperty("ChromeDriverPath", path); } DriverSettings(String location); void setFirefoxBinaryPath(String path); void setGeckcoDriverPath(String path); void setChromeDriverPath(String path); void setIEDriverPath(String path); ... | DriverSettings extends AbstractPropSettings { public void setChromeDriverPath(String path) { setProperty("ChromeDriverPath", path); } DriverSettings(String location); void setFirefoxBinaryPath(String path); void setGeckcoDriverPath(String path); void setChromeDriverPath(String path); void setIEDriverPath(String path); ... |
@Test public void testSetIEDriverPath() { String path = "./lib/ie"; ds.setIEDriverPath(path); assertEquals(ds.getIEDriverPath(), path); } | public void setIEDriverPath(String path) { setProperty("IEDriverPath", path); } | DriverSettings extends AbstractPropSettings { public void setIEDriverPath(String path) { setProperty("IEDriverPath", path); } } | DriverSettings extends AbstractPropSettings { public void setIEDriverPath(String path) { setProperty("IEDriverPath", path); } DriverSettings(String location); } | DriverSettings extends AbstractPropSettings { public void setIEDriverPath(String path) { setProperty("IEDriverPath", path); } DriverSettings(String location); void setFirefoxBinaryPath(String path); void setGeckcoDriverPath(String path); void setChromeDriverPath(String path); void setIEDriverPath(String path); void set... | DriverSettings extends AbstractPropSettings { public void setIEDriverPath(String path) { setProperty("IEDriverPath", path); } DriverSettings(String location); void setFirefoxBinaryPath(String path); void setGeckcoDriverPath(String path); void setChromeDriverPath(String path); void setIEDriverPath(String path); void set... |
@Test public void testSetEdgeDriverPath() { String path = "./lib/edge"; ds.setEdgeDriverPath(path); assertEquals(ds.getEdgeDriverPath(), path); } | public void setEdgeDriverPath(String path) { setProperty("EdgeDriverPath", path); } | DriverSettings extends AbstractPropSettings { public void setEdgeDriverPath(String path) { setProperty("EdgeDriverPath", path); } } | DriverSettings extends AbstractPropSettings { public void setEdgeDriverPath(String path) { setProperty("EdgeDriverPath", path); } DriverSettings(String location); } | DriverSettings extends AbstractPropSettings { public void setEdgeDriverPath(String path) { setProperty("EdgeDriverPath", path); } DriverSettings(String location); void setFirefoxBinaryPath(String path); void setGeckcoDriverPath(String path); void setChromeDriverPath(String path); void setIEDriverPath(String path); void... | DriverSettings extends AbstractPropSettings { public void setEdgeDriverPath(String path) { setProperty("EdgeDriverPath", path); } DriverSettings(String location); void setFirefoxBinaryPath(String path); void setGeckcoDriverPath(String path); void setChromeDriverPath(String path); void setIEDriverPath(String path); void... |
@Test public void testGetFuncList() { System.out.println("getFuncList"); String[] vals = {"Concat", "Random", "Round", "Pow", "Min", "Max", "Date"}; List<String> expResult = Arrays.asList(vals); Collections.sort(expResult); List<String> result = FParser.getFuncList(); Collections.sort(result); assertEquals(expResult.to... | public static List<String> getFuncList() { return FUNCTIONS; } | FParser { public static List<String> getFuncList() { return FUNCTIONS; } } | FParser { public static List<String> getFuncList() { return FUNCTIONS; } } | FParser { public static List<String> getFuncList() { return FUNCTIONS; } static List<String> getFuncList(); static Object eval(String s); static String evaljs(String script); } | FParser { public static List<String> getFuncList() { return FUNCTIONS; } static List<String> getFuncList(); static Object eval(String s); static String evaljs(String script); static List<String> FUNCTIONS; } |
@Test(invocationCount = 10) public void testEval() { System.out.println("Eval"); String s = "Concat(=Round(=Random(4)),test@gmail.com)"; Object result = FParser.eval(s); assertTrue(result.toString().matches("[0-9]{4}test@gmail.com"), "random email " + result); } | public static Object eval(String s) { String func = FN(s); s = s.replaceFirst(func, ""); String[] params = {}; if (s.length() >= 2) { String param = s.substring(1, s.lastIndexOf(")")); params = param.split(RX, -1); } return String.valueOf(EXE(func, params)); } | FParser { public static Object eval(String s) { String func = FN(s); s = s.replaceFirst(func, ""); String[] params = {}; if (s.length() >= 2) { String param = s.substring(1, s.lastIndexOf(")")); params = param.split(RX, -1); } return String.valueOf(EXE(func, params)); } } | FParser { public static Object eval(String s) { String func = FN(s); s = s.replaceFirst(func, ""); String[] params = {}; if (s.length() >= 2) { String param = s.substring(1, s.lastIndexOf(")")); params = param.split(RX, -1); } return String.valueOf(EXE(func, params)); } } | FParser { public static Object eval(String s) { String func = FN(s); s = s.replaceFirst(func, ""); String[] params = {}; if (s.length() >= 2) { String param = s.substring(1, s.lastIndexOf(")")); params = param.split(RX, -1); } return String.valueOf(EXE(func, params)); } static List<String> getFuncList(); static Object... | FParser { public static Object eval(String s) { String func = FN(s); s = s.replaceFirst(func, ""); String[] params = {}; if (s.length() >= 2) { String param = s.substring(1, s.lastIndexOf(")")); params = param.split(RX, -1); } return String.valueOf(EXE(func, params)); } static List<String> getFuncList(); static Object... |
@Test public void test_messages_are_enqueued_to_redis() throws InterruptedException { LOGGER.debug("creating the logger"); Logger logger = LOGGER_CONTEXT_RESOURCE .getLoggerContext() .getLogger(RedisAppenderTest.class.getCanonicalName()); int expectedMessageCount = MIN_MESSAGE_COUNT + RANDOM.nextInt(MAX_MESSAGE_COUNT -... | public RedisThrottlerJmxBean getJmxBean() { return throttler.getJmxBean(); } | RedisAppender implements Appender { public RedisThrottlerJmxBean getJmxBean() { return throttler.getJmxBean(); } } | RedisAppender implements Appender { public RedisThrottlerJmxBean getJmxBean() { return throttler.getJmxBean(); } private RedisAppender(Builder builder); } | RedisAppender implements Appender { public RedisThrottlerJmxBean getJmxBean() { return throttler.getJmxBean(); } private RedisAppender(Builder builder); Configuration getConfig(); @Override String getName(); @Override Layout<? extends Serializable> getLayout(); @Override boolean ignoreExceptions(); @Override ErrorHand... | RedisAppender implements Appender { public RedisThrottlerJmxBean getJmxBean() { return throttler.getJmxBean(); } private RedisAppender(Builder builder); Configuration getConfig(); @Override String getName(); @Override Layout<? extends Serializable> getLayout(); @Override boolean ignoreExceptions(); @Override ErrorHand... |
@Test public void testGetKeyLock() { KeyLock keylock = KeyLockManager.getKeyLock(TEST1); assertEquals(true, keylock != null); } | public static KeyLock getKeyLock(String type) { return keyLockMap.get(type); } | KeyLockManager { public static KeyLock getKeyLock(String type) { return keyLockMap.get(type); } } | KeyLockManager { public static KeyLock getKeyLock(String type) { return keyLockMap.get(type); } } | KeyLockManager { public static KeyLock getKeyLock(String type) { return keyLockMap.get(type); } static void init(String[] types, int keyLockExpireTime, int keyLockCycleSleepTime, ILog log); static KeyLock getKeyLock(String type); static Object lockMethod(String lockKey, String keyType, KeylockFunction func, Object... ... | KeyLockManager { public static KeyLock getKeyLock(String type) { return keyLockMap.get(type); } static void init(String[] types, int keyLockExpireTime, int keyLockCycleSleepTime, ILog log); static KeyLock getKeyLock(String type); static Object lockMethod(String lockKey, String keyType, KeylockFunction func, Object... ... |
@Test public void testAddMsgListener() throws Exception { TestMsgListener testMsgListener = new TestMsgListener(); boolean result = MsgManager.addMsgListener(testMsgListener); MsgManager.dispatchMsg("createuser", 111, 222); assertEquals(true, result); } | public static boolean addMsgListener(IMsgListener msgListener) throws Exception { Map<String, String> msgs = msgListener.getMsgs(); if (msgs != null) { Object[] msgKeyArray = msgs.keySet().toArray(); for (int i = 0; i < msgKeyArray.length; i++) { String msg = String.valueOf(msgKeyArray[i]); Method method = msgListener.... | MsgManager { public static boolean addMsgListener(IMsgListener msgListener) throws Exception { Map<String, String> msgs = msgListener.getMsgs(); if (msgs != null) { Object[] msgKeyArray = msgs.keySet().toArray(); for (int i = 0; i < msgKeyArray.length; i++) { String msg = String.valueOf(msgKeyArray[i]); Method method =... | MsgManager { public static boolean addMsgListener(IMsgListener msgListener) throws Exception { Map<String, String> msgs = msgListener.getMsgs(); if (msgs != null) { Object[] msgKeyArray = msgs.keySet().toArray(); for (int i = 0; i < msgKeyArray.length; i++) { String msg = String.valueOf(msgKeyArray[i]); Method method =... | MsgManager { public static boolean addMsgListener(IMsgListener msgListener) throws Exception { Map<String, String> msgs = msgListener.getMsgs(); if (msgs != null) { Object[] msgKeyArray = msgs.keySet().toArray(); for (int i = 0; i < msgKeyArray.length; i++) { String msg = String.valueOf(msgKeyArray[i]); Method method =... | MsgManager { public static boolean addMsgListener(IMsgListener msgListener) throws Exception { Map<String, String> msgs = msgListener.getMsgs(); if (msgs != null) { Object[] msgKeyArray = msgs.keySet().toArray(); for (int i = 0; i < msgKeyArray.length; i++) { String msg = String.valueOf(msgKeyArray[i]); Method method =... |
@Test public void testPutMonitor() { runMonitor.putMonitor("链接"); runMonitor.putMonitor("发送"); runMonitor.putMonitor("断开"); } | public void putMonitor(String content) { long time = System.currentTimeMillis(); contentList.add(content); timeList.add(time); } | RunMonitor { public void putMonitor(String content) { long time = System.currentTimeMillis(); contentList.add(content); timeList.add(time); } } | RunMonitor { public void putMonitor(String content) { long time = System.currentTimeMillis(); contentList.add(content); timeList.add(time); } RunMonitor(String type, String opCode); } | RunMonitor { public void putMonitor(String content) { long time = System.currentTimeMillis(); contentList.add(content); timeList.add(time); } RunMonitor(String type, String opCode); void putMonitor(String content); String toString(String opCode); @Override String toString(); } | RunMonitor { public void putMonitor(String content) { long time = System.currentTimeMillis(); contentList.add(content); timeList.add(time); } RunMonitor(String type, String opCode); void putMonitor(String content); String toString(String opCode); @Override String toString(); } |
@Test public void testAddMapping() throws InterruptedException { ThreadMsgManager.dispatchThreadMsg("createuser", 111, 222); ThreadMsgManager.dispatchThreadMsg("updateuser", 111, 222); Thread.sleep(1000); } | public static boolean addMapping(String msgOpCode, int[] threadPriority) { if (msgOpcodeType.containsKey(msgOpCode)) { return false; } if (threadPriority != null) { msgOpcodeType.put(msgOpCode, threadPriority); } return true; } | ThreadMsgManager { public static boolean addMapping(String msgOpCode, int[] threadPriority) { if (msgOpcodeType.containsKey(msgOpCode)) { return false; } if (threadPriority != null) { msgOpcodeType.put(msgOpCode, threadPriority); } return true; } } | ThreadMsgManager { public static boolean addMapping(String msgOpCode, int[] threadPriority) { if (msgOpcodeType.containsKey(msgOpCode)) { return false; } if (threadPriority != null) { msgOpcodeType.put(msgOpCode, threadPriority); } return true; } } | ThreadMsgManager { public static boolean addMapping(String msgOpCode, int[] threadPriority) { if (msgOpcodeType.containsKey(msgOpCode)) { return false; } if (threadPriority != null) { msgOpcodeType.put(msgOpCode, threadPriority); } return true; } static boolean addMapping(String msgOpCode, int[] threadPriority); stati... | ThreadMsgManager { public static boolean addMapping(String msgOpCode, int[] threadPriority) { if (msgOpcodeType.containsKey(msgOpCode)) { return false; } if (threadPriority != null) { msgOpcodeType.put(msgOpCode, threadPriority); } return true; } static boolean addMapping(String msgOpCode, int[] threadPriority); stati... |
@Test public void testLockMethodOneKey() { String str = (String) KeyLockManager.lockMethod("111", TEST1, (params) -> lockFunction(params), new Object[] { "222", 111 }); assertEquals("222111", str); } | public static Object lockMethod(String lockKey, String keyType, KeylockFunction func, Object... params) { boolean isKeyLockException = false; KeyLock keyLock = KeyLockManager.getKeyLock(keyType); try { keyLock.lock(lockKey); return func.apply(params); } catch (KeyLockException e) { isKeyLockException = true; if (KeyLoc... | KeyLockManager { public static Object lockMethod(String lockKey, String keyType, KeylockFunction func, Object... params) { boolean isKeyLockException = false; KeyLock keyLock = KeyLockManager.getKeyLock(keyType); try { keyLock.lock(lockKey); return func.apply(params); } catch (KeyLockException e) { isKeyLockException =... | KeyLockManager { public static Object lockMethod(String lockKey, String keyType, KeylockFunction func, Object... params) { boolean isKeyLockException = false; KeyLock keyLock = KeyLockManager.getKeyLock(keyType); try { keyLock.lock(lockKey); return func.apply(params); } catch (KeyLockException e) { isKeyLockException =... | KeyLockManager { public static Object lockMethod(String lockKey, String keyType, KeylockFunction func, Object... params) { boolean isKeyLockException = false; KeyLock keyLock = KeyLockManager.getKeyLock(keyType); try { keyLock.lock(lockKey); return func.apply(params); } catch (KeyLockException e) { isKeyLockException =... | KeyLockManager { public static Object lockMethod(String lockKey, String keyType, KeylockFunction func, Object... params) { boolean isKeyLockException = false; KeyLock keyLock = KeyLockManager.getKeyLock(keyType); try { keyLock.lock(lockKey); return func.apply(params); } catch (KeyLockException e) { isKeyLockException =... |
@Test public void testLockMethodTwoKey() { String str = (String) KeyLockManager.lockMethod("111", "222", TEST1, (params) -> lockFunction(params), new Object[] { "222", 111 }); assertEquals("222111", str); } | public static Object lockMethod(String lockKey, String keyType, KeylockFunction func, Object... params) { boolean isKeyLockException = false; KeyLock keyLock = KeyLockManager.getKeyLock(keyType); try { keyLock.lock(lockKey); return func.apply(params); } catch (KeyLockException e) { isKeyLockException = true; if (KeyLoc... | KeyLockManager { public static Object lockMethod(String lockKey, String keyType, KeylockFunction func, Object... params) { boolean isKeyLockException = false; KeyLock keyLock = KeyLockManager.getKeyLock(keyType); try { keyLock.lock(lockKey); return func.apply(params); } catch (KeyLockException e) { isKeyLockException =... | KeyLockManager { public static Object lockMethod(String lockKey, String keyType, KeylockFunction func, Object... params) { boolean isKeyLockException = false; KeyLock keyLock = KeyLockManager.getKeyLock(keyType); try { keyLock.lock(lockKey); return func.apply(params); } catch (KeyLockException e) { isKeyLockException =... | KeyLockManager { public static Object lockMethod(String lockKey, String keyType, KeylockFunction func, Object... params) { boolean isKeyLockException = false; KeyLock keyLock = KeyLockManager.getKeyLock(keyType); try { keyLock.lock(lockKey); return func.apply(params); } catch (KeyLockException e) { isKeyLockException =... | KeyLockManager { public static Object lockMethod(String lockKey, String keyType, KeylockFunction func, Object... params) { boolean isKeyLockException = false; KeyLock keyLock = KeyLockManager.getKeyLock(keyType); try { keyLock.lock(lockKey); return func.apply(params); } catch (KeyLockException e) { isKeyLockException =... |
@Test public void testLockPartOneKey() { boolean isKeyLockException = false; KeyLock keyLock = KeyLockManager.getKeyLock(TEST1); String lockKey = "111"; boolean result = false; try { keyLock.lock(lockKey); result = true; } catch (KeyLockException e) { isKeyLockException = true; } catch (Exception e) { } finally { if (!... | public static KeyLock getKeyLock(String type) { return keyLockMap.get(type); } | KeyLockManager { public static KeyLock getKeyLock(String type) { return keyLockMap.get(type); } } | KeyLockManager { public static KeyLock getKeyLock(String type) { return keyLockMap.get(type); } } | KeyLockManager { public static KeyLock getKeyLock(String type) { return keyLockMap.get(type); } static void init(String[] types, int keyLockExpireTime, int keyLockCycleSleepTime, ILog log); static KeyLock getKeyLock(String type); static Object lockMethod(String lockKey, String keyType, KeylockFunction func, Object... ... | KeyLockManager { public static KeyLock getKeyLock(String type) { return keyLockMap.get(type); } static void init(String[] types, int keyLockExpireTime, int keyLockCycleSleepTime, ILog log); static KeyLock getKeyLock(String type); static Object lockMethod(String lockKey, String keyType, KeylockFunction func, Object... ... |
@Test public void testLockPartTwoKey() { boolean isKeyLockException = false; KeyLock keyLock = KeyLockManager.getKeyLock(TEST1); String lockKey1 = "11"; String lockKey2 = "22"; boolean result = false; try { keyLock.lock(lockKey1, lockKey2); result = true; } catch (KeyLockException e) { isKeyLockException = true; } catc... | public static KeyLock getKeyLock(String type) { return keyLockMap.get(type); } | KeyLockManager { public static KeyLock getKeyLock(String type) { return keyLockMap.get(type); } } | KeyLockManager { public static KeyLock getKeyLock(String type) { return keyLockMap.get(type); } } | KeyLockManager { public static KeyLock getKeyLock(String type) { return keyLockMap.get(type); } static void init(String[] types, int keyLockExpireTime, int keyLockCycleSleepTime, ILog log); static KeyLock getKeyLock(String type); static Object lockMethod(String lockKey, String keyType, KeylockFunction func, Object... ... | KeyLockManager { public static KeyLock getKeyLock(String type) { return keyLockMap.get(type); } static void init(String[] types, int keyLockExpireTime, int keyLockCycleSleepTime, ILog log); static KeyLock getKeyLock(String type); static Object lockMethod(String lockKey, String keyType, KeylockFunction func, Object... ... |
@Test public void testAddHandle() throws NoSuchMethodException, SecurityException, InterruptedException { PacketTest packetTest = new PacketTest(); Method method = HandlerManagerTest.class.getMethod("handle", new Class[] { Object.class }); ThreadHandle threadHandle = new ThreadHandle(packetTest, method, null); boolean ... | public static boolean addHandle(IHandle handle, int threadId, int priority) { if (handle == null) { if (AsyncThreadManager.log != null) { AsyncThreadManager.log.warn("handle为空"); } return false; } AsyncThread asyncThread = asyncThreadMap.get(threadId); if (asyncThread == null) { if (AsyncThreadManager.log != null) { As... | AsyncThreadManager { public static boolean addHandle(IHandle handle, int threadId, int priority) { if (handle == null) { if (AsyncThreadManager.log != null) { AsyncThreadManager.log.warn("handle为空"); } return false; } AsyncThread asyncThread = asyncThreadMap.get(threadId); if (asyncThread == null) { if (AsyncThreadMana... | AsyncThreadManager { public static boolean addHandle(IHandle handle, int threadId, int priority) { if (handle == null) { if (AsyncThreadManager.log != null) { AsyncThreadManager.log.warn("handle为空"); } return false; } AsyncThread asyncThread = asyncThreadMap.get(threadId); if (asyncThread == null) { if (AsyncThreadMana... | AsyncThreadManager { public static boolean addHandle(IHandle handle, int threadId, int priority) { if (handle == null) { if (AsyncThreadManager.log != null) { AsyncThreadManager.log.warn("handle为空"); } return false; } AsyncThread asyncThread = asyncThreadMap.get(threadId); if (asyncThread == null) { if (AsyncThreadMana... | AsyncThreadManager { public static boolean addHandle(IHandle handle, int threadId, int priority) { if (handle == null) { if (AsyncThreadManager.log != null) { AsyncThreadManager.log.warn("handle为空"); } return false; } AsyncThread asyncThread = asyncThreadMap.get(threadId); if (asyncThread == null) { if (AsyncThreadMana... |
@Test public void testAddCycle() { CycleTest cycleTest = new CycleTest(); cycleTest.name = "testAddCycle"; boolean result = AsyncThreadManager.addCycle(cycleTest, 1, 1); assertEquals(true, result); } | public static boolean addCycle(ICycle cycle, int threadId, int priority) { if (cycle == null) { if (AsyncThreadManager.log != null) { AsyncThreadManager.log.warn("ICycle为空"); } return false; } AsyncThread asyncThread = asyncThreadMap.get(threadId); if (asyncThread == null) { if (AsyncThreadManager.log != null) { AsyncT... | AsyncThreadManager { public static boolean addCycle(ICycle cycle, int threadId, int priority) { if (cycle == null) { if (AsyncThreadManager.log != null) { AsyncThreadManager.log.warn("ICycle为空"); } return false; } AsyncThread asyncThread = asyncThreadMap.get(threadId); if (asyncThread == null) { if (AsyncThreadManager.... | AsyncThreadManager { public static boolean addCycle(ICycle cycle, int threadId, int priority) { if (cycle == null) { if (AsyncThreadManager.log != null) { AsyncThreadManager.log.warn("ICycle为空"); } return false; } AsyncThread asyncThread = asyncThreadMap.get(threadId); if (asyncThread == null) { if (AsyncThreadManager.... | AsyncThreadManager { public static boolean addCycle(ICycle cycle, int threadId, int priority) { if (cycle == null) { if (AsyncThreadManager.log != null) { AsyncThreadManager.log.warn("ICycle为空"); } return false; } AsyncThread asyncThread = asyncThreadMap.get(threadId); if (asyncThread == null) { if (AsyncThreadManager.... | AsyncThreadManager { public static boolean addCycle(ICycle cycle, int threadId, int priority) { if (cycle == null) { if (AsyncThreadManager.log != null) { AsyncThreadManager.log.warn("ICycle为空"); } return false; } AsyncThread asyncThread = asyncThreadMap.get(threadId); if (asyncThread == null) { if (AsyncThreadManager.... |
@Test public void testRemoveCycle() { CycleTest cycleTest = new CycleTest(); cycleTest.name = "testRemoveCycle"; boolean result = AsyncThreadManager.addCycle(cycleTest, 1, 1); result = AsyncThreadManager.removeCycle(cycleTest, 1, 1); assertEquals(true, result); } | public static boolean removeCycle(ICycle cycle, int threadId, int priority) { if (cycle == null) { if (AsyncThreadManager.log != null) { AsyncThreadManager.log.warn("ICycle为空"); } return false; } AsyncThread asyncThread = asyncThreadMap.get(threadId); if (asyncThread == null) { if (AsyncThreadManager.log != null) { Asy... | AsyncThreadManager { public static boolean removeCycle(ICycle cycle, int threadId, int priority) { if (cycle == null) { if (AsyncThreadManager.log != null) { AsyncThreadManager.log.warn("ICycle为空"); } return false; } AsyncThread asyncThread = asyncThreadMap.get(threadId); if (asyncThread == null) { if (AsyncThreadManag... | AsyncThreadManager { public static boolean removeCycle(ICycle cycle, int threadId, int priority) { if (cycle == null) { if (AsyncThreadManager.log != null) { AsyncThreadManager.log.warn("ICycle为空"); } return false; } AsyncThread asyncThread = asyncThreadMap.get(threadId); if (asyncThread == null) { if (AsyncThreadManag... | AsyncThreadManager { public static boolean removeCycle(ICycle cycle, int threadId, int priority) { if (cycle == null) { if (AsyncThreadManager.log != null) { AsyncThreadManager.log.warn("ICycle为空"); } return false; } AsyncThread asyncThread = asyncThreadMap.get(threadId); if (asyncThread == null) { if (AsyncThreadManag... | AsyncThreadManager { public static boolean removeCycle(ICycle cycle, int threadId, int priority) { if (cycle == null) { if (AsyncThreadManager.log != null) { AsyncThreadManager.log.warn("ICycle为空"); } return false; } AsyncThread asyncThread = asyncThreadMap.get(threadId); if (asyncThread == null) { if (AsyncThreadManag... |
@Test public void testGetRandomThreadPriority() { int[] threadPriority = AsyncThreadManager.getRandomThreadPriority(); assertEquals(true, threadPriority != null); } | public static int[] getRandomThreadPriority() { int thread = (int) (Math.random() * (asyncThreadNum - lockThreadNum) + 1); int priority = (int) (Math.random() * asyncThreadPriorityNum + 1); return new int[] { thread, priority }; } | AsyncThreadManager { public static int[] getRandomThreadPriority() { int thread = (int) (Math.random() * (asyncThreadNum - lockThreadNum) + 1); int priority = (int) (Math.random() * asyncThreadPriorityNum + 1); return new int[] { thread, priority }; } } | AsyncThreadManager { public static int[] getRandomThreadPriority() { int thread = (int) (Math.random() * (asyncThreadNum - lockThreadNum) + 1); int priority = (int) (Math.random() * asyncThreadPriorityNum + 1); return new int[] { thread, priority }; } } | AsyncThreadManager { public static int[] getRandomThreadPriority() { int thread = (int) (Math.random() * (asyncThreadNum - lockThreadNum) + 1); int priority = (int) (Math.random() * asyncThreadPriorityNum + 1); return new int[] { thread, priority }; } static void init(int asyncThreadCycleInterval, int asyncThreadNum, ... | AsyncThreadManager { public static int[] getRandomThreadPriority() { int thread = (int) (Math.random() * (asyncThreadNum - lockThreadNum) + 1); int priority = (int) (Math.random() * asyncThreadPriorityNum + 1); return new int[] { thread, priority }; } static void init(int asyncThreadCycleInterval, int asyncThreadNum, ... |
@Test public void testGetRandomThread() { int[] threadPriority = AsyncThreadManager.getRandomThread(); assertEquals(true, threadPriority != null); } | public static int[] getRandomThread() { int thread = (int) (Math.random() * (asyncThreadNum - lockThreadNum) + 1); return new int[] { thread, 1 }; } | AsyncThreadManager { public static int[] getRandomThread() { int thread = (int) (Math.random() * (asyncThreadNum - lockThreadNum) + 1); return new int[] { thread, 1 }; } } | AsyncThreadManager { public static int[] getRandomThread() { int thread = (int) (Math.random() * (asyncThreadNum - lockThreadNum) + 1); return new int[] { thread, 1 }; } } | AsyncThreadManager { public static int[] getRandomThread() { int thread = (int) (Math.random() * (asyncThreadNum - lockThreadNum) + 1); return new int[] { thread, 1 }; } static void init(int asyncThreadCycleInterval, int asyncThreadNum, int asyncThreadPriorityNum, int lockThreadNum, ILog log); static boolean addHandle... | AsyncThreadManager { public static int[] getRandomThread() { int thread = (int) (Math.random() * (asyncThreadNum - lockThreadNum) + 1); return new int[] { thread, 1 }; } static void init(int asyncThreadCycleInterval, int asyncThreadNum, int asyncThreadPriorityNum, int lockThreadNum, ILog log); static boolean addHandle... |
@Test public void testGetSchema() throws URISyntaxException { final SpreadsheetDataSetProducer producer = produceTestSpreadsheet(); Collection<String> tableNames = producer.getSchema().tableNames(); assertEquals("Number of tables found [" + tableNames + "]", 12, tableNames.size()); assertTrue("Tables correctly populate... | @Override public Schema getSchema() { return new Schema() { @Override public Table getTable(String name) { throw new UnsupportedOperationException("Cannot get the metadata of a table for a spreadsheet"); } @Override public boolean isEmptyDatabase() { return tables.isEmpty(); } @Override public boolean tableExists(Strin... | SpreadsheetDataSetProducer implements DataSetProducer { @Override public Schema getSchema() { return new Schema() { @Override public Table getTable(String name) { throw new UnsupportedOperationException("Cannot get the metadata of a table for a spreadsheet"); } @Override public boolean isEmptyDatabase() { return tables... | SpreadsheetDataSetProducer implements DataSetProducer { @Override public Schema getSchema() { return new Schema() { @Override public Table getTable(String name) { throw new UnsupportedOperationException("Cannot get the metadata of a table for a spreadsheet"); } @Override public boolean isEmptyDatabase() { return tables... | SpreadsheetDataSetProducer implements DataSetProducer { @Override public Schema getSchema() { return new Schema() { @Override public Table getTable(String name) { throw new UnsupportedOperationException("Cannot get the metadata of a table for a spreadsheet"); } @Override public boolean isEmptyDatabase() { return tables... | SpreadsheetDataSetProducer implements DataSetProducer { @Override public Schema getSchema() { return new Schema() { @Override public Table getTable(String name) { throw new UnsupportedOperationException("Cannot get the metadata of a table for a spreadsheet"); } @Override public boolean isEmptyDatabase() { return tables... |
@Test public void testRemovingIndexFromNonExistentTable() { Schema testSchema = schema(appleTable); removeIndex = new RemoveIndex("Sweets", index("Sweets_1").unique().columns("pieces")); removeIndex.isApplied(testSchema, MockConnectionResources.build()); } | @Override public boolean isApplied(Schema schema, ConnectionResources database) { if (!schema.tableExists(tableName)) return false; Table table = schema.getTable(tableName); SchemaHomology homology = new SchemaHomology(); for (Index index : table.indexes()) { if (homology.indexesMatch(index, indexToBeRemoved)) { return... | RemoveIndex implements SchemaChange { @Override public boolean isApplied(Schema schema, ConnectionResources database) { if (!schema.tableExists(tableName)) return false; Table table = schema.getTable(tableName); SchemaHomology homology = new SchemaHomology(); for (Index index : table.indexes()) { if (homology.indexesMa... | RemoveIndex implements SchemaChange { @Override public boolean isApplied(Schema schema, ConnectionResources database) { if (!schema.tableExists(tableName)) return false; Table table = schema.getTable(tableName); SchemaHomology homology = new SchemaHomology(); for (Index index : table.indexes()) { if (homology.indexesMa... | RemoveIndex implements SchemaChange { @Override public boolean isApplied(Schema schema, ConnectionResources database) { if (!schema.tableExists(tableName)) return false; Table table = schema.getTable(tableName); SchemaHomology homology = new SchemaHomology(); for (Index index : table.indexes()) { if (homology.indexesMa... | RemoveIndex implements SchemaChange { @Override public boolean isApplied(Schema schema, ConnectionResources database) { if (!schema.tableExists(tableName)) return false; Table table = schema.getTable(tableName); SchemaHomology homology = new SchemaHomology(); for (Index index : table.indexes()) { if (homology.indexesMa... |
@Test public void testRemovingIndexFromExistingTable() { Schema testSchema = schema(appleTable); removeIndex.isApplied(testSchema, MockConnectionResources.build()); } | @Override public boolean isApplied(Schema schema, ConnectionResources database) { if (!schema.tableExists(tableName)) return false; Table table = schema.getTable(tableName); SchemaHomology homology = new SchemaHomology(); for (Index index : table.indexes()) { if (homology.indexesMatch(index, indexToBeRemoved)) { return... | RemoveIndex implements SchemaChange { @Override public boolean isApplied(Schema schema, ConnectionResources database) { if (!schema.tableExists(tableName)) return false; Table table = schema.getTable(tableName); SchemaHomology homology = new SchemaHomology(); for (Index index : table.indexes()) { if (homology.indexesMa... | RemoveIndex implements SchemaChange { @Override public boolean isApplied(Schema schema, ConnectionResources database) { if (!schema.tableExists(tableName)) return false; Table table = schema.getTable(tableName); SchemaHomology homology = new SchemaHomology(); for (Index index : table.indexes()) { if (homology.indexesMa... | RemoveIndex implements SchemaChange { @Override public boolean isApplied(Schema schema, ConnectionResources database) { if (!schema.tableExists(tableName)) return false; Table table = schema.getTable(tableName); SchemaHomology homology = new SchemaHomology(); for (Index index : table.indexes()) { if (homology.indexesMa... | RemoveIndex implements SchemaChange { @Override public boolean isApplied(Schema schema, ConnectionResources database) { if (!schema.tableExists(tableName)) return false; Table table = schema.getTable(tableName); SchemaHomology homology = new SchemaHomology(); for (Index index : table.indexes()) { if (homology.indexesMa... |
@Test public void testNoDeployedViewsTable() { Schema schema = schema(table("SomeTable")); assertFalse(onTest.loadViewHashes(schema).isPresent()); } | Optional<Map<String, String>> loadViewHashes(Schema schema) { if (!schema.tableExists(DEPLOYED_VIEWS_NAME)) { return Optional.empty(); } Map<String, String> result = Maps.newHashMap(); SelectStatement upgradeAuditSelect = select(field("name"), field("hash")).from(tableRef(DEPLOYED_VIEWS_NAME)); String sql = dialect.con... | ExistingViewHashLoader { Optional<Map<String, String>> loadViewHashes(Schema schema) { if (!schema.tableExists(DEPLOYED_VIEWS_NAME)) { return Optional.empty(); } Map<String, String> result = Maps.newHashMap(); SelectStatement upgradeAuditSelect = select(field("name"), field("hash")).from(tableRef(DEPLOYED_VIEWS_NAME));... | ExistingViewHashLoader { Optional<Map<String, String>> loadViewHashes(Schema schema) { if (!schema.tableExists(DEPLOYED_VIEWS_NAME)) { return Optional.empty(); } Map<String, String> result = Maps.newHashMap(); SelectStatement upgradeAuditSelect = select(field("name"), field("hash")).from(tableRef(DEPLOYED_VIEWS_NAME));... | ExistingViewHashLoader { Optional<Map<String, String>> loadViewHashes(Schema schema) { if (!schema.tableExists(DEPLOYED_VIEWS_NAME)) { return Optional.empty(); } Map<String, String> result = Maps.newHashMap(); SelectStatement upgradeAuditSelect = select(field("name"), field("hash")).from(tableRef(DEPLOYED_VIEWS_NAME));... | ExistingViewHashLoader { Optional<Map<String, String>> loadViewHashes(Schema schema) { if (!schema.tableExists(DEPLOYED_VIEWS_NAME)) { return Optional.empty(); } Map<String, String> result = Maps.newHashMap(); SelectStatement upgradeAuditSelect = select(field("name"), field("hash")).from(tableRef(DEPLOYED_VIEWS_NAME));... |
@Test public void testFetch() throws SQLException { Schema schema = schema(table(DatabaseUpgradeTableContribution.DEPLOYED_VIEWS_NAME)); when(dataSource.getConnection()).thenReturn(connection); when(connection.createStatement()).thenReturn(statement); when(statement.executeQuery(anyString())).thenReturn(resultSet); whe... | Optional<Map<String, String>> loadViewHashes(Schema schema) { if (!schema.tableExists(DEPLOYED_VIEWS_NAME)) { return Optional.empty(); } Map<String, String> result = Maps.newHashMap(); SelectStatement upgradeAuditSelect = select(field("name"), field("hash")).from(tableRef(DEPLOYED_VIEWS_NAME)); String sql = dialect.con... | ExistingViewHashLoader { Optional<Map<String, String>> loadViewHashes(Schema schema) { if (!schema.tableExists(DEPLOYED_VIEWS_NAME)) { return Optional.empty(); } Map<String, String> result = Maps.newHashMap(); SelectStatement upgradeAuditSelect = select(field("name"), field("hash")).from(tableRef(DEPLOYED_VIEWS_NAME));... | ExistingViewHashLoader { Optional<Map<String, String>> loadViewHashes(Schema schema) { if (!schema.tableExists(DEPLOYED_VIEWS_NAME)) { return Optional.empty(); } Map<String, String> result = Maps.newHashMap(); SelectStatement upgradeAuditSelect = select(field("name"), field("hash")).from(tableRef(DEPLOYED_VIEWS_NAME));... | ExistingViewHashLoader { Optional<Map<String, String>> loadViewHashes(Schema schema) { if (!schema.tableExists(DEPLOYED_VIEWS_NAME)) { return Optional.empty(); } Map<String, String> result = Maps.newHashMap(); SelectStatement upgradeAuditSelect = select(field("name"), field("hash")).from(tableRef(DEPLOYED_VIEWS_NAME));... | ExistingViewHashLoader { Optional<Map<String, String>> loadViewHashes(Schema schema) { if (!schema.tableExists(DEPLOYED_VIEWS_NAME)) { return Optional.empty(); } Map<String, String> result = Maps.newHashMap(); SelectStatement upgradeAuditSelect = select(field("name"), field("hash")).from(tableRef(DEPLOYED_VIEWS_NAME));... |
@Test public void testExactPath() { List<Class<? extends UpgradeStep>> upgradeSteps = new ArrayList<>(); upgradeSteps.add(AddJamType.class); upgradeSteps.add(AddCakeTable.class); upgradeSteps.add(AddDiameter.class); upgradeSteps.add(InsertAVictoriaSpongeRowUsingDSL.class); UpgradePathFinder pathFinder = makeFinder(upgr... | public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!schemasMatch(target, t... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... |
@Test public void testConditionalUpgradeStepIsExecuted() { List<Class<? extends UpgradeStep>> upgradeSteps = new ArrayList<>(); upgradeSteps.add(AddJamType.class); upgradeSteps.add(AddDiameter.class); upgradeSteps.add(AddJamAmount.class); upgradeSteps.add(AddJamAmountUnit.class); UpgradePathFinder pathFinder = makeFind... | public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!schemasMatch(target, t... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... |
@Test public void testConditionalUpgradeStepNotExecuted() { List<Class<? extends UpgradeStep>> upgradeSteps = new ArrayList<>(); upgradeSteps.add(AddJamType.class); upgradeSteps.add(AddDiameter.class); upgradeSteps.add(AddJamAmount.class); upgradeSteps.add(AddJamAmountUnit.class); UpgradePathFinder pathFinder = makeFin... | public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!schemasMatch(target, t... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... |
@Test public void testLinearPath() { List<Class<? extends UpgradeStep>> upgradeSteps = new ArrayList<>(); upgradeSteps.add(AddWeight.class); upgradeSteps.add(AddJamType.class); upgradeSteps.add(AddCakeTable.class); upgradeSteps.add(AddDiameter.class); upgradeSteps.add(InsertAVictoriaSpongeRowUsingDSL.class); UpgradePat... | public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!schemasMatch(target, t... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... |
@Test public void testAddColumnFailsWhenItAlreadyExists() { List<Class<? extends UpgradeStep>> upgradeSteps = new ArrayList<>(); upgradeSteps.add(AddWeight.class); UpgradePathFinder pathFinder = makeFinder(upgradeSteps, appliedSteps()); Schema current = schema(sconeTable); Schema target = schema(upgradedSconeTable); tr... | public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!schemasMatch(target, t... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... |
@Test public void testAddDeleteSameColumn() { List<Class<? extends UpgradeStep>> upgradeSteps = new ArrayList<>(); upgradeSteps.add(AddStars.class); upgradeSteps.add(AddRating.class); upgradeSteps.add(DeleteRating.class); UpgradePathFinder pathFinder = makeFinder(upgradeSteps, appliedSteps()); Schema current = schema(c... | public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!schemasMatch(target, t... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... |
@Test(expected = IllegalArgumentException.class) public void testRenameTableNotExists() { Schema testSchema = schema(appleTable); RenameTable renameTable = new RenameTable("Pear", "Apple"); renameTable.apply(testSchema); } | @Override public Schema apply(Schema schema) { return applyChange(schema, oldTableName, newTableName); } | RenameTable implements SchemaChange { @Override public Schema apply(Schema schema) { return applyChange(schema, oldTableName, newTableName); } } | RenameTable implements SchemaChange { @Override public Schema apply(Schema schema) { return applyChange(schema, oldTableName, newTableName); } RenameTable(String oldTableName, String newTableName); } | RenameTable implements SchemaChange { @Override public Schema apply(Schema schema) { return applyChange(schema, oldTableName, newTableName); } RenameTable(String oldTableName, String newTableName); String getOldTableName(); String getNewTableName(); @Override Schema apply(Schema schema); @Override Schema reverse(Schema... | RenameTable implements SchemaChange { @Override public Schema apply(Schema schema) { return applyChange(schema, oldTableName, newTableName); } RenameTable(String oldTableName, String newTableName); String getOldTableName(); String getNewTableName(); @Override Schema apply(Schema schema); @Override Schema reverse(Schema... |
@Test public void testSchemasMatchWithUnappliedDataChange() { List<Class<? extends UpgradeStep>> upgradeSteps = new ArrayList<>(); upgradeSteps.add(AddRating.class); upgradeSteps.add(DeleteRating.class); upgradeSteps.add(InsertAVictoriaSpongeRowUsingDSL.class); UpgradePathFinder pathFinder = makeFinder(upgradeSteps, ap... | public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!schemasMatch(target, t... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... |
@Test public void testUpgradeWithSkippedStep() { List<Class<? extends UpgradeStep>> upgradeSteps = new ArrayList<>(); upgradeSteps.add(AddWeight.class); upgradeSteps.add(AddJamType.class); upgradeSteps.add(AddCakeTable.class); upgradeSteps.add(AddDiameter.class); UpgradePathFinder pathFinder = makeFinder(upgradeSteps, ... | public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!schemasMatch(target, t... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... |
@Test public void testNoUpgradeExists() { List<Class<? extends UpgradeStep>> upgradeSteps = new ArrayList<>(); upgradeSteps.add(AddJamType.class); upgradeSteps.add(AddCakeTable.class); UpgradePathFinder pathFinder = makeFinder(upgradeSteps, appliedSteps()); Schema current = schema(sconeTable); Schema target = schema(up... | public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!schemasMatch(target, t... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... |
@Test public void testInterdependentSequence() { List<Class<? extends UpgradeStep>> upgradeSteps = new ArrayList<>(); upgradeSteps.add(AddJamType.class); upgradeSteps.add(AddDiameter.class); upgradeSteps.add(ChangeGramsToWeight.class); upgradeSteps.add(AddGrams.class); upgradeSteps.add(AddCakeTable.class); upgradeSteps... | public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!schemasMatch(target, t... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... |
@Test public void testAddAssumedUUIDWhenUpgradeAuditUUIDPresent() { List<Class<? extends UpgradeStep>> upgradeSteps = new ArrayList<>(); upgradeSteps.add(MockAddUpgradeAudit.class); upgradeSteps.add(MockProvisionHistoryUpgrade.class); upgradeSteps.add(MockWidenIndustryCodeUpgrade.class); UpgradePathFinder pathFinder = ... | public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!schemasMatch(target, t... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... |
@Test public void testDontAddAssumedUUIDWhenEarlierStepsPresent() { List<Class<? extends UpgradeStep>> upgradeSteps = new ArrayList<>(); upgradeSteps.add(MockAddUpgradeAudit.class); upgradeSteps.add(MockProvisionHistoryUpgrade.class); upgradeSteps.add(MockWidenIndustryCodeUpgrade.class); UpgradePathFinder pathFinder = ... | public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!schemasMatch(target, t... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... | UpgradePathFinder { public SchemaChangeSequence determinePath(Schema current, Schema target, Collection<String> exceptionRegexes) throws NoUpgradePathExistsException { SchemaChangeSequence schemaChangeSequence = getSchemaChangeSequence(); Schema trialUpgradedSchema = schemaChangeSequence.applyToSchema(current); if (!sc... |
@Test public void testAddAuditRecord() throws ParseException { SchemaChangeVisitor visitor = mock(SchemaChangeVisitor.class); Schema schema = mock(Schema.class); UUID uuid = UUID.randomUUID(); String description = "Description"; given(schema.tableExists("UpgradeAudit")).willReturn(true); AuditRecordHelper.addAuditRecor... | public static void addAuditRecord(SchemaChangeVisitor visitor, Schema schema, UUID uuid, String description) { if (!schema.tableExists("UpgradeAudit")) return; InsertStatement auditRecord = createAuditInsertStatement(uuid, description); visitor.visit(new ExecuteStatement(auditRecord)); } | AuditRecordHelper { public static void addAuditRecord(SchemaChangeVisitor visitor, Schema schema, UUID uuid, String description) { if (!schema.tableExists("UpgradeAudit")) return; InsertStatement auditRecord = createAuditInsertStatement(uuid, description); visitor.visit(new ExecuteStatement(auditRecord)); } } | AuditRecordHelper { public static void addAuditRecord(SchemaChangeVisitor visitor, Schema schema, UUID uuid, String description) { if (!schema.tableExists("UpgradeAudit")) return; InsertStatement auditRecord = createAuditInsertStatement(uuid, description); visitor.visit(new ExecuteStatement(auditRecord)); } } | AuditRecordHelper { public static void addAuditRecord(SchemaChangeVisitor visitor, Schema schema, UUID uuid, String description) { if (!schema.tableExists("UpgradeAudit")) return; InsertStatement auditRecord = createAuditInsertStatement(uuid, description); visitor.visit(new ExecuteStatement(auditRecord)); } static voi... | AuditRecordHelper { public static void addAuditRecord(SchemaChangeVisitor visitor, Schema schema, UUID uuid, String description) { if (!schema.tableExists("UpgradeAudit")) return; InsertStatement auditRecord = createAuditInsertStatement(uuid, description); visitor.visit(new ExecuteStatement(auditRecord)); } static voi... |
@Test public void createAuditInsertStatement() throws Exception { UUID uuid = UUID.randomUUID(); String description = "Description"; InsertStatement statement = AuditRecordHelper.createAuditInsertStatement(uuid, description); assertAuditInsertStatement(uuid, description, statement); } | public static InsertStatement createAuditInsertStatement(UUID uuid, String description) { InsertStatement auditRecord = new InsertStatement().into( new TableReference("UpgradeAudit")).values( new FieldLiteral(uuid.toString()).as("upgradeUUID"), new FieldLiteral(description).as("description"), cast(dateToYyyyMMddHHmmss(... | AuditRecordHelper { public static InsertStatement createAuditInsertStatement(UUID uuid, String description) { InsertStatement auditRecord = new InsertStatement().into( new TableReference("UpgradeAudit")).values( new FieldLiteral(uuid.toString()).as("upgradeUUID"), new FieldLiteral(description).as("description"), cast(d... | AuditRecordHelper { public static InsertStatement createAuditInsertStatement(UUID uuid, String description) { InsertStatement auditRecord = new InsertStatement().into( new TableReference("UpgradeAudit")).values( new FieldLiteral(uuid.toString()).as("upgradeUUID"), new FieldLiteral(description).as("description"), cast(d... | AuditRecordHelper { public static InsertStatement createAuditInsertStatement(UUID uuid, String description) { InsertStatement auditRecord = new InsertStatement().into( new TableReference("UpgradeAudit")).values( new FieldLiteral(uuid.toString()).as("upgradeUUID"), new FieldLiteral(description).as("description"), cast(d... | AuditRecordHelper { public static InsertStatement createAuditInsertStatement(UUID uuid, String description) { InsertStatement auditRecord = new InsertStatement().into( new TableReference("UpgradeAudit")).values( new FieldLiteral(uuid.toString()).as("upgradeUUID"), new FieldLiteral(description).as("description"), cast(d... |
@Test public void testGetPath() { Table testTable = table("Foo").columns(column("name", DataType.STRING, 32)); View testView = view("FooView", select(field("name")).from(tableRef("Foo"))); View testView2 = view("BarView", select(field("name")).from(tableRef("MooView")), "MooView"); View testView3 = view("MooView", sele... | public UpgradePath getPath(Schema targetSchema, Collection<Class<? extends UpgradeStep>> upgradeSteps) { final UpgradePath path = upgradePathFactory.create(sqlDialect); writeStatements(targetSchema, path); writeUpgradeSteps(upgradeSteps, path); return path; } | Deployment { public UpgradePath getPath(Schema targetSchema, Collection<Class<? extends UpgradeStep>> upgradeSteps) { final UpgradePath path = upgradePathFactory.create(sqlDialect); writeStatements(targetSchema, path); writeUpgradeSteps(upgradeSteps, path); return path; } } | Deployment { public UpgradePath getPath(Schema targetSchema, Collection<Class<? extends UpgradeStep>> upgradeSteps) { final UpgradePath path = upgradePathFactory.create(sqlDialect); writeStatements(targetSchema, path); writeUpgradeSteps(upgradeSteps, path); return path; } @Inject Deployment(SqlDialect sqlDialect, SqlS... | Deployment { public UpgradePath getPath(Schema targetSchema, Collection<Class<? extends UpgradeStep>> upgradeSteps) { final UpgradePath path = upgradePathFactory.create(sqlDialect); writeStatements(targetSchema, path); writeUpgradeSteps(upgradeSteps, path); return path; } @Inject Deployment(SqlDialect sqlDialect, SqlS... | Deployment { public UpgradePath getPath(Schema targetSchema, Collection<Class<? extends UpgradeStep>> upgradeSteps) { final UpgradePath path = upgradePathFactory.create(sqlDialect); writeStatements(targetSchema, path); writeUpgradeSteps(upgradeSteps, path); return path; } @Inject Deployment(SqlDialect sqlDialect, SqlS... |
@Test public void testIncreaseColumnLength() { Schema testSchema = schema(appleTable); ChangeColumn changeColumn = new ChangeColumn("Apple", column("colour", DataType.STRING, 10).nullable(), column("colour", DataType.STRING, 35).nullable()); Schema updatedSchema = changeColumn.apply(testSchema); Table resultTable = upd... | @Override public Schema apply(Schema schema) { return applyChange(schema, fromColumn, toColumn); } | ChangeColumn implements SchemaChange { @Override public Schema apply(Schema schema) { return applyChange(schema, fromColumn, toColumn); } } | ChangeColumn implements SchemaChange { @Override public Schema apply(Schema schema) { return applyChange(schema, fromColumn, toColumn); } ChangeColumn(String tableName, Column fromColumn, Column toColumn); } | ChangeColumn implements SchemaChange { @Override public Schema apply(Schema schema) { return applyChange(schema, fromColumn, toColumn); } ChangeColumn(String tableName, Column fromColumn, Column toColumn); @Override void accept(SchemaChangeVisitor visitor); @Override Schema apply(Schema schema); @Override boolean isApp... | ChangeColumn implements SchemaChange { @Override public Schema apply(Schema schema) { return applyChange(schema, fromColumn, toColumn); } ChangeColumn(String tableName, Column fromColumn, Column toColumn); @Override void accept(SchemaChangeVisitor visitor); @Override Schema apply(Schema schema); @Override boolean isApp... |
@Test(expected = IllegalArgumentException.class) public void testRenameTableAlreadyExists() { Schema testSchema = schema(appleTable, orangeTable); RenameTable renameTable = new RenameTable("Apple", "Orange"); renameTable.apply(testSchema); } | @Override public Schema apply(Schema schema) { return applyChange(schema, oldTableName, newTableName); } | RenameTable implements SchemaChange { @Override public Schema apply(Schema schema) { return applyChange(schema, oldTableName, newTableName); } } | RenameTable implements SchemaChange { @Override public Schema apply(Schema schema) { return applyChange(schema, oldTableName, newTableName); } RenameTable(String oldTableName, String newTableName); } | RenameTable implements SchemaChange { @Override public Schema apply(Schema schema) { return applyChange(schema, oldTableName, newTableName); } RenameTable(String oldTableName, String newTableName); String getOldTableName(); String getNewTableName(); @Override Schema apply(Schema schema); @Override Schema reverse(Schema... | RenameTable implements SchemaChange { @Override public Schema apply(Schema schema) { return applyChange(schema, oldTableName, newTableName); } RenameTable(String oldTableName, String newTableName); String getOldTableName(); String getNewTableName(); @Override Schema apply(Schema schema); @Override Schema reverse(Schema... |
@Test public void testChangeColumnType() { Schema testSchema = schema(appleTable); ChangeColumn changeColumn = new ChangeColumn("Apple", column("numberavailable", DataType.DECIMAL, 5), column("numberavailable", DataType.BIG_INTEGER)); Schema updatedSchema = changeColumn.apply(testSchema); Table resultTable = updatedSch... | @Override public Schema apply(Schema schema) { return applyChange(schema, fromColumn, toColumn); } | ChangeColumn implements SchemaChange { @Override public Schema apply(Schema schema) { return applyChange(schema, fromColumn, toColumn); } } | ChangeColumn implements SchemaChange { @Override public Schema apply(Schema schema) { return applyChange(schema, fromColumn, toColumn); } ChangeColumn(String tableName, Column fromColumn, Column toColumn); } | ChangeColumn implements SchemaChange { @Override public Schema apply(Schema schema) { return applyChange(schema, fromColumn, toColumn); } ChangeColumn(String tableName, Column fromColumn, Column toColumn); @Override void accept(SchemaChangeVisitor visitor); @Override Schema apply(Schema schema); @Override boolean isApp... | ChangeColumn implements SchemaChange { @Override public Schema apply(Schema schema) { return applyChange(schema, fromColumn, toColumn); } ChangeColumn(String tableName, Column fromColumn, Column toColumn); @Override void accept(SchemaChangeVisitor visitor); @Override Schema apply(Schema schema); @Override boolean isApp... |
@Test public void testChangeColumnName() { Schema testSchema = schema(appleTable); ChangeColumn changeColumn = new ChangeColumn("Apple", column("variety", DataType.STRING, 15).nullable(), column("brand", DataType.STRING, 15).nullable()); Schema updatedSchema = changeColumn.apply(testSchema); Table resultTable = updated... | @Override public Schema apply(Schema schema) { return applyChange(schema, fromColumn, toColumn); } | ChangeColumn implements SchemaChange { @Override public Schema apply(Schema schema) { return applyChange(schema, fromColumn, toColumn); } } | ChangeColumn implements SchemaChange { @Override public Schema apply(Schema schema) { return applyChange(schema, fromColumn, toColumn); } ChangeColumn(String tableName, Column fromColumn, Column toColumn); } | ChangeColumn implements SchemaChange { @Override public Schema apply(Schema schema) { return applyChange(schema, fromColumn, toColumn); } ChangeColumn(String tableName, Column fromColumn, Column toColumn); @Override void accept(SchemaChangeVisitor visitor); @Override Schema apply(Schema schema); @Override boolean isApp... | ChangeColumn implements SchemaChange { @Override public Schema apply(Schema schema) { return applyChange(schema, fromColumn, toColumn); } ChangeColumn(String tableName, Column fromColumn, Column toColumn); @Override void accept(SchemaChangeVisitor visitor); @Override Schema apply(Schema schema); @Override boolean isApp... |
@Test public void testChangeColumnNullable() { Schema testSchema = schema(appleTable); ChangeColumn changeColumn = new ChangeColumn("Apple", column("nullcheck", DataType.DECIMAL, 9, 0).nullable(), column("nullcheck", DataType.DECIMAL, 9, 0)); Schema updatedSchema = changeColumn.apply(testSchema); Table resultTable = up... | @Override public Schema apply(Schema schema) { return applyChange(schema, fromColumn, toColumn); } | ChangeColumn implements SchemaChange { @Override public Schema apply(Schema schema) { return applyChange(schema, fromColumn, toColumn); } } | ChangeColumn implements SchemaChange { @Override public Schema apply(Schema schema) { return applyChange(schema, fromColumn, toColumn); } ChangeColumn(String tableName, Column fromColumn, Column toColumn); } | ChangeColumn implements SchemaChange { @Override public Schema apply(Schema schema) { return applyChange(schema, fromColumn, toColumn); } ChangeColumn(String tableName, Column fromColumn, Column toColumn); @Override void accept(SchemaChangeVisitor visitor); @Override Schema apply(Schema schema); @Override boolean isApp... | ChangeColumn implements SchemaChange { @Override public Schema apply(Schema schema) { return applyChange(schema, fromColumn, toColumn); } ChangeColumn(String tableName, Column fromColumn, Column toColumn); @Override void accept(SchemaChangeVisitor visitor); @Override Schema apply(Schema schema); @Override boolean isApp... |
@Test public void testReverseChangeLength() { appleTable = table("Apple").columns( idColumn(), versionColumn(), column("colour", DataType.STRING, 35).nullable(), column("variety", DataType.STRING, 15).nullable(), column("ispoisoned", DataType.BOOLEAN).nullable(), column("datecreated", DataType.DATE).nullable(), column(... | @Override public Schema reverse(Schema schema) { return applyChange(schema, toColumn, fromColumn); } | ChangeColumn implements SchemaChange { @Override public Schema reverse(Schema schema) { return applyChange(schema, toColumn, fromColumn); } } | ChangeColumn implements SchemaChange { @Override public Schema reverse(Schema schema) { return applyChange(schema, toColumn, fromColumn); } ChangeColumn(String tableName, Column fromColumn, Column toColumn); } | ChangeColumn implements SchemaChange { @Override public Schema reverse(Schema schema) { return applyChange(schema, toColumn, fromColumn); } ChangeColumn(String tableName, Column fromColumn, Column toColumn); @Override void accept(SchemaChangeVisitor visitor); @Override Schema apply(Schema schema); @Override boolean isA... | ChangeColumn implements SchemaChange { @Override public Schema reverse(Schema schema) { return applyChange(schema, toColumn, fromColumn); } ChangeColumn(String tableName, Column fromColumn, Column toColumn); @Override void accept(SchemaChangeVisitor visitor); @Override Schema apply(Schema schema); @Override boolean isA... |
@Test public void testReverseChangeColumnType() { Table alreadyChangedTable = table("Apple").columns( idColumn(), versionColumn(), column("colour", DataType.STRING, 10).nullable(), column("variety", DataType.STRING, 15).nullable(), column("ispoisoned", DataType.BOOLEAN).nullable(), column("datecreated", DataType.DATE).... | @Override public Schema reverse(Schema schema) { return applyChange(schema, toColumn, fromColumn); } | ChangeColumn implements SchemaChange { @Override public Schema reverse(Schema schema) { return applyChange(schema, toColumn, fromColumn); } } | ChangeColumn implements SchemaChange { @Override public Schema reverse(Schema schema) { return applyChange(schema, toColumn, fromColumn); } ChangeColumn(String tableName, Column fromColumn, Column toColumn); } | ChangeColumn implements SchemaChange { @Override public Schema reverse(Schema schema) { return applyChange(schema, toColumn, fromColumn); } ChangeColumn(String tableName, Column fromColumn, Column toColumn); @Override void accept(SchemaChangeVisitor visitor); @Override Schema apply(Schema schema); @Override boolean isA... | ChangeColumn implements SchemaChange { @Override public Schema reverse(Schema schema) { return applyChange(schema, toColumn, fromColumn); } ChangeColumn(String tableName, Column fromColumn, Column toColumn); @Override void accept(SchemaChangeVisitor visitor); @Override Schema apply(Schema schema); @Override boolean isA... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.