text:
@class ComplexOpt6;
@class ComplexOpt6_Builder;
@class ComplexOptionType1;
@class ComplexOptionType1_Builder;
@class ComplexOptionType2;
@class ComplexOptionType2_Builder;
@class ComplexOptionType2_ComplexOptionType4;
@class ComplexOptionType2_ComplexOptionType4_Builder;
@class ComplexOptionType3;
@class ComplexOptionType3_Builder;
@class ComplexOptionType3_ComplexOptionType5;
@class ComplexOptionType3_ComplexOptionType5_Builder;
@class CustomOptionFooRequest;
@class CustomOptionFooRequest_Builder;
@class CustomOptionFooResponse;
@class CustomOptionFooResponse_Builder;
@class CustomOptionMaxIntegerValues;
@class CustomOptionMaxIntegerValues_Builder;
@class CustomOptionMinIntegerValues;
@class CustomOptionMinIntegerValues_Builder;
@class CustomOptionOtherValues;
@class CustomOptionOtherValues_Builder;
@class DummyMessageContainingEnum;
@class DummyMessageContainingEnum_Builder;
@class DummyMessageInvalidAsOptionType;
@class DummyMessageInvalidAsOptionType_Builder;
@class PBDescriptorProto;
@class PBDescriptorProto_Builder;
@class PBDescriptorProto_ExtensionRange;
@class PBDescriptorProto_ExtensionRange_Builder;
@class PBEnumDescriptorProto;
@class PBEnumDescriptorProto_Builder;
@class PBEnumOptions;
@class PBEnumOptions_Builder;
@class PBEnumValueDescriptorProto;
@class PBEnumValueDescriptorProto_Builder;
@class PBEnumValueOptions;
@class PBEnumValueOptions_Builder;
@class PBFieldDescriptorProto;
@class PBFieldDescriptorProto_Builder;
@class PBFieldOptions;
@class PBFieldOptions_Builder;
@class PBFileDescriptorProto;
@class PBFileDescriptorProto_Builder;
@class PBFileDescriptorSet;
@class PBFileDescriptorSet_Builder;
@class PBFileOptions;
@class PBFileOptions_Builder;
@class PBMessageOptions;
@class PBMessageOptions_Builder;
@class PBMethodDescriptorProto;
@class PBMethodDescriptorProto_Builder;
@class PBMethodOptions;
@class PBMethodOptions_Builder;
@class PBServiceDescriptorProto;
@class PBServiceDescriptorProto_Builder;
@class PBServiceOptions;
@class PBServiceOptions_Builder;
@class PBUninterpretedOption;
@class PBUninterpretedOption_Builder;
@class PBUninterpretedOption_NamePart;
@class PBUninterpretedOption_NamePart_Builder;
@class SettingRealsFromNegativeInts;
@class SettingRealsFromNegativeInts_Builder;
@class SettingRealsFromPositiveInts;
@class SettingRealsFromPositiveInts_Builder;
@class TestMessageWithCustomOptions;
@class TestMessageWithCustomOptions_Builder;
@class VariousComplexOptions;
@class VariousComplexOptions_Builder;
typedef enum {
  MethodOpt1Methodopt1Val1 = 1,
  MethodOpt1Methodopt1Val2 = 2,
} MethodOpt1;

BOOL MethodOpt1IsValidValue(MethodOpt1 value);

typedef enum {
  TestMessageWithCustomOptions_AnEnumAnenumVal1 = 1,
  TestMessageWithCustomOptions_AnEnumAnenumVal2 = 2,
} TestMessageWithCustomOptions_AnEnum;

BOOL TestMessageWithCustomOptions_AnEnumIsValidValue(TestMessageWithCustomOptions_AnEnum value);

typedef enum {
  DummyMessageContainingEnum_TestEnumTypeTestOptionEnumType1 = 22,
  DummyMessageContainingEnum_TestEnumTypeTestOptionEnumType2 = -23,
} DummyMessageContainingEnum_TestEnumType;

BOOL DummyMessageContainingEnum_TestEnumTypeIsValidValue(DummyMessageContainingEnum_TestEnumType value);

@interface UnittestCustomOptionsRoot : NSObject {
}
+ (PBExtensionRegistry*) extensionRegistry;
+ (void) registerAllExtensions:(PBMutableExtensionRegistry*) registry;
+ (id<PBExtensionField>) fileOpt1;
+ (id<PBExtensionField>) messageOpt1;
+ (id<PBExtensionField>) fieldOpt1;
+ (id<PBExtensionField>) fieldOpt2;
+ (id<PBExtensionField>) enumOpt1;
+ (id<PBExtensionField>) enumValueOpt1;
+ (id<PBExtensionField>) serviceOpt1;
+ (id<PBExtensionField>) methodOpt1;
+ (id<PBExtensionField>) boolOpt;
+ (id<PBExtensionField>) int32Opt;
+ (id<PBExtensionField>) int64Opt;
+ (id<PBExtensionField>) uint32Opt;
+ (id<PBExtensionField>) uint64Opt;
+ (id<PBExtensionField>) sint32Opt;
+ (id<PBExtensionField>) sint64Opt;
+ (id<PBExtensionField>) fixed32Opt;
+ (id<PBExtensionField>) fixed64Opt;
+ (id<PBExtensionField>) sfixed32Opt;
+ (id<PBExtensionField>) sfixed64Opt;
+ (id<PBExtensionField>) floatOpt;
+ (id<PBExtensionField>) doubleOpt;
+ (id<PBExtensionField>) stringOpt;
+ (id<PBExtensionField>) bytesOpt;
+ (id<PBExtensionField>) enumOpt;
+ (id<PBExtensionField>) messageTypeOpt;
+ (id<PBExtensionField>) quux;
+ (id<PBExtensionField>) corge;
+ (id<PBExtensionField>) grault;
+ (id<PBExtensionField>) garply;
+ (id<PBExtensionField>) complexOpt1;
+ (id<PBExtensionField>) complexOpt2;
+ (id<PBExtensionField>) complexOpt3;
+ (id<PBExtensionField>) complexOpt6;
@end

@interface TestMessageWithCustomOptions : PBGeneratedMessage {
@private
  BOOL hasField1_:1;
  NSString* field1;
}
- (BOOL) hasField1;
@property (readonly, retain) NSString* field1;

+ (TestMessageWithCustomOptions*) defaultInstance;
- (TestMessageWithCustomOptions*) defaultInstance;

- (BOOL) isInitialized;
- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output;
- (TestMessageWithCustomOptions_Builder*) builder;
+ (TestMessageWithCustomOptions_Builder*) builder;
+ (TestMessageWithCustomOptions_Builder*) builderWithPrototype:(TestMessageWithCustomOptions*) prototype;

+ (TestMessageWithCustomOptions*) parseFromData:(NSData*) data;
+ (TestMessageWithCustomOptions*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (TestMessageWithCustomOptions*) parseFromInputStream:(NSInputStream*) input;
+ (TestMessageWithCustomOptions*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (TestMessageWithCustomOptions*) parseFromCodedInputStream:(PBCodedInputStream*) input;
+ (TestMessageWithCustomOptions*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end

@interface TestMessageWithCustomOptions_Builder : PBGeneratedMessage_Builder {
@private
  TestMessageWithCustomOptions* result;
}

- (TestMessageWithCustomOptions*) defaultInstance;

- (TestMessageWithCustomOptions_Builder*) clear;
- (TestMessageWithCustomOptions_Builder*) clone;

- (TestMessageWithCustomOptions*) build;
- (TestMessageWithCustomOptions*) buildPartial;

- (TestMessageWithCustomOptions_Builder*) mergeFrom:(TestMessageWithCustomOptions*) other;
- (TestMessageWithCustomOptions_Builder*) mergeFromCodedInputStream:(PBCodedInputStream*) input;
- (TestMessageWithCustomOptions_Builder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;

- (BOOL) hasField1;
- (NSString*) field1;
- (TestMessageWithCustomOptions_Builder*) setField1:(NSString*) value;
- (TestMessageWithCustomOptions_Builder*) clearField1;
@end

@interface CustomOptionFooRequest : PBGeneratedMessage {
@private
}

+ (CustomOptionFooRequest*) defaultInstance;
- (CustomOptionFooRequest*) defaultInstance;

- (BOOL) isInitialized;
- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output;
- (CustomOptionFooRequest_Builder*) builder;
+ (CustomOptionFooRequest_Builder*) builder;
+ (CustomOptionFooRequest_Builder*) builderWithPrototype:(CustomOptionFooRequest*) prototype;

+ (CustomOptionFooRequest*) parseFromData:(NSData*) data;
+ (CustomOptionFooRequest*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (CustomOptionFooRequest*) parseFromInputStream:(NSInputStream*) input;
+ (CustomOptionFooRequest*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (CustomOptionFooRequest*) parseFromCodedInputStream:(PBCodedInputStream*) input;
+ (CustomOptionFooRequest*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end

@interface CustomOptionFooRequest_Builder : PBGeneratedMessage_Builder {
@private
  CustomOptionFooRequest* result;
}

- (CustomOptionFooRequest*) defaultInstance;

- (CustomOptionFooRequest_Builder*) clear;
- (CustomOptionFooRequest_Builder*) clone;

- (CustomOptionFooRequest*) build;
- (CustomOptionFooRequest*) buildPartial;

- (CustomOptionFooRequest_Builder*) mergeFrom:(CustomOptionFooRequest*) other;
- (CustomOptionFooRequest_Builder*) mergeFromCodedInputStream:(PBCodedInputStream*) input;
- (CustomOptionFooRequest_Builder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end

@interface CustomOptionFooResponse : PBGeneratedMessage {
@private
}

+ (CustomOptionFooResponse*) defaultInstance;
- (CustomOptionFooResponse*) defaultInstance;

- (BOOL) isInitialized;
- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output;
- (CustomOptionFooResponse_Builder*) builder;
+ (CustomOptionFooResponse_Builder*) builder;
+ (CustomOptionFooResponse_Builder*) builderWithPrototype:(CustomOptionFooResponse*) prototype;

+ (CustomOptionFooResponse*) parseFromData:(NSData*) data;
+ (CustomOptionFooResponse*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (CustomOptionFooResponse*) parseFromInputStream:(NSInputStream*) input;
+ (CustomOptionFooResponse*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (CustomOptionFooResponse*) parseFromCodedInputStream:(PBCodedInputStream*) input;
+ (CustomOptionFooResponse*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end

@interface CustomOptionFooResponse_Builder : PBGeneratedMessage_Builder {
@private
  CustomOptionFooResponse* result;
}

- (CustomOptionFooResponse*) defaultInstance;

- (CustomOptionFooResponse_Builder*) clear;
- (CustomOptionFooResponse_Builder*) clone;

- (CustomOptionFooResponse*) build;
- (CustomOptionFooResponse*) buildPartial;

- (CustomOptionFooResponse_Builder*) mergeFrom:(CustomOptionFooResponse*) other;
- (CustomOptionFooResponse_Builder*) mergeFromCodedInputStream:(PBCodedInputStream*) input;
- (CustomOptionFooResponse_Builder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end

@interface DummyMessageContainingEnum : PBGeneratedMessage {
@private
}

+ (DummyMessageContainingEnum*) defaultInstance;
- (DummyMessageContainingEnum*) defaultInstance;

- (BOOL) isInitialized;
- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output;
- (DummyMessageContainingEnum_Builder*) builder;
+ (DummyMessageContainingEnum_Builder*) builder;
+ (DummyMessageContainingEnum_Builder*) builderWithPrototype:(DummyMessageContainingEnum*) prototype;

+ (DummyMessageContainingEnum*) parseFromData:(NSData*) data;
+ (DummyMessageContainingEnum*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (DummyMessageContainingEnum*) parseFromInputStream:(NSInputStream*) input;
+ (DummyMessageContainingEnum*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (DummyMessageContainingEnum*) parseFromCodedInputStream:(PBCodedInputStream*) input;
+ (DummyMessageContainingEnum*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end

@interface DummyMessageContainingEnum_Builder : PBGeneratedMessage_Builder {
@private
  DummyMessageContainingEnum* result;
}

- (DummyMessageContainingEnum*) defaultInstance;

- (DummyMessageContainingEnum_Builder*) clear;
- (DummyMessageContainingEnum_Builder*) clone;

- (DummyMessageContainingEnum*) build;
- (DummyMessageContainingEnum*) buildPartial;

- (DummyMessageContainingEnum_Builder*) mergeFrom:(DummyMessageContainingEnum*) other;
- (DummyMessageContainingEnum_Builder*) mergeFromCodedInputStream:(PBCodedInputStream*) input;
- (DummyMessageContainingEnum_Builder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end

@interface DummyMessageInvalidAsOptionType : PBGeneratedMessage {
@private
}

+ (DummyMessageInvalidAsOptionType*) defaultInstance;
- (DummyMessageInvalidAsOptionType*) defaultInstance;

- (BOOL) isInitialized;
- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output;
- (DummyMessageInvalidAsOptionType_Builder*) builder;
+ (DummyMessageInvalidAsOptionType_Builder*) builder;
+ (DummyMessageInvalidAsOptionType_Builder*) builderWithPrototype:(DummyMessageInvalidAsOptionType*) prototype;

+ (DummyMessageInvalidAsOptionType*) parseFromData:(NSData*) data;
+ (DummyMessageInvalidAsOptionType*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (DummyMessageInvalidAsOptionType*) parseFromInputStream:(NSInputStream*) input;
+ (DummyMessageInvalidAsOptionType*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (DummyMessageInvalidAsOptionType*) parseFromCodedInputStream:(PBCodedInputStream*) input;
+ (DummyMessageInvalidAsOptionType*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end

@interface DummyMessageInvalidAsOptionType_Builder : PBGeneratedMessage_Builder {
@private
  DummyMessageInvalidAsOptionType* result;
}

- (DummyMessageInvalidAsOptionType*) defaultInstance;

- (DummyMessageInvalidAsOptionType_Builder*) clear;
- (DummyMessageInvalidAsOptionType_Builder*) clone;

- (DummyMessageInvalidAsOptionType*) build;
- (DummyMessageInvalidAsOptionType*) buildPartial;

- (DummyMessageInvalidAsOptionType_Builder*) mergeFrom:(DummyMessageInvalidAsOptionType*) other;
- (DummyMessageInvalidAsOptionType_Builder*) mergeFromCodedInputStream:(PBCodedInputStream*) input;
- (DummyMessageInvalidAsOptionType_Builder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end

@interface CustomOptionMinIntegerValues : PBGeneratedMessage {
@private
}

+ (CustomOptionMinIntegerValues*) defaultInstance;
- (CustomOptionMinIntegerValues*) defaultInstance;

- (BOOL) isInitialized;
- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output;
- (CustomOptionMinIntegerValues_Builder*) builder;
+ (CustomOptionMinIntegerValues_Builder*) builder;
+ (CustomOptionMinIntegerValues_Builder*) builderWithPrototype:(CustomOptionMinIntegerValues*) prototype;

+ (CustomOptionMinIntegerValues*) parseFromData:(NSData*) data;
+ (CustomOptionMinIntegerValues*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (CustomOptionMinIntegerValues*) parseFromInputStream:(NSInputStream*) input;
+ (CustomOptionMinIntegerValues*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (CustomOptionMinIntegerValues*) parseFromCodedInputStream:(PBCodedInputStream*) input;
+ (CustomOptionMinIntegerValues*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end

@interface CustomOptionMinIntegerValues_Builder : PBGeneratedMessage_Builder {
@private
  CustomOptionMinIntegerValues* result;
}

- (CustomOptionMinIntegerValues*) defaultInstance;

- (CustomOptionMinIntegerValues_Builder*) clear;
- (CustomOptionMinIntegerValues_Builder*) clone;

- (CustomOptionMinIntegerValues*) build;
- (CustomOptionMinIntegerValues*) buildPartial;

- (CustomOptionMinIntegerValues_Builder*) mergeFrom:(CustomOptionMinIntegerValues*) other;
- (CustomOptionMinIntegerValues_Builder*) mergeFromCodedInputStream:(PBCodedInputStream*) input;
- (CustomOptionMinIntegerValues_Builder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end

@interface CustomOptionMaxIntegerValues : PBGeneratedMessage {
@private
}

+ (CustomOptionMaxIntegerValues*) defaultInstance;
- (CustomOptionMaxIntegerValues*) defaultInstance;

- (BOOL) isInitialized;
- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output;
- (CustomOptionMaxIntegerValues_Builder*) builder;
+ (CustomOptionMaxIntegerValues_Builder*) builder;
+ (CustomOptionMaxIntegerValues_Builder*) builderWithPrototype:(CustomOptionMaxIntegerValues*) prototype;

+ (CustomOptionMaxIntegerValues*) parseFromData:(NSData*) data;
+ (CustomOptionMaxIntegerValues*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (CustomOptionMaxIntegerValues*) parseFromInputStream:(NSInputStream*) input;
+ (CustomOptionMaxIntegerValues*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (CustomOptionMaxIntegerValues*) parseFromCodedInputStream:(PBCodedInputStream*) input;
+ (CustomOptionMaxIntegerValues*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end

@interface CustomOptionMaxIntegerValues_Builder : PBGeneratedMessage_Builder {
@private
  CustomOptionMaxIntegerValues* result;
}

- (CustomOptionMaxIntegerValues*) defaultInstance;

- (CustomOptionMaxIntegerValues_Builder*) clear;
- (CustomOptionMaxIntegerValues_Builder*) clone;

- (CustomOptionMaxIntegerValues*) build;
- (CustomOptionMaxIntegerValues*) buildPartial;

- (CustomOptionMaxIntegerValues_Builder*) mergeFrom:(CustomOptionMaxIntegerValues*) other;
- (CustomOptionMaxIntegerValues_Builder*) mergeFromCodedInputStream:(PBCodedInputStream*) input;
- (CustomOptionMaxIntegerValues_Builder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end

@interface CustomOptionOtherValues : PBGeneratedMessage {
@private
}

+ (CustomOptionOtherValues*) defaultInstance;
- (CustomOptionOtherValues*) defaultInstance;

- (BOOL) isInitialized;
- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output;
- (CustomOptionOtherValues_Builder*) builder;
+ (CustomOptionOtherValues_Builder*) builder;
+ (CustomOptionOtherValues_Builder*) builderWithPrototype:(CustomOptionOtherValues*) prototype;

+ (CustomOptionOtherValues*) parseFromData:(NSData*) data;
+ (CustomOptionOtherValues*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (CustomOptionOtherValues*) parseFromInputStream:(NSInputStream*) input;
+ (CustomOptionOtherValues*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (CustomOptionOtherValues*) parseFromCodedInputStream:(PBCodedInputStream*) input;
+ (CustomOptionOtherValues*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end

@interface CustomOptionOtherValues_Builder : PBGeneratedMessage_Builder {
@private
  CustomOptionOtherValues* result;
}

- (CustomOptionOtherValues*) defaultInstance;

- (CustomOptionOtherValues_Builder*) clear;
- (CustomOptionOtherValues_Builder*) clone;

- (CustomOptionOtherValues*) build;
- (CustomOptionOtherValues*) buildPartial;

- (CustomOptionOtherValues_Builder*) mergeFrom:(CustomOptionOtherValues*) other;
- (CustomOptionOtherValues_Builder*) mergeFromCodedInputStream:(PBCodedInputStream*) input;
- (CustomOptionOtherValues_Builder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end

@interface SettingRealsFromPositiveInts : PBGeneratedMessage {
@private
}

+ (SettingRealsFromPositiveInts*) defaultInstance;
- (SettingRealsFromPositiveInts*) defaultInstance;

- (BOOL) isInitialized;
- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output;
- (SettingRealsFromPositiveInts_Builder*) builder;
+ (SettingRealsFromPositiveInts_Builder*) builder;
+ (SettingRealsFromPositiveInts_Builder*) builderWithPrototype:(SettingRealsFromPositiveInts*) prototype;

+ (SettingRealsFromPositiveInts*) parseFromData:(NSData*) data;
+ (SettingRealsFromPositiveInts*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (SettingRealsFromPositiveInts*) parseFromInputStream:(NSInputStream*) input;
+ (SettingRealsFromPositiveInts*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (SettingRealsFromPositiveInts*) parseFromCodedInputStream:(PBCodedInputStream*) input;
+ (SettingRealsFromPositiveInts*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end

@interface SettingRealsFromPositiveInts_Builder : PBGeneratedMessage_Builder {
@private
  SettingRealsFromPositiveInts* result;
}

- (SettingRealsFromPositiveInts*) defaultInstance;

- (SettingRealsFromPositiveInts_Builder*) clear;
- (SettingRealsFromPositiveInts_Builder*) clone;

- (SettingRealsFromPositiveInts*) build;
- (SettingRealsFromPositiveInts*) buildPartial;

- (SettingRealsFromPositiveInts_Builder*) mergeFrom:(SettingRealsFromPositiveInts*) other;
- (SettingRealsFromPositiveInts_Builder*) mergeFromCodedInputStream:(PBCodedInputStream*) input;
- (SettingRealsFromPositiveInts_Builder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end

@interface SettingRealsFromNegativeInts : PBGeneratedMessage {
@private
}

+ (SettingRealsFromNegativeInts*) defaultInstance;
- (SettingRealsFromNegativeInts*) defaultInstance;

- (BOOL) isInitialized;
- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output;
- (SettingRealsFromNegativeInts_Builder*) builder;
+ (SettingRealsFromNegativeInts_Builder*) builder;
+ (SettingRealsFromNegativeInts_Builder*) builderWithPrototype:(SettingRealsFromNegativeInts*) prototype;

+ (SettingRealsFromNegativeInts*) parseFromData:(NSData*) data;
+ (SettingRealsFromNegativeInts*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (SettingRealsFromNegativeInts*) parseFromInputStream:(NSInputStream*) input;
+ (SettingRealsFromNegativeInts*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (SettingRealsFromNegativeInts*) parseFromCodedInputStream:(PBCodedInputStream*) input;
+ (SettingRealsFromNegativeInts*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end

@interface SettingRealsFromNegativeInts_Builder : PBGeneratedMessage_Builder {
@private
  SettingRealsFromNegativeInts* result;
}

- (SettingRealsFromNegativeInts*) defaultInstance;

- (SettingRealsFromNegativeInts_Builder*) clear;
- (SettingRealsFromNegativeInts_Builder*) clone;

- (SettingRealsFromNegativeInts*) build;
- (SettingRealsFromNegativeInts*) buildPartial;

- (SettingRealsFromNegativeInts_Builder*) mergeFrom:(SettingRealsFromNegativeInts*) other;
- (SettingRealsFromNegativeInts_Builder*) mergeFromCodedInputStream:(PBCodedInputStream*) input;
- (SettingRealsFromNegativeInts_Builder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end

@interface ComplexOptionType1 : PBExtendableMessage {
@private
  BOOL hasFoo_:1;
  int32_t foo;
}
- (BOOL) hasFoo;
@property (readonly) int32_t foo;

+ (ComplexOptionType1*) defaultInstance;
- (ComplexOptionType1*) defaultInstance;

- (BOOL) isInitialized;
- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output;
- (ComplexOptionType1_Builder*) builder;
+ (ComplexOptionType1_Builder*) builder;
+ (ComplexOptionType1_Builder*) builderWithPrototype:(ComplexOptionType1*) prototype;

+ (ComplexOptionType1*) parseFromData:(NSData*) data;
+ (ComplexOptionType1*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (ComplexOptionType1*) parseFromInputStream:(NSInputStream*) input;
+ (ComplexOptionType1*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (ComplexOptionType1*) parseFromCodedInputStream:(PBCodedInputStream*) input;
+ (ComplexOptionType1*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end

@interface ComplexOptionType1_Builder : PBExtendableMessage_Builder {
@private
  ComplexOptionType1* result;
}

- (ComplexOptionType1*) defaultInstance;

- (ComplexOptionType1_Builder*) clear;
- (ComplexOptionType1_Builder*) clone;

- (ComplexOptionType1*) build;
- (ComplexOptionType1*) buildPartial;

- (ComplexOptionType1_Builder*) mergeFrom:(ComplexOptionType1*) other;
- (ComplexOptionType1_Builder*) mergeFromCodedInputStream:(PBCodedInputStream*) input;
- (ComplexOptionType1_Builder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;

- (BOOL) hasFoo;
- (int32_t) foo;
- (ComplexOptionType1_Builder*) setFoo:(int32_t) value;
- (ComplexOptionType1_Builder*) clearFoo;
@end

@interface ComplexOptionType2 : PBExtendableMessage {
@private
  BOOL hasBaz_:1;
  BOOL hasBar_:1;
  BOOL hasFred_:1;
  int32_t baz;
  ComplexOptionType1* bar;
  ComplexOptionType2_ComplexOptionType4* fred;
}
- (BOOL) hasBar;
- (BOOL) hasBaz;
- (BOOL) hasFred;
@property (readonly, retain) ComplexOptionType1* bar;
@property (readonly) int32_t baz;
@property (readonly, retain) ComplexOptionType2_ComplexOptionType4* fred;

+ (ComplexOptionType2*) defaultInstance;
- (ComplexOptionType2*) defaultInstance;

- (BOOL) isInitialized;
- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output;
- (ComplexOptionType2_Builder*) builder;
+ (ComplexOptionType2_Builder*) builder;
+ (ComplexOptionType2_Builder*) builderWithPrototype:(ComplexOptionType2*) prototype;

+ (ComplexOptionType2*) parseFromData:(NSData*) data;
+ (ComplexOptionType2*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (ComplexOptionType2*) parseFromInputStream:(NSInputStream*) input;
+ (ComplexOptionType2*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (ComplexOptionType2*) parseFromCodedInputStream:(PBCodedInputStream*) input;
+ (ComplexOptionType2*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end

@interface ComplexOptionType2_ComplexOptionType4 : PBGeneratedMessage {
@private
  BOOL hasWaldo_:1;
  int32_t waldo;
}
- (BOOL) hasWaldo;
@property (readonly) int32_t waldo;

+ (ComplexOptionType2_ComplexOptionType4*) defaultInstance;
- (ComplexOptionType2_ComplexOptionType4*) defaultInstance;

+ (id<PBExtensionField>) complexOpt4;
- (BOOL) isInitialized;
- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output;
- (ComplexOptionType2_ComplexOptionType4_Builder*) builder;
+ (ComplexOptionType2_ComplexOptionType4_Builder*) builder;
+ (ComplexOptionType2_ComplexOptionType4_Builder*) builderWithPrototype:(ComplexOptionType2_ComplexOptionType4*) prototype;

+ (ComplexOptionType2_ComplexOptionType4*) parseFromData:(NSData*) data;
+ (ComplexOptionType2_ComplexOptionType4*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (ComplexOptionType2_ComplexOptionType4*) parseFromInputStream:(NSInputStream*) input;
+ (ComplexOptionType2_ComplexOptionType4*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (ComplexOptionType2_ComplexOptionType4*) parseFromCodedInputStream:(PBCodedInputStream*) input;
+ (ComplexOptionType2_ComplexOptionType4*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end

@interface ComplexOptionType2_ComplexOptionType4_Builder : PBGeneratedMessage_Builder {
@private
  ComplexOptionType2_ComplexOptionType4* result;
}

- (ComplexOptionType2_ComplexOptionType4*) defaultInstance;

- (ComplexOptionType2_ComplexOptionType4_Builder*) clear;
- (ComplexOptionType2_ComplexOptionType4_Builder*) clone;

- (ComplexOptionType2_ComplexOptionType4*) build;
- (ComplexOptionType2_ComplexOptionType4*) buildPartial;

- (ComplexOptionType2_ComplexOptionType4_Builder*) mergeFrom:(ComplexOptionType2_ComplexOptionType4*) other;
- (ComplexOptionType2_ComplexOptionType4_Builder*) mergeFromCodedInputStream:(PBCodedInputStream*) input;
- (ComplexOptionType2_ComplexOptionType4_Builder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;

- (BOOL) hasWaldo;
- (int32_t) waldo;
- (ComplexOptionType2_ComplexOptionType4_Builder*) setWaldo:(int32_t) value;
- (ComplexOptionType2_ComplexOptionType4_Builder*) clearWaldo;
@end

@interface ComplexOptionType2_Builder : PBExtendableMessage_Builder {
@private
  ComplexOptionType2* result;
}

- (ComplexOptionType2*) defaultInstance;

- (ComplexOptionType2_Builder*) clear;
- (ComplexOptionType2_Builder*) clone;

- (ComplexOptionType2*) build;
- (ComplexOptionType2*) buildPartial;

- (ComplexOptionType2_Builder*) mergeFrom:(ComplexOptionType2*) other;
- (ComplexOptionType2_Builder*) mergeFromCodedInputStream:(PBCodedInputStream*) input;
- (ComplexOptionType2_Builder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;

- (BOOL) hasBar;
- (ComplexOptionType1*) bar;
- (ComplexOptionType2_Builder*) setBar:(ComplexOptionType1*) value;
- (ComplexOptionType2_Builder*) setBarBuilder:(ComplexOptionType1_Builder*) builderForValue;
- (ComplexOptionType2_Builder*) mergeBar:(ComplexOptionType1*) value;
- (ComplexOptionType2_Builder*) clearBar;

- (BOOL) hasBaz;
- (int32_t) baz;
- (ComplexOptionType2_Builder*) setBaz:(int32_t) value;
- (ComplexOptionType2_Builder*) clearBaz;

- (BOOL) hasFred;
- (ComplexOptionType2_ComplexOptionType4*) fred;
- (ComplexOptionType2_Builder*) setFred:(ComplexOptionType2_ComplexOptionType4*) value;
- (ComplexOptionType2_Builder*) setFredBuilder:(ComplexOptionType2_ComplexOptionType4_Builder*) builderForValue;
- (ComplexOptionType2_Builder*) mergeFred:(ComplexOptionType2_ComplexOptionType4*) value;
- (ComplexOptionType2_Builder*) clearFred;
@end

@interface ComplexOptionType3 : PBGeneratedMessage {
@private
  BOOL hasQux_:1;
  BOOL hasComplexOptionType5_:1;
  int32_t qux;
  ComplexOptionType3_ComplexOptionType5* complexOptionType5;
}
- (BOOL) hasQux;
- (BOOL) hasComplexOptionType5;
@property (readonly) int32_t qux;
@property (readonly, retain) ComplexOptionType3_ComplexOptionType5* complexOptionType5;

+ (ComplexOptionType3*) defaultInstance;
- (ComplexOptionType3*) defaultInstance;

- (BOOL) isInitialized;
- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output;
- (ComplexOptionType3_Builder*) builder;
+ (ComplexOptionType3_Builder*) builder;
+ (ComplexOptionType3_Builder*) builderWithPrototype:(ComplexOptionType3*) prototype;

+ (ComplexOptionType3*) parseFromData:(NSData*) data;
+ (ComplexOptionType3*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (ComplexOptionType3*) parseFromInputStream:(NSInputStream*) input;
+ (ComplexOptionType3*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (ComplexOptionType3*) parseFromCodedInputStream:(PBCodedInputStream*) input;
+ (ComplexOptionType3*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end

@interface ComplexOptionType3_ComplexOptionType5 : PBGeneratedMessage {
@private
  BOOL hasPlugh_:1;
  int32_t plugh;
}
- (BOOL) hasPlugh;
@property (readonly) int32_t plugh;

+ (ComplexOptionType3_ComplexOptionType5*) defaultInstance;
- (ComplexOptionType3_ComplexOptionType5*) defaultInstance;

- (BOOL) isInitialized;
- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output;
- (ComplexOptionType3_ComplexOptionType5_Builder*) builder;
+ (ComplexOptionType3_ComplexOptionType5_Builder*) builder;
+ (ComplexOptionType3_ComplexOptionType5_Builder*) builderWithPrototype:(ComplexOptionType3_ComplexOptionType5*) prototype;

+ (ComplexOptionType3_ComplexOptionType5*) parseFromData:(NSData*) data;
+ (ComplexOptionType3_ComplexOptionType5*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (ComplexOptionType3_ComplexOptionType5*) parseFromInputStream:(NSInputStream*) input;
+ (ComplexOptionType3_ComplexOptionType5*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (ComplexOptionType3_ComplexOptionType5*) parseFromCodedInputStream:(PBCodedInputStream*) input;
+ (ComplexOptionType3_ComplexOptionType5*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end

@interface ComplexOptionType3_ComplexOptionType5_Builder : PBGeneratedMessage_Builder {
@private
  ComplexOptionType3_ComplexOptionType5* result;
}

- (ComplexOptionType3_ComplexOptionType5*) defaultInstance;

- (ComplexOptionType3_ComplexOptionType5_Builder*) clear;
- (ComplexOptionType3_ComplexOptionType5_Builder*) clone;

- (ComplexOptionType3_ComplexOptionType5*) build;
- (ComplexOptionType3_ComplexOptionType5*) buildPartial;

- (ComplexOptionType3_ComplexOptionType5_Builder*) mergeFrom:(ComplexOptionType3_ComplexOptionType5*) other;
- (ComplexOptionType3_ComplexOptionType5_Builder*) mergeFromCodedInputStream:(PBCodedInputStream*) input;
- (ComplexOptionType3_ComplexOptionType5_Builder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;

- (BOOL) hasPlugh;
- (int32_t) plugh;
- (ComplexOptionType3_ComplexOptionType5_Builder*) setPlugh:(int32_t) value;
- (ComplexOptionType3_ComplexOptionType5_Builder*) clearPlugh;
@end

@interface ComplexOptionType3_Builder : PBGeneratedMessage_Builder {
@private
  ComplexOptionType3* result;
}

- (ComplexOptionType3*) defaultInstance;

- (ComplexOptionType3_Builder*) clear;
- (ComplexOptionType3_Builder*) clone;

- (ComplexOptionType3*) build;
- (ComplexOptionType3*) buildPartial;

- (ComplexOptionType3_Builder*) mergeFrom:(ComplexOptionType3*) other;
- (ComplexOptionType3_Builder*) mergeFromCodedInputStream:(PBCodedInputStream*) input;
- (ComplexOptionType3_Builder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;

- (BOOL) hasQux;
- (int32_t) qux;
- (ComplexOptionType3_Builder*) setQux:(int32_t) value;
- (ComplexOptionType3_Builder*) clearQux;

- (BOOL) hasComplexOptionType5;
- (ComplexOptionType3_ComplexOptionType5*) complexOptionType5;
- (ComplexOptionType3_Builder*) setComplexOptionType5:(ComplexOptionType3_ComplexOptionType5*) value;
- (ComplexOptionType3_Builder*) setComplexOptionType5Builder:(ComplexOptionType3_ComplexOptionType5_Builder*) builderForValue;
- (ComplexOptionType3_Builder*) mergeComplexOptionType5:(ComplexOptionType3_ComplexOptionType5*) value;
- (ComplexOptionType3_Builder*) clearComplexOptionType5;
@end

@interface ComplexOpt6 : PBGeneratedMessage {
@private
  BOOL hasXyzzy_:1;
  int32_t xyzzy;
}
- (BOOL) hasXyzzy;
@property (readonly) int32_t xyzzy;

+ (ComplexOpt6*) defaultInstance;
- (ComplexOpt6*) defaultInstance;

- (BOOL) isInitialized;
- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output;
- (ComplexOpt6_Builder*) builder;
+ (ComplexOpt6_Builder*) builder;
+ (ComplexOpt6_Builder*) builderWithPrototype:(ComplexOpt6*) prototype;

+ (ComplexOpt6*) parseFromData:(NSData*) data;
+ (ComplexOpt6*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (ComplexOpt6*) parseFromInputStream:(NSInputStream*) input;
+ (ComplexOpt6*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (ComplexOpt6*) parseFromCodedInputStream:(PBCodedInputStream*) input;
+ (ComplexOpt6*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end

@interface ComplexOpt6_Builder : PBGeneratedMessage_Builder {
@private
  ComplexOpt6* result;
}

- (ComplexOpt6*) defaultInstance;

- (ComplexOpt6_Builder*) clear;
- (ComplexOpt6_Builder*) clone;

- (ComplexOpt6*) build;
- (ComplexOpt6*) buildPartial;

- (ComplexOpt6_Builder*) mergeFrom:(ComplexOpt6*) other;
- (ComplexOpt6_Builder*) mergeFromCodedInputStream:(PBCodedInputStream*) input;
- (ComplexOpt6_Builder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;

- (BOOL) hasXyzzy;
- (int32_t) xyzzy;
- (ComplexOpt6_Builder*) setXyzzy:(int32_t) value;
- (ComplexOpt6_Builder*) clearXyzzy;
@end

@interface VariousComplexOptions : PBGeneratedMessage {
@private
}

+ (VariousComplexOptions*) defaultInstance;
- (VariousComplexOptions*) defaultInstance;

- (BOOL) isInitialized;
- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output;
- (VariousComplexOptions_Builder*) builder;
+ (VariousComplexOptions_Builder*) builder;
+ (VariousComplexOptions_Builder*) builderWithPrototype:(VariousComplexOptions*) prototype;

+ (VariousComplexOptions*) parseFromData:(NSData*) data;
+ (VariousComplexOptions*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (VariousComplexOptions*) parseFromInputStream:(NSInputStream*) input;
+ (VariousComplexOptions*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (VariousComplexOptions*) parseFromCodedInputStream:(PBCodedInputStream*) input;
+ (VariousComplexOptions*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end

@interface VariousComplexOptions_Builder : PBGeneratedMessage_Builder {
@private
  VariousComplexOptions* result;
}

- (VariousComplexOptions*) defaultInstance;

- (VariousComplexOptions_Builder*) clear;
- (VariousComplexOptions_Builder*) clone;

- (VariousComplexOptions*) build;
- (VariousComplexOptions*) buildPartial;

- (VariousComplexOptions_Builder*) mergeFrom:(VariousComplexOptions*) other;
- (VariousComplexOptions_Builder*) mergeFromCodedInputStream:(PBCodedInputStream*) input;
- (VariousComplexOptions_Builder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end


text:
using NUnit.Framework;
using System.Buffers;

namespace SmtpPilot.Tests
{
    [TestFixture]
    public class SequenceReaderTests
    {
        private ReadOnlySequence<byte> SingleSegmentSequence
        {
            get
            {
                return SequenceHelper.Seq(
                    SequenceHelper.C('H', 'E', 'L', 'O', '\r', '\n')
                );
            }
        }

        [Test]
        public void SequenceIsRead()
        {

        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
> see https://aka.ms/autorest

This is the AutoRest configuration file for Purview.

---
## Getting Started
To build the SDK for Purview, simply [Install AutoRest](https://aka.ms/autorest/install) and in this folder, run:

> `autorest`

To see additional help and options, run:

> `autorest --help`
---

## Configuration

### Basic Information
These are the global settings for the Purview API.

``` yaml
openapi-type: arm
tag: package-2020-12-01-preview
```

### Tag: package-2020-12-01-preview

These settings apply only when `--tag=package-2020-12-01-preview` is specified on the command line.

``` yaml $(tag) == 'package-2020-12-01-preview'
input-file:
- Microsoft.Purview/preview/2020-12-01-preview/purview.json
```

---
# Code Generation

## Swagger to SDK

This section describes what SDK should be generated by the automatic system.
This is not used by Autorest itself.

``` yaml $(swagger-to-sdk)
swagger-to-sdk:
  - repo: azure-sdk-for-python-track2
  - repo: azure-sdk-for-go
  - repo: azure-resource-manager-schemas
```

## C#

These settings apply only when `--csharp` is specified on the command line.
Please also specify `--csharp-sdks-folder=<path to "SDKs" directory of your azure-sdk-for-net clone>`.

``` yaml $(csharp)
csharp:
  azure-arm: true
  license-header: MICROSOFT_MIT_NO_VERSION
  namespace: Microsoft.Azure.Management.Purview
  output-folder: $(csharp-sdks-folder)/Purview/Microsoft.Azure.Management.Purview/src/Generated
  clear-output-folder: true
```

## Python

See configuration in [readme.python.md](./readme.python.md)

## Go

See configuration in [readme.go.md](./readme.go.md)


text:
.. Copyright (c) 2011 Yan Pujante

   Licensed under the Apache License, Version 2.0 (the "License"); you may not
   use this file except in compliance with the License. You may obtain a copy of
   the License at

   http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
   WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
   License for the specific language governing permissions and limitations under
   the License.

A taste of glu (tutorial)
=========================

.. sidebar:: July 2011 video

             This tutorial is featured live in the video/presentation about glu that was given early July 2011 at the devops meetup in Chicago (`video <http://devops.com/2011/07/09/glu-deployment-automation-video/>`_ or `slides only (pdf) <http://linkedin.github.com/glu/slides/glu-tech-talk-201107.pdf>`_). The live demo starts around 27:00.

The purpose of this tutorial is to give you a taste of glu: the idea is to be up and running as quickly as possible and try it for yourself so that you get a feel of what glu can do.

.. note::
   For the sake of this tutorial, the agent and the console are all running on the same host. This is not the production case where there is 1 agent per host with a central console to command them.

During this tutorial you are going to deploy 3 jetty containers running 4 webapps!

.. note::
   Note that this tutorial will launch several applications on the following ports so make sure nothing is running on them or you will encounter some issues::

    agent:    12906
    console:   8080
    webapp1:   9000
    webapp2:   9001
    webapp3:   9003
    zookeeper: 2181

Requirements
------------
Currently glu requires a UNIX like platform (tested on Mac OS X and Solaris) and Java 1.6.

.. warning::
   Due to a `bug with OpenJDK <https://github.com/linkedin/glu/issues/74>`_ glu currently requires the Sun Java VM.

Install the tutorial
--------------------
Download the binary called ``<version>/org.linkedin.glu.packaging-all-<version>.tgz`` from the `downloads <http://www.pongasoft.com/glu/downloads/>`_ section.

Untar/Unzip in a location of your choice. From now on, this location will be referred to as ``GLU_TUTORIAL_ROOT``.

Initial setup
-------------
In a shell terminal enter::

    cd $GLU_TUTORIAL_ROOT
    ./bin/tutorial.sh setup

This step does the following:

1. it loads the keys in ZooKeeper (``agent.keystore``, ``console.truststore``) for the fabric ``glu-dev-1``
2. it loads the agent configuration in ZooKeeper (``config.properties``) for the fabric ``glu-dev-1``
3. it configures and assigns ``agent-1`` to fabric ``glu-dev-1``

.. image:: /images/tutorial/tutorial-setup.png
   :align: center
   :alt: output of setup command

Start all components
--------------------
From the same terminal enter::

   ./bin/tutorial.sh start
   ./bin/tutorial.sh tail

This will start 3 components:

* ZooKeeper
* the agent
* the console (which contains the orchestration engine)

The second command tails the log for each component.

.. note::
   Depending on the speed of your system, sometimes the console takes a little while to create its log file. In order to see it in the output of the tail command, you may have to reissue the command after waiting a little while.

.. tip::
   The console includes this documentation as well, available at http://localhost:8080/glu/docs/html/tutorial.html

Login to the console
--------------------
Point your browser to http://localhost:8080/console

1. login::

    username: admin
    password: admin

  .. image:: /images/tutorial/tutorial-console-login-600.png
     :align: center
     :alt: console login screen

  .. note::
     The very first time the console is started, an admin account is created. In production mode, it is highly recommended to change the default password!

2. The very first time, you will be prompted to create a fabric::

    Name             : glu-dev-1
    Zk Connect String: localhost:2181
    Zk Timeout       : 30s

  .. image:: /images/tutorial/tutorial-console-create-fabric.png
     :align: center
     :alt: create fabric

When the console is launched for the very first time, the database is empty and you need to add a fabric to it. In this case we create the fabric called ``glu-dev-1`` (which is the same name used in the setup) and we associate it to the local ZooKeeper.

View the agent
--------------
1. Click on the ``'Agents'`` tab where you will see a list of all agents (nodes). In this case there should be only 1 entry.

  .. image:: /images/tutorial/tutorial-dashboard-1-600.png
     :align: center
     :alt: From the Agents list, click on agent-1

2. Click on ``agent-1`` (which is the name of the agent that was previously set up)

3. Click on ``'View Details'`` which show/hide the details about the agent: this information is coming straight from agent-1 which was registered in ZooKeeper when the agent started.

4. You should see the properties ``glu.agent.port`` (``12906``) and ``glu.agent.pid`` representing the pid of the agent.

  .. image:: /images/tutorial/tutorial-view-agent-1-600.png
     :align: center
     :alt: Agent view / View details

View log files
--------------
1. Click on ``'main'`` (next to ``Logs:``) which shows the last 500 lines of the main log file of the agent (if you scroll to the bottom you should see the same message that the tail command (started previously is showing)).

  .. image:: /images/tutorial/tutorial-view-agent-2.png
     :align: center
     :alt: Agent view / View log file

  .. note:: the agent logs a message that you are looking at its log file!

2. Go back to the agent view page and click ``'more...'`` (next to ``Logs:``). This will show you the content of the logs folder and you can navigate to look at any file you want!

  .. image:: /images/tutorial/tutorial-view-agent-more-600.png
     :align: center
     :alt: Agent view / View log file

.. note:: All those operations are executed on the agent(s) and the console merely displays the result (as can be seen in the log file of the agent).

View processes (``ps``)
-----------------------
1. Click on the ``'All Processes'`` subtab. This essentialy runs the ``'ps'`` command on the agent and returns the result.

  .. image:: /images/tutorial/tutorial-ps-1-600.png
     :align: center
     :alt: View all processes running on an agent

  .. image:: /images/tutorial/tutorial-ps-2-600.png
     :align: center
     :alt: Identify the glu processes

2. In the ``org.linkedin.app.name`` column you should be able to identify the agent that is running (as well as zookeeper and the console itself). By clicking on the pid you can view details about the process as well as sending a signal to the process!

.. note:: All those operations are executed on the agent(s) and the console merely displays the result (as can be seen in the log file of the agent).

Loading the model
-----------------
1. Click on the ``'Model'`` tab and ``'Load'`` subtab and enter::

    Json Uri: http://localhost:8080/glu/repository/systems/sample-webapp-system.json

2. Click ``Load``.

.. image:: /images/tutorial/tutorial-loading-model.png
     :align: center
     :alt: Load the model

.. note:: the console is a simple web application and is being run in a jetty container which is also used to serve static content. In a production environment it is usually *not* the way it is being done as the agents would not in general talk to the console but instead would fetch their information from a binary repository (like Artifactory) using the ivy protocol for example.

.. note:: you can view the model you just loaded at http://localhost:8080/glu/repository/systems/sample-webapp-system.json (you may need to do 'View Source' in your browser if you don't see anything).

*Fixing* the issues
-------------------
.. sidebar:: What has just happened?

      We have just loaded a model which represents a system where 3 'entries' need to be running on ``agent-1``. Since nothing is running, the orchestration engine computed a delta (represented by the red rows) that the console tells you to fix. *Fixing* it means deploying the 3 'entries'.

1. After loading the model you should be back on the Dashboard view with 3 red rows in the table. The status of each row reads: ``'NOT deployed'``.

   .. image:: /images/tutorial/tutorial-dashboard-2-600.png
      :align: center
      :alt: Applications are not deployed

   .. note:: From there, there are several ways to go about it (partially or all at once). Let's do it all for now.

2. Click on the ``'Plans'`` subtab. You should see a table at the bottom of the page with ``Select a plan`` right next to it. Select the radio group control in the table that says ``Deploy PARALLEL`` (the row should be highlighted in red). It should immediately shows you the list of actions (and their ordering) that are going to be accomplished to 'fix' the delta.

3. Click ``'Select this plan'``.

   .. image:: /images/tutorial/tutorial-select-plan-3-600.png
      :align: center
      :alt: Select a plan page

4. The next page allows you to *customize* the plan. Simply click ``'Execute'`` and confirm the action.

5. The next page will show you the plan again and will change as the plan gets executed. Since you selected ``PARALLEL`` all the actions will take place in parallel. The plan should conclude successfully.

   .. image:: /images/tutorial/tutorial-plan-success.png
      :align: center
      :alt: Successfull plan execution

   .. note:: At this stage you can check the tail command output and see all the activity.

      .. image:: /images/tutorial/tutorial-agent-log-1-600.png
         :align: center
         :alt: Agent log after deployment plan

6. Go back to the ``Dashboard`` and everything should be green.

   .. image:: /images/tutorial/tutorial-dashboard-3-600.png
      :align: center
      :alt: Applications are now deployed successfully

   .. note:: the terminology 'entry' may sound a little vague right now, but it is associated to a unique mountPoint (or unique key) like ``/sample/i001`` on an agent with a script (called glu script) which represents the set of instructions necessary to start an application. In the course of this tutorial we use the `JettyGluScript <https://github.com/linkedin/glu/blob/master/scripts/org.linkedin.glu.script-jetty/src/main/groovy/JettyGluScript.groovy>`_ which starts a jetty webapp container and deploy some webapps in it.

7. At this stage you have just started 3 jetty container with 4 webapps and you can verify that it worked::

     webapp1: /sample/i001 (port 9000)
	/cp1: http://localhost:9000/cp1/monitor
	/cp2: http://localhost:9000/cp2/monitor

     webapp2: /sample/i002 (port 9001)
	/cp1: http://localhost:9001/cp1/monitor

     webapp3: /sample/i003 (port 9002)
	/cp4: http://localhost:9002/cp4/monitor

Viewing entry details
---------------------
1. Let's go back to the page that shows you the details about the agent. For this you can either click on the ``'Agents'`` tab and select ``'agent-1'`` from the list, like you did in a previous step or you can simply click on the little magnifying glass that is displayed on the dashboard right next to the name of the agent (``agent-1``).

   The page shows you now the 3 entries that were installed.

2. Under ``/sample/i001`` click the ``'View Details'`` link to show/hide details about the entry.

   You should see a section called ``initParameters`` which is coming directly from the system model that you loaded.

   You should also see a section called ``scriptState`` which shows various information like the port (``9000``) or the pid of the process that was started or the location of the log files.

   Note also that under every entry, there is a ``Logs:`` section which allows you to access the log file of the specific container directly, including the gc log file.

   .. image:: /images/tutorial/tutorial-view-agent-3-600.png
      :align: center
      :alt: Entry details for ``/sample/i001``

Detecting failures
------------------
1. In another browser window, go to the monitor page for the first entry (``/sample/i001``): http://localhost:9000/cp2/monitor

2. Select ``BUSY`` and click ``Change monitor state``. By doing this, we are simulating the fact that the webapp has detected that it is overloaded and not responding.

   .. image:: /images/tutorial/tutorial-monitor-busy.png
      :align: center
      :alt: Monitor busy

   2 things should happen (it may take up to 15 seconds to detect the failure):

   a. in the agent log file (look at the ``tail`` command you ran previously), you should see something like::

        2011/01/11 14:57:21.140 WARN [/sample/i001] Server is up but some webapps are busy. Check the log file for errors.

   b. on the Dashboard, the first row should be red and the status should read: ``ERROR``. If you click on ``ERROR`` you should see the same message you just saw in the agent log file::

        Server is up but some webapps are busy. Check the log file for errors.

      .. image:: /images/tutorial/tutorial-dashboard-4-600.png
         :align: center
         :alt: ``/sample/i00`` is in error

3. Now go back to the monitor page, select ``GOOD`` and click ``Change monitor state``.

   .. image:: /images/tutorial/tutorial-monitor-good.png
      :align: center
      :alt: Monitor busy

   Again 2 things should happen (within 15 seconds at most):

   1. in the agent log file, you should see something like::

        2011/01/11 15:03:57.082 INFO [/sample/i001] All webapps are up, clearing error status.

   2. on the Dashboard, everything should be back to green.

Changing the model
------------------
1. Now click the ``'Model'`` tab again.

2. You should see a table with 2 entries which shows you the model that you loaded previously (the one highlighted) as well as the empty model (default one when creating a fabric)

   Click on the first id. You should now see the json document that you loaded previously. We are going to edit it in place.

   The format is an array of entries representing each entry in the model (as explained previously).

3. In the second entry (look for ``"port": 9001``, around the bottom of the text area), change the ``contextPath`` value to ``/cp3``. and click ``"Save Changes"``.

   .. image:: /images/tutorial/tutorial-model-change-1.png
      :align: center
      :alt: Changing the model

4. Go back to the ``Dashboard``.

   Note that the second row is now yellow and the status says ``'DELTA'``. If you click on the status you can view an explanation of the delta (in this case the context path is different).

   .. image:: /images/tutorial/tutorial-dashboard-5.png
      :align: center
      :alt: Dashboard shows the delta

   There is a delta: the system in the console is not matching with what is currently deployed. It is graphically represented as a different color.

5. Click on ``'/sample/i002'`` which sets a filter on the model: it excludes all the entries except the one where ``'mountPoint'`` is equal to ``'/sample/i002'``. Click on the ``'Plans'`` subtab.

6. Choose ``'Deploy / SEQUENTIAL'``. Note that since there is only 1 entry, choosing ``SEQUENTIAL`` or ``PARALLEL`` will have the same effect.

   .. image:: /images/tutorial/tutorial-select-plan-2.png
      :align: center
      :alt: Dashboard shows the delta

7. Select the plan and execute it: it first stops the jetty server uninstalls it entirely and reinstall and restart the new one.

8. When the plan finishes executing, click on ``/sample/i002`` which is a shortcut to the agent view page.

9. If you click on ``'View Details'`` (for ``/sample/i002``), you should see the new context path and you can check that it did work by going to: http://localhost:9001/cp3/monitor

Now the system (also known as desired state) and the current state match. There is no delta anymore so the console is happy: everything is green.

Reloading the model and experiencing a failure
----------------------------------------------
1. Manually edit the file: ``$GLU_TUTORIAL_ROOT/console-server/glu/repository/systems/sample-webapp-system.json``

2. Change the contextPath in the very last entry from ``/cp4`` to ``/fail`` and change the name of the model to ``Tutorial System Model (with failure)`` and save your changes (it will make it easier to differentiate the model in the UI by giving it a different name).

3. Go back to the console and reload the model:

   Click on the ``'Model'`` tab, ``'Load'`` subtab and enter::

     Json Uri: http://localhost:8080/glu/repository/systems/sample-webapp-system.json

   and click ``Load``.

   .. note:: When you go back to the model, the filter you set previously will still be active. Make sure you click the ``'X'`` right next to it to remove it and see the whole, unfiltered model! You should now have 2 rows that are yellow: you reloaded the model thus discarding the changes you had made to entry 2 and you changed entry 3.

      .. image:: /images/tutorial/tutorial-dashboard-6-600.png
         :align: center
         :alt: 2 rows are in error

4. Click on the ``'Plans'`` subtab and follow the same steps we executed before to 'fix' the delta (select deploy in parallel and then execute the plan).

   This time around you should see a failure: the last entry failed during boot time (this is artificially triggered by deploying it under ``/fail``).

   .. image:: /images/tutorial/tutorial-plan-failure.png
      :align: center
      :alt: one entry in the plan fails

   .. note:: Since the plan is executing in parallel, the failure does not impact the rest of the deployment plan. When the plan is executed sequentially, any failure will prevent the execution of the following steps.

5. Click on the shortcut ``/sample/i003`` and on the agent view page select the ``Logs: more...`` entry for ``/sample/i003`` then click on the first log file called ``<yyyy_mm_dd>.stderrout.log``. You should be able to see the log file of the jetty container with the exception of why it failed (something similar to)::

    java.lang.RuntimeException: does not boot
      at org.linkedin.glu.samples.webapp.SampleListener.contextInitialized(SampleListener.java:45)
    ...

.. _tutorial-using-console-cli:

Using the console cli
---------------------
1. Click on the ``'Model'`` tab and set as current the very first model you loaded (it should be right above the ``Empty System Model`` one).

2. In the console, click on the ``'Deployments'`` tab and make sure you leave this window visible. Note that at this point you should see the list of all the plans you have already executed including the last one which failed.

   .. image:: /images/tutorial/tutorial-plans-600.png
      :align: center
      :alt: Execution plans

3. Now open a new shell terminal

   .. note:: if you have followed all the instructions so far, you should have a shell terminal window with the tail command in it, this is why we need to open a new one.

4. Go to the root directory::

      cd $GLU_TUTORIAL_ROOT

5. Now issue the following command (``-b`` is to make it more readable)::

      ./bin/console-cli.sh -f glu-dev-1 -u admin -x admin -b status

   which will display the model that is currently loaded in the console and::

      ./bin/console-cli.sh -f glu-dev-1 -u admin -x admin -b -l status

   which will display the current live model (note that you get a ``scriptState`` section similar to the one you can see in the console when clicking on the ``View Details`` link for an entry).

6. Now we are going to redeploy everything in parallel by issuing::

      ./bin/console-cli.sh -f glu-dev-1 -u admin -x admin -a -p redeploy

   Please pay attention to the following:

   * in the shell window in which you just issued the command there will be a progress bar

     .. image:: /images/tutorial/tutorial-plan-progress-cli.png
        :align: center
        :alt: plan progress from the cli
   * in your web browser you should also see the plan appearing with a progress bar (you can click on the plan to see the details)

     .. image:: /images/tutorial/tutorial-plan-progress-gui.png
        :align: center
        :alt: plan progress from the cli
   * in the shell window with the tail you should see the ouput of the execution

   The plan will succeed and you should see::

       100:COMPLETED

   unless you did not change the context path to ``/cp4`` (you may want to try reverting the model to ``/fail`` as an exercise...).

7. Try a dry-run mode (``-n``)::

     ./bin/console-cli.sh -f glu-dev-1 -u admin -x admin -a -n -p redeploy

   which will display an xml representation of the plan that would be executed if you remove the ``-n`` option. You should see the 3 entries in the xml output::

     <?xml version="1.0"?>
     <plan fabric="glu-dev-1" systemId="deeab8468ddbead277ba86ee2f361ba3a13eefd4" origin="rest" action="redeploy" filter="all" name="origin=rest - action=redeploy - filter=all - PARALLEL" savedTime="1308603147004">
       <parallel origin="rest" action="redeploy" filter="all">
	 <sequential agent="agent-1" mountPoint="/sample/i001">
	   <leaf agent="agent-1" fabric="glu-dev-1" mountPoint="/sample/i001" name="Run [stop] phase for [/sample/i001] on [agent-1]" scriptAction="stop" toState="stopped" />
	   <leaf agent="agent-1" fabric="glu-dev-1" mountPoint="/sample/i001" name="Run [unconfigure] phase for [/sample/i001] on [agent-1]" scriptAction="unconfigure" toState="installed" />
	   <leaf agent="agent-1" fabric="glu-dev-1" mountPoint="/sample/i001" name="Run [uninstall] phase for [/sample/i001] on [agent-1]" scriptAction="uninstall" toState="NONE" />
	   <leaf agent="agent-1" fabric="glu-dev-1" mountPoint="/sample/i001" name="Uninstall script for [/sample/i001] on [agent-1]" scriptLifecycle="uninstallScript" />
	   <leaf agent="agent-1" fabric="glu-dev-1" initParameters="{metadata={product=product1, container={name=sample}, cluster=c1, version=1.0.0}, port=9000, skeleton=http://localhost:8080/glu/repository/tgzs/jetty-distribution-7.2.2.v20101205.tar.gz, tags=[frontend, osx, webapp], webapps=[{monitor=/monitor, contextPath=/cp1, war=http://localhost:8080/glu/repository/wars/org.linkedin.glu.samples.sample-webapp-3.0.0.war}, {monitor=/monitor, contextPath=/cp2, war=http://localhost:8080/glu/repository/wars/org.linkedin.glu.samples.sample-webapp-3.0.0.war}]}"
                 mountPoint="/sample/i001" name="Install script for [/sample/i001] on [agent-1]" script="http://localhost:8080/glu/repository/scripts/org.linkedin.glu.script-jetty-3.0.0/JettyGluScript.groovy" scriptLifecycle="installScript" />
	   <leaf agent="agent-1" fabric="glu-dev-1" mountPoint="/sample/i001" name="Run [install] phase for [/sample/i001] on [agent-1]" scriptAction="install" toState="installed" />
	   <leaf agent="agent-1" fabric="glu-dev-1" mountPoint="/sample/i001" name="Run [configure] phase for [/sample/i001] on [agent-1]" scriptAction="configure" toState="stopped" />
	   <leaf agent="agent-1" fabric="glu-dev-1" mountPoint="/sample/i001" name="Run [start] phase for [/sample/i001] on [agent-1]" scriptAction="start" toState="running" />
	 </sequential>
	 <sequential agent="agent-1" mountPoint="/sample/i002">
	   <leaf agent="agent-1" fabric="glu-dev-1" mountPoint="/sample/i002" name="Run [stop] phase for [/sample/i002] on [agent-1]" scriptAction="stop" toState="stopped" />
	   <leaf agent="agent-1" fabric="glu-dev-1" mountPoint="/sample/i002" name="Run [unconfigure] phase for [/sample/i002] on [agent-1]" scriptAction="unconfigure" toState="installed" />
	   <leaf agent="agent-1" fabric="glu-dev-1" mountPoint="/sample/i002" name="Run [uninstall] phase for [/sample/i002] on [agent-1]" scriptAction="uninstall" toState="NONE" />
	   <leaf agent="agent-1" fabric="glu-dev-1" mountPoint="/sample/i002" name="Uninstall script for [/sample/i002] on [agent-1]" scriptLifecycle="uninstallScript" />
	   <leaf agent="agent-1" fabric="glu-dev-1" initParameters="{metadata={product=product1, container={name=sample}, cluster=c1, version=1.0.0}, port=9001, skeleton=http://localhost:8080/glu/repository/tgzs/jetty-distribution-7.2.2.v20101205.tar.gz, tags=[frontend, osx, webapp], webapps=[{monitor=/monitor, contextPath=/cp1, war=http://localhost:8080/glu/repository/wars/org.linkedin.glu.samples.sample-webapp-3.0.0.war}]}"
                 mountPoint="/sample/i002" name="Install script for [/sample/i002] on [agent-1]" script="http://localhost:8080/glu/repository/scripts/org.linkedin.glu.script-jetty-3.0.0/JettyGluScript.groovy" scriptLifecycle="installScript" />
	   <leaf agent="agent-1" fabric="glu-dev-1" mountPoint="/sample/i002" name="Run [install] phase for [/sample/i002] on [agent-1]" scriptAction="install" toState="installed" />
	   <leaf agent="agent-1" fabric="glu-dev-1" mountPoint="/sample/i002" name="Run [configure] phase for [/sample/i002] on [agent-1]" scriptAction="configure" toState="stopped" />
	   <leaf agent="agent-1" fabric="glu-dev-1" mountPoint="/sample/i002" name="Run [start] phase for [/sample/i002] on [agent-1]" scriptAction="start" toState="running" />
	 </sequential>
	 <sequential agent="agent-1" mountPoint="/sample/i003">
	   <leaf agent="agent-1" fabric="glu-dev-1" mountPoint="/sample/i003" name="Run [stop] phase for [/sample/i003] on [agent-1]" scriptAction="stop" toState="stopped" />
	   <leaf agent="agent-1" fabric="glu-dev-1" mountPoint="/sample/i003" name="Run [unconfigure] phase for [/sample/i003] on [agent-1]" scriptAction="unconfigure" toState="installed" />
	   <leaf agent="agent-1" fabric="glu-dev-1" mountPoint="/sample/i003" name="Run [uninstall] phase for [/sample/i003] on [agent-1]" scriptAction="uninstall" toState="NONE" />
	   <leaf agent="agent-1" fabric="glu-dev-1" mountPoint="/sample/i003" name="Uninstall script for [/sample/i003] on [agent-1]" scriptLifecycle="uninstallScript" />
	   <leaf agent="agent-1" fabric="glu-dev-1" initParameters="{metadata={product=product1, container={name=sample}, cluster=c2, version=1.0.0}, port=9002, skeleton=http://localhost:8080/glu/repository/tgzs/jetty-distribution-7.2.2.v20101205.tar.gz, tags=[backend, osx, webapp], webapps=[{monitor=/monitor, contextPath=/cp4, war=http://localhost:8080/glu/repository/wars/org.linkedin.glu.samples.sample-webapp-3.0.0.war}]}"
                 mountPoint="/sample/i003" name="Install script for [/sample/i003] on [agent-1]" script="http://localhost:8080/glu/repository/scripts/org.linkedin.glu.script-jetty-3.0.0/JettyGluScript.groovy" scriptLifecycle="installScript" />
	   <leaf agent="agent-1" fabric="glu-dev-1" mountPoint="/sample/i003" name="Run [install] phase for [/sample/i003] on [agent-1]" scriptAction="install" toState="installed" />
	   <leaf agent="agent-1" fabric="glu-dev-1" mountPoint="/sample/i003" name="Run [configure] phase for [/sample/i003] on [agent-1]" scriptAction="configure" toState="stopped" />
	   <leaf agent="agent-1" fabric="glu-dev-1" mountPoint="/sample/i003" name="Run [start] phase for [/sample/i003] on [agent-1]" scriptAction="start" toState="running" />
	 </sequential>
       </parallel>
     </plan>

8. Now try with a filter::

     ./bin/console-cli.sh -f glu-dev-1 -u admin -x admin -n -p -s "metadata.cluster='c1'" redeploy

   You should now see only 2 entries because the first two have been tagged ``c1`` for the cluster and the last one is tagged ``c2`` and we are applying a filter which selects only the entries in cluster ``c1``::

     <?xml version="1.0"?>
     <plan fabric="glu-dev-1" systemId="deeab8468ddbead277ba86ee2f361ba3a13eefd4" origin="rest" action="redeploy" filter="metadata.cluster='c1'" name="origin=rest - action=redeploy - filter=metadata.cluster='c1' - PARALLEL" savedTime="1308603240157">
       <parallel origin="rest" action="redeploy" filter="metadata.cluster='c1'">
	 <sequential agent="agent-1" mountPoint="/sample/i001">
	   <leaf agent="agent-1" fabric="glu-dev-1" mountPoint="/sample/i001" name="Run [stop] phase for [/sample/i001] on [agent-1]" scriptAction="stop" toState="stopped" />
	   <leaf agent="agent-1" fabric="glu-dev-1" mountPoint="/sample/i001" name="Run [unconfigure] phase for [/sample/i001] on [agent-1]" scriptAction="unconfigure" toState="installed" />
	   <leaf agent="agent-1" fabric="glu-dev-1" mountPoint="/sample/i001" name="Run [uninstall] phase for [/sample/i001] on [agent-1]" scriptAction="uninstall" toState="NONE" />
	   <leaf agent="agent-1" fabric="glu-dev-1" mountPoint="/sample/i001" name="Uninstall script for [/sample/i001] on [agent-1]" scriptLifecycle="uninstallScript" />
	   <leaf agent="agent-1" fabric="glu-dev-1" initParameters="{metadata={product=product1, container={name=sample}, cluster=c1, version=1.0.0}, port=9000, skeleton=http://localhost:8080/glu/repository/tgzs/jetty-distribution-7.2.2.v20101205.tar.gz, tags=[frontend, osx, webapp], webapps=[{monitor=/monitor, contextPath=/cp1, war=http://localhost:8080/glu/repository/wars/org.linkedin.glu.samples.sample-webapp-3.0.0.war}, {monitor=/monitor, contextPath=/cp2, war=http://localhost:8080/glu/repository/wars/org.linkedin.glu.samples.sample-webapp-3.0.0.war}]}"
                 mountPoint="/sample/i001" name="Install script for [/sample/i001] on [agent-1]" script="http://localhost:8080/glu/repository/scripts/org.linkedin.glu.script-jetty-3.0.0/JettyGluScript.groovy" scriptLifecycle="installScript" />
	   <leaf agent="agent-1" fabric="glu-dev-1" mountPoint="/sample/i001" name="Run [install] phase for [/sample/i001] on [agent-1]" scriptAction="install" toState="installed" />
	   <leaf agent="agent-1" fabric="glu-dev-1" mountPoint="/sample/i001" name="Run [configure] phase for [/sample/i001] on [agent-1]" scriptAction="configure" toState="stopped" />
	   <leaf agent="agent-1" fabric="glu-dev-1" mountPoint="/sample/i001" name="Run [start] phase for [/sample/i001] on [agent-1]" scriptAction="start" toState="running" />
	 </sequential>
	 <sequential agent="agent-1" mountPoint="/sample/i002">
	   <leaf agent="agent-1" fabric="glu-dev-1" mountPoint="/sample/i002" name="Run [stop] phase for [/sample/i002] on [agent-1]" scriptAction="stop" toState="stopped" />
	   <leaf agent="agent-1" fabric="glu-dev-1" mountPoint="/sample/i002" name="Run [unconfigure] phase for [/sample/i002] on [agent-1]" scriptAction="unconfigure" toState="installed" />
	   <leaf agent="agent-1" fabric="glu-dev-1" mountPoint="/sample/i002" name="Run [uninstall] phase for [/sample/i002] on [agent-1]" scriptAction="uninstall" toState="NONE" />
	   <leaf agent="agent-1" fabric="glu-dev-1" mountPoint="/sample/i002" name="Uninstall script for [/sample/i002] on [agent-1]" scriptLifecycle="uninstallScript" />
	   <leaf agent="agent-1" fabric="glu-dev-1" initParameters="{metadata={product=product1, container={name=sample}, cluster=c1, version=1.0.0}, port=9001, skeleton=http://localhost:8080/glu/repository/tgzs/jetty-distribution-7.2.2.v20101205.tar.gz, tags=[frontend, osx, webapp], webapps=[{monitor=/monitor, contextPath=/cp1, war=http://localhost:8080/glu/repository/wars/org.linkedin.glu.samples.sample-webapp-3.0.0.war}]}"
                 mountPoint="/sample/i002" name="Install script for [/sample/i002] on [agent-1]" script="http://localhost:8080/glu/repository/scripts/org.linkedin.glu.script-jetty-3.0.0/JettyGluScript.groovy" scriptLifecycle="installScript" />
	   <leaf agent="agent-1" fabric="glu-dev-1" mountPoint="/sample/i002" name="Run [install] phase for [/sample/i002] on [agent-1]" scriptAction="install" toState="installed" />
	   <leaf agent="agent-1" fabric="glu-dev-1" mountPoint="/sample/i002" name="Run [configure] phase for [/sample/i002] on [agent-1]" scriptAction="configure" toState="stopped" />
	   <leaf agent="agent-1" fabric="glu-dev-1" mountPoint="/sample/i002" name="Run [start] phase for [/sample/i002] on [agent-1]" scriptAction="start" toState="running" />
	 </sequential>
       </parallel>
     </plan>

9. Finally, issue the command::

     ./bin/console-cli.sh -f glu-dev-1 -u admin -x admin -a -p undeploy

   which will undeploy all apps.

Executing an arbitrary shell command
------------------------------------
1. In the console, click on the ``'Agents'`` tab, then click ``'agent-1'`` and then the ``'Commands'`` subtab.

2. Enter ``uptime`` in the text field and press ``return`` on your keyboard or click on ``Execute``

   .. image:: /images/tutorial/tutorial-agent-command-600.png
      :align: center
      :alt: Running the uptime command

3. What happens here is (like the ``ps`` section previously), the command you enter in the text field will be executed on the (remote) agent and the result will be displayed in the console.

   .. note:: It can be any shell command supported on your agent, including pipes, redirects, etc... Simply try another command like ``env|sort`` (you will need to click the ``[...]`` to see the full output).

Viewing the audit log
---------------------
1. Go back to the console and click the ``'Admin'`` tab and then select ``'View Audit Logs'``.

   You should be able to see all the actions that you have done in the system (usually all actions involving talking to the agent are logged).

   .. image:: /images/tutorial/tutorial-audit-log-600.png
      :align: center
      :alt: Entry details for ``/sample/i001``

The end
-------
1. You should go back to the original shell terminal (the one where the ``tail`` command should still be running), issue a ``CTRL-C`` to stop the ``tail`` and issue::

     ./bin/tutorial.sh stop

   which will stop the console, the agent and ZooKeeper.

.. note:: if you did not undeploy the apps, as previously mentionned in :ref:`tutorial-using-console-cli` section, they should still be running and this is on purpose: the lifecycle of the apps installed by the glu agent is independent from the agent itself. You can restart the tutorial (``./bin/tutorial.sh start``) and continue where you left off!


text:
{-# LANGUAGE ScopedTypeVariables, FlexibleInstances, MultiParamTypeClasses, UndecidableInstances, ExistentialQuantification, Rank2Types #-}
{-# OPTIONS_GHC -Wno-orphans #-}

{- |
    /DEPRECATED/: Use "Data.Generics.Uniplate.Data" instead.

    This module exports 'Biplate' instances for everything with 'Data' defined.
    Using GHC the 'Data' instances can be constructed with @deriving Data@.
-}
module Data.Generics.PlateData
    {-# DEPRECATED "Use Data.Generics.Uniplate.Data instead" #-}
    (
    module Data.Generics.Biplate
    ) where

import Data.Generics.Biplate
import Data.Generics.Uniplate.Internal.Utils
import Data.Generics

data Box find = Box {fromBox :: forall a . Typeable a => a -> Answer find}

data Answer a = Hit {_fromHit :: a} -- you just hit the element you were after (here is a cast)
              | Follow -- go forward, you will find something
              | Miss -- you failed to sink my battleship!

containsMatch :: (Data start, Typeable start, Data find, Typeable find) =>
                 start -> find ->
                 Box find

-- GHC 6.4.2 does not export typeRepKey, so we can't do the trick
-- as efficiently, so we just give up and revert to always following

containsMatch start find = Box query
    where
        query a = case cast a of
                       Just y -> Hit y
                       Nothing -> Follow

instance (Data a, Typeable a) => Uniplate a where
    uniplate = collect_generate (fromBox answer)
        where
            answer :: Box a
            answer = containsMatch (undefined :: a) (undefined :: a)

instance (Data a, Data b, Uniplate b, Typeable a, Typeable b) => Biplate a b where
    biplate = collect_generate_self (fromBox answer)
        where
            answer :: Box b
            answer = containsMatch (undefined :: a) (undefined :: b)

newtype C x a = C {fromC :: CC x a}

type CC x a = (Str x, Str x -> a)

collect_generate_self :: (Data on, Data with, Typeable on, Typeable with) =>
                         (forall a . Typeable a => a -> Answer with) -> on -> CC with on
collect_generate_self oracle x = res
        where
            res = case oracle x of
                       Hit y -> (One y, \(One x) -> unsafeCoerce x)
                       Follow -> collect_generate oracle x
                       Miss -> (Zero, \_ -> x)

collect_generate :: (Data on, Data with, Typeable on, Typeable with) =>
                    (forall a . Typeable a => a -> Answer with) -> on -> CC with on
collect_generate oracle item = fromC $ gfoldl combine create item
    where
        -- forall a b . Data a => C with (a -> b) -> a -> C with b
        combine (C (c,g)) x = case collect_generate_self oracle x of
                                  (c2, g2) -> C (Two c c2, \(Two c' c2') -> g c' (g2 c2'))

        -- forall g . g -> C with g
        create x = C (Zero, \_ -> x)


text:
;
(function () {

    var listDiv = document.getElementById("list"),

        showConnectionInfo = function (s) {
            listDiv.innerHTML = s;
            listDiv.style.display = "block";
        },
        hideConnectionInfo = function () {
            listDiv.style.display = "none";
        },
        connections = [],
        updateConnections = function (conn, remove) {
            if (!remove) connections.push(conn);
            else {
                var idx = -1;
                for (var i = 0; i < connections.length; i++) {
                    if (connections[i] == conn) {
                        idx = i;
                        break;
                    }
                }
                if (idx != -1) connections.splice(idx, 1);
            }
            if (connections.length > 0) {
                var s = "Connections

Scope	Source	Target
";
                for (var j = 0; j < connections.length; j++) {
                    s = s + "
" + connections[j].scope + "	" + "" + connections[j].sourceId + "	" + connections[j].targetId + "
";
                }
                showConnectionInfo(s);
            } else
                hideConnectionInfo();
        };

    jsPlumb.ready(function () {

        var instance = jsPlumb.getInstance({
            DragOptions: { cursor: 'pointer', zIndex: 2000 },
            PaintStyle: { stroke: '#666' },
            EndpointHoverStyle: { fill: "orange" },
            HoverPaintStyle: { stroke: "orange" },
            EndpointStyle: { width: 20, height: 16, stroke: '#666' },
            Endpoint: "Rectangle",
            Anchors: ["TopCenter", "TopCenter"],
            Container: "canvas"
        });

        // suspend drawing and initialise.
        instance.batch(function () {

            // bind to connection/connectionDetached events, and update the list of connections on screen.
            instance.bind("connection", function (info, originalEvent) {
                updateConnections(info.connection);
            });
            instance.bind("connectionDetached", function (info, originalEvent) {
                updateConnections(info.connection, true);
            });

            instance.bind("connectionMoved", function (info, originalEvent) {
                //  only remove here, because a 'connection' event is also fired.
                // in a future release of jsplumb this extra connection event will not
                // be fired.
                updateConnections(info.connection, true);
            });

            instance.bind("click", function (component, originalEvent) {
                alert("click!")
            });

            // configure some drop options for use by all endpoints.
            var exampleDropOptions = {
                tolerance: "touch",
                hoverClass: "dropHover",
                activeClass: "dragActive"
            };

            //
            // first example endpoint.  it's a 25x21 rectangle (the size is provided in the 'style' arg to the Endpoint),
            // and it's both a source and target.  the 'scope' of this Endpoint is 'exampleConnection', meaning any connection
            // starting from this Endpoint is of type 'exampleConnection' and can only be dropped on an Endpoint target
            // that declares 'exampleEndpoint' as its drop scope, and also that
            // only 'exampleConnection' types can be dropped here.
            //
            // the connection style for this endpoint is a Bezier curve (we didn't provide one, so we use the default), with a strokeWidth of
            // 5 pixels, and a gradient.
            //
            // there is a 'beforeDrop' interceptor on this endpoint which is used to allow the user to decide whether
            // or not to allow a particular connection to be established.
            //
            var exampleColor = "#00f";
            var exampleEndpoint = {
                endpoint: "Rectangle",
                paintStyle: { width: 25, height: 21, fill: exampleColor },
                isSource: true,
                reattach: true,
                scope: "blue",
                connectorStyle: {
                    gradient: {stops: [
                        [0, exampleColor],
                        [0.5, "#09098e"],
                        [1, exampleColor]
                    ]},
                    strokeWidth: 5,
                    stroke: exampleColor,
                    dashstyle: "2 2"
                },
                isTarget: true,
                beforeDrop: function (params) {
                    return confirm("Connect " + params.sourceId + " to " + params.targetId + "?");
                },
                dropOptions: exampleDropOptions
            };

            //
            // the second example uses a Dot of radius 15 as the endpoint marker, is both a source and target,
            // and has scope 'exampleConnection2'.
            //
            var color2 = "#316b31";
            var exampleEndpoint2 = {
                endpoint: ["Dot", { radius: 11 }],
                paintStyle: { fill: color2 },
                isSource: true,
                scope: "green",
                connectorStyle: { stroke: color2, strokeWidth: 6 },
                connector: ["Bezier", { curviness: 63 } ],
                maxConnections: 3,
                isTarget: true,
                dropOptions: exampleDropOptions
            };

            //
            // the third example uses a Dot of radius 17 as the endpoint marker, is both a source and target, and has scope
            // 'exampleConnection3'.  it uses a Straight connector, and the Anchor is created here (bottom left corner) and never
            // overriden, so it appears in the same place on every element.
            //
            // this example also demonstrates the beforeDetach interceptor, which allows you to intercept
            // a connection detach and decide whether or not you wish to allow it to proceed.
            //
            var example3Color = "rgba(229,219,61,0.5)";
            var exampleEndpoint3 = {
                endpoint: ["Dot", {radius: 17} ],
                anchor: "BottomLeft",
                paintStyle: { fill: example3Color, opacity: 0.5 },
                isSource: true,
                scope: 'yellow',
                connectorStyle: {
                    stroke: example3Color,
                    strokeWidth: 4
                },
                connector: "Straight",
                isTarget: true,
                dropOptions: exampleDropOptions,
                beforeDetach: function (conn) {
                    return confirm("Detach connection?");
                },
                onMaxConnections: function (info) {
                    alert("Cannot drop connection " + info.connection.id + " : maxConnections has been reached on Endpoint " + info.endpoint.id);
                }
            };

            // setup some empty endpoints.  again note the use of the three-arg method to reuse all the parameters except the location
            // of the anchor (purely because we want to move the anchor around here; you could set it one time and forget about it though.)
            var e1 = instance.addEndpoint('dragDropWindow1', { anchor: [0.5, 1, 0, 1] }, exampleEndpoint2);

            // setup some DynamicAnchors for use with the blue endpoints
            // and a function to set as the maxConnections callback.
            var anchors = [
                    [1, 0.2, 1, 0],
                    [0.8, 1, 0, 1],
                    [0, 0.8, -1, 0],
                    [0.2, 0, 0, -1]
                ],
                maxConnectionsCallback = function (info) {
                    alert("Cannot drop connection " + info.connection.id + " : maxConnections has been reached on Endpoint " + info.endpoint.id);
                };

            var e1 = instance.addEndpoint("dragDropWindow1", { anchor: anchors }, exampleEndpoint);
            // you can bind for a maxConnections callback using a standard bind call, but you can also supply 'onMaxConnections' in an Endpoint definition - see exampleEndpoint3 above.
            e1.bind("maxConnections", maxConnectionsCallback);

            var e2 = instance.addEndpoint('dragDropWindow2', { anchor: [0.5, 1, 0, 1] }, exampleEndpoint);
            // again we bind manually. it's starting to get tedious.  but now that i've done one of the blue endpoints this way, i have to do them all...
            e2.bind("maxConnections", maxConnectionsCallback);
            instance.addEndpoint('dragDropWindow2', { anchor: "RightMiddle" }, exampleEndpoint2);

            var e3 = instance.addEndpoint("dragDropWindow3", { anchor: [0.25, 0, 0, -1] }, exampleEndpoint);
            e3.bind("maxConnections", maxConnectionsCallback);
            instance.addEndpoint("dragDropWindow3", { anchor: [0.75, 0, 0, -1] }, exampleEndpoint2);

            var e4 = instance.addEndpoint("dragDropWindow4", { anchor: [1, 0.5, 1, 0] }, exampleEndpoint);
            e4.bind("maxConnections", maxConnectionsCallback);
            instance.addEndpoint("dragDropWindow4", { anchor: [0.25, 0, 0, -1] }, exampleEndpoint2);

            // make .window divs draggable
            instance.draggable(jsPlumb.getSelector(".drag-drop-demo .window"));

            // add endpoint of type 3 using a selector.
            instance.addEndpoint(jsPlumb.getSelector(".drag-drop-demo .window"), exampleEndpoint3);

            var hideLinks = jsPlumb.getSelector(".drag-drop-demo .hide");
            instance.on(hideLinks, "click", function (e) {
                instance.toggleVisible(this.getAttribute("rel"));
                jsPlumbUtil.consume(e);
            });

            var dragLinks = jsPlumb.getSelector(".drag-drop-demo .drag");
            instance.on(dragLinks, "click", function (e) {
                var s = instance.toggleDraggable(this.getAttribute("rel"));
                this.innerHTML = (s ? 'disable dragging' : 'enable dragging');
                jsPlumbUtil.consume(e);
            });

            var detachLinks = jsPlumb.getSelector(".drag-drop-demo .detach");
            instance.on(detachLinks, "click", function (e) {
                instance.detachAllConnections(this.getAttribute("rel"));
                jsPlumbUtil.consume(e);
            });

            instance.on(document.getElementById("clear"), "click", function (e) {
                instance.detachEveryConnection();
                showConnectionInfo("");
                jsPlumbUtil.consume(e);
            });
        });

        jsPlumb.fire("jsPlumbDemoLoaded", instance);

    });
})();


text:
using System.Threading.Tasks;
using IuguClientAPI.Models;

namespace IuguClientAPI
{
    public partial class IuguApiClient
    {
        public async Task<IuguCustomer> CreateClient(IuguCustomer customer) => await Post(customer, "/customers");

        public IuguCustomer CreateClientSync(IuguCustomer customer) => PostSync(customer, "/customers");

        public async Task<IuguCustomer> UpdateClient(IuguCustomer customer) => await Put(customer, customer.Id, "/customers/{id}");

        public IuguCustomer UpdateClientSync(IuguCustomer customer) => PutSync(customer, customer.Id, "/customers/{id}");

        public async Task<IuguCustomer> DeleteClient(string clientId) => await Delete<IuguCustomer>(clientId, "/customers/{id}");

        public IuguCustomer DeleteClientSync(string clientId) => DeleteSync<IuguCustomer>(clientId, "/customers/{id}");
    }
}


text:
package danmaku;

import java.awt.Point;
import java.util.Vector;

public class AttackSpell extends SpellCard {

	protected Vector<Bullet> bullets = new Vector<Bullet>();
	protected Vector<Point> startPoint = new Vector<Point>();
	protected Thread spellTH;
	protected Boolean activated;

	public Vector<Bullet> getBullets() {
		return bullets;
	}

	public void setBullets(Vector<Bullet> bullets) {
		this.bullets = bullets;
	}

	public Vector<Point> getStartPoint() {
		return startPoint;
	}

	public void setStartPoint(Vector<Point> startPoint) {
		this.startPoint = startPoint;
	}

	public Thread getSpellTH() {
		return spellTH;
	}

	public void setSpellTH(Thread spellTH) {
		this.spellTH = spellTH;
	}

	public Boolean getActivated() {
		return activated;
	}

	public void setActivated(Boolean activated) {
		this.activated = activated;
	}

	public AttackSpell() {
		// TODO Auto-generated constructor stub
	}

	public void activate()
	{

	}

	public void stop()
	{

	}

}


text:
#ifndef FREERDP_CHANNEL_GEOMETRY_H
#define FREERDP_CHANNEL_GEOMETRY_H

#include <winpr/wtypes.h>
#include <freerdp/types.h>

#define GEOMETRY_DVC_CHANNEL_NAME "Microsoft::Windows::RDS::Geometry::v08.01"

enum
{
	GEOMETRY_UPDATE	= 1,
	GEOMETRY_CLEAR	= 2
};

enum
{
	RDH_RECTANGLE = 1
};

struct _FREERDP_RGNDATA
{
	RDP_RECT boundingRect;
	UINT32 nRectCount;
	RDP_RECT *rects;
};

typedef struct _FREERDP_RGNDATA FREERDP_RGNDATA;

struct _MAPPED_GEOMETRY_PACKET
{
	UINT32 version;
	UINT64 mappingId;
	UINT32 updateType;
	UINT64 topLevelId;
	INT32 left, top, right, bottom;
	INT32 topLevelLeft, topLevelTop, topLevelRight, topLevelBottom;
	UINT32 geometryType;

	FREERDP_RGNDATA geometry;
};

typedef struct _MAPPED_GEOMETRY_PACKET MAPPED_GEOMETRY_PACKET;

#endif /* FREERDP_CHANNEL_GEOMETRY_H */


text:
class GenerateTournamentMatches
    def initialize( tournament )
      @tournament = tournament
    end

    def generateWeight(weight)
      if Rails.env.production?
        self.delay(:job_owner_id => @tournament.id, :job_owner_type => "Generate matches for weights class #{weight.max}").generate_weight_raw(weight)
      else
        self.generate_weight_raw(weight)
      end
    end

    def generate_weight_raw(weight)
      WipeTournamentMatches.new(@tournament).wipeWeightMatches(weight)
      @tournament.curently_generating_matches = 1
      @tournament.save
      unAssignBouts
      unAssignMats
      PoolToBracketMatchGeneration.new(@tournament).generatePoolToBracketMatchesWeight(weight) if @tournament.tournament_type == "Pool to bracket"
      postMatchCreationActions
      PoolToBracketGenerateLoserNames.new(@tournament).assignLoserNamesWeight(weight) if @tournament.tournament_type == "Pool to bracket"
    end

    def generate
      if Rails.env.production?
        self.delay(:job_owner_id => @tournament.id, :job_owner_type => "Generate matches for all weights").generate_raw
      else
        self.generate_raw
      end
    end

    def generate_raw
        standardStartingActions
        PoolToBracketMatchGeneration.new(@tournament).generatePoolToBracketMatches if @tournament.tournament_type == "Pool to bracket"
        ModifiedSixteenManMatchGeneration.new(@tournament).generate_matches if @tournament.tournament_type.include? "Modified 16 Man Double Elimination"
        DoubleEliminationMatchGeneration.new(@tournament).generate_matches if @tournament.tournament_type.include? "Regular Double Elimination"
        postMatchCreationActions
        PoolToBracketMatchGeneration.new(@tournament).assignLoserNames if @tournament.tournament_type == "Pool to bracket"
        ModifiedSixteenManGenerateLoserNames.new(@tournament).assign_loser_names if @tournament.tournament_type.include? "Modified 16 Man Double Elimination"
        DoubleEliminationGenerateLoserNames.new(@tournament).assign_loser_names if @tournament.tournament_type.include? "Regular Double Elimination"
    end

    def standardStartingActions
        @tournament.curently_generating_matches = 1
        @tournament.save
        WipeTournamentMatches.new(@tournament).setUpMatchGeneration
        TournamentSeeding.new(@tournament).setSeeds
    end

    def postMatchCreationActions
        moveFinalsMatchesToLastRound
        assignBouts
        assignFirstMatchesToMats
        @tournament.curently_generating_matches = nil
        @tournament.save!
    end

    def assignBouts
      bout_counts = Hash.new(0)
      @tournament.matches.reload
      @tournament.matches.sort_by{|m| [m.round, m.weight_max]}.each do |m|
        m.bout_number = m.round * 1000 + bout_counts[m.round]
        bout_counts[m.round] += 1
        m.save!
      end
    end

    def moveFinalsMatchesToLastRound
      finalsRound = @tournament.reload.total_rounds
      finalsMatches = @tournament.matches.reload.select{|m| m.bracket_position == "1/2" || m.bracket_position == "3/4" || m.bracket_position == "5/6" || m.bracket_position == "7/8"}
      finalsMatches. each do |m|
        m.round = finalsRound
        m.save
      end
    end

    def assignFirstMatchesToMats
      matsToAssign = @tournament.mats
      if matsToAssign.count > 0
        until matsToAssign.sort_by{|m| m.id}.last.matches.count == 4
          matsToAssign.sort_by{|m| m.id}.each do |m|
            m.assign_next_match
          end
        end
      end
    end

    def unAssignMats
      matches = @tournament.matches.reload
      matches.each do |m|
        m.mat_id = nil
        m.save!
      end
    end

    def unAssignBouts
      bout_counts = Hash.new(0)
      @tournament.matches.each do |m|
        m.bout_number = nil
        m.save!
      end
    end
end