Rename ServerSideSortingControl
ServerSideSortingRequestControl will be more consistent when ServerSideSortingResponseControl is implemented.
This commit is contained in:
parent
f1d4b667c3
commit
352e4bbfba
|
@ -7,7 +7,8 @@ var EntryChangeNotificationControl =
|
|||
require('./entry_change_notification_control');
|
||||
var PersistentSearchControl = require('./persistent_search_control');
|
||||
var PagedResultsControl = require('./paged_results_control');
|
||||
var ServerSideSortingControl = require('./server_side_sorting_control.js');
|
||||
var ServerSideSortingRequestControl =
|
||||
require('./server_side_sorting_request_control.js');
|
||||
|
||||
|
||||
|
||||
|
@ -58,8 +59,8 @@ module.exports = {
|
|||
value: value
|
||||
});
|
||||
break;
|
||||
case ServerSideSortingControl.OID:
|
||||
control = new ServerSideSortingControl({
|
||||
case ServerSideSortingRequestControl.OID:
|
||||
control = new ServerSideSortingRequestControl({
|
||||
critical: critical,
|
||||
value: value
|
||||
});
|
||||
|
@ -80,5 +81,5 @@ module.exports = {
|
|||
EntryChangeNotificationControl: EntryChangeNotificationControl,
|
||||
PagedResultsControl: PagedResultsControl,
|
||||
PersistentSearchControl: PersistentSearchControl,
|
||||
ServerSideSortingControl: ServerSideSortingControl
|
||||
ServerSideSortingRequestControl: ServerSideSortingRequestControl
|
||||
};
|
||||
|
|
|
@ -15,11 +15,11 @@ var BerWriter = asn1.BerWriter;
|
|||
|
||||
///--- API
|
||||
|
||||
function ServerSideSortingControl(options) {
|
||||
function ServerSideSortingRequestControl(options) {
|
||||
if (!options)
|
||||
options = {};
|
||||
|
||||
options.type = ServerSideSortingControl.OID;
|
||||
options.type = ServerSideSortingRequestControl.OID;
|
||||
if (options.value) {
|
||||
if (Buffer.isBuffer(options.value)) {
|
||||
this.parse(options.value);
|
||||
|
@ -49,11 +49,11 @@ function ServerSideSortingControl(options) {
|
|||
return self._value || [];
|
||||
});
|
||||
}
|
||||
util.inherits(ServerSideSortingControl, Control);
|
||||
module.exports = ServerSideSortingControl;
|
||||
util.inherits(ServerSideSortingRequestControl, Control);
|
||||
module.exports = ServerSideSortingRequestControl;
|
||||
|
||||
|
||||
ServerSideSortingControl.prototype.parse = function parse(buffer) {
|
||||
ServerSideSortingRequestControl.prototype.parse = function parse(buffer) {
|
||||
assert.ok(buffer);
|
||||
|
||||
var ber = new BerReader(buffer);
|
||||
|
@ -78,7 +78,7 @@ ServerSideSortingControl.prototype.parse = function parse(buffer) {
|
|||
};
|
||||
|
||||
|
||||
ServerSideSortingControl.prototype._toBer = function (ber) {
|
||||
ServerSideSortingRequestControl.prototype._toBer = function (ber) {
|
||||
assert.ok(ber);
|
||||
|
||||
if (!this._value || this.value.length === 0)
|
||||
|
@ -105,10 +105,10 @@ ServerSideSortingControl.prototype._toBer = function (ber) {
|
|||
};
|
||||
|
||||
|
||||
ServerSideSortingControl.prototype._json = function (obj) {
|
||||
ServerSideSortingRequestControl.prototype._json = function (obj) {
|
||||
obj.controlValue = this.value;
|
||||
return obj;
|
||||
};
|
||||
|
||||
|
||||
ServerSideSortingControl.OID = '1.2.840.113556.1.4.473';
|
||||
ServerSideSortingRequestControl.OID = '1.2.840.113556.1.4.473';
|
|
@ -6,26 +6,26 @@ var asn1 = require('asn1');
|
|||
var BerReader = asn1.BerReader;
|
||||
var BerWriter = asn1.BerWriter;
|
||||
var getControl;
|
||||
var ServerSideSortingControl;
|
||||
var SSSRControl;
|
||||
|
||||
///--- Tests
|
||||
|
||||
|
||||
test('load library', function (t) {
|
||||
ServerSideSortingControl = require('../../lib').ServerSideSortingControl;
|
||||
t.ok(ServerSideSortingControl);
|
||||
SSSRControl = require('../../lib').ServerSideSortingRequestControl;
|
||||
t.ok(SSSRControl);
|
||||
getControl = require('../../lib').getControl;
|
||||
t.ok(getControl);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('new no args', function (t) {
|
||||
t.ok(new ServerSideSortingControl());
|
||||
t.ok(new SSSRControl());
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('new with args', function (t) {
|
||||
var c = new ServerSideSortingControl({
|
||||
var c = new SSSRControl({
|
||||
criticality: true,
|
||||
value: {
|
||||
attributeType: 'sn'
|
||||
|
@ -41,7 +41,7 @@ test('new with args', function (t) {
|
|||
});
|
||||
|
||||
test('toBer - object', function (t) {
|
||||
var sssc = new ServerSideSortingControl({
|
||||
var sssc = new SSSRControl({
|
||||
criticality: true,
|
||||
value: {
|
||||
attributeType: 'sn',
|
||||
|
@ -64,7 +64,7 @@ test('toBer - object', function (t) {
|
|||
});
|
||||
|
||||
test('toBer - array', function (t) {
|
||||
var sssc = new ServerSideSortingControl({
|
||||
var sssc = new SSSRControl({
|
||||
criticality: true,
|
||||
value: [
|
||||
{
|
||||
|
@ -97,7 +97,7 @@ test('toBer - array', function (t) {
|
|||
});
|
||||
|
||||
test('toBer - empty', function (t) {
|
||||
var sssc = new ServerSideSortingControl();
|
||||
var sssc = new SSSRControl();
|
||||
var ber = new BerWriter();
|
||||
sssc.toBer(ber);
|
||||
|
Loading…
Reference in New Issue