Lines 56-62
Link Here
|
56 |
import org.netbeans.modules.versioning.spi.testvcs.TestVCSHistoryProvider; |
56 |
import org.netbeans.modules.versioning.spi.testvcs.TestVCSHistoryProvider; |
57 |
|
57 |
|
58 |
import org.openide.util.Lookup; |
58 |
import org.openide.util.Lookup; |
59 |
import org.netbeans.modules.versioning.spi.testvcs.TestVCSInterceptor; |
|
|
60 |
|
59 |
|
61 |
/** |
60 |
/** |
62 |
* Versioning SPI unit tests of VCSInterceptor. |
61 |
* Versioning SPI unit tests of VCSInterceptor. |
Lines 118-123
Link Here
|
118 |
assertTrue(provider.revisionprovided); |
117 |
assertTrue(provider.revisionprovided); |
119 |
} |
118 |
} |
120 |
|
119 |
|
|
|
120 |
public void testHistoryEntryProvidesParent() throws IOException { |
121 |
ParentProviderImpl provider = new ParentProviderImpl(); |
122 |
VCSHistoryProvider.HistoryEntry h = |
123 |
new VCSHistoryProvider.HistoryEntry( |
124 |
new File[] {new File("")}, |
125 |
new Date(System.currentTimeMillis()), |
126 |
"msg", |
127 |
"user", |
128 |
"username", |
129 |
"12345", |
130 |
"1234567890", |
131 |
new Action[0], |
132 |
null, |
133 |
null, |
134 |
provider); |
135 |
|
136 |
h = h.getParentEntry(); |
137 |
assertNotNull(h); |
138 |
assertEquals(ParentProviderImpl.PARENT_MSG, h.getMessage()); |
139 |
} |
140 |
|
121 |
public void testHistoryGetRevisionIsReallyInvoked() throws IOException { |
141 |
public void testHistoryGetRevisionIsReallyInvoked() throws IOException { |
122 |
File f = new File(dataRootDir, "workdir/root-test-versioned/" + TestVCSHistoryProvider.FILE_PROVIDES_REVISIONS_SUFFIX); |
142 |
File f = new File(dataRootDir, "workdir/root-test-versioned/" + TestVCSHistoryProvider.FILE_PROVIDES_REVISIONS_SUFFIX); |
123 |
f.createNewFile(); |
143 |
f.createNewFile(); |
Lines 148-153
Link Here
|
148 |
assertTrue(TestVCSHistoryProvider.instance.revisionProvided); |
168 |
assertTrue(TestVCSHistoryProvider.instance.revisionProvided); |
149 |
} |
169 |
} |
150 |
|
170 |
|
|
|
171 |
public void testHistoryGetParentIsReallyInvoked() throws IOException { |
172 |
File f = new File(dataRootDir, "workdir/root-test-versioned/" + TestVCSHistoryProvider.FILE_PROVIDES_REVISIONS_SUFFIX); |
173 |
f.createNewFile(); |
174 |
VersioningSystem vs = VersioningSupport.getOwner(f); |
175 |
assertNotNull(vs); |
176 |
VCSHistoryProvider hp = vs.getVCSHistoryProvider(); |
177 |
assertNotNull(hp); |
178 |
|
179 |
HistoryEntry[] history = hp.getHistory(new File[] {f}, null); |
180 |
assertNotNull(history); |
181 |
assertTrue(history.length > 0); |
182 |
HistoryEntry parentEntry = history[0].getParentEntry(); |
183 |
assertNotNull(parentEntry); |
184 |
assertEquals(TestVCSHistoryProvider.PARENT_MSG, parentEntry.getMessage()); |
185 |
|
186 |
// the same test again just to see that VCSSystemProvider.VersioningSystem properly delegates |
187 |
VCSFileProxy proxy = VCSFileProxy.createFileProxy(f); |
188 |
VCSSystemProvider.VersioningSystem pvs = Utils.getOwner(proxy); |
189 |
assertNotNull(pvs); |
190 |
org.netbeans.modules.versioning.core.spi.VCSHistoryProvider php = pvs.getVCSHistoryProvider(); |
191 |
assertNotNull(php); |
192 |
|
193 |
org.netbeans.modules.versioning.core.spi.VCSHistoryProvider.HistoryEntry[] phistory = php.getHistory(new VCSFileProxy[] {proxy}, null); |
194 |
assertNotNull(phistory); |
195 |
assertTrue(phistory.length > 0); |
196 |
org.netbeans.modules.versioning.core.spi.VCSHistoryProvider.HistoryEntry proxyParentEntry = phistory[0].getParentEntry(); |
197 |
assertEquals(TestVCSHistoryProvider.PARENT_MSG, proxyParentEntry.getMessage()); |
198 |
} |
199 |
|
151 |
public void testHistoryEntryDoesntProvideRevision() throws IOException { |
200 |
public void testHistoryEntryDoesntProvideRevision() throws IOException { |
152 |
RevisionProviderImpl provider = new RevisionProviderImpl(); |
201 |
RevisionProviderImpl provider = new RevisionProviderImpl(); |
153 |
provider.revisionprovided = false; |
202 |
provider.revisionprovided = false; |
Lines 166-171
Link Here
|
166 |
// nothing happend |
215 |
// nothing happend |
167 |
} |
216 |
} |
168 |
|
217 |
|
|
|
218 |
public void testHistoryEntryDoesntProvideParent() throws IOException { |
219 |
RevisionProviderImpl provider = new RevisionProviderImpl(); |
220 |
provider.revisionprovided = false; |
221 |
VCSHistoryProvider.HistoryEntry h = |
222 |
new VCSHistoryProvider.HistoryEntry( |
223 |
new File[] {new File("")}, |
224 |
new Date(System.currentTimeMillis()), |
225 |
"msg", |
226 |
"user", |
227 |
"username", |
228 |
"12345", |
229 |
"1234567890", |
230 |
new Action[0], |
231 |
null); |
232 |
h.getParentEntry(); |
233 |
// nothing happend |
234 |
} |
235 |
|
169 |
public void testHistoryEntryEditable() throws IOException { |
236 |
public void testHistoryEntryEditable() throws IOException { |
170 |
MessageEditProviderImpl provider = new MessageEditProviderImpl(); |
237 |
MessageEditProviderImpl provider = new MessageEditProviderImpl(); |
171 |
provider.message = null; |
238 |
provider.message = null; |
Lines 229-234
Link Here
|
229 |
} |
296 |
} |
230 |
} |
297 |
} |
231 |
|
298 |
|
|
|
299 |
private class ParentProviderImpl implements VCSHistoryProvider.ParentProvider { |
300 |
static final String PARENT_MSG = "im.the.parent"; |
301 |
private VCSHistoryProvider.HistoryEntry he = |
302 |
new VCSHistoryProvider.HistoryEntry( |
303 |
new File[] {new File("")}, |
304 |
new Date(System.currentTimeMillis()), |
305 |
PARENT_MSG, |
306 |
"user", |
307 |
"username", |
308 |
"12345", |
309 |
"1234567890", |
310 |
new Action[0], |
311 |
null, |
312 |
null); |
313 |
@Override |
314 |
public HistoryEntry getParentEntry() { |
315 |
return he; |
316 |
} |
317 |
} |
318 |
|
232 |
private class MessageEditProviderImpl implements VCSHistoryProvider.MessageEditProvider { |
319 |
private class MessageEditProviderImpl implements VCSHistoryProvider.MessageEditProvider { |
233 |
String message; |
320 |
String message; |
234 |
@Override |
321 |
@Override |